signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class StringHelper { /** * Optimized replace method that replaces a set of characters with another * character . This method was created for efficient unsafe character * replacements ! * @ param sInputString * The input string . * @ param aSearchChars * The characters to replace . * @ param cReplacementChar * The new char to be used instead of the search chars . * @ return The replaced version of the string or an empty char array if the * input string was < code > null < / code > . * @ since 8.6.3 */ @ Nonnull public static String replaceMultipleAsString ( @ Nullable final String sInputString , @ Nonnull final char [ ] aSearchChars , final char cReplacementChar ) { } }
ValueEnforcer . notNull ( aSearchChars , "SearchChars" ) ; if ( hasNoText ( sInputString ) ) return "" ; final StringBuilder aSB = new StringBuilder ( sInputString . length ( ) ) ; replaceMultipleTo ( sInputString , aSearchChars , cReplacementChar , aSB ) ; return aSB . toString ( ) ;
public class HttpChannelConfig { /** * Parse the header change limit property . * @ param props */ private void parseHeaderChangeLimit ( Map < Object , Object > props ) { } }
Object value = props . get ( HttpConfigConstants . PROPNAME_HEADER_CHANGE_LIMIT ) ; if ( null != value ) { try { this . headerChangeLimit = convertInteger ( value ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Config: header change limit is " + getHeaderChangeLimit ( ) ) ; } } catch ( NumberFormatException nfe ) { FFDCFilter . processException ( nfe , getClass ( ) . getName ( ) + ".parseHeaderChangeLimit" , "1" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Config: Invalid header change count of " + value ) ; } } }
public class DeployClient { /** * Converts a POSIX compliant program argument array to a String - to - String Map . * @ param args Array of Strings where each element is a POSIX compliant program argument ( Ex : " - - os = Linux " ) . * @ return Map of argument Keys and Values ( Ex : Key = " os " and Value = " Linux " ) . */ public static Map < String , String > fromPosixArray ( Iterable < String > args ) { } }
Map < String , String > kvMap = Maps . newHashMap ( ) ; for ( String arg : args ) { kvMap . putAll ( Splitter . on ( "--" ) . omitEmptyStrings ( ) . trimResults ( ) . withKeyValueSeparator ( "=" ) . split ( arg ) ) ; } return kvMap ;
public class RemoteUserSettingFilter { /** * / * ( non - Javadoc ) * @ see javax . servlet . Filter # doFilter ( javax . servlet . ServletRequest , javax . servlet . ServletResponse , javax . servlet . FilterChain ) */ @ Override public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } }
final String remoteUser = StringUtils . trimToNull ( FileUtils . readFileToString ( this . remoteUserFile ) ) ; if ( remoteUser != null ) { request = new HttpServletRequestWrapper ( ( HttpServletRequest ) request ) { /* ( non - Javadoc ) * @ see javax . servlet . http . HttpServletRequestWrapper # getRemoteUser ( ) */ @ Override public String getRemoteUser ( ) { return remoteUser ; } /* ( non - Javadoc ) * @ see javax . servlet . http . HttpServletRequestWrapper # getHeader ( java . lang . String ) */ @ Override public String getHeader ( String name ) { if ( "REMOTE_USER" . equals ( name ) ) { return remoteUser ; } return super . getHeader ( name ) ; } /* ( non - Javadoc ) * @ see javax . servlet . http . HttpServletRequestWrapper # getHeaders ( java . lang . String ) */ @ Override public Enumeration < String > getHeaders ( String name ) { if ( "REMOTE_USER" . equals ( name ) ) { return Iterators . asEnumeration ( Collections . singleton ( remoteUser ) . iterator ( ) ) ; } return super . getHeaders ( name ) ; } /* ( non - Javadoc ) * @ see javax . servlet . http . HttpServletRequestWrapper # getHeaderNames ( ) */ @ Override public Enumeration < String > getHeaderNames ( ) { final LinkedHashSet < String > headers = new LinkedHashSet < String > ( ) ; for ( final Enumeration < String > headersEnum = super . getHeaderNames ( ) ; headersEnum . hasMoreElements ( ) ; ) { headers . add ( headersEnum . nextElement ( ) ) ; } headers . add ( "REMOTE_USER" ) ; return Iterators . asEnumeration ( headers . iterator ( ) ) ; } /* ( non - Javadoc ) * @ see javax . servlet . http . HttpServletRequestWrapper # getIntHeader ( java . lang . String ) */ @ Override public int getIntHeader ( String name ) { if ( "REMOTE_USER" . equals ( name ) ) { return Integer . valueOf ( remoteUser ) ; } return super . getIntHeader ( name ) ; } } ; } chain . doFilter ( request , response ) ;
public class EventDispatcherBase { /** * Gets the thread type used in log message for the given queue selector . * @ param queueSelector The queue selector . * @ return The name of the thread type . */ private String getThreadType ( DispatchQueueSelector queueSelector ) { } }
String threadType ; if ( queueSelector instanceof DiscordApi ) { threadType = "a global listener thread" ; } else if ( queueSelector == null ) { threadType = "a connection listener thread" ; } else { threadType = String . format ( "a listener thread for %s" , queueSelector ) ; } return threadType ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } } */ @ XmlElementDecl ( namespace = "http://www.drugbank.ca" , name = "protein-name" , scope = SnpAdverseDrugReactionType . class ) public JAXBElement < String > createSnpAdverseDrugReactionTypeProteinName ( String value ) { } }
return new JAXBElement < String > ( _SnpAdverseDrugReactionTypeProteinName_QNAME , String . class , SnpAdverseDrugReactionType . class , value ) ;
public class ProcessUtils { /** * Logs a fatal error and then exits the system . * @ param logger the logger to log to * @ param format the error message format string * @ param args args for the format string */ public static void fatalError ( Logger logger , String format , Object ... args ) { } }
fatalError ( logger , null , format , args ) ;
public class ComponentTagDeclarationLibrary { /** * Add a ComponentHandler with the specified componentType and rendererType , aliased by the tag name . * @ see ComponentHandler * @ see javax . faces . application . Application # createComponent ( java . lang . String ) * @ param name * name to use , " foo " would be & lt ; my : foo / > * @ param componentType * componentType to use * @ param rendererType * rendererType to use */ public final void addComponent ( String namespace , String name , String componentType , String rendererType ) { } }
Map < String , TagHandlerFactory > map = _factories . get ( namespace ) ; if ( map == null ) { map = new HashMap < String , TagHandlerFactory > ( ) ; _factories . put ( namespace , map ) ; } map . put ( name , new ComponentHandlerFactory ( componentType , rendererType ) ) ;
public class CoreActivity { /** * Determines the response encoding . * @ return the response encoding */ protected String resolveResponseEncoding ( ) { } }
String encoding = getRequestRule ( ) . getEncoding ( ) ; if ( encoding == null ) { encoding = resolveRequestEncoding ( ) ; } return encoding ;
public class ReflectUtil { /** * 获得指定类过滤后的Public方法列表 * @ param clazz 查找方法的类 * @ param excludeMethodNames 不包括的方法名列表 * @ return 过滤后的方法列表 */ public static List < Method > getPublicMethods ( Class < ? > clazz , String ... excludeMethodNames ) { } }
final HashSet < String > excludeMethodNameSet = CollectionUtil . newHashSet ( excludeMethodNames ) ; return getPublicMethods ( clazz , new Filter < Method > ( ) { @ Override public boolean accept ( Method method ) { return false == excludeMethodNameSet . contains ( method . getName ( ) ) ; } } ) ;
public class AbstractGenerator { /** * Add collection of pages to sitemap * @ param < T > This is the type parameter * @ param webPages Collection of pages * @ param mapper Mapper function which transforms some object to String . This will be passed to WebPage . of ( name ) * @ return this */ public < T > I addPageNames ( Collection < T > webPages , Function < T , String > mapper ) { } }
for ( T element : webPages ) { addPage ( WebPage . of ( mapper . apply ( element ) ) ) ; } return getThis ( ) ;
public class lbmonitor { /** * Use this API to fetch lbmonitor resource of given name . */ public static lbmonitor get ( nitro_service service , String monitorname ) throws Exception { } }
lbmonitor obj = new lbmonitor ( ) ; obj . set_monitorname ( monitorname ) ; lbmonitor response = ( lbmonitor ) obj . get_resource ( service ) ; return response ;
public class EditShape { /** * Removes a path , gets rid of all its vertices , and returns the next one */ int removePath ( int path ) { } }
int prev = getPrevPath ( path ) ; int next = getNextPath ( path ) ; int geometry = getGeometryFromPath ( path ) ; if ( prev != - 1 ) setNextPath_ ( prev , next ) ; else { setFirstPath_ ( geometry , next ) ; } if ( next != - 1 ) setPrevPath_ ( next , prev ) ; else { setLastPath_ ( geometry , prev ) ; } clearPath ( path ) ; setGeometryPathCount_ ( geometry , getPathCount ( geometry ) - 1 ) ; freePath_ ( path ) ; return next ;
public class ThreadSettingsApi { /** * Sets the payment public key . The payment _ public _ key is used to encrypt * sensitive payment data sent to you . * @ param publicKey * the public key to set . * @ see < a href = * " https : / / developers . facebook . com / docs / messenger - platform / thread - settings / payment " * > Facebook ' s Messenger Platform Payments Thread Settings * Documentation < / a > * @ see < a href = * " https : / / developers . facebook . com / docs / messenger - platform / payments - reference # encryption _ key " * > Facebook ' s Messenger Platform Creating Encryption Documentation < / a > * @ since 1.2.0 */ public static void setPaymentsPublicKey ( String publicKey ) { } }
PaymentSettings request = new PaymentSettings ( ) ; request . setPrivacyUrl ( publicKey ) ; FbBotMillNetworkController . postThreadSetting ( request ) ;
public class Nodes { /** * Gets the name of the given property in JCR domain . * @ param cmisName the name of the given property in CMIS domain . * @ return the name of the given property in JCR domain . */ public String findJcrName ( String cmisName ) { } }
for ( Relation aList : list ) { if ( aList . cmisName . equals ( cmisName ) ) { return aList . jcrName ; } } return cmisName ;
public class ULocale { /** * Returns the given ( canonical ) locale id minus the last part before the tags . */ private static String getFallbackString ( String fallback ) { } }
int extStart = fallback . indexOf ( '@' ) ; if ( extStart == - 1 ) { extStart = fallback . length ( ) ; } int last = fallback . lastIndexOf ( '_' , extStart ) ; if ( last == - 1 ) { last = 0 ; } else { // truncate empty segment while ( last > 0 ) { if ( fallback . charAt ( last - 1 ) != '_' ) { break ; } last -- ; } } return fallback . substring ( 0 , last ) + fallback . substring ( extStart ) ;
public class LongStream { /** * Takes elements while the predicate returns { @ code true } . * < p > This is an intermediate operation . * < p > Example : * < pre > * predicate : ( a ) - & gt ; a & lt ; 3 * stream : [ 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4] * result : [ 1 , 2] * < / pre > * @ param predicate the predicate used to take elements * @ return the new { @ code LongStream } */ @ NotNull public LongStream takeWhile ( @ NotNull final LongPredicate predicate ) { } }
return new LongStream ( params , new LongTakeWhile ( iterator , predicate ) ) ;
public class StringGroovyMethods { /** * TODO expose this for other usage scenarios , e . g . stream based stripping ? */ private static String stripMarginFromLine ( String line , char marginChar ) { } }
int length = line . length ( ) ; int index = 0 ; while ( index < length && line . charAt ( index ) <= ' ' ) index ++ ; return ( index < length && line . charAt ( index ) == marginChar ) ? line . substring ( index + 1 ) : line ;
public class AffineTransformation { /** * Add a matrix operation to the matrix . * Be careful to use only invertible matrices if you want an invertible affine * transformation . * @ param m matrix ( should be invertible ) */ public void addMatrix ( double [ ] [ ] m ) { } }
assert ( m . length == dim ) ; assert ( m [ 0 ] . length == dim ) ; // reset inverse transformation - needs recomputation . inv = null ; // extend the matrix with an extra row and column double [ ] [ ] ht = new double [ dim + 1 ] [ dim + 1 ] ; for ( int i = 0 ; i < dim ; i ++ ) { for ( int j = 0 ; j < dim ; j ++ ) { ht [ i ] [ j ] = m [ i ] [ j ] ; } } // the other cells default to identity matrix ht [ dim ] [ dim ] = 1.0 ; // Multiply from left . trans = times ( ht , trans ) ;
public class BatchGetItemRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( BatchGetItemRequest batchGetItemRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( batchGetItemRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchGetItemRequest . getRequestItems ( ) , REQUESTITEMS_BINDING ) ; protocolMarshaller . marshall ( batchGetItemRequest . getReturnConsumedCapacity ( ) , RETURNCONSUMEDCAPACITY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CmsXmlContentEditor { /** * Adds an optional element to the XML content or removes an optional element from the XML content . < p > * Depends on the given action value . < p > * @ throws JspException if including the error page fails */ public void actionToggleElement ( ) throws JspException { } }
// set editor values from request try { setEditorValues ( getElementLocale ( ) ) ; } catch ( CmsXmlException e ) { // an error occurred while trying to set the values , stop action showErrorPage ( e ) ; return ; } // get the necessary parameters to add / remove the element int index = 0 ; try { index = Integer . parseInt ( getParamElementIndex ( ) ) ; } catch ( Exception e ) { // ignore , should not happen } if ( getAction ( ) == ACTION_ELEMENT_REMOVE ) { // remove the value , first get the value to remove I_CmsXmlContentValue value = m_content . getValue ( getParamElementName ( ) , getElementLocale ( ) , index ) ; m_content . removeValue ( getParamElementName ( ) , getElementLocale ( ) , index ) ; // check if the value was a choice option and the last one if ( value . isChoiceOption ( ) && ( m_content . getSubValues ( CmsXmlUtils . removeLastXpathElement ( getParamElementName ( ) ) , getElementLocale ( ) ) . size ( ) == 0 ) ) { // also remove the parent choice type value String xpath = CmsXmlUtils . removeLastXpathElement ( getParamElementName ( ) ) ; m_content . removeValue ( xpath , getElementLocale ( ) , CmsXmlUtils . getXpathIndexInt ( xpath ) - 1 ) ; } } else { // add the new value after the clicked element if ( m_content . hasValue ( getParamElementName ( ) , getElementLocale ( ) ) ) { // when other values are present , increase index to use right position index += 1 ; } String elementPath = getParamElementName ( ) ; if ( CmsStringUtil . isNotEmpty ( getParamChoiceElement ( ) ) ) { // we have to add a choice element , first check if the element to add itself is part of a choice or not boolean choiceType = Boolean . valueOf ( getParamChoiceType ( ) ) . booleanValue ( ) ; I_CmsXmlSchemaType elemType = m_content . getContentDefinition ( ) . getSchemaType ( elementPath ) ; if ( ! choiceType || ( elemType . isChoiceOption ( ) && elemType . isChoiceType ( ) ) ) { // this is a choice option or a nested choice type to add , remove last element name from xpath elementPath = CmsXmlUtils . removeLastXpathElement ( elementPath ) ; } else { // this is a choice type to add , first create type element m_content . addValue ( getCms ( ) , elementPath , getElementLocale ( ) , index ) ; elementPath = CmsXmlUtils . createXpathElement ( elementPath , index + 1 ) ; // all eventual following elements to create have to be at first position index = 0 ; } // check if there are nested choice elements to add if ( CmsXmlUtils . isDeepXpath ( getParamChoiceElement ( ) ) ) { // create all missing elements except the last one String pathToChoice = CmsXmlUtils . removeLastXpathElement ( getParamChoiceElement ( ) ) ; String newPath = elementPath ; while ( CmsStringUtil . isNotEmpty ( pathToChoice ) ) { String createElement = CmsXmlUtils . getFirstXpathElement ( pathToChoice ) ; newPath = CmsXmlUtils . concatXpath ( newPath , createElement ) ; pathToChoice = CmsXmlUtils . isDeepXpath ( pathToChoice ) ? CmsXmlUtils . removeFirstXpathElement ( pathToChoice ) : null ; I_CmsXmlContentValue newVal = m_content . addValue ( getCms ( ) , newPath , getElementLocale ( ) , index ) ; newPath = newVal . getPath ( ) ; // all eventual following elements to create have to be at first position index = 0 ; } // create the path to the last choice element elementPath = CmsXmlUtils . concatXpath ( newPath , CmsXmlUtils . getLastXpathElement ( getParamChoiceElement ( ) ) ) ; } else { // create the path to the choice element elementPath += "/" + getParamChoiceElement ( ) ; } } // add the value m_content . addValue ( getCms ( ) , elementPath , getElementLocale ( ) , index ) ; } if ( getValidationHandler ( ) . hasWarnings ( getElementLocale ( ) ) ) { // there were warnings for the edited content , reset validation handler to avoid display issues resetErrorHandler ( ) ; } try { // write the modified content to the temporary file writeContent ( ) ; } catch ( CmsException e ) { // an error occurred while trying to save showErrorPage ( e ) ; }
public class RunsInner { /** * Gets all the runs for a registry . * @ param resourceGroupName The name of the resource group to which the container registry belongs . * @ param registryName The name of the container registry . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; RunInner & gt ; object */ public Observable < Page < RunInner > > listAsync ( final String resourceGroupName , final String registryName ) { } }
return listWithServiceResponseAsync ( resourceGroupName , registryName ) . map ( new Func1 < ServiceResponse < Page < RunInner > > , Page < RunInner > > ( ) { @ Override public Page < RunInner > call ( ServiceResponse < Page < RunInner > > response ) { return response . body ( ) ; } } ) ;
public class RetryUtil { /** * 重试直到无异常抛出或者超过最大重试次数 */ public static < Return > Return retryUntilNoException ( Callable < Return > callable , int maxTry ) throws Throwable { } }
String errMsg = "连续重试失败" + maxTry + "次。" ; Throwable cause = null ; while ( maxTry > 0 ) { try { return callable . call ( ) ; } catch ( Throwable throwable ) { cause = throwable ; maxTry -- ; } } LOG . error ( new Throwable ( errMsg , cause ) ) ; throw cause ;
public class JodaBeanSer { /** * Checks if the property is serialized . * @ param prop the property to check * @ return true if the property is seialized */ public boolean isSerialized ( MetaProperty < ? > prop ) { } }
return prop . style ( ) . isSerializable ( ) || ( prop . style ( ) . isDerived ( ) && includeDerived ) ;
public class Level { /** * CHECKSTYLE : ON */ @ Override public int compareTo ( final Level other ) { } }
return intLevel < other . intLevel ? - 1 : ( intLevel > other . intLevel ? 1 : 0 ) ;
public class HTCashbillServiceImp { /** * ( non - Javadoc ) * @ see com . popbill . api . HTCashbillService # Summary ( java . lang . String , java . lang . String , java . lang . String [ ] , java . lang . String [ ] , java . lang . String ) */ @ Override public HTCashbillSummary summary ( String CorpNum , String JobID , String [ ] TradeUsage , String [ ] TradeType , String UserID ) throws PopbillException { } }
if ( JobID . length ( ) != 18 ) throw new PopbillException ( - 99999999 , "작업아이디가 올바르지 않습니다." ) ; String uri = "/HomeTax/Cashbill/" + JobID + "/Summary" ; uri += "?TradeUsage=" + Arrays . toString ( TradeUsage ) . replaceAll ( "\\[|\\]|\\s" , "" ) ; uri += "&TradeType=" + Arrays . toString ( TradeType ) . replaceAll ( "\\[|\\]|\\s" , "" ) ; return httpget ( uri , CorpNum , UserID , HTCashbillSummary . class ) ;
public class AbstractArrayBytesBuff { /** * 检查当前数组某区块是否超出范围 * @ param index * @ param fieldLength */ void checkIndex ( int index , int fieldLength ) { } }
if ( isOutOfBounds ( index , fieldLength , capacity ( ) ) ) { throw new IndexOutOfBoundsException ( String . format ( "index: %d, length: %d (expected: range(0, %d))" , index , fieldLength , capacity ( ) ) ) ; }
public class CmsRole { /** * Creates a new role based on this one for the given organizational unit . < p > * @ param ouFqn fully qualified name of the organizational unit * @ return a new role based on this one for the given organizational unit */ public CmsRole forOrgUnit ( String ouFqn ) { } }
CmsRole newRole = new CmsRole ( this ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( ouFqn ) ) { if ( ! ouFqn . endsWith ( CmsOrganizationalUnit . SEPARATOR ) ) { ouFqn += CmsOrganizationalUnit . SEPARATOR ; } } newRole . m_ouFqn = ouFqn ; return newRole ;
public class BugInstance { /** * Add a source line annotation for instruction whose PC is given in the * method that the given visitor is currently visiting . Note that if the * method does not have line number information , then no source line * annotation will be added . * @ param classContext * the ClassContext * @ param visitor * a PreorderVisitor that is currently visiting the method * @ param pc * bytecode offset of the instruction * @ return this object */ @ Nonnull public BugInstance addSourceLine ( ClassContext classContext , PreorderVisitor visitor , int pc ) { } }
SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation . fromVisitedInstruction ( classContext , visitor , pc ) ; if ( sourceLineAnnotation != null ) { add ( sourceLineAnnotation ) ; } return this ;
public class DefaultContainerBuilder { /** * if there are xml configure then add new ones ; if not , register it ; * @ param configList * Collection the configure collection for jdonframework . xml */ public void registerAppRoot ( String configureFileName ) throws Exception { } }
try { AppConfigureCollection existedAppConfigureFiles = ( AppConfigureCollection ) containerWrapper . lookup ( AppConfigureCollection . NAME ) ; if ( existedAppConfigureFiles == null ) { xmlcontainerRegistry . registerAppRoot ( ) ; existedAppConfigureFiles = ( AppConfigureCollection ) containerWrapper . lookup ( AppConfigureCollection . NAME ) ; } if ( ! existedAppConfigureFiles . getConfigList ( ) . contains ( configureFileName ) ) { Debug . logInfo ( "[JdonFramework]found jdonframework configuration:" + configureFileName , module ) ; existedAppConfigureFiles . addConfigList ( configureFileName ) ; } } catch ( Exception ex ) { Debug . logError ( "[JdonFramework] found jdonframework configuration error:" + ex , module ) ; throw new Exception ( ex ) ; }
public class ComposedTransformer { /** * { @ inheritDoc } */ @ Override protected Object primTransform ( Object anObject ) throws Exception { } }
Object current = anObject ; for ( Transformer transformer : this . transformers ) { current = transformer . transform ( current ) ; } return current ;
public class AbstractConnectProtocol { /** * Connect to currentHost . * @ throws SQLException exception */ public void connect ( ) throws SQLException { } }
if ( ! isClosed ( ) ) { close ( ) ; } try { connect ( ( currentHost != null ) ? currentHost . host : null , ( currentHost != null ) ? currentHost . port : 3306 ) ; } catch ( IOException ioException ) { throw ExceptionMapper . connException ( "Could not connect to " + currentHost + ". " + ioException . getMessage ( ) + getTraces ( ) , ioException ) ; }
public class ByteList { /** * This is equivalent to : * < pre > * < code > * if ( isEmpty ( ) ) { * return OptionalByte . empty ( ) ; * byte result = elementData [ 0 ] ; * for ( int i = 1 ; i < size ; i + + ) { * result = accumulator . applyAsByte ( result , elementData [ i ] ) ; * return OptionalByte . of ( result ) ; * < / code > * < / pre > * @ param accumulator * @ return */ public < E extends Exception > OptionalByte reduce ( final Try . ByteBinaryOperator < E > accumulator ) throws E { } }
if ( isEmpty ( ) ) { return OptionalByte . empty ( ) ; } byte result = elementData [ 0 ] ; for ( int i = 1 ; i < size ; i ++ ) { result = accumulator . applyAsByte ( result , elementData [ i ] ) ; } return OptionalByte . of ( result ) ;
public class COSDataBlocks { /** * Create a factory . * @ param owner factory owner * @ param name factory name - the option from { @ link Constants } * @ return the factory , ready to be initialized * @ throws IllegalArgumentException if the name is unknown */ static BlockFactory createFactory ( COSAPIClient owner , String name ) { } }
switch ( name ) { case COSConstants . FAST_UPLOAD_BUFFER_ARRAY : return new ArrayBlockFactory ( owner ) ; case COSConstants . FAST_UPLOAD_BUFFER_DISK : return new DiskBlockFactory ( owner ) ; default : throw new IllegalArgumentException ( "Unsupported block buffer" + " \"" + name + '"' ) ; }
public class Functionals { /** * Converts a runnable instance into an Action0 instance . * @ param run the Runnable to run when the Action0 is called * @ return the Action0 wrapping the Runnable */ public static Action0 fromRunnable ( Runnable run , Worker inner ) { } }
if ( run == null ) { throw new NullPointerException ( "run" ) ; } return new ActionWrappingRunnable ( run , inner ) ;
public class CommerceAddressLocalServiceUtil { /** * Deletes the commerce address from the database . Also notifies the appropriate model listeners . * @ param commerceAddress the commerce address * @ return the commerce address that was removed * @ throws PortalException */ public static com . liferay . commerce . model . CommerceAddress deleteCommerceAddress ( com . liferay . commerce . model . CommerceAddress commerceAddress ) throws com . liferay . portal . kernel . exception . PortalException { } }
return getService ( ) . deleteCommerceAddress ( commerceAddress ) ;
public class CloudSdkDownloader { /** * Downloads / installs / updates the Cloud SDK * @ return The cloud SDK installation directory */ public Path downloadIfNecessary ( String version , Log log , boolean requiresAppEngineComponents , boolean offline ) { } }
ManagedCloudSdk managedCloudSdk = managedCloudSdkFactory . apply ( version ) ; if ( offline ) { // in offline mode , don ' t download anything return managedCloudSdk . getSdkHome ( ) ; } try { ProgressListener progressListener = new NoOpProgressListener ( ) ; ConsoleListener consoleListener = new CloudSdkDownloaderConsoleListener ( log ) ; if ( ! managedCloudSdk . isInstalled ( ) ) { managedCloudSdk . newInstaller ( ) . install ( progressListener , consoleListener ) ; } if ( requiresAppEngineComponents && ! managedCloudSdk . hasComponent ( SdkComponent . APP_ENGINE_JAVA ) ) { managedCloudSdk . newComponentInstaller ( ) . installComponent ( SdkComponent . APP_ENGINE_JAVA , progressListener , consoleListener ) ; } if ( ! managedCloudSdk . isUpToDate ( ) ) { managedCloudSdk . newUpdater ( ) . update ( progressListener , consoleListener ) ; } return managedCloudSdk . getSdkHome ( ) ; } catch ( IOException | SdkInstallerException | ManagedSdkVersionMismatchException | InterruptedException | CommandExecutionException | CommandExitException | ManagedSdkVerificationException ex ) { throw new RuntimeException ( ex ) ; }
public class Currency { /** * Returns the list of remaining tender currencies after a filter is applied . * @ param filter the filter to apply to the tender currencies * @ return a list of tender currencies */ private static List < String > getTenderCurrencies ( CurrencyFilter filter ) { } }
CurrencyMetaInfo info = CurrencyMetaInfo . getInstance ( ) ; return info . currencies ( filter . withTender ( ) ) ;
public class AvroYarnJobSubmissionParametersSerializer { /** * Reads avro object from file . * @ param file The file to read from * @ return Avro object * @ throws IOException */ AvroYarnJobSubmissionParameters fromFile ( final File file ) throws IOException { } }
try ( final FileInputStream fileInputStream = new FileInputStream ( file ) ) { // This is mainly a test hook . return fromInputStream ( fileInputStream ) ; }
public class MyStringUtils { /** * Gets the first group of a regex * @ param pattern Pattern * @ param str String to find * @ return the matching group */ public static String regexFindFirst ( String pattern , String str ) { } }
return regexFindFirst ( Pattern . compile ( pattern ) , str , 1 ) ;
public class BoxSession { /** * Called when this session has been refreshed with new authentication info . * @ param info the latest info from a successful refresh . */ @ Override public void onRefreshed ( BoxAuthentication . BoxAuthenticationInfo info ) { } }
if ( sameUser ( info ) ) { BoxAuthentication . BoxAuthenticationInfo . cloneInfo ( mAuthInfo , info ) ; if ( sessionAuthListener != null ) { sessionAuthListener . onRefreshed ( info ) ; } }
public class JsonResponse { public OptionalThing < Class < ? > [ ] > getValidatorGroups ( ) { } }
return OptionalThing . ofNullable ( validatorGroups , ( ) -> { String msg = "Not found the validator groups: " + JsonResponse . this . toString ( ) ; throw new IllegalStateException ( msg ) ; } ) ;
public class TaskExecutor { @ Override public void onStart ( ) throws Exception { } }
try { startTaskExecutorServices ( ) ; } catch ( Exception e ) { final TaskManagerException exception = new TaskManagerException ( String . format ( "Could not start the TaskExecutor %s" , getAddress ( ) ) , e ) ; onFatalError ( exception ) ; throw exception ; } startRegistrationTimeout ( ) ;
public class ProfilingDriver { /** * Register a duration in milliseconds for running a JDBC method . * @ param group indication of type of command . * @ param durationMillis duration in milliseconds */ static void register ( String group , long durationMillis ) { } }
for ( ProfilingListener listener : LISTENERS ) { listener . register ( group , durationMillis ) ; }
public class ElementsTable { /** * Returns the module documentation level mode . * @ return the module documentation level mode */ public ModuleMode getModuleMode ( ) { } }
switch ( accessFilter . getAccessValue ( ElementKind . MODULE ) ) { case PACKAGE : case PRIVATE : return DocletEnvironment . ModuleMode . ALL ; default : return DocletEnvironment . ModuleMode . API ; }
public class BinaryReader { /** * Read a short from the input stream . * @ return The number read . * @ throws IOException if unable to read from stream . */ public short expectShort ( ) throws IOException { } }
int b1 = in . read ( ) ; if ( b1 < 0 ) { throw new IOException ( "Missing byte 1 to expected short" ) ; } int b2 = in . read ( ) ; if ( b2 < 0 ) { throw new IOException ( "Missing byte 2 to expected short" ) ; } return ( short ) unshift2bytes ( b1 , b2 ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcClassificationReference ( ) { } }
if ( ifcClassificationReferenceEClass == null ) { ifcClassificationReferenceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 97 ) ; } return ifcClassificationReferenceEClass ;
public class JPEGDecoder { /** * Decodes the dequantizied DCT coefficients into a buffer per color component . * The number of buffers must match the number of color channels . * Each color channel can have a different sub sampling factor . * @ param buffer the ShortBuffers for each color component * @ param numMCURows the number of MCU rows to decode . * @ throws IOException if an IO error occurred * @ throws IllegalArgumentException if numMCURows is invalid , or if the number of buffers / strides is not enough * @ throws IllegalStateException if { @ link # startDecode ( ) } has not been called * @ throws UnsupportedOperationException if the color components are not in the same SOS chunk * @ see # getNumComponents ( ) * @ see # getNumMCURows ( ) */ public void decodeDCTCoeffs ( ShortBuffer [ ] buffer , int numMCURows ) throws IOException { } }
if ( ! insideSOS ) { throw new IllegalStateException ( "decode not started" ) ; } if ( numMCURows <= 0 || currentMCURow + numMCURows > mcuCountY ) { throw new IllegalArgumentException ( "numMCURows" ) ; } int scanN = order . length ; if ( scanN != components . length ) { throw new UnsupportedOperationException ( "for RAW decode all components need to be decoded at once" ) ; } if ( scanN > buffer . length ) { throw new IllegalArgumentException ( "not enough buffers" ) ; } for ( int compIdx = 0 ; compIdx < scanN ; compIdx ++ ) { order [ compIdx ] . outPos = buffer [ compIdx ] . position ( ) ; } outer : for ( int j = 0 ; j < numMCURows ; j ++ ) { ++ currentMCURow ; for ( int i = 0 ; i < mcuCountX ; i ++ ) { for ( int compIdx = 0 ; compIdx < scanN ; compIdx ++ ) { Component c = order [ compIdx ] ; ShortBuffer sb = buffer [ compIdx ] ; int outStride = 64 * c . blocksPerMCUHorz * mcuCountX ; int outPos = c . outPos + 64 * i * c . blocksPerMCUHorz + j * c . blocksPerMCUVert * outStride ; for ( int y = 0 ; y < c . blocksPerMCUVert ; y ++ ) { sb . position ( outPos ) ; for ( int x = 0 ; x < c . blocksPerMCUHorz ; x ++ ) { try { decodeBlock ( data , c ) ; } catch ( ArrayIndexOutOfBoundsException ex ) { throwBadHuffmanCode ( ) ; } sb . put ( data ) ; } outPos += outStride ; } } if ( -- todo <= 0 ) { if ( ! checkRestart ( ) ) { break outer ; } } } } checkDecodeEnd ( ) ; for ( int compIdx = 0 ; compIdx < scanN ; compIdx ++ ) { Component c = order [ compIdx ] ; int outStride = 64 * c . blocksPerMCUHorz * mcuCountX ; buffer [ compIdx ] . position ( c . outPos + numMCURows * c . blocksPerMCUVert * outStride ) ; }
public class NavigationPreference { /** * Obtains the fragment from a specific typed array . * @ param typedArray * The typed array , the fragment should be obtained from , as an instance of the class * { @ link TypedArray } . The typed array may not be null */ private void obtainFragment ( @ NonNull final TypedArray typedArray ) { } }
setFragment ( typedArray . getString ( R . styleable . NavigationPreference_android_fragment ) ) ;
public class HBaseClient { /** * Method to find entities using JPQL ( converted into FilterList . ) * @ param < E > * parameterized entity class . * @ param entityClass * entity class . * @ param metadata * entity metadata . * @ param f * the f * @ param filterClausequeue * the filter clausequeue * @ param columns * the columns * @ return list of entities . */ public < E > List < E > findByQuery ( Class < E > entityClass , EntityMetadata metadata , Filter f , Queue filterClausequeue , String ... columns ) { } }
EntityMetadata entityMetadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClass ) ; List < String > relationNames = entityMetadata . getRelationNames ( ) ; // columnFamily has a different meaning for HBase , so it won ' t be used // here String tableName = entityMetadata . getSchema ( ) ; List results = null ; FilterList filter = new FilterList ( ) ; if ( f != null ) { filter . addFilter ( f ) ; } if ( isFindKeyOnly ( metadata , columns ) ) { columns = null ; filter . addFilter ( new KeyOnlyFilter ( ) ) ; } try { results = fetchEntity ( entityClass , null , entityMetadata , relationNames , tableName , results , filter , filterClausequeue , columns ) ; } catch ( IOException ioex ) { log . error ( "Error during find by query, Caused by: ." , ioex ) ; throw new KunderaException ( ioex ) ; } return results != null ? results : new ArrayList ( ) ;
public class ActiveConnectionMultimap { /** * Stores the given connection record in the list of active connections * associated with the object having the given identifier . * @ param identifier * The identifier of the object being connected to . * @ param record * The record associated with the active connection . */ public void put ( String identifier , ActiveConnectionRecord record ) { } }
synchronized ( records ) { // Get set of active connection records , creating if necessary Set < ActiveConnectionRecord > connections = records . get ( identifier ) ; if ( connections == null ) { connections = Collections . synchronizedSet ( Collections . newSetFromMap ( new LinkedHashMap < ActiveConnectionRecord , Boolean > ( ) ) ) ; records . put ( identifier , connections ) ; } // Add active connection connections . add ( record ) ; }
public class IPv6AddressSection { /** * Applies the given mask to the network section of the address as indicated by the given prefix length . * Useful for subnetting . Once you have zeroed a section of the network you can insert bits * using { @ link # bitwiseOr ( IPv6AddressSection ) } or { @ link # replace ( int , IPv6AddressSection ) } * @ param mask * @ param networkPrefixLength * @ return * @ throws IncompatibleAddressException */ public IPv6AddressSection maskNetwork ( IPv6AddressSection mask , int networkPrefixLength ) throws IncompatibleAddressException , PrefixLenException , SizeMismatchException { } }
checkMaskSectionCount ( mask ) ; if ( getNetwork ( ) . getPrefixConfiguration ( ) . allPrefixedAddressesAreSubnets ( ) ) { return getSubnetSegments ( this , cacheBits ( networkPrefixLength ) , getAddressCreator ( ) , true , this :: getSegment , i -> mask . getSegment ( i ) . getSegmentValue ( ) , false ) ; } IPv6AddressSection hostMask = getNetwork ( ) . getHostMaskSection ( networkPrefixLength ) ; return getSubnetSegments ( this , cacheBits ( networkPrefixLength ) , getAddressCreator ( ) , true , this :: getSegment , i -> { int val1 = mask . getSegment ( i ) . getSegmentValue ( ) ; int val2 = hostMask . getSegment ( i ) . getSegmentValue ( ) ; return val1 | val2 ; } , false ) ;
public class CoverageData { /** * Get the coverage data tile results for a specified tile matrix * @ param requestProjectedBoundingBox * request projected bounding box * @ param tileMatrix * tile matrix * @ param overlappingPixels * number of overlapping pixels used by the algorithm * @ return tile matrix results */ private CoverageDataTileMatrixResults getResults ( BoundingBox requestProjectedBoundingBox , TileMatrix tileMatrix , int overlappingPixels ) { } }
CoverageDataTileMatrixResults results = null ; BoundingBox paddedBoundingBox = padBoundingBox ( tileMatrix , requestProjectedBoundingBox , overlappingPixels ) ; TileResultSet tileResults = retrieveSortedTileResults ( paddedBoundingBox , tileMatrix ) ; if ( tileResults != null ) { if ( tileResults . getCount ( ) > 0 ) { results = new CoverageDataTileMatrixResults ( tileMatrix , tileResults ) ; } else { tileResults . close ( ) ; } } return results ;
public class ObjectStreamClass { /** * Return a String representing the signature for a method { @ code m } . * @ param m * a java . lang . reflect . Method for which to compute the signature * @ return the method ' s signature */ static String getMethodSignature ( Method m ) { } }
StringBuilder result = new StringBuilder ( ) ; result . append ( '(' ) ; for ( Class < ? > parameterType : m . getParameterTypes ( ) ) { result . append ( getSignature ( parameterType ) ) ; } result . append ( ")" ) ; result . append ( getSignature ( m . getReturnType ( ) ) ) ; return result . toString ( ) ;
public class InferenceSpecification { /** * A list of the instance types that are used to generate inferences in real - time . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setSupportedRealtimeInferenceInstanceTypes ( java . util . Collection ) } or * { @ link # withSupportedRealtimeInferenceInstanceTypes ( java . util . Collection ) } if you want to override the existing * values . * @ param supportedRealtimeInferenceInstanceTypes * A list of the instance types that are used to generate inferences in real - time . * @ return Returns a reference to this object so that method calls can be chained together . * @ see ProductionVariantInstanceType */ public InferenceSpecification withSupportedRealtimeInferenceInstanceTypes ( String ... supportedRealtimeInferenceInstanceTypes ) { } }
if ( this . supportedRealtimeInferenceInstanceTypes == null ) { setSupportedRealtimeInferenceInstanceTypes ( new java . util . ArrayList < String > ( supportedRealtimeInferenceInstanceTypes . length ) ) ; } for ( String ele : supportedRealtimeInferenceInstanceTypes ) { this . supportedRealtimeInferenceInstanceTypes . add ( ele ) ; } return this ;
public class RedundentExprEliminator { /** * Add the given variable to the psuedoVarRecipient . */ protected ElemVariable addVarDeclToElem ( ElemTemplateElement psuedoVarRecipient , LocPathIterator lpi , ElemVariable psuedoVar ) throws org . w3c . dom . DOMException { } }
// Create psuedo variable element ElemTemplateElement ete = psuedoVarRecipient . getFirstChildElem ( ) ; lpi . callVisitors ( null , m_varNameCollector ) ; // If the location path contains variables , we have to insert the // psuedo variable after the reference . ( Otherwise , we want to // insert it as close as possible to the top , so we ' ll be sure // it is in scope for any other vars . if ( m_varNameCollector . getVarCount ( ) > 0 ) { ElemTemplateElement baseElem = getElemFromExpression ( lpi ) ; ElemVariable varElem = getPrevVariableElem ( baseElem ) ; while ( null != varElem ) { if ( m_varNameCollector . doesOccur ( varElem . getName ( ) ) ) { psuedoVarRecipient = varElem . getParentElem ( ) ; ete = varElem . getNextSiblingElem ( ) ; break ; } varElem = getPrevVariableElem ( varElem ) ; } } if ( ( null != ete ) && ( Constants . ELEMNAME_PARAMVARIABLE == ete . getXSLToken ( ) ) ) { // Can ' t stick something in front of a param , so abandon ! ( see variable13 . xsl ) if ( isParam ( lpi ) ) return null ; while ( null != ete ) { ete = ete . getNextSiblingElem ( ) ; if ( ( null != ete ) && Constants . ELEMNAME_PARAMVARIABLE != ete . getXSLToken ( ) ) break ; } } psuedoVarRecipient . insertBefore ( psuedoVar , ete ) ; m_varNameCollector . reset ( ) ; return psuedoVar ;
public class ObjectEnvelopeTable { /** * This method have to be called to reuse all registered { @ link ObjectEnvelope } * objects after transaction commit / flush / checkpoint call . */ private void prepareForReuse ( boolean reuse ) { } }
if ( reuse ) { // using clone to avoid ConcurentModificationException Iterator iter = ( ( List ) mvOrderOfIds . clone ( ) ) . iterator ( ) ; while ( iter . hasNext ( ) ) { ObjectEnvelope mod = ( ObjectEnvelope ) mhtObjectEnvelopes . get ( iter . next ( ) ) ; if ( ! needsCommit || ( mod . getModificationState ( ) == StateOldClean . getInstance ( ) || mod . getModificationState ( ) . isTransient ( ) ) ) { // nothing to do } else { mod . setModificationState ( mod . getModificationState ( ) . markClean ( ) ) ; } } }
public class WasInvalidatedBy { /** * Gets the value of the role property . * This accessor method returns a reference to the live list , * not a snapshot . Therefore any modification you make to the * returned list will be present inside the JAXB object . * This is why there is not a < CODE > set < / CODE > method for the role property . * For example , to add a new item , do as follows : * < pre > * getRole ( ) . add ( newItem ) ; * < / pre > * Objects of the following type ( s ) are allowed in the list * { @ link org . openprovenance . prov . xml . Role } */ public List < org . openprovenance . prov . model . Role > getRole ( ) { } }
if ( role == null ) { role = AttributeList . populateKnownAttributes ( this , all , org . openprovenance . prov . model . Role . class ) ; } return this . role ;
public class ConvolveImageNormalized { /** * Performs a 2D normalized convolution across the image . * @ param src The original image . Not modified . * @ param dst Where the resulting image is written to . Modified . * @ param kernel The kernel that is being convolved . Not modified . */ public static void convolve ( Kernel2D_S32 kernel , InterleavedS32 src , InterleavedS32 dst ) { } }
InputSanityCheck . checkSameShapeB ( src , dst ) ; boolean processed = BOverrideConvolveImageNormalized . invokeNativeConvolve ( kernel , src , dst ) ; if ( ! processed ) { if ( kernel . width >= src . width || kernel . width >= src . height ) { ConvolveNormalizedNaive_IL . convolve ( kernel , src , dst ) ; } else { ConvolveImageNoBorder . convolve ( kernel , src , dst , kernel . computeSum ( ) ) ; ConvolveNormalized_JustBorder_IL . convolve ( kernel , src , dst ) ; } }
public class Dart { /** * Inject fields annotated with { @ link BindExtra } in the specified { @ code target } using the { @ code * source } { @ link android . os . Bundle } as the source . * @ param target Target class for field binding . * @ param source Bundle source on which extras will be looked up . * @ throws Dart . UnableToInjectException if binding could not be performed . */ public static void bindNavigationModel ( Object target , Bundle source ) { } }
bindNavigationModel ( target , source , Finder . BUNDLE ) ;
public class ResourceConverter { /** * Deserializes a < a href = " http : / / jsonapi . org / format / # document - links " > JSON - API links object < / a > to a { @ code Map } * keyed by the link name . * The { @ code linksObject } may represent links in string form or object form ; both are supported by this method . * E . g . * < pre > * " links " : { * " self " : " http : / / example . com / posts " * < / pre > * or * < pre > * " links " : { * " related " : { * " href " : " http : / / example . com / articles / 1 / comments " , * " meta " : { * " count " : 10 * < / pre > * @ param linksObject a { @ code JsonNode } representing a links object * @ return a { @ code Map } keyed by link name */ private Map < String , Link > mapLinks ( JsonNode linksObject ) { } }
Map < String , Link > result = new HashMap < > ( ) ; Iterator < Map . Entry < String , JsonNode > > linkItr = linksObject . fields ( ) ; while ( linkItr . hasNext ( ) ) { Map . Entry < String , JsonNode > linkNode = linkItr . next ( ) ; Link linkObj = new Link ( ) ; linkObj . setHref ( getLink ( linkNode . getValue ( ) ) ) ; if ( linkNode . getValue ( ) . has ( META ) ) { linkObj . setMeta ( mapMeta ( linkNode . getValue ( ) . get ( META ) ) ) ; } result . put ( linkNode . getKey ( ) , linkObj ) ; } return result ;
public class LinearSearch { /** * Search for the maximum element in the array . * @ param < E > the type of elements in this array . * @ param array array that we are searching in . * @ return the maximum element in the array . */ public static < E extends Comparable < E > > E searchMax ( E [ ] array ) { } }
if ( array . length == 0 ) { throw new IllegalArgumentException ( "The array you provided does not have any elements" ) ; } E max = array [ 0 ] ; for ( int i = 1 ; i < array . length ; i ++ ) { if ( array [ i ] . compareTo ( max ) > 0 ) { max = array [ i ] ; } } return max ;
public class Layout { /** * Set up the screen input fields . */ public void setupFields ( ) { } }
FieldInfo field = null ; field = new FieldInfo ( this , ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Integer . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , LAST_CHANGED , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Date . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , DELETED , 10 , null , new Boolean ( false ) ) ; field . setDataClass ( Boolean . class ) ; field . setHidden ( true ) ; field = new FieldInfo ( this , NAME , 50 , null , null ) ; field = new FieldInfo ( this , PARENT_FOLDER_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setDataClass ( Integer . class ) ; field = new FieldInfo ( this , SEQUENCE , 5 , null , null ) ; field . setDataClass ( Short . class ) ; field = new FieldInfo ( this , COMMENT , 255 , null , null ) ; field = new FieldInfo ( this , CODE , 30 , null , null ) ; field = new FieldInfo ( this , TYPE , 50 , null , null ) ; field = new FieldInfo ( this , FIELD_VALUE , 255 , null , null ) ; field = new FieldInfo ( this , RETURNS_VALUE , 50 , null , null ) ; field = new FieldInfo ( this , MAXIMUM , 10 , null , null ) ; field . setDataClass ( Integer . class ) ; field = new FieldInfo ( this , SYSTEM_NAME , 30 , null , null ) ; field = new FieldInfo ( this , COMMENTS , 10 , null , null ) ; field . setDataClass ( Boolean . class ) ;
public class StripeReader { /** * Builds ( codec . stripeLength + codec . parityLength ) inputs given some erased locations . * Outputs : * - the array of input streams @ param inputs * - the list of erased locations @ param erasedLocations . * - the list of locations that are not read @ param locationsToNotRead . */ public InputStream [ ] buildInputs ( FileSystem srcFs , Path srcFile , FileStatus srcStat , FileSystem parityFs , Path parityFile , FileStatus parityStat , int stripeIdx , long offsetInBlock , List < Integer > erasedLocations , Set < Integer > locationsToNotRead , ErasureCode code ) throws IOException { } }
InputStream [ ] inputs = new InputStream [ codec . stripeLength + codec . parityLength ] ; boolean redo = false ; do { locationsToNotRead . clear ( ) ; List < Integer > locationsToRead = code . locationsToReadForDecode ( erasedLocations ) ; for ( int i = 0 ; i < inputs . length ; i ++ ) { boolean isErased = ( erasedLocations . indexOf ( i ) != - 1 ) ; boolean shouldRead = ( locationsToRead . indexOf ( i ) != - 1 ) ; try { InputStream stm = null ; if ( isErased || ! shouldRead ) { if ( isErased ) { LOG . info ( "Location " + i + " is erased, using zeros" ) ; } else { LOG . info ( "Location " + i + " need not be read, using zeros" ) ; } locationsToNotRead . add ( i ) ; stm = new RaidUtils . ZeroInputStream ( srcStat . getBlockSize ( ) * ( ( i < codec . parityLength ) ? stripeIdx * codec . parityLength + i : stripeIdx * codec . stripeLength + i - codec . parityLength ) ) ; } else { stm = buildOneInput ( i , offsetInBlock , srcFs , srcFile , srcStat , parityFs , parityFile , parityStat ) ; } inputs [ i ] = stm ; } catch ( IOException e ) { if ( e instanceof BlockMissingException || e instanceof ChecksumException ) { erasedLocations . add ( i ) ; redo = true ; RaidUtils . closeStreams ( inputs ) ; break ; } else { throw e ; } } } } while ( redo ) ; assert ( locationsToNotRead . size ( ) == codec . parityLength ) ; return inputs ;
public class TaggerUtils { /** * Creates training examples from sequential data where each example * involves predicting a single label given the current input and * previous label . Such examples are suitable for training * locally - normalized sequence models , such as HMMs and MEMMs . * @ param sequences * @ param featureGen * @ param inputGen * @ param modelVariables * @ return */ public static < I , O > List < Example < DynamicAssignment , DynamicAssignment > > reformatTrainingDataPerItem ( List < ? extends TaggedSequence < I , O > > sequences , FeatureVectorGenerator < LocalContext < I > > featureGen , Function < ? super LocalContext < I > , ? extends Object > inputGen , DynamicVariableSet modelVariables , I startInput , O startLabel ) { } }
DynamicVariableSet plate = modelVariables . getPlate ( PLATE_NAME ) ; VariableNumMap x = plate . getFixedVariables ( ) . getVariablesByName ( INPUT_FEATURES_NAME ) ; VariableNumMap xInput = plate . getFixedVariables ( ) . getVariablesByName ( INPUT_NAME ) ; VariableNumMap y = plate . getFixedVariables ( ) . getVariablesByName ( OUTPUT_NAME ) ; ReformatPerItemMapper < I , O > mapper = new ReformatPerItemMapper < I , O > ( featureGen , inputGen , x , xInput , y , startInput , startLabel ) ; List < List < Example < DynamicAssignment , DynamicAssignment > > > exampleLists = MapReduceConfiguration . getMapReduceExecutor ( ) . map ( sequences , mapper ) ; List < Example < DynamicAssignment , DynamicAssignment > > examples = Lists . newArrayList ( ) ; for ( List < Example < DynamicAssignment , DynamicAssignment > > exampleList : exampleLists ) { examples . addAll ( exampleList ) ; } return examples ;
public class BaseLiaison { /** * from DatabaseLiaison */ public boolean tableContainsIndex ( Connection conn , String table , String index ) throws SQLException { } }
ResultSet rs = conn . getMetaData ( ) . getIndexInfo ( null , null , table , false , true ) ; while ( rs . next ( ) ) { String tname = rs . getString ( "TABLE_NAME" ) ; String iname = rs . getString ( "INDEX_NAME" ) ; if ( tname . equals ( table ) && index . equals ( iname ) ) { return true ; } } return false ;
public class Fn { /** * Returns a stateful < code > Function < / code > which should not be used in parallel stream . * @ param func * @ return * @ deprecated replaced by { @ code Functions # indexed ( IndexedFunction ) } . */ @ Deprecated static < T , R > Function < T , R > indexedd ( final IndexedFunction < T , R > func ) { } }
return Functions . indexed ( func ) ;
public class BlockPlacementPolicyConfigurable { /** * returns a random integer within a modular window taking into consideration * a sorted list of nodes to be excluded . */ protected int randomIntInWindow ( int begin , int windowSize , int n , Set < Integer > excludeSet ) { } }
final int size = Math . min ( windowSize , n ) ; if ( size <= 0 ) { return - 1 ; } int adjustment = 0 ; for ( Integer v : excludeSet ) { int vindex = ( v . intValue ( ) - begin + n ) % n ; if ( vindex < size ) { adjustment ++ ; // calculates excluded elements within window } } if ( adjustment >= size ) { return - 1 ; } int rindex = r . nextInt ( size - adjustment ) ; // ith element is chosen int iterator = begin ; for ( int i = 0 ; i <= rindex ; i ++ ) { while ( excludeSet . contains ( iterator ) ) { iterator = ( iterator + 1 ) % n ; } if ( i != rindex ) { iterator = ( iterator + 1 ) % n ; } } return iterator ;
public class JsonObject { /** * unhidden . */ public JsonObject accumulate ( String name , Object value ) throws JsonException { } }
checkIfFrozen ( ) ; Object current = nameValuePairs . get ( checkName ( name ) ) ; if ( current == null ) { return put ( name , value ) ; } if ( current instanceof JsonArray ) { JsonArray array = ( JsonArray ) current ; array . put ( value ) ; } else { JsonArray array = new JsonArray ( ) ; array . put ( current ) ; array . put ( value ) ; nameValuePairs . put ( name , array ) ; } return this ;
public class ClassScanner { /** * Returns all the classes found in a sorted map */ public SortedMap < String , Class < ? > > getAllClassesMap ( ) { } }
Package [ ] packages = Package . getPackages ( ) ; return getClassesMap ( packages ) ;
public class TemplatedURLFormatter { /** * Gets the TemplatedURLFormatter instance from a ServletRequest attribute . * @ param servletRequest the current ServletRequest . * @ return the TemplatedURLFormatter instance from the ServletRequest . */ public static TemplatedURLFormatter getTemplatedURLFormatter ( ServletRequest servletRequest ) { } }
assert servletRequest != null : "The ServletRequest cannot be null." ; if ( servletRequest == null ) { throw new IllegalArgumentException ( "The ServletRequest cannot be null." ) ; } return ( TemplatedURLFormatter ) servletRequest . getAttribute ( TEMPLATED_URL_FORMATTER_ATTR ) ;
public class ConnectResponse { /** * / * ( non - Javadoc ) * @ see tuwien . auto . calimero . knxnetip . servicetype . ServiceType # getStructLength ( ) */ short getStructLength ( ) { } }
int len = 2 ; if ( endpt != null && crd != null ) len += endpt . getStructLength ( ) + crd . getStructLength ( ) ; return ( short ) len ;
public class PersistenceInitializer { /** * Starts the H2 database engine if the database mode is set to ' server ' */ private void startDbServer ( ) { } }
final String mode = Config . getInstance ( ) . getProperty ( Config . AlpineKey . DATABASE_MODE ) ; final int port = Config . getInstance ( ) . getPropertyAsInt ( Config . AlpineKey . DATABASE_PORT ) ; if ( StringUtils . isEmpty ( mode ) || ! ( "server" . equals ( mode ) || "embedded" . equals ( mode ) || "external" . equals ( mode ) ) ) { LOGGER . error ( "Database mode not specified. Expected values are 'server', 'embedded', or 'external'" ) ; } if ( dbServer != null || "embedded" . equals ( mode ) || "external" . equals ( mode ) ) { return ; } final String [ ] args = new String [ ] { "-tcp" , "-tcpPort" , String . valueOf ( port ) , "-tcpAllowOthers" , } ; try { LOGGER . info ( "Attempting to start database service" ) ; dbServer = Server . createTcpServer ( args ) . start ( ) ; LOGGER . info ( "Database service started" ) ; } catch ( SQLException e ) { LOGGER . error ( "Unable to start database service: " + e . getMessage ( ) ) ; stopDbServer ( ) ; }
public class SARLJvmModelInferrer { /** * Transform the constructor . * @ param source the feature to transform . * @ param container the target container of the transformation result . */ @ Override protected void transform ( final XtendConstructor source , final JvmGenericType container ) { } }
final String constructorName = container . getSimpleName ( ) ; // Special case : static constructor if ( source . isStatic ( ) ) { final JvmOperation staticConstructor = this . typesFactory . createJvmOperation ( ) ; container . getMembers ( ) . add ( staticConstructor ) ; this . associator . associatePrimary ( source , staticConstructor ) ; staticConstructor . setSimpleName ( Utils . STATIC_CONSTRUCTOR_NAME ) ; staticConstructor . setVisibility ( JvmVisibility . PRIVATE ) ; staticConstructor . setStatic ( true ) ; staticConstructor . setReturnType ( this . _typeReferenceBuilder . typeRef ( Void . TYPE ) ) ; setBody ( staticConstructor , source . getExpression ( ) ) ; copyAndCleanDocumentationTo ( source , staticConstructor ) ; return ; } final GenerationContext context = getContext ( container ) ; final boolean isVarArgs = Utils . isVarArg ( source . getParameters ( ) ) ; // Generate the unique identifier of the constructor . final QualifiedActionName actionKey = this . sarlSignatureProvider . createConstructorQualifiedName ( container ) ; // Generate all the constructor signatures related to the constructor to create . final InferredPrototype constructorSignatures = this . sarlSignatureProvider . createPrototypeFromSarlModel ( actionKey , Utils . isVarArg ( source . getParameters ( ) ) , source . getParameters ( ) ) ; // Generate the main Java constructor . final JvmConstructor constructor = this . typesFactory . createJvmConstructor ( ) ; container . getMembers ( ) . add ( constructor ) ; this . associator . associatePrimary ( source , constructor ) ; constructor . setSimpleName ( constructorName ) ; setVisibility ( constructor , source ) ; constructor . setVarArgs ( isVarArgs ) ; // Generate the parameters final List < InferredStandardParameter > paramList = constructorSignatures . getOriginalParameterTypes ( ) ; translateSarlFormalParameters ( context , constructor , container , isVarArgs , source . getParameters ( ) , false , paramList ) ; // Generate additional information ( type parameters , exceptions . . . ) copyAndFixTypeParameters ( source . getTypeParameters ( ) , constructor ) ; for ( final JvmTypeReference exception : source . getExceptions ( ) ) { constructor . getExceptions ( ) . add ( this . typeBuilder . cloneWithProxies ( exception ) ) ; } translateAnnotationsTo ( source . getAnnotations ( ) , constructor ) ; // Set the body . setBody ( constructor , source . getExpression ( ) ) ; // The signature definition of the constructor . final ActionParameterTypes sigKey = this . sarlSignatureProvider . createParameterTypesFromJvmModel ( isVarArgs , constructor . getParameters ( ) ) ; // Update the list of generated constructors if ( context != null ) { context . getGeneratedConstructors ( ) . put ( sigKey , constructor ) ; } copyAndCleanDocumentationTo ( source , constructor ) ; final Runnable differedGeneration = ( ) -> { // Generate the Java functions that correspond to the action with the parameter default values applied . for ( final Entry < ActionParameterTypes , List < InferredStandardParameter > > entry : constructorSignatures . getInferredParameterTypes ( ) . entrySet ( ) ) { if ( context == null || ! context . getGeneratedConstructors ( ) . containsKey ( entry . getKey ( ) ) ) { final List < InferredStandardParameter > otherSignature = entry . getValue ( ) ; // Generate the additional constructor that is invoke the main constructor previously generated . final JvmConstructor constructor2 = SARLJvmModelInferrer . this . typesFactory . createJvmConstructor ( ) ; container . getMembers ( ) . add ( constructor2 ) ; copyAndCleanDocumentationTo ( source , constructor2 ) ; constructor2 . setSimpleName ( container . getSimpleName ( ) ) ; constructor2 . setVisibility ( constructor . getVisibility ( ) ) ; constructor2 . setVarArgs ( isVarArgs ) ; final List < String > args = translateSarlFormalParametersForSyntheticOperation ( constructor2 , container , isVarArgs , otherSignature ) ; addAnnotationSafe ( constructor2 , DefaultValueUse . class , constructorSignatures . getFormalParameterTypes ( ) . toString ( ) ) ; appendGeneratedAnnotation ( constructor2 , context ) ; setBody ( constructor2 , toStringConcatenation ( "this(" // $ NON - NLS - 1 $ + IterableExtensions . join ( args , ", " ) // $ NON - NLS - 1 $ + ");" ) ) ; // $ NON - NLS - 1 $ // Update the list of the generated constructors . if ( context != null ) { context . getGeneratedConstructors ( ) . put ( entry . getKey ( ) , constructor2 ) ; } } } } ; if ( context != null ) { context . getPreFinalizationElements ( ) . add ( differedGeneration ) ; context . setActionIndex ( context . getActionIndex ( ) + 1 ) ; context . incrementSerial ( sigKey . hashCode ( ) ) ; } else { differedGeneration . run ( ) ; }
public class SeaGlassLookAndFeel { /** * Initialize the internal frame maximize button settings . * @ param d the UI defaults map . */ private void defineInternalFrameMaximizeButton ( UIDefaults d ) { } }
String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\"" ; String c = PAINTER_PREFIX + "TitlePaneMaximizeButtonPainter" ; d . put ( p + ".WindowNotFocused" , new TitlePaneMaximizeButtonWindowNotFocusedState ( ) ) ; d . put ( p + ".WindowMaximized" , new TitlePaneMaximizeButtonWindowMaximizedState ( ) ) ; d . put ( p + ".contentMargins" , new InsetsUIResource ( 0 , 0 , 0 , 0 ) ) ; // Set the maximize button states . d . put ( p + "[Disabled].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_DISABLED ) ) ; d . put ( p + "[Enabled].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_ENABLED ) ) ; d . put ( p + "[MouseOver].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MOUSEOVER ) ) ; d . put ( p + "[Pressed].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_PRESSED ) ) ; d . put ( p + "[Enabled+WindowNotFocused].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_ENABLED_WINDOWNOTFOCUSED ) ) ; d . put ( p + "[MouseOver+WindowNotFocused].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED ) ) ; d . put ( p + "[Pressed+WindowNotFocused].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_PRESSED_WINDOWNOTFOCUSED ) ) ; // Set the restore button states . d . put ( p + "[Disabled+WindowMaximized].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MAXIMIZED_DISABLED ) ) ; d . put ( p + "[Enabled+WindowMaximized].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MAXIMIZED_ENABLED ) ) ; d . put ( p + "[MouseOver+WindowMaximized].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MAXIMIZED_MOUSEOVER ) ) ; d . put ( p + "[Pressed+WindowMaximized].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MAXIMIZED_PRESSED ) ) ; d . put ( p + "[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED ) ) ; d . put ( p + "[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED ) ) ; d . put ( p + "[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter" , new LazyPainter ( c , TitlePaneMaximizeButtonPainter . Which . BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED ) ) ; d . put ( p + ".icon" , new SeaGlassIcon ( p , "iconPainter" , 25 , 18 ) ) ;
public class ClassUtil { /** * 获得ClassPath * @ param packageName 包名称 * @ param isDecode 是否解码路径中的特殊字符 ( 例如空格和中文 ) * @ return ClassPath路径字符串集合 * @ since 4.0.11 */ public static Set < String > getClassPaths ( String packageName , boolean isDecode ) { } }
String packagePath = packageName . replace ( StrUtil . DOT , StrUtil . SLASH ) ; Enumeration < URL > resources ; try { resources = getClassLoader ( ) . getResources ( packagePath ) ; } catch ( IOException e ) { throw new UtilException ( e , "Loading classPath [{}] error!" , packagePath ) ; } final Set < String > paths = new HashSet < String > ( ) ; String path ; while ( resources . hasMoreElements ( ) ) { path = resources . nextElement ( ) . getPath ( ) ; paths . add ( isDecode ? URLUtil . decode ( path , CharsetUtil . systemCharsetName ( ) ) : path ) ; } return paths ;
public class SynchronizationManagerImpl { /** * 2 . The lock can be locked more then once - for example in InBuffer startGetMessages ( ) and then in ackMessages ( ) do put ( ) in OutBuffer and do startPutMessages ( ) */ private void unlockCompletely ( ReentrantLock lockToUnlock ) { } }
int counter = lockToUnlock . getHoldCount ( ) ; for ( int i = 0 ; i < counter ; i ++ ) { lockToUnlock . unlock ( ) ; }
public class nsmode { /** * Use this API to disable nsmode . */ public static base_response disable ( nitro_service client , nsmode resource ) throws Exception { } }
nsmode disableresource = new nsmode ( ) ; disableresource . mode = resource . mode ; return disableresource . perform_operation ( client , "disable" ) ;
public class CryptoPrimitives { /** * Decodes an ECDSA signature and returns a two element BigInteger array . * @ param signature ECDSA signature bytes . * @ return BigInteger array for the signature ' s r and s values * @ throws Exception */ private static BigInteger [ ] decodeECDSASignature ( byte [ ] signature ) throws Exception { } }
try ( ByteArrayInputStream inStream = new ByteArrayInputStream ( signature ) ) { ASN1InputStream asnInputStream = new ASN1InputStream ( inStream ) ; ASN1Primitive asn1 = asnInputStream . readObject ( ) ; BigInteger [ ] sigs = new BigInteger [ 2 ] ; int count = 0 ; if ( asn1 instanceof ASN1Sequence ) { ASN1Sequence asn1Sequence = ( ASN1Sequence ) asn1 ; ASN1Encodable [ ] asn1Encodables = asn1Sequence . toArray ( ) ; for ( ASN1Encodable asn1Encodable : asn1Encodables ) { ASN1Primitive asn1Primitive = asn1Encodable . toASN1Primitive ( ) ; if ( asn1Primitive instanceof ASN1Integer ) { ASN1Integer asn1Integer = ( ASN1Integer ) asn1Primitive ; BigInteger integer = asn1Integer . getValue ( ) ; if ( count < 2 ) { sigs [ count ] = integer ; } count ++ ; } } } if ( count != 2 ) { throw new CryptoException ( format ( "Invalid ECDSA signature. Expected count of 2 but got: %d. Signature is: %s" , count , DatatypeConverter . printHexBinary ( signature ) ) ) ; } return sigs ; }
public class SCoverageReportMojo { /** * { @ inheritDoc } */ @ Override public String getDescription ( Locale locale ) { } }
if ( StringUtils . isEmpty ( description ) ) { return getBundle ( locale ) . getString ( "report.scoverage.description" ) ; } return description ;
public class CreateSpatialIndexGeneratorGeoDB { /** * { @ inheritDoc } Also ensures that the SRID is populated . */ @ Override public ValidationErrors validate ( final CreateSpatialIndexStatement statement , final Database database , final SqlGeneratorChain sqlGeneratorChain ) { } }
final ValidationErrors validationErrors = super . validate ( statement , database , sqlGeneratorChain ) ; validationErrors . checkRequiredField ( "srid" , statement . getSrid ( ) ) ; return validationErrors ;
public class ConnectionDataGroup { /** * Creates and returns a new conversation . The conversation must be connected to * the same remote process as the conversation group is associated with . The conversation * will be created over a connection within this connection group . * @ param conversationReceiveListener The conversation receive listener to use for the * new conversation . * @ param usageType Usage type for the conversation . * @ return The conversation created . * @ throws SIResourceException thrown if the connect attempt fails . */ protected Conversation connect ( final ConversationReceiveListener conversationReceiveListener , final ConversationUsageType usageType ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "connect" , new Object [ ] { conversationReceiveListener , usageType } ) ; // Pass in an ' empty ' JFapAddressHolder . Conversation retConversation = doConnect ( conversationReceiveListener , usageType , new JFapAddressHolder ( ) , currentConnectionFactoryFactory ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "connect" , retConversation ) ; return retConversation ;
public class StringUtils { /** * Unwraps a given string from anther string . * < pre > * StringUtils . unwrap ( null , null ) = null * StringUtils . unwrap ( null , " " ) = null * StringUtils . unwrap ( null , " 1 " ) = null * StringUtils . unwrap ( " \ ' abc \ ' " , " \ ' " ) = " abc " * StringUtils . unwrap ( " \ " abc \ " " , " \ " " ) = " abc " * StringUtils . unwrap ( " AABabcBAA " , " AA " ) = " BabcB " * StringUtils . unwrap ( " A " , " # " ) = " A " * StringUtils . unwrap ( " # A " , " # " ) = " # A " * StringUtils . unwrap ( " A # " , " # " ) = " A # " * < / pre > * @ param str * the String to be unwrapped , can be null * @ param wrapToken * the String used to unwrap * @ return unwrapped String or the original string * if it is not quoted properly with the wrapToken * @ since 3.6 */ public static String unwrap ( final String str , final String wrapToken ) { } }
if ( isEmpty ( str ) || isEmpty ( wrapToken ) ) { return str ; } if ( startsWith ( str , wrapToken ) && endsWith ( str , wrapToken ) ) { final int startIndex = str . indexOf ( wrapToken ) ; final int endIndex = str . lastIndexOf ( wrapToken ) ; final int wrapLength = wrapToken . length ( ) ; if ( startIndex != - 1 && endIndex != - 1 ) { return str . substring ( startIndex + wrapLength , endIndex ) ; } } return str ;
public class BeginSegmentImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . BEGIN_SEGMENT__SEGNAME : setSEGNAME ( SEGNAME_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ;
public class AbstractExtractor { /** * To string function t . * @ param toStringFunction the to string function * @ return the t */ public T toStringFunction ( @ NonNull SerializableFunction < HString , String > toStringFunction ) { } }
this . toStringFunction = toStringFunction ; return Cast . as ( this ) ;
public class DateTimeExtensions { /** * Iterates from this to the { @ code to } { @ link java . time . temporal . Temporal } , inclusive , incrementing by one * { @ code unit } each iteration , calling the closure once per iteration . The closure may accept a single * { @ link java . time . temporal . Temporal } argument . * If the unit is too large to iterate to the second Temporal exactly , such as iterating from two LocalDateTimes * that are seconds apart using { @ link java . time . temporal . ChronoUnit # DAYS } as the unit , the iteration will cease * as soon as the current value of the iteration is later than the second Temporal argument . The closure will * not be called with any value later than the { @ code to } value . * @ param from the starting Temporal * @ param to the ending Temporal * @ param unit the TemporalUnit to increment by * @ param closure the zero or one - argument closure to call * @ throws GroovyRuntimeException if this value is later than { @ code to } * @ throws GroovyRuntimeException if { @ code to } is a different type than this * @ since 2.5.0 */ public static void upto ( Temporal from , Temporal to , TemporalUnit unit , Closure closure ) { } }
if ( isUptoEligible ( from , to ) ) { for ( Temporal i = from ; isUptoEligible ( i , to ) ; i = i . plus ( 1 , unit ) ) { closure . call ( i ) ; } } else { throw new GroovyRuntimeException ( "The argument (" + to + ") to upto() cannot be earlier than the value (" + from + ") it's called on." ) ; }
public class CountMin4 { /** * Returns the estimated number of occurrences of an element , up to the maximum ( 15 ) . * @ param e the element to count occurrences of * @ return the estimated number of occurrences of the element ; possibly zero but never negative */ @ Override public int frequency ( long e ) { } }
int hash = spread ( Long . hashCode ( e ) ) ; int start = ( hash & 3 ) << 2 ; int frequency = Integer . MAX_VALUE ; for ( int i = 0 ; i < 4 ; i ++ ) { int index = indexOf ( hash , i ) ; int count = ( int ) ( ( table [ index ] >>> ( ( start + i ) << 2 ) ) & 0xfL ) ; frequency = Math . min ( frequency , count ) ; } return frequency ;
public class DigitsValidator { /** * / * ( non - Javadoc ) * @ see nz . co . senanque . validationengine . annotations1 . FieldValidator # validate ( java . lang . Object ) */ public void validate ( Object o ) { } }
String s = String . valueOf ( o ) ; int i = s . indexOf ( "." ) ; if ( i == - 1 ) { if ( ( m_integerDigits != - 1 && s . length ( ) > m_integerDigits ) ) { String message = m_propertyMetadata . getMessageSourceAccessor ( ) . getMessage ( m_message , new Object [ ] { m_propertyMetadata . getLabelName ( ) , m_integerDigits , m_fractionalDigits , String . valueOf ( o ) } ) ; throw new ValidationException ( message ) ; } } else { if ( m_integerDigits != - 1 && s . length ( ) > m_integerDigits ) { String message = m_propertyMetadata . getMessageSourceAccessor ( ) . getMessage ( m_message , new Object [ ] { m_propertyMetadata . getLabelName ( ) , m_integerDigits , m_fractionalDigits , String . valueOf ( o ) } ) ; throw new ValidationException ( message ) ; } if ( m_fractionalDigits != - 1 && ( s . length ( ) - ( i + 1 ) ) > m_fractionalDigits ) { String message = m_propertyMetadata . getMessageSourceAccessor ( ) . getMessage ( m_message , new Object [ ] { m_propertyMetadata . getLabelName ( ) , m_integerDigits , m_fractionalDigits , String . valueOf ( o ) } ) ; throw new ValidationException ( message ) ; } }
public class ConfigResolutionStrategy { /** * Activate the strategy . */ void activate ( ) { } }
nodes ( ) . flatMap ( e -> e . allKeysRecursively ( ) ) . distinct ( ) . forEach ( key -> { activate ( key ) ; } ) ;
public class CougarSerializerFactory { /** * If a Cougar server response contains a class the client doesn ' t know about ( which is legal and backwards compatible * in cases ) then the default behavior of Hessian is to perform a lookup , fail , throw an exception and log it . * This has been measured at about 25 times slower than the happy path , and Hessian does not negatively cache ' misses ' , * so this is a per - response slowdown . This implementation caches type lookup misses , and so eradicates the problem . */ private Deserializer optimizedGetDeserializer ( String type ) throws HessianProtocolException { } }
if ( missingTypes . contains ( type ) ) { return null ; } Deserializer answer = super . getDeserializer ( type ) ; if ( answer == null ) { missingTypes . add ( type ) ; } return answer ;
public class ServerSocket { /** * Retrieve setting for SO _ TIMEOUT . 0 returns implies that the * option is disabled ( i . e . , timeout of infinity ) . * @ return the SO _ TIMEOUT value * @ exception IOException if an I / O error occurs * @ since JDK1.1 * @ see # setSoTimeout ( int ) */ public synchronized int getSoTimeout ( ) throws IOException { } }
if ( isClosed ( ) ) throw new SocketException ( "Socket is closed" ) ; Object o = getImpl ( ) . getOption ( SocketOptions . SO_TIMEOUT ) ; /* extra type safety */ if ( o instanceof Integer ) { return ( ( Integer ) o ) . intValue ( ) ; } else { return 0 ; }
public class CMMLHelper { /** * Extracts a single node for the specified XPath expression . * @ param node the node * @ param xExpr expression * @ param xPath the x path * @ return Node * @ throws XPathExpressionException the xpath expression exception */ public static Node getElement ( Node node , String xExpr , XPath xPath ) throws XPathExpressionException { } }
return ( Node ) xPath . compile ( xExpr ) . evaluate ( node , XPathConstants . NODE ) ;
public class Asm { /** * Create dword ( 4 Bytes ) pointer operand . */ public static final Mem dword_ptr_abs ( long target , long disp , SEGMENT segmentPrefix ) { } }
return _ptr_build_abs ( target , disp , segmentPrefix , SIZE_DWORD ) ;
public class FlexiBean { /** * Gets the value of the property as a { @ code long } using a default value . * @ param propertyName the property name , not empty * @ param defaultValue the default value for null or invalid property * @ return the value of the property * @ throws ClassCastException if the value is not compatible */ public long getLong ( String propertyName , long defaultValue ) { } }
Object obj = get ( propertyName ) ; return obj != null ? ( ( Number ) get ( propertyName ) ) . longValue ( ) : defaultValue ;
public class SparseWeightedDirectedTypedEdgeSet { /** * Returns the sum of the weights of the edges contained in this set . */ public double sum ( ) { } }
double sum = 0 ; for ( WeightedDirectedTypedEdge < T > e : inEdges . values ( ) ) sum += e . weight ( ) ; for ( WeightedDirectedTypedEdge < T > e : outEdges . values ( ) ) sum += e . weight ( ) ; return sum ;
public class Error { /** * Factory method for errors list . Returns a list of error objects , given the page and size preferences . * @ param client the client * @ param page the page * @ param size the page size * @ return the list * @ throws IOException unexpected error . */ public static ResourceList < Error > list ( final BandwidthClient client , final int page , final int size ) throws IOException { } }
final String resourceUri = client . getUserResourceUri ( BandwidthConstants . ERRORS_URI_PATH ) ; final ResourceList < Error > errors = new ResourceList < Error > ( page , size , resourceUri , Error . class ) ; errors . setClient ( client ) ; errors . initialize ( ) ; return errors ;
public class AmazonGuardDutyClient { /** * Lists detectorIds of all the existing Amazon GuardDuty detector resources . * @ param listDetectorsRequest * @ return Result of the ListDetectors operation returned by the service . * @ throws BadRequestException * 400 response * @ throws InternalServerErrorException * 500 response * @ sample AmazonGuardDuty . ListDetectors * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / guardduty - 2017-11-28 / ListDetectors " target = " _ top " > AWS API * Documentation < / a > */ @ Override public ListDetectorsResult listDetectors ( ListDetectorsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListDetectors ( request ) ;
public class StringUtilities { /** * Copy the directive to the { @ link StringBuilder } if not null . * ( A directive is a parameter of the digest authentication process . ) * @ param directives the directives map * @ param sb the output buffer * @ param directive the directive name to look for */ public static void copyDirective ( HashMap < String , String > directives , StringBuilder sb , String directive ) { } }
String directiveValue = directives . get ( directive ) ; if ( directiveValue != null ) { sb . append ( directive ) . append ( " = \"" ) . append ( directiveValue ) . append ( "\", " ) ; }
public class SeleniumDriverFixture { /** * < p > < code > * | ensure | do | < i > type < / i > | on | < i > searchString < / i > | with | < i > some text < / i > | * < / code > < / p > * @ param command * @ param target * @ param value * @ return */ public boolean doOnWith ( final String command , final String target , final String value ) { } }
LOG . info ( "Performing | " + command + " | " + target + " | " + value + " |" ) ; return executeDoCommand ( command , new String [ ] { unalias ( target ) , unalias ( value ) } ) ;
public class PrcInvItemTaxCategoryLineSave { /** * < p > Process entity request . < / p > * @ param pAddParam additional param , e . g . return this line ' s * document in " nextEntity " for farther process * @ param pRequestData Request Data * @ param pEntity Entity to process * @ return Entity processed for farther process or null * @ throws Exception - an exception */ @ Override public final InvItemTaxCategoryLine process ( final Map < String , Object > pAddParam , final InvItemTaxCategoryLine pEntity , final IRequestData pRequestData ) throws Exception { } }
if ( pEntity . getItsPercentage ( ) . doubleValue ( ) <= 0 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "percentage_wrong" ) ; } if ( pEntity . getTax ( ) == null ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "tax_wrong" ) ; } // Beige - Orm refresh : pEntity . setItsOwner ( getSrvOrm ( ) . retrieveEntity ( pAddParam , pEntity . getItsOwner ( ) ) ) ; // optimistic locking ( dirty check ) : Long ownerVersion = Long . valueOf ( pRequestData . getParameter ( InvItemTaxCategory . class . getSimpleName ( ) + ".ownerVersion" ) ) ; pEntity . getItsOwner ( ) . setItsVersion ( ownerVersion ) ; pEntity . setTax ( getSrvOrm ( ) . retrieveEntity ( pAddParam , pEntity . getTax ( ) ) ) ; if ( ! ( ETaxType . SALES_TAX_INITEM . equals ( pEntity . getTax ( ) . getItsType ( ) ) || ETaxType . SALES_TAX_OUTITEM . equals ( pEntity . getTax ( ) . getItsType ( ) ) ) ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "tax_wrong" ) ; } if ( pEntity . getIsNew ( ) ) { getSrvOrm ( ) . insertEntity ( pAddParam , pEntity ) ; pEntity . setIsNew ( false ) ; } else { getSrvOrm ( ) . updateEntity ( pAddParam , pEntity ) ; } updateInvItemTaxCategory ( pAddParam , pEntity . getItsOwner ( ) ) ; pAddParam . put ( "nextEntity" , pEntity . getItsOwner ( ) ) ; pAddParam . put ( "nameOwnerEntity" , InvItemTaxCategory . class . getSimpleName ( ) ) ; return null ;