signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class FessMessages { /** * Add the created action message for the key ' success . started _ data _ update ' with parameters . * < pre > * message : Started data update process . * < / pre > * @ param property The property name for the message . ( NotNull ) * @ return this . ( NotNull ) */ public FessMessages addSuccessStartedDataUpdate ( String property ) { } }
assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( SUCCESS_started_data_update ) ) ; return this ;
public class JMessageClient { /** * Upload file , only support image file ( jpg , bmp , gif , png ) currently , * file size should not larger than 8M . * @ param path Necessary , the native path of the file you want to upload * @ param fileType Current support type : image , file , voice * @ return UploadResult * @ throws APIConnectionException connect exception * @ throws APIRequestException request exception */ public UploadResult uploadFile ( String path , String fileType ) throws APIConnectionException , APIRequestException { } }
return _resourceClient . uploadFile ( path , fileType ) ;
public class ExecutionGraph { /** * Gets a serialized accumulator map . * @ return The accumulator map with serialized accumulator values . */ @ Override public Map < String , SerializedValue < OptionalFailure < Object > > > getAccumulatorsSerialized ( ) { } }
return aggregateUserAccumulators ( ) . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: getKey , entry -> serializeAccumulator ( entry . getKey ( ) , entry . getValue ( ) ) ) ) ;
public class BaseDateTimeField { /** * Sets a value in the milliseconds supplied from a human - readable , text value . * If the specified locale is null , the default locale is used . * This implementation uses < code > convertText ( String , Locale ) < / code > and * { @ link # set ( ReadablePartial , int , int [ ] , int ) } . * @ param instant the partial instant * @ param fieldIndex the index of this field in the instant * @ param values the values of the partial instant which should be updated * @ param text the text value to set * @ param locale the locale to use for selecting a text symbol , null for default * @ return the passed in values * @ throws IllegalArgumentException if the text value is invalid */ public int [ ] set ( ReadablePartial instant , int fieldIndex , int [ ] values , String text , Locale locale ) { } }
int value = convertText ( text , locale ) ; return set ( instant , fieldIndex , values , value ) ;
public class CPDefinitionVirtualSettingPersistenceImpl { /** * Removes all the cp definition virtual settings where uuid = & # 63 ; and companyId = & # 63 ; from the database . * @ param uuid the uuid * @ param companyId the company ID */ @ Override public void removeByUuid_C ( String uuid , long companyId ) { } }
for ( CPDefinitionVirtualSetting cpDefinitionVirtualSetting : findByUuid_C ( uuid , companyId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( cpDefinitionVirtualSetting ) ; }
public class ClassPathBuilder { /** * Add a worklist item to the worklist . This method maintains the invariant * that all of the worklist items representing application codebases appear * < em > before < / em > all of the worklist items representing auxiliary * codebases . * @ param projectWorkList * the worklist * @ param itemToAdd * the worklist item to add */ private void addToWorkList ( LinkedList < WorkListItem > workList , WorkListItem itemToAdd ) { } }
if ( DEBUG ) { new RuntimeException ( "Adding work list item " + itemToAdd ) . printStackTrace ( System . out ) ; } if ( ! itemToAdd . isAppCodeBase ( ) ) { // Auxiliary codebases are always added at the end workList . addLast ( itemToAdd ) ; return ; } // Adding an application codebase : position a ListIterator // just before first auxiliary codebase ( or at the end of the list // if there are no auxiliary codebases ) ListIterator < WorkListItem > i = workList . listIterator ( ) ; while ( i . hasNext ( ) ) { WorkListItem listItem = i . next ( ) ; if ( ! listItem . isAppCodeBase ( ) ) { i . previous ( ) ; break ; } } // Add the codebase to the worklist i . add ( itemToAdd ) ;
public class AddOn { /** * Returns the IDs of the add - ons dependencies , an empty collection if none . * @ return the IDs of the dependencies . * @ since 2.4.0 */ public List < String > getIdsAddOnDependencies ( ) { } }
if ( dependencies == null ) { return Collections . emptyList ( ) ; } List < String > ids = new ArrayList < > ( dependencies . getAddOns ( ) . size ( ) ) ; for ( AddOnDep dep : dependencies . getAddOns ( ) ) { ids . add ( dep . getId ( ) ) ; } return ids ;
public class CmsContentTypeVisitor { /** * Returns the tab informations for the given content definition . < p > * @ param definition the content definition * @ return the tab informations */ private List < CmsTabInfo > collectTabInfos ( CmsXmlContentDefinition definition ) { } }
List < CmsTabInfo > result = new ArrayList < CmsTabInfo > ( ) ; CmsMacroResolver resolver = new CmsMacroResolver ( ) ; resolver . setMessages ( m_messages ) ; if ( definition . getContentHandler ( ) . getTabs ( ) != null ) { for ( CmsXmlContentTab xmlTab : definition . getContentHandler ( ) . getTabs ( ) ) { String tabName ; // in case the tab name attribute contains a localization macro if ( xmlTab . getTabName ( ) . contains ( MESSAGE_MACRO_START ) || xmlTab . getTabName ( ) . contains ( MESSAGE_MACRO_START_OLD ) ) { tabName = resolver . resolveMacros ( xmlTab . getTabName ( ) ) ; } else { tabName = m_messages . keyDefault ( A_CmsWidget . LABEL_PREFIX + definition . getInnerName ( ) + "." + xmlTab . getTabName ( ) , xmlTab . getTabName ( ) ) ; } result . add ( new CmsTabInfo ( tabName , xmlTab . getIdName ( ) , xmlTab . getStartName ( ) , xmlTab . isCollapsed ( ) , resolver . resolveMacros ( xmlTab . getDescription ( ) ) ) ) ; } } return result ;
public class ModelsImpl { /** * Get the explicit list of the pattern . any entity . * @ param appId The application ID . * @ param versionId The version ID . * @ param entityId The Pattern . Any entity id . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ErrorResponseException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the List & lt ; ExplicitListItem & gt ; object if successful . */ public List < ExplicitListItem > getExplicitList ( UUID appId , String versionId , UUID entityId ) { } }
return getExplicitListWithServiceResponseAsync ( appId , versionId , entityId ) . toBlocking ( ) . single ( ) . body ( ) ;
public class BindTransformer { /** * Checks if is binded object . * @ param typeName * the type name * @ return true , if is binded object */ public static boolean isBindedObject ( TypeName typeName ) { } }
BindTransform t = lookup ( typeName ) ; if ( t != null && t instanceof ObjectBindTransform ) { return true ; } return false ;
public class RequireJS { /** * Returns the JSON RequireJS config for a given WebJar * @ param webJar A tuple ( artifactId - & gt ; version ) representing the WebJar . * @ param prefixes A list of the prefixes to use in the ` paths ` part of the RequireJS config . * @ return The JSON RequireJS config for the WebJar based on the meta - data in the WebJar ' s pom . xml file . */ public static ObjectNode getWebJarRequireJsConfig ( Map . Entry < String , String > webJar , List < Map . Entry < String , Boolean > > prefixes ) { } }
String rawRequireJsConfig = getRawWebJarRequireJsConfig ( webJar ) ; ObjectMapper mapper = new ObjectMapper ( ) . configure ( ALLOW_UNQUOTED_FIELD_NAMES , true ) . configure ( ALLOW_SINGLE_QUOTES , true ) ; // default to just an empty object ObjectNode webJarRequireJsNode = mapper . createObjectNode ( ) ; try { JsonNode maybeRequireJsConfig = mapper . readTree ( rawRequireJsConfig ) ; if ( maybeRequireJsConfig != null && maybeRequireJsConfig . isObject ( ) ) { // The provided config was parseable , now lets fix the paths webJarRequireJsNode = ( ObjectNode ) maybeRequireJsConfig ; if ( webJarRequireJsNode . isObject ( ) ) { // update the paths ObjectNode pathsNode = ( ObjectNode ) webJarRequireJsNode . get ( "paths" ) ; ObjectNode newPaths = mapper . createObjectNode ( ) ; if ( pathsNode != null ) { Iterator < Map . Entry < String , JsonNode > > paths = pathsNode . fields ( ) ; while ( paths . hasNext ( ) ) { Map . Entry < String , JsonNode > pathNode = paths . next ( ) ; String originalPath = null ; if ( pathNode . getValue ( ) . isArray ( ) ) { ArrayNode nodePaths = ( ArrayNode ) pathNode . getValue ( ) ; // lets just assume there is only 1 for now originalPath = nodePaths . get ( 0 ) . asText ( ) ; } else if ( pathNode . getValue ( ) . isTextual ( ) ) { TextNode nodePath = ( TextNode ) pathNode . getValue ( ) ; originalPath = nodePath . textValue ( ) ; } if ( originalPath != null ) { ArrayNode newPathsNode = newPaths . putArray ( pathNode . getKey ( ) ) ; for ( Map . Entry < String , Boolean > prefix : prefixes ) { String newPath = prefix . getKey ( ) + webJar . getKey ( ) ; if ( prefix . getValue ( ) ) { newPath += "/" + webJar . getValue ( ) ; } newPath += "/" + originalPath ; newPathsNode . add ( newPath ) ; } newPathsNode . add ( originalPath ) ; } else { log . error ( "Strange... The path could not be parsed. Here is what was provided: " + pathNode . getValue ( ) . toString ( ) ) ; } } } webJarRequireJsNode . replace ( "paths" , newPaths ) ; // update the location in the packages node ArrayNode packagesNode = webJarRequireJsNode . withArray ( "packages" ) ; ArrayNode newPackages = mapper . createArrayNode ( ) ; if ( packagesNode != null ) { for ( JsonNode packageJson : packagesNode ) { String originalLocation = packageJson . get ( "location" ) . textValue ( ) ; if ( prefixes . size ( ) > 0 ) { // this picks the last prefix assuming that it is the right one // not sure of a better way to do this since I don ' t think we want the CDN prefix // maybe this can be an array like paths ? Map . Entry < String , Boolean > prefix = prefixes . get ( prefixes . size ( ) - 1 ) ; String newLocation = prefix . getKey ( ) + webJar . getKey ( ) ; if ( prefix . getValue ( ) ) { newLocation += "/" + webJar . getValue ( ) ; } newLocation += "/" + originalLocation ; ( ( ObjectNode ) packageJson ) . put ( "location" , newLocation ) ; } newPackages . add ( packageJson ) ; } } webJarRequireJsNode . replace ( "packages" , newPackages ) ; } } else { if ( rawRequireJsConfig . length ( ) > 0 ) { log . error ( requireJsConfigErrorMessage ( webJar ) ) ; } else { log . warn ( requireJsConfigErrorMessage ( webJar ) ) ; } } } catch ( IOException e ) { log . warn ( requireJsConfigErrorMessage ( webJar ) ) ; if ( rawRequireJsConfig . length ( ) > 0 ) { // only show the error if there was a config to parse log . error ( e . getMessage ( ) ) ; } } return webJarRequireJsNode ;
public class ResourceGroovyMethods { /** * Append binary data to the file . See { @ link # append ( java . io . File , java . io . InputStream ) } * @ param file a File * @ param data an InputStream of data to write to the file * @ return the file * @ throws IOException if an IOException occurs . * @ since 1.5.0 */ public static File leftShift ( File file , InputStream data ) throws IOException { } }
append ( file , data ) ; return file ;
public class UnImplNode { /** * Unimplemented . See org . w3c . dom . Node * @ param newChild New child node to insert * @ param refChild Insert in front of this child * @ return null * @ throws DOMException */ public Node insertBefore ( Node newChild , Node refChild ) throws DOMException { } }
error ( XMLErrorResources . ER_FUNCTION_NOT_SUPPORTED ) ; // " insertBefore not supported ! " ) ; return null ;
public class FilterRuleChainXmlParser { /** * This method parses the chain from the given { @ code inStream } . The XML contained in { @ code inStream } needs to * contain the chain rules as child - nodes of the { @ link Document # getDocumentElement ( ) root - element } . The name of the * root - element is ignored ( use e . g . " chain " ) . * @ param inStream is the stream containing the XML to parse . It will be closed by this method ( on success as well as * in an exceptional state ) . * @ return the parsed filter rule . * @ throws IOException if an input / output error occurred . * @ throws SAXException if the { @ code inStream } contains invalid XML . */ public FilterRuleChain < String > parseChain ( InputStream inStream ) throws IOException , SAXException { } }
try { Document xmlDoc = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) . parse ( inStream ) ; return parseChain ( xmlDoc . getDocumentElement ( ) ) ; } catch ( ParserConfigurationException e ) { throw new IllegalStateException ( "XML configuration error!" , e ) ; } finally { inStream . close ( ) ; }
public class RequireJavaVersion { /** * Converts a jdk string from 1.5.0-11b12 to a single 3 digit version like 1.5.0-11 * @ param theJdkVersion to be converted . * @ return the converted string . */ public static String normalizeJDKVersion ( String theJdkVersion ) { } }
theJdkVersion = theJdkVersion . replaceAll ( "_|-" , "." ) ; String tokenArray [ ] = StringUtils . split ( theJdkVersion , "." ) ; List < String > tokens = Arrays . asList ( tokenArray ) ; StringBuffer buffer = new StringBuffer ( theJdkVersion . length ( ) ) ; Iterator < String > iter = tokens . iterator ( ) ; for ( int i = 0 ; i < tokens . size ( ) && i < 4 ; i ++ ) { String section = ( String ) iter . next ( ) ; section = section . replaceAll ( "[^0-9]" , "" ) ; if ( StringUtils . isNotEmpty ( section ) ) { buffer . append ( Integer . parseInt ( section ) ) ; if ( i != 2 ) { buffer . append ( '.' ) ; } else { buffer . append ( '-' ) ; } } } String version = buffer . toString ( ) ; version = StringUtils . stripEnd ( version , "-" ) ; return StringUtils . stripEnd ( version , "." ) ;
public class EntityFilter { /** * A list of IDs for affected entities . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setEntityValues ( java . util . Collection ) } or { @ link # withEntityValues ( java . util . Collection ) } if you want to * override the existing values . * @ param entityValues * A list of IDs for affected entities . * @ return Returns a reference to this object so that method calls can be chained together . */ public EntityFilter withEntityValues ( String ... entityValues ) { } }
if ( this . entityValues == null ) { setEntityValues ( new java . util . ArrayList < String > ( entityValues . length ) ) ; } for ( String ele : entityValues ) { this . entityValues . add ( ele ) ; } return this ;
public class ServoGraphiteSetup { /** * Looks for the value of the key as a key firstly as a JVM argument , and if * not found , to an environment variable . If still not found , then null is * returned . * @ param key * @ return */ private static String findVariable ( String key ) { } }
String value = System . getProperty ( key ) ; if ( value == null ) { return System . getenv ( key ) ; } return value ;
public class FileExtFileFilter { /** * Returns whether or not the supplied file extension is one that this filter matches . * @ param aFileExt A file extension like : jpg , gif , jp2 , txt , xml , etc . * @ return True if this filter matches files with the supplied extension */ public boolean filters ( final String aFileExt ) { } }
final String normalizedExt = normalizeExt ( aFileExt ) ; for ( final String extension : myExtensions ) { if ( extension . equals ( normalizedExt ) ) { return true ; } } return false ;
public class JdbcUtil { /** * Parse the ResultSet obtained by executing query with the specified Connection and sql . * @ param conn * @ param sql * @ param offset * @ param count * @ param processThreadNum new threads started to parse / process the lines / records * @ param queueSize size of queue to save the processing records / lines loaded from source data . Default size is 1024. * @ param rowParser * @ param onComplete * @ throws UncheckedSQLException */ public static < E extends Exception , E2 extends Exception > void parse ( final Connection conn , final String sql , final long offset , final long count , final int processThreadNum , final int queueSize , final Try . Consumer < Object [ ] , E > rowParser , final Try . Runnable < E2 > onComplete ) throws UncheckedSQLException , E , E2 { } }
PreparedStatement stmt = null ; try { stmt = prepareStatement ( conn , sql ) ; stmt . setFetchSize ( 200 ) ; parse ( stmt , offset , count , processThreadNum , queueSize , rowParser , onComplete ) ; } catch ( SQLException e ) { throw new UncheckedSQLException ( e ) ; } finally { closeQuietly ( stmt ) ; }
public class SearchHandle { /** * Returns a list of the facet names returned in this search . * @ return The array of names . */ @ Override public String [ ] getFacetNames ( ) { } }
if ( facets == null || facets . isEmpty ( ) ) { return new String [ 0 ] ; } Set < String > names = facets . keySet ( ) ; return names . toArray ( new String [ names . size ( ) ] ) ;
public class DateTimeUtil { /** * 给定时间 , 获取一年中的第几周 。 * @ param date 时间 ( { @ link Date } ) * @ return ( Integer ) , 如果date is null , 将返回null */ public static Integer getWeekOfYear ( Date date ) { } }
if ( date == null ) return null ; Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( date ) ; return calendar . get ( Calendar . WEEK_OF_YEAR ) ;
public class Statement { /** * Reads an output parameter value from the statement . * @ param key parameter key . * @ return parameter value ( optional ) . * @ throws SQLException if error occurs while reading parameter value . * @ since v1.0 */ public Object read ( Object key ) throws SQLException { } }
if ( key instanceof Integer ) { return base . getObject ( ( Integer ) key ) ; } else { return base . getObject ( ( String ) key ) ; }
public class ZipExtensions { /** * Unzip . * @ param zipFile * the zip file * @ param toDir * the to dir * @ throws IOException * Signals that an I / O exception has occurred . */ public static void unzip ( final ZipFile zipFile , final File toDir ) throws IOException { } }
try { for ( final Enumeration < ? extends ZipEntry > e = zipFile . entries ( ) ; e . hasMoreElements ( ) ; ) { final ZipEntry entry = e . nextElement ( ) ; extractZipEntry ( zipFile , entry , toDir ) ; } zipFile . close ( ) ; } catch ( final IOException e ) { throw e ; } finally { zipFile . close ( ) ; }
public class FnJodaTimeUtils { /** * A { @ link DateTime } is created from the input { @ link Integer } { @ link Collection } . * The result will be created with the given { @ link Chronology } * The valid input Collection & lt ; Integer & gt ; are : * < ul > * < li > year ( month and day will be set to 1 ) < / li > * < li > year , month ( day will be set to 1 ) < / li > * < li > year , month , day < / li > * < / ul > * @ param chronology { @ link Chronology } to be used * @ return the { @ link DateTime } created from the input and arguments */ public static final Function < Collection < Integer > , DateTime > integerFieldCollectionToDateTime ( Chronology chronology ) { } }
return FnDateTime . integerFieldCollectionToDateTime ( chronology ) ;
public class NetUtils { /** * 清除所有Cookie * @ param cookies { @ link Cookie } * @ param response { @ link HttpServletResponse } * @ return { @ link Boolean } * @ since 1.0.8 */ public static boolean clearCookie ( Cookie [ ] cookies , HttpServletResponse response ) { } }
if ( Checker . isNotEmpty ( cookies ) ) { for ( Cookie cookie : cookies ) { removeCookie ( cookie , response ) ; } return true ; } return false ;
public class ElementMatchers { /** * Matches an iterable by assuring that at least one element of the iterable collection matches the * provided matcher . * @ param matcher The matcher to apply to each element . * @ param < T > The type of the matched object . * @ return A matcher that matches an iterable if at least one element matches the provided matcher . */ public static < T > ElementMatcher . Junction < Iterable < ? extends T > > whereAny ( ElementMatcher < ? super T > matcher ) { } }
return new CollectionItemMatcher < T > ( matcher ) ;
public class JPATaskPersistenceContext { /** * Interface methods - - - - - */ @ Override public Task findTask ( Long taskId ) { } }
check ( ) ; Task task = null ; if ( this . pessimisticLocking ) { return this . em . find ( TaskImpl . class , taskId , lockMode ) ; } task = this . em . find ( TaskImpl . class , taskId ) ; return task ;
public class App { /** * The App identifier ( the id but without the prefix ' app : ' ) . * The identifier may start with a whitespace character e . g . " myapp " . * This indicates that the app is sharing a table with other apps . * This is disabled by default unless ' para . prepend _ shared _ appids _ with _ space = true ' * @ return the identifier ( appid ) */ public String getAppIdentifier ( ) { } }
String pre = isSharingTable ( ) && Config . getConfigBoolean ( "prepend_shared_appids_with_space" , false ) ? " " : "" ; return ( getId ( ) != null ) ? getId ( ) . replaceFirst ( PREFIX , pre ) : "" ;
public class LinkerBinderManager { /** * Return a set of all DeclarationBinder matching the DeclarationBinderFilter of the Linker . * @ return a Set of all DeclarationBinder matching the DeclarationBinderFilter of the Linker . */ public Set < S > getMatchedDeclarationBinder ( ) { } }
Set < S > bindedSet = new HashSet < S > ( ) ; for ( Map . Entry < ServiceReference < S > , BinderDescriptor > e : declarationBinders . entrySet ( ) ) { if ( e . getValue ( ) . match ) { bindedSet . add ( getDeclarationBinder ( e . getKey ( ) ) ) ; } } return bindedSet ;
public class PathUtils { /** * The parameter currentObject recommend to user ' this ' , because of can not * be a object which build by manually with ' new ' ; * @ param currentObject * @ return web project physical path . */ public static String getWebProjectPath ( Object currentObject ) { } }
Class < ? extends Object > class1 = currentObject . getClass ( ) ; ClassLoader classLoader = class1 . getClassLoader ( ) ; URL resource = classLoader . getResource ( "/" ) ; String path = resource . getPath ( ) ; int webRootIndex = StringUtils . indexOfIgnoreCase ( path , "WEB-INF" ) ; if ( path . indexOf ( ":/" ) > 0 ) { return path . substring ( 1 , webRootIndex ) ; } else { return path . substring ( 0 , webRootIndex ) ; }
public class GitHubPlugin { /** * Shortcut method for getting instance of { @ link GitHubPluginConfig } . * @ return configuration of plugin */ @ Nonnull public static GitHubPluginConfig configuration ( ) { } }
return defaultIfNull ( GitHubPluginConfig . all ( ) . get ( GitHubPluginConfig . class ) , GitHubPluginConfig . EMPTY_CONFIG ) ;
public class BackupStatusInner { /** * Get the container backup status . * @ param azureRegion Azure region to hit Api * @ param parameters Container Backup Status Request * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the BackupStatusResponseInner object */ public Observable < ServiceResponse < BackupStatusResponseInner > > getWithServiceResponseAsync ( String azureRegion , BackupStatusRequest parameters ) { } }
if ( azureRegion == null ) { throw new IllegalArgumentException ( "Parameter azureRegion is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( parameters == null ) { throw new IllegalArgumentException ( "Parameter parameters is required and cannot be null." ) ; } Validator . validate ( parameters ) ; final String apiVersion = "2017-07-01" ; return service . get ( azureRegion , this . client . subscriptionId ( ) , apiVersion , parameters , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < BackupStatusResponseInner > > > ( ) { @ Override public Observable < ServiceResponse < BackupStatusResponseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < BackupStatusResponseInner > clientResponse = getDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class MethodMap { /** * RTC102289 */ private static String getPackageName ( Class < ? > klass ) { } }
String className = klass . getName ( ) ; int index = className . lastIndexOf ( '.' ) ; return index == - 1 ? "" : className . substring ( 0 , index ) ;
public class PerEntityPoolingMetadataExtractor { /** * If a metadata tag is unsupported for this version of Elasticsearch then a */ private FieldExtractor _createExtractorFor ( Metadata metadata ) { } }
// Boot metadata tags that are not supported in this version of Elasticsearch if ( version . onOrAfter ( EsMajorVersion . V_6_X ) ) { // 6.0 Removed support for TTL and Timestamp metadata on index and update requests . switch ( metadata ) { case TTL : // Fall through case TIMESTAMP : return new UnsupportedMetadataFieldExtractor ( metadata , version ) ; } } return createExtractorFor ( metadata ) ;
public class GenericUtils { /** * Takes an array of 4 bytes and returns an integer that is * represented by them . * @ param array * @ return int that represents the 4 bytes * @ throws IllegalArgumentException for invalid arguments */ static public int asInt ( byte [ ] array ) { } }
if ( null == array || 4 != array . length ) { throw new IllegalArgumentException ( "Length of the byte array should be 4" ) ; } return ( ( array [ 0 ] << 24 ) + ( ( array [ 1 ] & 255 ) << 16 ) + ( ( array [ 2 ] & 255 ) << 8 ) + ( array [ 3 ] & 255 ) ) ;
public class HttpFields { Field getField ( FieldInfo info , boolean getValid ) { } }
int hi = info . hashCode ( ) ; if ( hi < _index . length ) { if ( _index [ hi ] >= 0 ) { Field field = ( Field ) ( _fields . get ( _index [ hi ] ) ) ; return ( field != null && ( ! getValid || field . _version == _version ) ) ? field : null ; } } else { for ( int i = 0 ; i < _fields . size ( ) ; i ++ ) { Field field = ( Field ) _fields . get ( i ) ; if ( info . equals ( field . _info ) && ( ! getValid || field . _version == _version ) ) return field ; } } return null ;
public class AWSSimpleSystemsManagementClient { /** * Returns high - level aggregated patch compliance state for a patch group . * @ param describePatchGroupStateRequest * @ return Result of the DescribePatchGroupState operation returned by the service . * @ throws InternalServerErrorException * An error occurred on the server side . * @ throws InvalidNextTokenException * The specified token is not valid . * @ sample AWSSimpleSystemsManagement . DescribePatchGroupState * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ssm - 2014-11-06 / DescribePatchGroupState " target = " _ top " > AWS * API Documentation < / a > */ @ Override public DescribePatchGroupStateResult describePatchGroupState ( DescribePatchGroupStateRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribePatchGroupState ( request ) ;
public class ZmqMainThread { private static String formatTime ( long ms ) { } }
StringTokenizer st = new StringTokenizer ( new Date ( ms ) . toString ( ) ) ; ArrayList < String > arrayList = new ArrayList < > ( ) ; while ( st . hasMoreTokens ( ) ) arrayList . add ( st . nextToken ( ) ) ; String time = arrayList . get ( 3 ) ; double d = ( double ) ms / 1000 ; long l = ms / 1000 ; d = ( d - l ) * 1000 ; ms = ( long ) d ; return time + "." + ms ;
public class WebFragmentTypeImpl { /** * If not already created , a new < code > ejb - local - ref < / code > element will be created and returned . * Otherwise , the first existing < code > ejb - local - ref < / code > element will be returned . * @ return the instance defined for the element < code > ejb - local - ref < / code > */ public EjbLocalRefType < WebFragmentType < T > > getOrCreateEjbLocalRef ( ) { } }
List < Node > nodeList = childNode . get ( "ejb-local-ref" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new EjbLocalRefTypeImpl < WebFragmentType < T > > ( this , "ejb-local-ref" , childNode , nodeList . get ( 0 ) ) ; } return createEjbLocalRef ( ) ;
public class TaskManager { /** * refresh channels work info . is not thread safe */ private void calcChannelsStats ( List < TaskRec > tasks ) { } }
for ( ChannelWorkContext wc : channelContextMap . values ( ) ) { wc . lastGotCount = 0 ; } for ( TaskRec taskRec : tasks ) { ChannelWorkContext wc = channelContextMap . get ( taskRec . channel ) ; if ( wc == null ) { wc = new ChannelWorkContext ( taskRec . channel ) ; channelContextMap . put ( taskRec . channel , wc ) ; } wc . lastGotCount ++ ; } // update next portion - double if found something , clear to minimum if not for ( ChannelWorkContext wc : channelContextMap . values ( ) ) { if ( wc . lastGotCount > 0 ) { wc . nextSlowLimit = Math . min ( wc . nextSlowLimit * 2 , MAX_TASK_COUNT ) ; logger . debug ( "Channel " + wc . channelName + " nextSlowLimit=" + wc . nextSlowLimit ) ; } else { wc . dropNextSlowLimit ( ) ; } }
public class SamlProfileSamlNameIdBuilder { /** * Prepare name id encoder saml 2 string name id encoder . * @ param authnRequest the authn request * @ param nameFormat the name format * @ param attribute the attribute * @ param service the service * @ param adaptor the adaptor * @ return the saml 2 string name id encoder */ protected static SAML2StringNameIDEncoder prepareNameIdEncoder ( final RequestAbstractType authnRequest , final String nameFormat , final IdPAttribute attribute , final SamlRegisteredService service , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor ) { } }
val encoder = new SAML2StringNameIDEncoder ( ) ; encoder . setNameFormat ( nameFormat ) ; if ( getNameIDPolicy ( authnRequest ) != null ) { val qualifier = getNameIDPolicy ( authnRequest ) . getSPNameQualifier ( ) ; LOGGER . debug ( "NameID qualifier is set to [{}]" , qualifier ) ; encoder . setNameQualifier ( qualifier ) ; } return encoder ;
public class ResourceFinder { /** * Assumes the class specified points to a directory in the classpath that holds files * containing the name of a class that implements or is a subclass of the specfied class . * Any class that cannot be loaded or assigned to the specified interface will be cause * an exception to be thrown . * Example classpath : * META - INF / java . net . URLStreamHandler / jar * META - INF / java . net . URLStreamHandler / file * META - INF / java . net . URLStreamHandler / http * ResourceFinder finder = new ResourceFinder ( " META - INF / " ) ; * Map map = finder . mapAllImplementations ( java . net . URLStreamHandler . class ) ; * Class jarUrlHandler = map . get ( " jar " ) ; * Class fileUrlHandler = map . get ( " file " ) ; * Class httpUrlHandler = map . get ( " http " ) ; * @ param interfase a superclass or interface * @ return * @ throws IOException if the URL cannot be read * @ throws ClassNotFoundException if the class found is not loadable * @ throws ClassCastException if the class found is not assignable to the specified superclass or interface */ public Map < String , Class > mapAllImplementations ( Class interfase ) throws IOException , ClassNotFoundException { } }
Map < String , Class > implementations = new HashMap < > ( ) ; Map < String , String > map = mapAllStrings ( interfase . getName ( ) ) ; for ( Iterator iterator = map . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) iterator . next ( ) ; String string = ( String ) entry . getKey ( ) ; String className = ( String ) entry . getValue ( ) ; Class impl = classLoader . loadClass ( className ) ; if ( ! interfase . isAssignableFrom ( impl ) ) { throw new ClassCastException ( "Class not of type: " + interfase . getName ( ) ) ; } implementations . put ( string , impl ) ; } return implementations ;
public class Criteria { /** * Adds Like ( NOT LIKE ) criteria , * customer _ id NOT LIKE 10034 * @ see LikeCriteria * @ param attribute The field name to be used * @ param value An object representing the value of the field */ public void addNotLike ( String attribute , Object value ) { } }
// PAW // addSelectionCriteria ( ValueCriteria . buildNotLikeCriteria ( attribute , value , getAlias ( ) ) ) ; addSelectionCriteria ( ValueCriteria . buildNotLikeCriteria ( attribute , value , getUserAlias ( attribute ) ) ) ;
public class MinimizeExitPoints { /** * Move all the child nodes following start in srcParent to the end of * destParent ' s child list . * @ param start The start point in the srcParent child list . * @ param srcParent The parent node of start . * @ param destParent The destination node . */ private static void moveAllFollowing ( Node start , Node srcParent , Node destParent ) { } }
for ( Node n = start . getNext ( ) ; n != null ; n = start . getNext ( ) ) { boolean isFunctionDeclaration = NodeUtil . isFunctionDeclaration ( n ) ; srcParent . removeChild ( n ) ; if ( isFunctionDeclaration ) { destParent . addChildToFront ( n ) ; } else { destParent . addChildToBack ( n ) ; } }
public class JavaBeanSetterInfo { /** * 返回所有的public方法 */ public Map < String , FieldSetterInfo > getFiledSetterInfos ( ) { } }
Map < String , FieldSetterInfo > map = new HashMap < String , FieldSetterInfo > ( ) ; for ( Field field : clazz . getFields ( ) ) { if ( Modifier . isStatic ( field . getModifiers ( ) ) ) { continue ; } if ( Modifier . isFinal ( field . getModifiers ( ) ) ) { continue ; } if ( ! Modifier . isPublic ( field . getModifiers ( ) ) ) { continue ; } String propertyName = field . getName ( ) ; // 如果已经暴露了方法 , 那么就不使用属性设置 if ( this . methodSetterInfos . containsKey ( propertyName ) ) { continue ; } map . put ( propertyName , new FieldSetterInfo ( propertyName , field ) ) ; } return map ;
public class IoUtil { /** * Read and return the entire contents of the supplied { @ link File } . * @ param file the file containing the information to be read ; may be null * @ return the contents , or an empty string if the supplied reader is null * @ throws IOException if there is an error reading the content */ public static String read ( File file ) throws IOException { } }
if ( file == null ) return "" ; StringBuilder sb = new StringBuilder ( ) ; boolean error = false ; Reader reader = new FileReader ( file ) ; try { int numRead = 0 ; char [ ] buffer = new char [ 1024 ] ; while ( ( numRead = reader . read ( buffer ) ) > - 1 ) { sb . append ( buffer , 0 , numRead ) ; } } catch ( IOException e ) { error = true ; // this error should be thrown , even if there is an error closing reader throw e ; } catch ( RuntimeException e ) { error = true ; // this error should be thrown , even if there is an error closing reader throw e ; } finally { try { reader . close ( ) ; } catch ( IOException e ) { if ( ! error ) throw e ; } } return sb . toString ( ) ;
public class NetworkWatchersInner { /** * Gets the next hop from the specified VM . * @ param resourceGroupName The name of the resource group . * @ param networkWatcherName The name of the network watcher . * @ param parameters Parameters that define the source and destination endpoint . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < ServiceResponse < NextHopResultInner > > getNextHopWithServiceResponseAsync ( String resourceGroupName , String networkWatcherName , NextHopParameters parameters ) { } }
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( networkWatcherName == null ) { throw new IllegalArgumentException ( "Parameter networkWatcherName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( parameters == null ) { throw new IllegalArgumentException ( "Parameter parameters is required and cannot be null." ) ; } Validator . validate ( parameters ) ; final String apiVersion = "2018-04-01" ; Observable < Response < ResponseBody > > observable = service . getNextHop ( resourceGroupName , networkWatcherName , this . client . subscriptionId ( ) , parameters , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) ; return client . getAzureClient ( ) . getPostOrDeleteResultAsync ( observable , new TypeToken < NextHopResultInner > ( ) { } . getType ( ) ) ;
public class JCasUtil2 { /** * Creates paragraph annotations in { @ code target } by copying paragraphs from the { @ code source } . * @ param source source jcas * @ param target target jcas * @ throws IllegalArgumentException if source text and target text are different or if target * already contains paragraph annotations */ public static void copyParagraphAnnotations ( JCas source , JCas target ) throws IllegalArgumentException { } }
if ( ! source . getDocumentText ( ) . equals ( target . getDocumentText ( ) ) ) { throw new IllegalArgumentException ( "source.documentText and target.documentText are not equal" ) ; } Collection < Paragraph > targetParagraphs = JCasUtil . select ( target , Paragraph . class ) ; if ( ! targetParagraphs . isEmpty ( ) ) { throw new IllegalArgumentException ( "target already contains paragraph annotations" ) ; } for ( Paragraph paragraph : JCasUtil . select ( source , Paragraph . class ) ) { Paragraph paragraphCopy = new Paragraph ( target ) ; paragraphCopy . setBegin ( paragraph . getBegin ( ) ) ; paragraphCopy . setEnd ( paragraph . getEnd ( ) ) ; paragraphCopy . addToIndexes ( ) ; }
public class Converters { /** * Sets if converters registered with the VM PropertyEditorManager . * If the new value is true , all currently registered converters are * immediately registered with the VM . */ public static void setRegisterWithVM ( final boolean registerWithVM ) { } }
if ( Converters . registerWithVM != registerWithVM ) { Converters . registerWithVM = registerWithVM ; // register all converters with the VM if ( registerWithVM ) { for ( Entry < Class , Converter > entry : REGISTRY . entrySet ( ) ) { Class type = entry . getKey ( ) ; Converter converter = entry . getValue ( ) ; PropertyEditorManager . registerEditor ( type , converter . getClass ( ) ) ; } } }
public class ByteArrayUtil { /** * Get a < i > int < / i > from the given byte array starting at the given offset * in big endian order . * There is no bounds checking . * @ param array source byte array * @ param offset source offset * @ return the < i > int < / i > */ public static int getIntBE ( final byte [ ] array , final int offset ) { } }
return ( array [ offset + 3 ] & 0XFF ) | ( ( array [ offset + 2 ] & 0XFF ) << 8 ) | ( ( array [ offset + 1 ] & 0XFF ) << 16 ) | ( ( array [ offset ] & 0XFF ) << 24 ) ;
public class AbstractListDialogBuilder { /** * Sets the selectable items , which should be shown by the dialog , which is created by the * builder . Multiple items can be selected at once . * Note , that the attached listener is not stored using a dialog ' s * < code > onSaveInstanceState < / code > - method , because it is not serializable . Therefore this * method must be called again after configuration changes , e . g when the orientation of the * device has changed , in order to re - register the listener . * @ param items * The items , which should be set , as an array of the type { @ link CharSequence } . The * items may not be null * @ param checkedItems * An array , which contains , whether the items , which correspond to the corresponding * indices , should be selected by default , or not , as a { @ link Boolean } array or null , * if no items should be selected by default * @ param listener * The listener , which should be notified , when an item is clicked , as an instance of * the type { @ link DialogInterface . OnClickListener } or null , if no listener should be * notified * @ return The builder , the method has been called upon , as an instance of the generic type * BuilderType */ public final BuilderType setMultiChoiceItems ( @ NonNull final CharSequence [ ] items , @ Nullable final boolean [ ] checkedItems , @ Nullable final DialogInterface . OnMultiChoiceClickListener listener ) { } }
getProduct ( ) . setMultiChoiceItems ( items , checkedItems , listener ) ; return self ( ) ;
public class StateUtils { /** * This fires during the Restore View phase , restoring state . */ public static final Object reconstruct ( String string , ExternalContext ctx ) { } }
byte [ ] bytes ; try { if ( log . isLoggable ( Level . FINE ) ) { log . fine ( "Processing state : " + string ) ; } bytes = string . getBytes ( ZIP_CHARSET ) ; bytes = decode ( bytes ) ; if ( isSecure ( ctx ) ) { bytes = decrypt ( bytes , ctx ) ; } if ( enableCompression ( ctx ) ) { bytes = decompress ( bytes ) ; } return getAsObject ( bytes , ctx ) ; } catch ( Throwable e ) { if ( log . isLoggable ( Level . FINE ) ) { log . log ( Level . FINE , "View State cannot be reconstructed" , e ) ; } return null ; }
public class TwitterAuthFilter { /** * Calls the Twitter API to get the user profile using a given access token . * @ param app the app where the user will be created , use null for root app * @ param accessToken token in the format " oauth _ token : oauth _ secret " * @ return { @ link UserAuthentication } object or null if something went wrong * @ throws IOException ex */ public UserAuthentication getOrCreateUser ( App app , String accessToken ) throws IOException { } }
UserAuthentication userAuth = null ; User user = new User ( ) ; if ( accessToken != null && accessToken . contains ( Config . SEPARATOR ) ) { String [ ] tokens = accessToken . split ( Config . SEPARATOR ) ; String [ ] keys = SecurityUtils . getOAuthKeysForApp ( app , Config . TWITTER_PREFIX ) ; Map < String , String [ ] > params2 = new HashMap < > ( ) ; HttpGet profileGet = new HttpGet ( PROFILE_URL + "?include_email=true" ) ; params2 . put ( "include_email" , new String [ ] { "true" } ) ; profileGet . setHeader ( HttpHeaders . AUTHORIZATION , OAuth1HmacSigner . sign ( "GET" , PROFILE_URL , params2 , keys [ 0 ] , keys [ 1 ] , tokens [ 0 ] , tokens [ 1 ] ) ) ; Map < String , Object > profile = null ; try ( CloseableHttpResponse resp3 = httpclient . execute ( profileGet ) ) { if ( resp3 . getStatusLine ( ) . getStatusCode ( ) == HttpServletResponse . SC_OK ) { profile = jreader . readValue ( resp3 . getEntity ( ) . getContent ( ) ) ; EntityUtils . consumeQuietly ( resp3 . getEntity ( ) ) ; } } if ( profile != null && profile . containsKey ( "id_str" ) ) { String twitterId = ( String ) profile . get ( "id_str" ) ; String pic = ( String ) profile . get ( "profile_image_url_https" ) ; String alias = ( String ) profile . get ( "screen_name" ) ; String name = ( String ) profile . get ( "name" ) ; String email = ( String ) profile . get ( "email" ) ; user . setAppid ( getAppid ( app ) ) ; user . setIdentifier ( Config . TWITTER_PREFIX + twitterId ) ; user . setEmail ( email ) ; user = User . readUserForIdentifier ( user ) ; if ( user == null ) { // user is new user = new User ( ) ; user . setActive ( true ) ; user . setAppid ( getAppid ( app ) ) ; user . setEmail ( StringUtils . isBlank ( email ) ? alias + "@twitter.com" : email ) ; user . setName ( StringUtils . isBlank ( name ) ? "No Name" : name ) ; user . setPassword ( Utils . generateSecurityToken ( ) ) ; user . setPicture ( getPicture ( pic ) ) ; user . setIdentifier ( Config . TWITTER_PREFIX + twitterId ) ; String id = user . create ( ) ; if ( id == null ) { throw new AuthenticationServiceException ( "Authentication failed: cannot create new user." ) ; } } else { String picture = getPicture ( pic ) ; boolean update = false ; if ( ! StringUtils . equals ( user . getPicture ( ) , picture ) ) { user . setPicture ( picture ) ; update = true ; } if ( ! StringUtils . isBlank ( email ) && ! StringUtils . equals ( user . getEmail ( ) , email ) ) { user . setEmail ( email ) ; update = true ; } if ( update ) { user . update ( ) ; } } userAuth = new UserAuthentication ( new AuthenticatedUserDetails ( user ) ) ; } } return SecurityUtils . checkIfActive ( userAuth , user , false ) ;
public class Requirement { /** * < pre > * Strategy to use for matching types in the value parameter ( e . g . for * BANNED _ CODE _ PATTERN checks ) . * < / pre > * < code > optional . jscomp . Requirement . TypeMatchingStrategy type _ matching _ strategy = 13 [ default = LOOSE ] ; < / code > */ public com . google . javascript . jscomp . Requirement . TypeMatchingStrategy getTypeMatchingStrategy ( ) { } }
com . google . javascript . jscomp . Requirement . TypeMatchingStrategy result = com . google . javascript . jscomp . Requirement . TypeMatchingStrategy . valueOf ( typeMatchingStrategy_ ) ; return result == null ? com . google . javascript . jscomp . Requirement . TypeMatchingStrategy . LOOSE : result ;
public class DAOValidatorHelper { /** * Methode permettant de charger toutes les Classes de validation de l ' Objet en fonction du Mode * @ param objectObjet a inspecter * @ returnListe des classes d ' implementation */ public static List < Class < ? extends IDAOValidator < ? extends Annotation > > > loadDAOValidatorClass ( Object object ) { } }
// Liste de classes de validation retrouvees List < Class < ? extends IDAOValidator < ? extends Annotation > > > result = new ArrayList < Class < ? extends IDAOValidator < ? extends Annotation > > > ( ) ; // Si l ' objet est null if ( object == null ) { // On retourne une liste vide return result ; } // Obtention des annotations de la classe Annotation [ ] objectAnnotations = object . getClass ( ) . getAnnotations ( ) ; // Si le tableau est vide if ( objectAnnotations == null || objectAnnotations . length == 0 ) { // On retourne une liste vide return result ; } // Parcours for ( Annotation annotation : objectAnnotations ) { // Si c ' est une annotation du Framework if ( isDAOValidatorAnnotation ( annotation ) ) { // Obtention de l ' annotation de validfation DAOConstraint daoAnnotation = annotation . annotationType ( ) . getAnnotation ( DAOConstraint . class ) ; // On ajoute l ' annotation result . add ( daoAnnotation . validatedBy ( ) ) ; } } // On retourne la liste return result ;
public class StringTools { /** * Case - insensitive version of indexOf ( ) */ public static int indexOfIgnoreCase ( String text , String needle , int fromIndex ) { } }
int textLen = text . length ( ) ; int needleLen = needle . length ( ) ; if ( fromIndex >= textLen ) return needleLen == 0 ? textLen : - 1 ; int i = fromIndex ; if ( i < 0 ) i = 0 ; if ( needleLen == 0 ) return i ; char first = Character . toUpperCase ( needle . charAt ( 0 ) ) ; int max = textLen - needleLen ; startSearchForFirstChar : while ( true ) { // Look for first character . while ( i <= max ) { char c = Character . toUpperCase ( text . charAt ( i ) ) ; if ( c != first ) i ++ ; else break ; } if ( i > max ) return - 1 ; // Found first character , now look at the rest of the string int j = i + 1 ; int end = j + needleLen - 1 ; int k = 1 ; while ( j < end ) { char c1 = Character . toUpperCase ( text . charAt ( j ++ ) ) ; char c2 = Character . toUpperCase ( needle . charAt ( k ++ ) ) ; if ( c1 != c2 ) { i ++ ; // Look for str ' s first char again . continue startSearchForFirstChar ; } } return i ; }
public class AnnotationUtils { /** * Deep search of specified annotation considering " annotation as meta annotation " case ( annotation annotated with specified annotation ) . * @ param source * specified annotated element * @ param targetAnnotationClass * specified annotation class * @ param < A > * the type of the annotation to query for and return if present * @ return specified element ' s annotation for the specified annotation type if deeply present on this element , else null */ public static < A extends Annotation > A findAnnotation ( final AnnotatedElement source , final Class < A > targetAnnotationClass ) { } }
Objects . requireNonNull ( source , "incoming 'source' is not valid" ) ; Objects . requireNonNull ( targetAnnotationClass , "incoming 'targetAnnotationClass' is not valid" ) ; final A result = source . getAnnotation ( targetAnnotationClass ) ; if ( result != null ) return result ; return findAnnotationInAnnotations ( source , targetAnnotationClass ) ;
public class AbstractListenerMetadata { /** * Registers the given method as the callback method for the given event type . * @ param callbackType * the callback type * @ param method * the callback method * @ throws EntityManagerException * if there was already a callback method for the given event type . */ public void putListener ( CallbackType callbackType , Method method ) { } }
if ( callbacks == null ) { callbacks = new EnumMap < > ( CallbackType . class ) ; } Method oldMethod = callbacks . put ( callbackType , method ) ; if ( oldMethod != null ) { String format = "Class %s has at least two methods, %s and %s, with annotation of %s. " + "At most one method is allowed for a given callback type. " ; String message = String . format ( format , listenerClass . getName ( ) , oldMethod . getName ( ) , method . getName ( ) , callbackType . getAnnotationClass ( ) . getName ( ) ) ; throw new EntityManagerException ( message ) ; }
public class Properties { /** * Get the value from the property path ( Example : foo . bar . key ) . If the * property path is a empty String , the full root map is returned . * @ param propertyPath * Example : foo . bar . key * @ return the value from the propertyPath . * @ throws PropertyException * if the propertyKey - Path is not a property key or is a not * part of a property path . */ @ SuppressWarnings ( "unchecked" ) public Object getValue ( String propertyPath ) throws PropertyException { } }
// add the PreFixPropertyPath if this Property is a copy deeper level String fullPropertyPath = addPath ( mPropertyPathPrefix , propertyPath ) ; // check propertyPath ObjectChecks . checkForNullReference ( fullPropertyPath , "propertyPath is null" ) ; // split propertyPath String [ ] propertyKeyArray = fullPropertyPath . split ( "\\." ) ; // load the application properties Map < String , Object > applicationConfigs = load ( ) ; // return the full root map if ( fullPropertyPath . equals ( "" ) ) { return applicationConfigs ; } // iterate the root Map for every token for ( int i = 0 ; i < propertyKeyArray . length ; i ++ ) { Object tmp = applicationConfigs . get ( propertyKeyArray [ i ] ) ; if ( tmp == null ) { if ( propertyKeyArray . length > 1 ) { throw new PropertyException ( "property path[" + fullPropertyPath + "] have not a property key[" + propertyKeyArray [ i ] + "] !" ) ; } else { throw new PropertyException ( propertyKeyArray [ i ] + "] is not a property key!" ) ; } } if ( tmp instanceof Map ) { applicationConfigs = ( Map < String , Object > ) tmp ; } else { return tmp ; } } return applicationConfigs ;
public class AbstractSourceResolver { /** * Resolves the clazzname to a fileobject of the java - file * @ param clazzname * @ return null or the fileobject */ protected JavaSource getJavaSourceForClass ( String clazzname ) { } }
String resource = clazzname . replaceAll ( "\\." , "/" ) + ".java" ; FileObject fileObject = classPath . findResource ( resource ) ; if ( fileObject == null ) { return null ; } Project project = FileOwnerQuery . getOwner ( fileObject ) ; if ( project == null ) { return null ; } SourceGroup [ ] sourceGroups = ProjectUtils . getSources ( project ) . getSourceGroups ( "java" ) ; for ( SourceGroup sourceGroup : sourceGroups ) { return JavaSource . create ( ClasspathInfo . create ( sourceGroup . getRootFolder ( ) ) ) ; } return null ;
public class RtfParser { /** * Imports the mappings defined in the RtfImportMappings into the * RtfImportHeader of this RtfParser2. * @ param importMappings * The RtfImportMappings to import . * @ since 2.1.3 */ private void handleImportMappings ( RtfImportMappings importMappings ) { } }
Iterator it = importMappings . getFontMappings ( ) . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String fontNr = ( String ) it . next ( ) ; this . importMgr . importFont ( fontNr , ( String ) importMappings . getFontMappings ( ) . get ( fontNr ) ) ; } it = importMappings . getColorMappings ( ) . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String colorNr = ( String ) it . next ( ) ; this . importMgr . importColor ( colorNr , ( Color ) importMappings . getColorMappings ( ) . get ( colorNr ) ) ; } it = importMappings . getListMappings ( ) . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String listNr = ( String ) it . next ( ) ; this . importMgr . importList ( listNr , ( String ) importMappings . getListMappings ( ) . get ( listNr ) ) ; } it = importMappings . getStylesheetListMappings ( ) . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String stylesheetListNr = ( String ) it . next ( ) ; this . importMgr . importStylesheetList ( stylesheetListNr , ( List ) importMappings . getStylesheetListMappings ( ) . get ( stylesheetListNr ) ) ; }
public class FunctionMultiArgs { /** * Tell if this expression or it ' s subexpressions can traverse outside * the current subtree . * @ return true if traversal outside the context node ' s subtree can occur . */ public boolean canTraverseOutsideSubtree ( ) { } }
if ( super . canTraverseOutsideSubtree ( ) ) return true ; else { int n = m_args . length ; for ( int i = 0 ; i < n ; i ++ ) { if ( m_args [ i ] . canTraverseOutsideSubtree ( ) ) return true ; } return false ; }
public class BlockHouseHolder_DDRB { /** * Scales the elements in the specified row starting at element colStart by ' val ' . < br > * W = val * Y * Takes in account zeros and leading one automatically . * @ param zeroOffset How far off the diagonal is the first element in the vector . */ public static void scale_row ( final int blockLength , final DSubmatrixD1 Y , final DSubmatrixD1 W , final int row , final int zeroOffset , final double val ) { } }
int offset = row + zeroOffset ; if ( offset >= W . col1 - W . col0 ) return ; // handle the one W . set ( row , offset , val ) ; // scale rest of the vector VectorOps_DDRB . scale_row ( blockLength , Y , row , val , W , row , offset + 1 , Y . col1 - Y . col0 ) ;
public class Reporter { /** * Generates a unique id * @ return String : a random string with timestamp */ public static String getUUID ( ) { } }
long timeInSeconds = new Date ( ) . getTime ( ) ; String randomChars = TestCase . getRandomString ( 10 ) ; return timeInSeconds + "_" + randomChars ;
public class TextUtils { /** * converts the list of integer arrays to a string ready for API consumption . * @ param distributions the list of integer arrays representing the distribution * @ return a string with the distribution values * @ since 3.0.0 */ public static String formatDistributions ( List < Integer [ ] > distributions ) { } }
if ( distributions . isEmpty ( ) ) { return null ; } String [ ] distributionsFormatted = new String [ distributions . size ( ) ] ; for ( int i = 0 ; i < distributions . size ( ) ; i ++ ) { if ( distributions . get ( i ) . length == 0 ) { distributionsFormatted [ i ] = "" ; } else { distributionsFormatted [ i ] = String . format ( Locale . US , "%s,%s" , TextUtils . formatCoordinate ( distributions . get ( i ) [ 0 ] ) , TextUtils . formatCoordinate ( distributions . get ( i ) [ 1 ] ) ) ; } } return TextUtils . join ( ";" , distributionsFormatted ) ;
public class DescribeFleetMetadataRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeFleetMetadataRequest describeFleetMetadataRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeFleetMetadataRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeFleetMetadataRequest . getFleetArn ( ) , FLEETARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AbstractGuacamoleTunnelService { /** * Returns a list of all balanced connections within a given connection * group . If the connection group is not balancing , or it contains no * connections , an empty list is returned . * @ param user * The user on whose behalf the balanced connections within the given * connection group are being retrieved . * @ param connectionGroup * The connection group to retrieve the balanced connections of . * @ return * A list containing all balanced connections within the given group , * or an empty list if there are no such connections . */ private List < ModeledConnection > getBalancedConnections ( ModeledAuthenticatedUser user , ModeledConnectionGroup connectionGroup ) { } }
// If not a balancing group , there are no balanced connections if ( connectionGroup . getType ( ) != ConnectionGroup . Type . BALANCING ) return Collections . < ModeledConnection > emptyList ( ) ; // If group has no children , there are no balanced connections Collection < String > identifiers = connectionMapper . selectIdentifiersWithin ( connectionGroup . getIdentifier ( ) ) ; if ( identifiers . isEmpty ( ) ) return Collections . < ModeledConnection > emptyList ( ) ; // Restrict to preferred connections if session affinity is enabled if ( connectionGroup . isSessionAffinityEnabled ( ) ) identifiers = getPreferredConnections ( user , identifiers ) ; // Retrieve all children Collection < ConnectionModel > models = connectionMapper . select ( identifiers ) ; List < ModeledConnection > connections = new ArrayList < ModeledConnection > ( models . size ( ) ) ; // Convert each retrieved model to a modeled connection for ( ConnectionModel model : models ) { ModeledConnection connection = connectionProvider . get ( ) ; connection . init ( user , model ) ; connections . add ( connection ) ; } return connections ;
public class ObjectByteExtentImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . OBJECT_BYTE_EXTENT__BYTE_EXT : return BYTE_EXT_EDEFAULT == null ? byteExt != null : ! BYTE_EXT_EDEFAULT . equals ( byteExt ) ; case AfplibPackage . OBJECT_BYTE_EXTENT__BYTE_EXT_HI : return BYTE_EXT_HI_EDEFAULT == null ? byteExtHi != null : ! BYTE_EXT_HI_EDEFAULT . equals ( byteExtHi ) ; } return super . eIsSet ( featureID ) ;
public class LabelInfo { /** * Configures the given button with the properties held in this instance . Note that this * instance doesn ' t hold any keystroke accelerator information . * @ param button The button to be configured . * @ throws IllegalArgumentException if { @ code button } is null . */ public void configureButton ( AbstractButton button ) { } }
Assert . notNull ( button ) ; button . setText ( this . text ) ; button . setMnemonic ( getMnemonic ( ) ) ; button . setDisplayedMnemonicIndex ( getMnemonicIndex ( ) ) ;
public class GenericDraweeHierarchyBuilder { /** * Sets the retry image and its scale type . * @ param retryDrawable drawable to be used as retry image * @ param retryImageScaleType scale type for the retry image * @ return modified instance of this builder */ public GenericDraweeHierarchyBuilder setRetryImage ( Drawable retryDrawable , @ Nullable ScalingUtils . ScaleType retryImageScaleType ) { } }
mRetryImage = retryDrawable ; mRetryImageScaleType = retryImageScaleType ; return this ;
public class SequentialMethodArrangement { /** * { @ inheritDoc } */ @ Override protected List < BenchmarkElement > arrangeList ( final List < BenchmarkElement > elements ) { } }
final Map < BenchmarkMethod , ArrayList < BenchmarkElement > > table = new Hashtable < BenchmarkMethod , ArrayList < BenchmarkElement > > ( ) ; final List < BenchmarkElement > returnVal = new ArrayList < BenchmarkElement > ( ) ; // Having a table for ( final BenchmarkElement elem : elements ) { if ( ! table . containsKey ( elem . getMeth ( ) ) ) { table . put ( elem . getMeth ( ) , new ArrayList < BenchmarkElement > ( ) ) ; } table . get ( elem . getMeth ( ) ) . add ( elem ) ; } // Computing complete number of elements int numberOfElements = 0 ; for ( final BenchmarkMethod meth : table . keySet ( ) ) { numberOfElements = numberOfElements + table . get ( meth ) . size ( ) ; } // Defining order to execute , start with the one with the most elements final Set < Entry < BenchmarkMethod , ArrayList < BenchmarkElement > > > compareMethods = new TreeSet < Entry < BenchmarkMethod , ArrayList < BenchmarkElement > > > ( new BenchmarkElementComparator ( ) ) ; for ( final Entry < BenchmarkMethod , ArrayList < BenchmarkElement > > entry : table . entrySet ( ) ) { compareMethods . add ( entry ) ; } final ArrayList < BenchmarkMethod > methods = new ArrayList < BenchmarkMethod > ( ) ; for ( Entry < BenchmarkMethod , ArrayList < BenchmarkElement > > entry : compareMethods ) { methods . add ( entry . getKey ( ) ) ; } for ( int i = 0 ; i < numberOfElements ; i ++ ) { BenchmarkElement elem = null ; int indexPart = 0 ; while ( elem == null ) { final int index = ( i + indexPart ) % methods . size ( ) ; final BenchmarkMethod methodToInclude = methods . get ( index ) ; if ( table . containsKey ( methodToInclude ) ) { elem = table . get ( methodToInclude ) . remove ( 0 ) ; if ( table . get ( methodToInclude ) . size ( ) == 0 ) { table . remove ( methodToInclude ) ; } } indexPart ++ ; } returnVal . add ( elem ) ; } return returnVal ;
public class Coercion { /** * Coerces an object to a String representation , supporting streaming for specialized types . * @ param encoder if null , no encoding is performed - write through */ public static void write ( Object value , MediaEncoder encoder , Writer out ) throws IOException { } }
if ( encoder == null ) { write ( value , out ) ; } else { // Otherwise , if A is null , then the result is " " . // Write nothing if ( value != null ) { // Unwrap out to avoid unnecessary validation of known valid output while ( true ) { out = unwrap ( out ) ; if ( out instanceof MediaValidator ) { MediaValidator validator = ( MediaValidator ) out ; if ( validator . canSkipValidation ( encoder . getValidMediaOutputType ( ) ) ) { // Can skip validation , write directly to the wrapped output through the encoder out = validator . getOut ( ) ; } else { break ; } } else { break ; } } // Write through the given encoder if ( value instanceof String ) { // If A is a string , then the result is A . encoder . write ( ( String ) value , out ) ; } else if ( value instanceof Writable ) { Writable writable = ( Writable ) value ; if ( writable . isFastToString ( ) ) { encoder . write ( writable . toString ( ) , out ) ; } else { // Avoid intermediate String from Writable writable . writeTo ( encoder , out ) ; } } else if ( value instanceof Node ) { // Otherwise , if is a DOM node , serialize the output try { // Can use thread - local or pooled transformers if performance is ever an issue TransformerFactory transFactory = TransformerFactory . newInstance ( ) ; Transformer transformer = transFactory . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , "yes" ) ; transformer . transform ( new DOMSource ( ( Node ) value ) , new StreamResult ( new MediaWriter ( encoder , out ) ) ) ; } catch ( TransformerException e ) { throw new IOException ( e ) ; } } else { // Otherwise , if A . toString ( ) throws an exception , then raise an error // Otherwise , the result is A . toString ( ) ; encoder . write ( value . toString ( ) , out ) ; } } }
public class ConfigurationUpdate { /** * Remove a path from the configuration . * @ param path the path to be removed * @ return the event for easy chaining */ public ConfigurationUpdate removePath ( String path ) { } }
if ( path == null || ! path . startsWith ( "/" ) ) { throw new IllegalArgumentException ( "Path must start with \"/\"." ) ; } paths . put ( path , null ) ; return this ;
public class CmsDriverManager { /** * Returns a list with all projects from history . < p > * @ param dbc the current database context * @ return list of < code > { @ link CmsHistoryProject } < / code > objects * with all projects from history . * @ throws CmsException if operation was not successful */ public List < CmsHistoryProject > getAllHistoricalProjects ( CmsDbContext dbc ) throws CmsException { } }
// user is allowed to access all existing projects for the ous he has the project _ manager role Set < CmsOrganizationalUnit > manOus = new HashSet < CmsOrganizationalUnit > ( getOrgUnitsForRole ( dbc , CmsRole . PROJECT_MANAGER , true ) ) ; List < CmsHistoryProject > projects = getHistoryDriver ( dbc ) . readProjects ( dbc ) ; Iterator < CmsHistoryProject > itProjects = projects . iterator ( ) ; while ( itProjects . hasNext ( ) ) { CmsHistoryProject project = itProjects . next ( ) ; if ( project . isHidden ( ) ) { // project is hidden itProjects . remove ( ) ; continue ; } if ( ! project . getOuFqn ( ) . startsWith ( dbc . currentUser ( ) . getOuFqn ( ) ) ) { // project is not visible from the users ou itProjects . remove ( ) ; continue ; } CmsOrganizationalUnit ou = readOrganizationalUnit ( dbc , project . getOuFqn ( ) ) ; if ( manOus . contains ( ou ) ) { // user is project manager for this project continue ; } else if ( project . getOwnerId ( ) . equals ( dbc . currentUser ( ) . getId ( ) ) ) { // user is owner of the project continue ; } else { boolean found = false ; Iterator < CmsGroup > itGroups = getGroupsOfUser ( dbc , dbc . currentUser ( ) . getName ( ) , false ) . iterator ( ) ; while ( itGroups . hasNext ( ) ) { CmsGroup group = itGroups . next ( ) ; if ( project . getManagerGroupId ( ) . equals ( group . getId ( ) ) ) { found = true ; break ; } } if ( found ) { // user is member of the manager group of the project continue ; } } itProjects . remove ( ) ; } return projects ;
public class DefaultGroovyMethods { /** * Support the subscript operator with a range for a char array * @ param array a char array * @ param range a range indicating the indices for the items to retrieve * @ return list of the retrieved chars * @ since 1.5.0 */ @ SuppressWarnings ( "unchecked" ) public static List < Character > getAt ( char [ ] array , Range range ) { } }
return primitiveArrayGet ( array , range ) ;
public class Predicates { /** * Returns a Predicate that evaluates to true iff any one of its components * evaluates to true . The components are evaluated in order , and evaluation * will be " short - circuited " as soon as the answer is determined . Does not * defensively copy the iterable passed in , so future changes to it will alter * the behavior of this Predicate . If components is empty , the returned * Predicate will always evaluate to false . */ public static < T > Predicate < T > or ( Iterable < ? extends Predicate < ? super T > > components ) { } }
return new OrPredicate ( components ) ;
public class RawCursor { /** * Calls toPrevious , but considers start bound . */ private boolean toBoundedPrevious ( ) throws FetchException { } }
if ( ! toPrevious ( ) ) { return false ; } if ( mStartBound != null ) { byte [ ] currentKey = getCurrentKey ( ) ; if ( currentKey == null ) { return false ; } int result = compareKeysPartially ( currentKey , mStartBound ) ; if ( result <= 0 ) { if ( result < 0 || ! mInclusiveStart ) { // Too far now , reset to first . toBoundedFirst ( ) ; return false ; } } } return prefixMatches ( ) ;
public class Expressions { /** * Create a new Template expression * @ param cl type of expression * @ param template template * @ param args template parameters * @ return template expression */ public static < T extends Comparable < ? > > ComparableTemplate < T > comparableTemplate ( Class < ? extends T > cl , String template , Object ... args ) { } }
return comparableTemplate ( cl , createTemplate ( template ) , ImmutableList . copyOf ( args ) ) ;
public class PersistUtils { /** * StatementBuilder */ public static String [ ] toWhereArgs ( Object ... args ) { } }
String [ ] arr = new String [ args . length ] ; for ( int i = 0 ; i < args . length ; i ++ ) { Object arg = args [ i ] ; String argStr ; if ( arg == null ) { argStr = "NULL" ; } else if ( arg instanceof Boolean ) { argStr = ( ( Boolean ) arg ) ? "1" : "0" ; } else if ( arg instanceof Date ) { argStr = String . valueOf ( ( ( Date ) arg ) . getTime ( ) ) ; } else if ( arg instanceof Entity ) { argStr = String . valueOf ( ( ( Entity ) arg ) . _id ) ; } else { argStr = arg . toString ( ) ; } arr [ i ] = argStr ; } return arr ;
public class Response { /** * Adds cookie to the response . Can be invoked multiple times to insert more than one cookie . * @ param domain domain of the cookie * @ param path path of the cookie * @ param name name of the cookie * @ param value value of the cookie * @ param maxAge max age of the cookie in seconds ( negative for the not persistent cookie , zero - deletes the cookie ) * @ param secured if true : cookie will be secured * @ param httpOnly if true : cookie will be marked as http only */ public void cookie ( String domain , String path , String name , String value , int maxAge , boolean secured , boolean httpOnly ) { } }
Cookie cookie = new Cookie ( name , value ) ; cookie . setPath ( path ) ; cookie . setDomain ( domain ) ; cookie . setMaxAge ( maxAge ) ; cookie . setSecure ( secured ) ; cookie . setHttpOnly ( httpOnly ) ; response . addCookie ( cookie ) ;
public class ContinuousFileMonitoringFunction { /** * Returns { @ code true } if the file is NOT to be processed further . * This happens if the modification time of the file is smaller than * the { @ link # globalModificationTime } . * @ param filePath the path of the file to check . * @ param modificationTime the modification time of the file . */ private boolean shouldIgnore ( Path filePath , long modificationTime ) { } }
assert ( Thread . holdsLock ( checkpointLock ) ) ; boolean shouldIgnore = modificationTime <= globalModificationTime ; if ( shouldIgnore && LOG . isDebugEnabled ( ) ) { LOG . debug ( "Ignoring " + filePath + ", with mod time= " + modificationTime + " and global mod time= " + globalModificationTime ) ; } return shouldIgnore ;
public class CeSymmResult { /** * Return a String describing the reasons for the CE - Symm final decision in * this particular result . * @ return String decision reason */ public String getReason ( ) { } }
// Cases : // 1 . Asymmetric because insignificant self - alignment ( 1itb . A _ 1-100) double tm = selfAlignment . getTMScore ( ) ; if ( tm < params . getUnrefinedScoreThreshold ( ) ) { return String . format ( "Insignificant self-alignment (TM=%.2f)" , tm ) ; } // 2 . Asymmetric because order detector returned 1 if ( numRepeats == 1 ) { return String . format ( "Order detector found asymmetric alignment (TM=%.2f)" , tm ) ; } // Check that the user requested refinement if ( params . getRefineMethod ( ) != RefineMethod . NOT_REFINED ) { // 3 . Asymmetric because refinement failed if ( ! refined ) { return "Refinement failed" ; } tm = multipleAlignment . getScore ( MultipleAlignmentScorer . AVGTM_SCORE ) ; // 4 . Asymmetric because refinement & optimization were not // significant if ( ! isSignificant ( ) ) { return String . format ( "Refinement was not significant (TM=%.2f)" , tm ) ; } } else { // 4 . Not refined , but result was not significant if ( ! isSignificant ( ) ) { return String . format ( "Result was not significant (TM=%.2f)" , tm ) ; } } String hierarchical = "" ; if ( axes . getNumLevels ( ) > 1 ) { hierarchical = String . format ( "; Contains %d levels of symmetry" , axes . getNumLevels ( ) ) ; } // 5 . Symmetric . // a . Open . Give # repeats ( 1n0r . A ) if ( axes . getElementaryAxis ( 0 ) . getSymmType ( ) == SymmetryType . OPEN ) { return String . format ( "Contains %d open repeats (TM=%.2f)%s" , getNumRepeats ( ) , tm , hierarchical ) ; } // b . Closed , non - hierarchical ( 1itb . A ) // c . Closed , heirarchical ( 4gcr ) return String . format ( "Significant (TM=%.2f)%s" , tm , hierarchical ) ;
public class CmsStaticExportManager { /** * Returns the export path for the static export , that is the folder where the * static exported resources will be written to . < p > * The returned value will be a directory like prefix . The value is configured * in the < code > opencms - importexport . xml < / code > configuration file . An optimization * of the configured value will be performed , where all relative path information is resolved * ( for example < code > / export / . . / static < / code > will be resolved to < code > / export < / code > . * Moreover , if the configured path ends with a < code > / < / code > , this will be cut off * ( for example < code > / export / < / code > becomes < code > / export < / code > . < p > * This is resource name based , and based on the rfs - rules defined in the * < code > opencms - importexport . xml < / code > configuration file . < p > * @ param vfsName the name of the resource to export * @ return the export path for the static export , that is the folder where the * @ see # getRfsPrefix ( String ) * @ see # getVfsPrefix ( ) */ public String getExportPath ( String vfsName ) { } }
if ( vfsName != null ) { Iterator < CmsStaticExportRfsRule > it = m_rfsRules . iterator ( ) ; while ( it . hasNext ( ) ) { CmsStaticExportRfsRule rule = it . next ( ) ; if ( rule . getSource ( ) . matcher ( vfsName ) . matches ( ) ) { return rule . getExportPath ( ) ; } } } if ( m_useTempDirs && isFullStaticExport ( ) ) { return getExportWorkPath ( ) ; } return m_staticExportPath ;
public class FeedParsers { /** * Finds the real parser type for the given document feed . * @ param document document feed to find the parser for . * @ return the parser for the given document or < b > null < / b > if there is no parser for that * document . */ public WireFeedParser getParserFor ( final Document document ) { } }
final List < WireFeedParser > parsers = getPlugins ( ) ; for ( final WireFeedParser parser : parsers ) { if ( parser . isMyType ( document ) ) { return parser ; } } return null ;
public class JdonPicoContainer { /** * Dispose the components of this PicoContainer and all its logical child * containers . Any component implementing the lifecycle interface * { @ link org . picocontainer . Disposable } will be disposed . * @ see # makeChildContainer ( ) * @ see # addChildContainer ( PicoContainer ) * @ see # removeChildContainer ( PicoContainer ) */ public void dispose ( ) { } }
if ( disposed ) throw new IllegalStateException ( "Already disposed" ) ; for ( Iterator iterator = children . iterator ( ) ; iterator . hasNext ( ) ; ) { PicoContainer child = ( PicoContainer ) iterator . next ( ) ; child . dispose ( ) ; } Collection < ComponentAdapter > adapters = getComponentAdapters ( ) ; for ( ComponentAdapter componentAdapter : adapters ) { if ( componentAdapter instanceof LifecycleStrategy ) { ( ( LifecycleStrategy ) componentAdapter ) . dispose ( getInstance ( componentAdapter ) ) ; } } disposed = true ;
public class EC2MetadataClient { /** * Reads a response from the Amazon EC2 Instance Metadata Service and * returns the content as a string . * @ param connection * The connection to the Amazon EC2 Instance Metadata Service . * @ return The content contained in the response from the Amazon EC2 * Instance Metadata Service . * @ throws IOException * If any problems ocurred while reading the response . */ private String readResponse ( HttpURLConnection connection ) throws IOException { } }
if ( connection . getResponseCode ( ) == HttpURLConnection . HTTP_NOT_FOUND ) throw new SdkClientException ( "The requested metadata is not found at " + connection . getURL ( ) ) ; InputStream inputStream = connection . getInputStream ( ) ; try { StringBuilder buffer = new StringBuilder ( ) ; while ( true ) { int c = inputStream . read ( ) ; if ( c == - 1 ) break ; buffer . append ( ( char ) c ) ; } return buffer . toString ( ) ; } finally { inputStream . close ( ) ; }
public class HessianToJdonRequestProcessor { /** * Finds method of class by using mangled name from incoming request */ public Method getMethod ( Class clz , String mangledMethodName ) { } }
Map < String , Method > methods = methodsByComponentType . get ( clz ) ; if ( methods == null ) { methods = new HashMap < String , Method > ( ) ; methodsByComponentType . put ( clz , methods ) ; for ( Method method : clz . getDeclaredMethods ( ) ) { Class < ? > [ ] param = method . getParameterTypes ( ) ; String mangledName1 = method . getName ( ) + "__" + param . length ; String mangledName2 = AbstractSkeleton . mangleName ( method , false ) ; if ( param . length == 0 || ! methods . containsKey ( method . getName ( ) ) ) { methods . put ( method . getName ( ) , method ) ; } methods . put ( mangledName1 , method ) ; methods . put ( mangledName2 , method ) ; } } return ( Method ) methods . get ( mangledMethodName ) ;
public class AWSAppSyncClient { /** * Retrieves the introspection schema for a GraphQL API . * @ param getIntrospectionSchemaRequest * @ return Result of the GetIntrospectionSchema operation returned by the service . * @ throws GraphQLSchemaException * The GraphQL schema is not valid . * @ throws NotFoundException * The resource specified in the request was not found . Check the resource , and then try again . * @ throws UnauthorizedException * You are not authorized to perform this operation . * @ throws InternalFailureException * An internal AWS AppSync error occurred . Try your request again . * @ sample AWSAppSync . GetIntrospectionSchema * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / appsync - 2017-07-25 / GetIntrospectionSchema " target = " _ top " > AWS * API Documentation < / a > */ @ Override public GetIntrospectionSchemaResult getIntrospectionSchema ( GetIntrospectionSchemaRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetIntrospectionSchema ( request ) ;
public class XSerializables { /** * Create an XElement with the given name and items stored from the source sequence . * @ param container the container name * @ param item the item name * @ param source the source of items * @ return the list in XElement */ public static XElement storeList ( String container , String item , Iterable < ? extends XSerializable > source ) { } }
XElement result = new XElement ( container ) ; for ( XSerializable e : source ) { e . save ( result . add ( item ) ) ; } return result ;
public class CPOptionCategoryPersistenceImpl { /** * Returns the last cp option category in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; . * @ param uuid the uuid * @ param companyId the company ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching cp option category * @ throws NoSuchCPOptionCategoryException if a matching cp option category could not be found */ @ Override public CPOptionCategory findByUuid_C_Last ( String uuid , long companyId , OrderByComparator < CPOptionCategory > orderByComparator ) throws NoSuchCPOptionCategoryException { } }
CPOptionCategory cpOptionCategory = fetchByUuid_C_Last ( uuid , companyId , orderByComparator ) ; if ( cpOptionCategory != null ) { return cpOptionCategory ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "uuid=" ) ; msg . append ( uuid ) ; msg . append ( ", companyId=" ) ; msg . append ( companyId ) ; msg . append ( "}" ) ; throw new NoSuchCPOptionCategoryException ( msg . toString ( ) ) ;
public class Quat4f { /** * public void EulerToQuaternion ( float roll , float pitch , float yaw ) * float cr , cp , cy , sr , sp , sy , cpcy , spsy ; * cr = cos ( roll / 2 ) ; * cp = cos ( pitch / 2 ) ; * cy = cos ( yaw / 2 ) ; * sr = sin ( roll / 2 ) ; * sp = sin ( pitch / 2 ) ; * sy = sin ( yaw / 2 ) ; * cpcy = cp * cy ; * spsy = sp * sy ; * w = cr * cpcy + sr * spsy ; * x = sr * cpcy - cr * spsy ; * y = cr * sp * cy + sr * cp * sy ; * z = cr * cp * sy - sr * sp * cy ; */ public void normalize ( ) { } }
float d = 1.0f / ( x * x + y * y + z * z + w * w ) ; x *= d ; y *= d ; z *= d ; w *= d ;
public class Assembly { /** * Removes file from your assembly . * @ param name field name of the file to remove . */ public void removeFile ( String name ) { } }
if ( files . containsKey ( name ) ) { files . remove ( name ) ; } if ( fileStreams . containsKey ( name ) ) { fileStreams . remove ( name ) ; }
public class Utils { /** * Load the contents of an input stream . * @ param stream input stream that contains the bytes to load * @ return the byte array loaded from the input stream */ public static byte [ ] loadFromStream ( InputStream stream ) { } }
try { BufferedInputStream bis = new BufferedInputStream ( stream ) ; int size = 2048 ; byte [ ] theData = new byte [ size ] ; int dataReadSoFar = 0 ; byte [ ] buffer = new byte [ size / 2 ] ; int read = 0 ; while ( ( read = bis . read ( buffer ) ) != - 1 ) { if ( ( read + dataReadSoFar ) > theData . length ) { // need to make more room byte [ ] newTheData = new byte [ theData . length * 2 ] ; // System . out . println ( " doubled to " + newTheData . length ) ; System . arraycopy ( theData , 0 , newTheData , 0 , dataReadSoFar ) ; theData = newTheData ; } System . arraycopy ( buffer , 0 , theData , dataReadSoFar , read ) ; dataReadSoFar += read ; } bis . close ( ) ; // Resize to actual data read byte [ ] returnData = new byte [ dataReadSoFar ] ; System . arraycopy ( theData , 0 , returnData , 0 , dataReadSoFar ) ; return returnData ; } catch ( IOException e ) { throw new ReloadException ( "Unexpectedly unable to load bytedata from input stream" , e ) ; }
public class PathBuilder { /** * Parses path provided by the application . The path provided cannot contain neither hostname nor protocol . It * can start or end with slash e . g . < i > / tasks / 1 / < / i > or < i > tasks / 1 < / i > . * @ param path Path to be parsed * @ return doubly - linked list which represents path given at the input * @ deprecated use build */ public JsonPath buildPath ( String path ) { } }
JsonPath jsonPath = build ( path ) ; if ( jsonPath != null ) { return jsonPath ; } else { throw new RepositoryNotFoundException ( path ) ; }
public class PermissionsImpl { /** * Returns all < code > permission < / code > elements * @ return list of < code > permission < / code > */ public List < Permission < Permissions < T > > > getAllPermission ( ) { } }
List < Permission < Permissions < T > > > list = new ArrayList < Permission < Permissions < T > > > ( ) ; List < Node > nodeList = childNode . get ( "permission" ) ; for ( Node node : nodeList ) { Permission < Permissions < T > > type = new PermissionImpl < Permissions < T > > ( this , "permission" , childNode , node ) ; list . add ( type ) ; } return list ;
public class ShortStringPropertyCoder { /** * @ see PropertyCoder # encodeProperty */ void encodeProperty ( ByteArrayOutputStream baos , Object value ) throws JMSException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodeProperty" , new Object [ ] { baos , value } ) ; // The value should be a non - null String if ( value instanceof String ) { baos . write ( encodedName , 0 , encodedName . length ) ; // Write out the encoded tname String strVal = ( String ) value ; int len = Utf8Codec . getEncodedLength ( strVal ) ; byte [ ] buffer = new byte [ len + ArrayUtil . SHORT_SIZE ] ; // bytes for the value length & the value itself ArrayUtil . writeShort ( buffer , 0 , ( short ) len ) ; // Encode in the length of the String value Utf8Codec . encode ( buffer , ArrayUtil . SHORT_SIZE , strVal ) ; // Encode in the String value itself baos . write ( buffer , 0 , buffer . length ) ; // Write the encode value to the buffer } // If it is not a String , something has gone horribly wrong else { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "INTERNAL_ERROR_CWSIA0362" , new Object [ ] { "ShortStringPropertyCoder.encodeProperty#1" , longName , value } , null , "ShortStringPropertyCoder.encodeProperty#1" , null , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "encodeProperty" ) ;
public class MalisisCore { /** * Initialization event * @ param event the event */ @ EventHandler public void init ( FMLInitializationEvent event ) { } }
if ( isClient ( ) ) { ClientCommandHandler . instance . registerCommand ( new MalisisCommand ( ) ) ; } Registries . processFMLStateEvent ( event ) ;
public class CmsAliasTableController { /** * This method is called when the user wants to add a new alias entry . < p > * @ param aliasPath the alias path * @ param resourcePath the resource site path * @ param mode the alias mode */ public void editNewAlias ( String aliasPath , String resourcePath , CmsAliasMode mode ) { } }
CmsAliasTableRow row = new CmsAliasTableRow ( ) ; row . setEdited ( true ) ; row . setAliasPath ( aliasPath ) ; row . setResourcePath ( resourcePath ) ; row . setMode ( mode ) ; validateNew ( row ) ;
public class RDBMDistributedLayoutStore { /** * Handles locking and identifying proper root and namespaces that used to take place in super * class . * @ param person * @ param profile * @ return @ */ private Document _safeGetUserLayout ( IPerson person , IUserProfile profile ) { } }
Document layoutDoc ; Tuple < String , String > key = null ; final Cache < Tuple < String , String > , Document > layoutCache = getLayoutImportExportCache ( ) ; if ( layoutCache != null ) { key = new Tuple < > ( person . getUserName ( ) , profile . getProfileFname ( ) ) ; layoutDoc = layoutCache . getIfPresent ( key ) ; if ( layoutDoc != null ) { return ( Document ) layoutDoc . cloneNode ( true ) ; } } layoutDoc = super . getPersonalUserLayout ( person , profile ) ; Element layout = layoutDoc . getDocumentElement ( ) ; layout . setAttribute ( Constants . NS_DECL , Constants . NS_URI ) ; if ( layoutCache != null && key != null ) { layoutCache . put ( key , ( Document ) layoutDoc . cloneNode ( true ) ) ; } return layoutDoc ;
public class XMemcachedClient { /** * ( non - Javadoc ) * @ see net . rubyeye . xmemcached . MemcachedClient # flushAll ( java . net . InetSocketAddress , long ) */ public final void flushAll ( InetSocketAddress address , long timeout ) throws MemcachedException , InterruptedException , TimeoutException { } }
this . flushSpecialMemcachedServer ( address , timeout , false , 0 ) ;