signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MessageProcessor { /** * Removes a connection from the list of connections
* @ param connection
* The connection to remove . */
protected void removeConnection ( ConnectionImpl connection ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeConnection" , connection ) ; synchronized ( _connections ) { _connections . remove ( connection ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeConnection" ) ; |
public class AbstractAttributeDefinitionBuilder { /** * Adds an access constraint to the set used with the attribute
* @ param accessConstraint the constraint
* @ return a builder that can be used to continue building the attribute definition */
@ SuppressWarnings ( "deprecation" ) public BUILDER addAccessConstraint ( final AccessConstraintDefinition accessConstraint ) { } } | if ( accessConstraints == null ) { accessConstraints = new AccessConstraintDefinition [ ] { accessConstraint } ; } else { accessConstraints = Arrays . copyOf ( accessConstraints , accessConstraints . length + 1 ) ; accessConstraints [ accessConstraints . length - 1 ] = accessConstraint ; } return ( BUILDER ) this ; |
public class Limits { /** * Return a predicate , which will truncate the evolution stream after the
* given number of generations . The returned predicate behaves like a call
* of the { @ link java . util . stream . Stream # limit ( long ) } and exists for
* < i > completeness < / i > reasons .
* @ since 3.1
* @ param generation the number of generations after the evolution stream is
* truncated
* @ return a predicate which truncates the evolution stream after the given
* number of generations
* @ throws java . lang . IllegalArgumentException if the given { @ code generation }
* is smaller than zero . */
public static Predicate < Object > byFixedGeneration ( final long generation ) { } } | if ( generation < 0 ) { throw new IllegalArgumentException ( format ( "The number of generations must greater than one, but was %d" , generation ) ) ; } return new Predicate < Object > ( ) { private final AtomicLong _current = new AtomicLong ( ) ; @ Override public boolean test ( final Object o ) { return _current . incrementAndGet ( ) <= generation ; } } ; |
public class QueryTraversal { /** * Reduces the fields of a Document ( or parts of it ) to a single value . The fields are visited in post - order .
* @ param queryReducer the query reducer
* @ param initialValue the initial value to pass to the reducer
* @ param < T > the type of reduced value
* @ return the calculated overall value */
@ SuppressWarnings ( "unchecked" ) public < T > T reducePostOrder ( QueryReducer < T > queryReducer , T initialValue ) { } } | // compiler hack to make acc final and mutable : - )
final Object [ ] acc = { initialValue } ; visitPostOrder ( new QueryVisitorStub ( ) { @ Override public void visitField ( QueryVisitorFieldEnvironment env ) { acc [ 0 ] = queryReducer . reduceField ( env , ( T ) acc [ 0 ] ) ; } } ) ; return ( T ) acc [ 0 ] ; |
public class SimpleMonthView { /** * Sets all the parameters for displaying this week . The only required
* parameter is the week number . Other parameters have a default value and
* will only update if a new value is included , except for focus month ,
* which will always default to no focus month if no value is passed in . See
* { @ link # VIEW _ PARAMS _ HEIGHT } for more info on parameters .
* @ param params A map of the new parameters , see
* { @ link # VIEW _ PARAMS _ HEIGHT } */
public void setMonthParams ( HashMap < String , Integer > params ) { } } | if ( ! params . containsKey ( VIEW_PARAMS_MONTH ) && ! params . containsKey ( VIEW_PARAMS_YEAR ) ) { throw new InvalidParameterException ( "You must specify the month and year for this view" ) ; } setTag ( params ) ; // We keep the current value for any params not present
if ( params . containsKey ( VIEW_PARAMS_HEIGHT ) ) { mRowHeight = params . get ( VIEW_PARAMS_HEIGHT ) ; if ( mRowHeight < MIN_HEIGHT ) { mRowHeight = MIN_HEIGHT ; } } if ( params . containsKey ( VIEW_PARAMS_SELECTED_DAY ) ) { mSelectedDay = params . get ( VIEW_PARAMS_SELECTED_DAY ) ; } // Allocate space for caching the day numbers and focus values
mMonth = params . get ( VIEW_PARAMS_MONTH ) ; mYear = params . get ( VIEW_PARAMS_YEAR ) ; // Figure out what day today is
final Time today = new Time ( Time . getCurrentTimezone ( ) ) ; today . setToNow ( ) ; mHasToday = false ; mToday = - 1 ; mCalendar . set ( Calendar . MONTH , mMonth ) ; mCalendar . set ( Calendar . YEAR , mYear ) ; mCalendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; mDayOfWeekStart = mCalendar . get ( Calendar . DAY_OF_WEEK ) ; if ( params . containsKey ( VIEW_PARAMS_WEEK_START ) ) { mWeekStart = params . get ( VIEW_PARAMS_WEEK_START ) ; } else { mWeekStart = mCalendar . getFirstDayOfWeek ( ) ; } mNumCells = DateTimePickerUtils . getDaysInMonth ( mMonth , mYear ) ; for ( int i = 0 ; i < mNumCells ; i ++ ) { final int day = i + 1 ; if ( sameDay ( day , today ) ) { mHasToday = true ; mToday = day ; } } mNumRows = calculateNumRows ( ) ; // Invalidate cached accessibility information .
mNodeProvider . invalidateParent ( ) ; |
public class GitkitClient { /** * Gets out - of - band response . Used by oob endpoint for ResetPassword and ChangeEmail operation .
* The web site needs to send user an email containing the oobUrl in the response . The user needs
* to click the oobUrl to finish the operation .
* @ param req http request for the oob endpoint
* @ return the oob response .
* @ throws GitkitServerException */
public OobResponse getOobResponse ( HttpServletRequest req ) throws GitkitServerException { } } | String gitkitToken = lookupCookie ( req , cookieName ) ; return getOobResponse ( req , gitkitToken ) ; |
public class FactorySteerCoefficients { /** * Coefficients for even or odd parity polynomials .
* @ param order order of the polynomial .
* @ return Steering coeficient . */
public static SteerableCoefficients polynomial ( int order ) { } } | if ( order == 1 ) return new PolyOrder1 ( ) ; else if ( order == 2 ) return new PolyOrder2 ( ) ; else if ( order == 3 ) return new PolyOrder3 ( ) ; else if ( order == 4 ) return new PolyOrder4 ( ) ; else throw new IllegalArgumentException ( "Only supports orders 1 to 4" ) ; |
public class CmsImportVersion7 { /** * Sets the flags . < p >
* @ param flags the flags to set
* @ see # N _ FLAGS
* @ see # addResourceAttributesRules ( Digester , String ) */
public void setFlags ( String flags ) { } } | try { m_flags = Integer . parseInt ( flags ) ; } catch ( Throwable e ) { setThrowable ( e ) ; } |
public class ProcessorDependencyGraph { /** * Get all the names of inputs that are required to be in the Values object when this graph is executed . */
@ SuppressWarnings ( "unchecked" ) public Multimap < String , Processor > getAllRequiredAttributes ( ) { } } | Multimap < String , Processor > requiredInputs = HashMultimap . create ( ) ; for ( ProcessorGraphNode root : this . roots ) { final BiMap < String , String > inputMapper = root . getInputMapper ( ) ; for ( String attr : inputMapper . keySet ( ) ) { requiredInputs . put ( attr , root . getProcessor ( ) ) ; } final Object inputParameter = root . getProcessor ( ) . createInputParameter ( ) ; if ( inputParameter instanceof Values ) { continue ; } else if ( inputParameter != null ) { final Class < ? > inputParameterClass = inputParameter . getClass ( ) ; final Set < String > requiredAttributesDefinedInInputParameter = getAttributeNames ( inputParameterClass , FILTER_ONLY_REQUIRED_ATTRIBUTES ) ; for ( String attName : requiredAttributesDefinedInInputParameter ) { try { if ( inputParameterClass . getField ( attName ) . getType ( ) == Values . class ) { continue ; } } catch ( NoSuchFieldException e ) { throw new RuntimeException ( e ) ; } String mappedName = ProcessorUtils . getInputValueName ( root . getProcessor ( ) . getInputPrefix ( ) , inputMapper , attName ) ; requiredInputs . put ( mappedName , root . getProcessor ( ) ) ; } } } return requiredInputs ; |
public class StringUtils { /** * Sort the array in reverse order . < / br > 反转字符串 。
* @ param string string to be handled . */
public static String reverse ( final String string ) { } } | return isEmpty ( string ) ? string : new StringBuilder ( string ) . reverse ( ) . toString ( ) ; |
public class FetchBeanInfosRenderer { /** * This methods generates the HTML code of the current b : fetchBeanInfos .
* @ param context
* the FacesContext .
* @ param component
* the current b : fetchBeanInfos .
* @ throws IOException
* thrown if something goes wrong when writing the HTML code . */
@ Override public void encodeBegin ( FacesContext context , UIComponent component ) throws IOException { } } | if ( ! component . isRendered ( ) ) { return ; } FetchBeanInfos fetchBeanInfos = ( FetchBeanInfos ) component ; ResponseWriter rw = context . getResponseWriter ( ) ; String clientId = fetchBeanInfos . getClientId ( ) ; boolean validationFailed = context . isValidationFailed ( ) ; Severity maximumSeverity = context . getMaximumSeverity ( ) ; String maximum = "null" ; if ( maximumSeverity != null ) { maximum = String . valueOf ( maximumSeverity . getOrdinal ( ) ) ; } String variables = "bfMaximumMessageSeverity=" + maximum + ";" ; boolean hasFatalError = false ; boolean hasError = false ; boolean hasWarning = false ; boolean hasInfo = false ; List < FacesMessage > messageList = context . getMessageList ( ) ; for ( FacesMessage message : messageList ) { if ( FacesMessage . SEVERITY_FATAL . equals ( message . getSeverity ( ) ) ) { hasFatalError = true ; } else if ( FacesMessage . SEVERITY_ERROR . equals ( message . getSeverity ( ) ) ) { hasError = true ; } else if ( FacesMessage . SEVERITY_WARN . equals ( message . getSeverity ( ) ) ) { hasWarning = true ; } else if ( FacesMessage . SEVERITY_INFO . equals ( message . getSeverity ( ) ) ) { hasInfo = true ; } } variables += "bfHasFatalError=" + hasFatalError + ";" ; variables += "bfHasError=" + hasError + ";" ; variables += "bfHasWarning=" + hasWarning + ";" ; variables += "bfHasInfo=" + hasInfo + ";" ; rw . startElement ( "script" , fetchBeanInfos ) ; rw . writeAttribute ( "id" , clientId , null ) ; rw . writeText ( "validationFailed=" + validationFailed + ";" + variables , null ) ; rw . endElement ( "script" ) ; |
public class AWSIoTAnalyticsClient { /** * Creates a data store , which is a repository for messages .
* @ param createDatastoreRequest
* @ return Result of the CreateDatastore operation returned by the service .
* @ throws InvalidRequestException
* The request was not valid .
* @ throws ResourceAlreadyExistsException
* A resource with the same name already exists .
* @ throws InternalFailureException
* There was an internal failure .
* @ throws ServiceUnavailableException
* The service is temporarily unavailable .
* @ throws ThrottlingException
* The request was denied due to request throttling .
* @ throws LimitExceededException
* The command caused an internal limit to be exceeded .
* @ sample AWSIoTAnalytics . CreateDatastore
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / iotanalytics - 2017-11-27 / CreateDatastore " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public CreateDatastoreResult createDatastore ( CreateDatastoreRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateDatastore ( request ) ; |
public class AbstractConverter { /** * Convert the input object into an output object of the specified type .
* Typical implementations will provide a minimum of { @ code String - - > type } conversion .
* @ param < G > the type in which the provided value has o be converted
* @ param type Data type to which this value should be converted .
* @ param value The input value to be converted .
* @ return The converted value .
* @ deprecated since 3.0M1 overwrite { @ link # convertToType ( Type , Object ) } instead */
@ Deprecated protected < G extends T > G convertToType ( Class < G > type , Object value ) { } } | return convertToType ( ( Type ) type , value ) ; |
public class CommerceDiscountUsageEntryPersistenceImpl { /** * Clears the cache for the commerce discount usage entry .
* The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */
@ Override public void clearCache ( CommerceDiscountUsageEntry commerceDiscountUsageEntry ) { } } | entityCache . removeResult ( CommerceDiscountUsageEntryModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountUsageEntryImpl . class , commerceDiscountUsageEntry . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; |
public class AbstractShellInteraction { /** * Called by { @ link AbstractShellInteraction # promptRequiredMissingValues ( ShellImpl ) } */
protected void promptRequiredMissingValues ( ShellImpl shell , Iterable < InputComponent < ? , ? > > inputs ) throws InterruptedException { } } | ShellUIPromptImpl prompt = shell . createPrompt ( context ) ; for ( InputComponent < ? , ? > input : inputs ) { if ( input . isEnabled ( ) && ! input . isDeprecated ( ) ) { boolean requiredInputMissing = input . isRequired ( ) && ! ( input . hasDefaultValue ( ) || input . hasValue ( ) ) ; Object obj = prompt . promptValueFrom ( input ) ; if ( obj == null && requiredInputMissing ) { // No value returned . Just stop testing other inputs
break ; } } } |
public class ReferenceUtil { /** * 获得引用
* @ param < T > 被引用对象类型
* @ param type 引用类型枚举
* @ param referent 被引用对象
* @ param queue 引用队列
* @ return { @ link Reference } */
public static < T > Reference < T > create ( ReferenceType type , T referent , ReferenceQueue < T > queue ) { } } | switch ( type ) { case SOFT : return new SoftReference < > ( referent ) ; case WEAK : return new WeakReference < > ( referent ) ; case PHANTOM : return new PhantomReference < T > ( referent , queue ) ; default : return null ; } |
public class CommerceWarehouseItemLocalServiceBaseImpl { /** * Returns a range of all the commerce warehouse items .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . model . impl . CommerceWarehouseItemModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce warehouse items
* @ param end the upper bound of the range of commerce warehouse items ( not inclusive )
* @ return the range of commerce warehouse items */
@ Override public List < CommerceWarehouseItem > getCommerceWarehouseItems ( int start , int end ) { } } | return commerceWarehouseItemPersistence . findAll ( start , end ) ; |
public class ClientTable { /** * Move the data source buffer to all the fields .
* In this implementation , move the local copy of the returned datasource to the fields .
* @ return an error code .
* @ exception DBException File exception . */
public int dataToFields ( Rec record ) throws DBException { } } | try { return ( ( BaseBuffer ) m_dataSource ) . bufferToFields ( ( FieldList ) record , DBConstants . DONT_DISPLAY , DBConstants . READ_MOVE ) ; } catch ( Exception ex ) { throw DatabaseException . toDatabaseException ( ex ) ; } |
public class AbstractJavaMetadata { /** * Process the parameterized type of a { @ link FieldDeclaration } .
* @ param fieldDeclaration - the field declaration .
* @ return ParameterizedTypeFieldMetadata . */
protected FieldMetadata processParameterizedType ( FieldDeclaration fieldDeclaration ) { } } | ParameterizedType parameterizedType = ( ParameterizedType ) fieldDeclaration . getType ( ) ; Type typeOfParameterizedType = parameterizedType . getType ( ) ; // type may be a simple type or a qualified type .
FieldMetadata referenceFieldMetadata = createParameterizedFieldMetadataFrom ( typeOfParameterizedType ) ; // modifiers
processModifiersOfFieldDeclaration ( fieldDeclaration , referenceFieldMetadata ) ; // variables
referenceFieldMetadata . setName ( getFieldName ( fieldDeclaration ) ) ; processVariablesOfVariableDeclarationFragment ( fieldDeclaration , referenceFieldMetadata ) ; return referenceFieldMetadata ; |
public class br_vm_template { /** * Use this API to fetch filtered set of br _ vm _ template resources .
* filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */
public static br_vm_template [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | br_vm_template obj = new br_vm_template ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; br_vm_template [ ] response = ( br_vm_template [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class HttpBase { /** * 设置请求头 < br >
* 不覆盖原有请求头
* @ param headers 请求头
* @ return this */
public T header ( Map < String , List < String > > headers ) { } } | return header ( headers , false ) ; |
public class GenericUtils { /** * Helper function to concat two byte [ ] s into a new , larger one .
* @ param src
* @ param dst
* @ param srcPos
* @ param srcLength
* @ param dstPos
* @ param dstLength
* @ return byte [ ] ( null if any errors ) */
static public byte [ ] expandByteArray ( byte [ ] src , byte [ ] dst , int srcPos , int srcLength , int dstPos , int dstLength ) { } } | byte [ ] rc = null ; int totalLen = 0 ; if ( null != src ) { totalLen += srcLength ; } if ( null != dst ) { totalLen += dstLength ; } if ( 0 < totalLen ) { rc = new byte [ totalLen ] ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Created byte[] of size " + totalLen ) ; } try { if ( null != src ) { System . arraycopy ( src , srcPos , rc , 0 , srcLength ) ; } if ( null != dst ) { System . arraycopy ( dst , dstPos , rc , srcLength , dstLength ) ; } } catch ( Exception e ) { // no FFDC required
// any error from arraycopy , we ' ll just return null
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception " + e + " while copying." ) ; } rc = null ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "expandByteArray returning: [" + getEnglishString ( rc ) + "]" ) ; } return rc ; |
public class EqualityInference { /** * Rewrite single value InPredicates as equality if possible */
private static Expression normalizeInPredicateToEquality ( Expression expression ) { } } | if ( expression instanceof InPredicate ) { InPredicate inPredicate = ( InPredicate ) expression ; if ( inPredicate . getValueList ( ) instanceof InListExpression ) { InListExpression valueList = ( InListExpression ) inPredicate . getValueList ( ) ; if ( valueList . getValues ( ) . size ( ) == 1 ) { return new ComparisonExpression ( ComparisonExpression . Operator . EQUAL , inPredicate . getValue ( ) , Iterables . getOnlyElement ( valueList . getValues ( ) ) ) ; } } } return expression ; |
public class TimeUtil { /** * 获取指定格式的SimpleDateFormat
* < p > Function : getDateFormat < / p >
* < p > Description : < / p >
* @ param timeType
* @ return
* @ author acexy @ thankjava . com
* @ date 2015年6月18日 上午10:00:31
* @ version 1.0 */
public static SimpleDateFormat getDateFormat ( TimeType timeType ) { } } | if ( timeType == null ) { timeType = TimeType . DEFAULT ; } SimpleDateFormat sdf = simpleDateFormatMap . get ( timeType ) ; if ( sdf == null ) { sdf = new SimpleDateFormat ( timeType . getType ( ) ) ; simpleDateFormatMap . put ( timeType , sdf ) ; } return sdf ; |
public class NumberHelper { /** * This method retrieves a double value from a String instance .
* It returns zero by default if a null value or an empty string is supplied .
* @ param value string representation of a double
* @ return double value */
public static final double getDouble ( String value ) { } } | return ( value == null || value . length ( ) == 0 ? 0 : Double . parseDouble ( value ) ) ; |
public class GreenPepperXmlRpcServer { /** * { @ inheritDoc } */
public Vector < Object > getSpecificationRepositoriesOfAssociatedProject ( Vector < Object > repositoryParams ) { } } | try { Repository repository = loadRepository ( repositoryParams ) ; Collection < Repository > repositories = service . getSpecificationRepositoriesOfAssociatedProject ( repository . getUid ( ) ) ; log . debug ( "Retrieved Test Repositories Of Associated Project of " + repository . getUid ( ) + " number: " + repositories . size ( ) ) ; return XmlRpcDataMarshaller . toXmlRpcRepositoriesParameters ( repositories ) ; } catch ( Exception e ) { return errorAsVector ( e , RETRIEVE_SPECIFICATION_REPOS ) ; } |
public class FetcherMgrImpl { /** * 根据 URL 从远程 获取Value值 */
public String getValueFromServer ( String url ) throws Exception { } } | // 远程地址
RemoteUrl remoteUrl = new RemoteUrl ( url , hostList ) ; ValueVo confItemVo = restfulMgr . getJsonData ( ValueVo . class , remoteUrl , retryTime , retrySleepSeconds ) ; LOGGER . debug ( "remote server return: " + confItemVo . toString ( ) ) ; if ( confItemVo . getStatus ( ) . equals ( Constants . NOTOK ) ) { throw new Exception ( "status is not ok." ) ; } return confItemVo . getValue ( ) ; |
public class RaftState { /** * Initializes the last applied group members with the members and logIndex .
* This method expects there ' s no uncommitted membership changes , committed members are the same as
* the last applied members .
* Leader state is updated for the members which don ' t exist in committed members and committed members
* those don ' t exist in latest applied members are removed .
* @ param logIndex log index of membership change
* @ param members latest applied members */
public void updateGroupMembers ( long logIndex , Collection < Endpoint > members ) { } } | assert committedGroupMembers == lastGroupMembers : "Cannot update group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " is different than committed group members: " + committedGroupMembers ; assert lastGroupMembers . index ( ) < logIndex : "Cannot update group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " has a bigger log index." ; RaftGroupMembers newGroupMembers = new RaftGroupMembers ( logIndex , members , localEndpoint ) ; committedGroupMembers = lastGroupMembers ; lastGroupMembers = newGroupMembers ; if ( leaderState != null ) { for ( Endpoint endpoint : members ) { if ( ! committedGroupMembers . isKnownMember ( endpoint ) ) { leaderState . add ( endpoint , log . lastLogOrSnapshotIndex ( ) ) ; } } for ( Endpoint endpoint : committedGroupMembers . remoteMembers ( ) ) { if ( ! members . contains ( endpoint ) ) { leaderState . remove ( endpoint ) ; } } } |
public class SieveOfEratosthenes { /** * Implementation of Sieve of Eratosthenes
* http : / / en . wikipedia . org / wiki / Sieve _ of _ Eratosthenes */
public static PrimeNumberSieve getInstance ( ) { } } | return new PrimeNumberSieve ( ) { @ Override public PSArray < Integer > calcList ( int max ) { boolean [ ] prime = new boolean [ max + 1 ] ; Arrays . fill ( prime , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int i = 2 ; i <= max ; i ++ ) if ( prime [ i ] ) for ( int j = i + i ; j <= max ; j += i ) prime [ j ] = false ; return toArray ( max , prime ) ; } } ; |
public class SimpleItemExporter { /** * { @ inheritDoc } */
@ Override protected boolean beforeExport ( ) { } } | if ( null == titles ) { String contextTitle = context . get ( "titles" , String . class ) ; if ( null != contextTitle ) { titles = Strings . split ( contextTitle , "," ) ; } } if ( null == titles || titles . length == 0 ) return false ; writer . writeTitle ( null , titles ) ; return true ; |
public class ModelsImpl { /** * Adds a pattern . any entity extractor to the application .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param extractorCreateObject A model object containing the name and explicit list for the new Pattern . Any entity extractor .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the UUID object */
public Observable < ServiceResponse < UUID > > createPatternAnyEntityModelWithServiceResponseAsync ( UUID appId , String versionId , PatternAnyModelCreateObject extractorCreateObject ) { } } | if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } if ( extractorCreateObject == null ) { throw new IllegalArgumentException ( "Parameter extractorCreateObject is required and cannot be null." ) ; } Validator . validate ( extractorCreateObject ) ; String parameterizedHost = Joiner . on ( ", " ) . join ( "{Endpoint}" , this . client . endpoint ( ) ) ; return service . createPatternAnyEntityModel ( appId , versionId , extractorCreateObject , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < UUID > > > ( ) { @ Override public Observable < ServiceResponse < UUID > > call ( Response < ResponseBody > response ) { try { ServiceResponse < UUID > clientResponse = createPatternAnyEntityModelDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class NetworkConfig { /** * Returns the current { @ link SSLConfig } . It is possible that null is returned if no SSLConfig has been set .
* @ return the SSLConfig
* @ see # setSSLConfig ( SSLConfig )
* @ throws SecurityException If a security manager exists and the calling method doesn ' t have corresponding
* { @ link HazelcastRuntimePermission } */
public SSLConfig getSSLConfig ( ) { } } | SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { sm . checkPermission ( new HazelcastRuntimePermission ( "com.hazelcast.config.NetworkConfig.getSSLConfig" ) ) ; } return sslConfig ; |
public class RandomUtils { /** * Generates a number random bytes specified by the user
* @ return byte array representation of random bytes */
public static byte [ ] randomBytes ( int n ) { } } | byte [ ] buffer = new byte [ n ] ; if ( RandomUtils . secureRandom == null ) { try { RandomUtils . secureRandom = SecureRandom . getInstance ( ALGORITHM ) ; } catch ( NoSuchAlgorithmException e ) { e . printStackTrace ( ) ; } } RandomUtils . secureRandom . nextBytes ( buffer ) ; return buffer ; |
public class GetPlanRequest { /** * The target tables .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSinks ( java . util . Collection ) } or { @ link # withSinks ( java . util . Collection ) } if you want to override the
* existing values .
* @ param sinks
* The target tables .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetPlanRequest withSinks ( CatalogEntry ... sinks ) { } } | if ( this . sinks == null ) { setSinks ( new java . util . ArrayList < CatalogEntry > ( sinks . length ) ) ; } for ( CatalogEntry ele : sinks ) { this . sinks . add ( ele ) ; } return this ; |
public class MCDImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . MCD__RG : getRG ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ; |
public class ZipFileIndexCache { /** * Returns a list of all ZipFileIndex entries
* @ param openedOnly If true it returns a list of only opened ZipFileIndex entries , otherwise
* all ZipFileEntry ( s ) are included into the list .
* @ return A list of ZipFileIndex entries , or an empty list */
public synchronized List < ZipFileIndex > getZipFileIndexes ( boolean openedOnly ) { } } | List < ZipFileIndex > zipFileIndexes = new ArrayList < ZipFileIndex > ( ) ; zipFileIndexes . addAll ( map . values ( ) ) ; if ( openedOnly ) { for ( ZipFileIndex elem : zipFileIndexes ) { if ( ! elem . isOpen ( ) ) { zipFileIndexes . remove ( elem ) ; } } } return zipFileIndexes ; |
public class LifecyclePolicyPreviewResultMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LifecyclePolicyPreviewResult lifecyclePolicyPreviewResult , ProtocolMarshaller protocolMarshaller ) { } } | if ( lifecyclePolicyPreviewResult == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( lifecyclePolicyPreviewResult . getImageTags ( ) , IMAGETAGS_BINDING ) ; protocolMarshaller . marshall ( lifecyclePolicyPreviewResult . getImageDigest ( ) , IMAGEDIGEST_BINDING ) ; protocolMarshaller . marshall ( lifecyclePolicyPreviewResult . getImagePushedAt ( ) , IMAGEPUSHEDAT_BINDING ) ; protocolMarshaller . marshall ( lifecyclePolicyPreviewResult . getAction ( ) , ACTION_BINDING ) ; protocolMarshaller . marshall ( lifecyclePolicyPreviewResult . getAppliedRulePriority ( ) , APPLIEDRULEPRIORITY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GetCostForecastResult { /** * The forecasts for your query , in order . For < code > DAILY < / code > forecasts , this is a list of days . For
* < code > MONTHLY < / code > forecasts , this is a list of months .
* @ param forecastResultsByTime
* The forecasts for your query , in order . For < code > DAILY < / code > forecasts , this is a list of days . For
* < code > MONTHLY < / code > forecasts , this is a list of months . */
public void setForecastResultsByTime ( java . util . Collection < ForecastResult > forecastResultsByTime ) { } } | if ( forecastResultsByTime == null ) { this . forecastResultsByTime = null ; return ; } this . forecastResultsByTime = new java . util . ArrayList < ForecastResult > ( forecastResultsByTime ) ; |
public class GISCoordinates { /** * This function convert WSG84 GPS coordinate to France Lambert IV coordinate .
* @ param lambda in degrees .
* @ param phi in degrees .
* @ return the France Lambert IV coordinates . */
public static Point2d WSG84_L4 ( double lambda , double phi ) { } } | final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi ( lambda , phi ) ; return NTFLambdaPhi_NTFLambert ( ntfLambdaPhi . getX ( ) , ntfLambdaPhi . getY ( ) , LAMBERT_4_N , LAMBERT_4_C , LAMBERT_4_XS , LAMBERT_4_YS ) ; |
public class ReflectionUtils { /** * Get only the first Level of Nested Reference Attributes from a given class
* @ param clazz
* @ return List < Field > of referenced fields */
public static List < Field > getFirstLevelOfReferenceAttributes ( Class < ? > clazz ) { } } | List < Field > references = new ArrayList < Field > ( ) ; List < String > referencedFields = ReflectionUtils . getReferencedAttributeNames ( clazz ) ; for ( String eachReference : referencedFields ) { Field referenceField = ReflectionUtils . getField ( clazz , eachReference ) ; references . add ( referenceField ) ; } return references ; |
public class Values { /** * Get a value as a string .
* @ param key the key for looking up the value .
* @ param type the type of the object
* @ param < V > the type */
public < V > V getObject ( final String key , final Class < V > type ) { } } | final Object obj = this . values . get ( key ) ; return type . cast ( obj ) ; |
public class SoapWebServiceAdapter { /** * The SOAPAction HTTP request header value . */
protected String getSoapAction ( ) { } } | String soapAction = null ; try { soapAction = getAttributeValueSmart ( SOAP_ACTION ) ; } catch ( PropertyException ex ) { logger . severeException ( ex . getMessage ( ) , ex ) ; } if ( soapAction == null ) { // required by SOAP 1.1 ( http : / / www . w3 . org / TR / soap11 / # _ Toc478383528)
String soapVersion = getSoapVersion ( ) ; if ( soapVersion != null && soapVersion . equals ( SOAP_VERSION_11 ) ) soapAction = "" ; } return soapAction ; |
public class SharedPreferenceUtils { /** * put the string value to shared preference
* @ param key
* the name of the preference to save
* @ param value
* the name of the preference to modify .
* @ see android . content . SharedPreferences # edit ( ) # putString ( String , String ) */
public void putString ( String key , String value ) { } } | sharedPreferences . edit ( ) . putString ( key , value ) . commit ( ) ; |
public class VertxJdbcResultSet { /** * Vert . x turns byte [ ] into a B64 encoded string . Reverse it .
* @ see io . apiman . gateway . engine . components . jdbc . IJdbcResultSet # getBytes ( int ) */
@ Override public byte [ ] getBytes ( int index ) { } } | String b64String = rows . get ( row ) . getString ( index ) ; return Base64 . getDecoder ( ) . decode ( b64String ) ; |
public class JobGraph { /** * Adds the path of a JAR file required to run the job on a task manager .
* @ param jar
* path of the JAR file required to run the job on a task manager */
public void addJar ( Path jar ) { } } | if ( jar == null ) { throw new IllegalArgumentException ( ) ; } if ( ! userJars . contains ( jar ) ) { userJars . add ( jar ) ; } |
public class JSTypeRegistry { /** * Creates a constructor function type .
* @ param name the function ' s name or { @ code null } to indicate that the function is anonymous .
* @ param source the node defining this function . Its type ( { @ link Node # getToken ( ) } ( ) } ) must be
* { @ link Token # FUNCTION } .
* @ param parameters the function ' s parameters or { @ code null } to indicate that the parameter
* types are unknown .
* @ param returnType the function ' s return type or { @ code null } to indicate that the return type
* is unknown .
* @ param templateKeys the templatized types for the class .
* @ param isAbstract whether the function type represents an abstract class */
public FunctionType createConstructorType ( String name , Node source , Node parameters , JSType returnType , ImmutableList < TemplateType > templateKeys , boolean isAbstract ) { } } | checkArgument ( source == null || source . isFunction ( ) || source . isClass ( ) ) ; return FunctionType . builder ( this ) . forConstructor ( ) . withName ( name ) . withSourceNode ( source ) . withParamsNode ( parameters ) . withReturnType ( returnType ) . withTemplateKeys ( templateKeys ) . withIsAbstract ( isAbstract ) . build ( ) ; |
public class KamDialect { /** * { @ inheritDoc } */
@ Override public KamEdge replaceEdge ( KamEdge kamEdge , KamEdge replacement ) { } } | return kam . replaceEdge ( kamEdge , replacement ) ; |
public class Compose { /** * Executes a compose of fst1 o fst2 , with fst2 being a precomputed / preprocessed fst ( for performance reasons )
* @ param fst1 outer fst
* @ param fst2 inner fst
* @ param useSorted if true , then performance will be faster ; NOTE fst1 must be sorted by OUTPUT labels
* @ param trimOutput if true , then output will be trimmed before returning
* @ return */
public static MutableFst composeWithPrecomputed ( MutableFst fst1 , PrecomputedComposeFst fst2 , boolean useSorted , boolean trimOutput ) { } } | fst1 . throwIfInvalid ( ) ; if ( useSorted ) { if ( fst1 . getOutputSymbols ( ) != fst2 . getFstInputSymbolsAsFrozen ( ) && fst1 . getOutputSymbols ( ) != fst2 . getFst ( ) . getInputSymbols ( ) ) { throw new IllegalArgumentException ( "When using the precomputed and useSorted optimization, you must have " + "the outer's output symbol be the same symbol table as the inner's input" ) ; } } Semiring semiring = fst2 . getSemiring ( ) ; augment ( AugmentLabels . OUTPUT , fst1 , semiring , fst2 . getEps1 ( ) , fst2 . getEps2 ( ) ) ; if ( useSorted ) { ArcSort . sortByOutput ( fst1 ) ; } ImmutableFst filter = fst2 . getFilterFst ( ) ; MutableFst tmp = Compose . doCompose ( fst1 , filter , semiring , useSorted ) ; if ( useSorted ) { ArcSort . sortByOutput ( tmp ) ; } MutableFst res = Compose . doCompose ( tmp , fst2 . getFst ( ) , semiring , useSorted ) ; // definitionally the output of compose should be trimmed , but if you don ' t care , you can save some cpu
if ( trimOutput ) { Connect . apply ( res ) ; } return res ; |
public class PolylineUtils { /** * Square distance from a point to a segment .
* @ param point { @ link Point } whose distance from segment needs to be determined
* @ param p1 , p2 points defining the segment
* @ return square of the distance between first input point and segment defined by
* other two input points */
private static double getSqSegDist ( Point point , Point p1 , Point p2 ) { } } | double horizontal = p1 . longitude ( ) ; double vertical = p1 . latitude ( ) ; double diffHorizontal = p2 . longitude ( ) - horizontal ; double diffVertical = p2 . latitude ( ) - vertical ; if ( diffHorizontal != 0 || diffVertical != 0 ) { double total = ( ( point . longitude ( ) - horizontal ) * diffHorizontal + ( point . latitude ( ) - vertical ) * diffVertical ) / ( diffHorizontal * diffHorizontal + diffVertical * diffVertical ) ; if ( total > 1 ) { horizontal = p2 . longitude ( ) ; vertical = p2 . latitude ( ) ; } else if ( total > 0 ) { horizontal += diffHorizontal * total ; vertical += diffVertical * total ; } } diffHorizontal = point . longitude ( ) - horizontal ; diffVertical = point . latitude ( ) - vertical ; return diffHorizontal * diffHorizontal + diffVertical * diffVertical ; |
public class PresizeCollections { /** * implements the visitor to look for creation of collections that are then populated with a known number of elements usually based on another collection ,
* but the new collection is not presized .
* @ param seen
* the opcode of the currently parsed instruction */
@ edu . umd . cs . findbugs . annotations . SuppressFBWarnings ( value = "CLI_CONSTANT_LIST_INDEX" , justification = "Constrained by FindBugs API" ) @ Override public void sawOpcode ( int seen ) { } } | PSCUserValue userValue = null ; boolean sawAlloc = false ; try { stack . precomputation ( this ) ; switch ( seen ) { case Const . INVOKESPECIAL : String clsName = getClassConstantOperand ( ) ; if ( PRESIZEABLE_COLLECTIONS . contains ( clsName ) ) { String methodName = getNameConstantOperand ( ) ; if ( Values . CONSTRUCTOR . equals ( methodName ) ) { String signature = getSigConstantOperand ( ) ; if ( SignatureBuilder . SIG_VOID_TO_VOID . equals ( signature ) ) { userValue = new PSCUserValue ( Integer . valueOf ( nextAllocNumber ++ ) ) ; sawAlloc = true ; } else if ( guavaOnPath && ( stack . getStackDepth ( ) > 0 ) ) { FQMethod fqMethod = new FQMethod ( clsName , methodName , signature ) ; if ( HASHMAP_SIZED_CTOR . equals ( fqMethod ) || HASHSET_SIZED_CTOR . equals ( fqMethod ) ) { OpcodeStack . Item itm = stack . getStackItem ( 0 ) ; XMethod xm = itm . getReturnValueOf ( ) ; if ( ( xm != null ) && "size" . equals ( xm . getMethodDescriptor ( ) . getName ( ) ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . PSC_SUBOPTIMAL_COLLECTION_SIZING . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this ) ) ; } } } } } break ; case Const . INVOKEINTERFACE : String methodName = getNameConstantOperand ( ) ; if ( ITERATOR_METHOD . equals ( new QMethod ( methodName , getSigConstantOperand ( ) ) ) ) { if ( stack . getStackDepth ( ) > 0 ) { OpcodeStack . Item itm = stack . getStackItem ( 0 ) ; userValue = isSizedSource ( itm ) ; } } else if ( ITERATOR_HASNEXT . equals ( new FQMethod ( getClassConstantOperand ( ) , methodName , getSigConstantOperand ( ) ) ) ) { if ( stack . getStackDepth ( ) > 0 ) { OpcodeStack . Item itm = stack . getStackItem ( 0 ) ; userValue = ( PSCUserValue ) itm . getUserValue ( ) ; } } else if ( "add" . equals ( methodName ) || "addAll" . equals ( methodName ) ) { String signature = getSigConstantOperand ( ) ; int numArguments = SignatureUtils . getNumParameters ( signature ) ; if ( ( numArguments == 1 ) && ( stack . getStackDepth ( ) > 1 ) ) { OpcodeStack . Item item = stack . getStackItem ( 1 ) ; PSCUserValue uv = ( PSCUserValue ) item . getUserValue ( ) ; if ( uv != null ) { Integer allocNum = uv . getAllocationNumber ( ) ; if ( allocNum != null ) { if ( "addAll" . equals ( methodName ) ) { allocToAddPCs . remove ( allocNum ) ; } else { List < Integer > lines = allocToAddPCs . get ( allocNum ) ; if ( lines == null ) { lines = new ArrayList < > ( ) ; allocToAddPCs . put ( allocNum , lines ) ; } lines . add ( Integer . valueOf ( getPC ( ) ) ) ; } } } } } else if ( "put" . equals ( methodName ) || "putAll" . equals ( methodName ) ) { String signature = getSigConstantOperand ( ) ; int numArguments = SignatureUtils . getNumParameters ( signature ) ; if ( ( numArguments == 2 ) && ( stack . getStackDepth ( ) > 2 ) ) { OpcodeStack . Item item = stack . getStackItem ( 2 ) ; PSCUserValue uv = ( PSCUserValue ) item . getUserValue ( ) ; if ( uv != null ) { Integer allocNum = uv . getAllocationNumber ( ) ; if ( allocNum != null ) { if ( "putAll" . equals ( methodName ) ) { allocToAddPCs . remove ( allocNum ) ; } else { List < Integer > lines = allocToAddPCs . get ( allocNum ) ; if ( lines == null ) { lines = new ArrayList < > ( ) ; allocToAddPCs . put ( allocNum , lines ) ; } lines . add ( Integer . valueOf ( getPC ( ) ) ) ; } } } } } break ; case Const . INVOKESTATIC : FQMethod fqm = new FQMethod ( getClassConstantOperand ( ) , getNameConstantOperand ( ) , getSigConstantOperand ( ) ) ; if ( STATIC_COLLECTION_FACTORIES . contains ( fqm ) ) { userValue = new PSCUserValue ( Integer . valueOf ( nextAllocNumber ++ ) ) ; sawAlloc = true ; } break ; case Const . LOOKUPSWITCH : case Const . TABLESWITCH : int [ ] offsets = getSwitchOffsets ( ) ; if ( offsets . length >= 2 ) { int pc = getPC ( ) ; int thisOffset = pc + offsets [ 0 ] ; for ( int o = 0 ; o < ( offsets . length - 1 ) ; o ++ ) { int nextOffset = offsets [ o + 1 ] + pc ; CodeRange db = new CodeRange ( thisOffset , nextOffset , false ) ; optionalRanges . add ( db ) ; thisOffset = nextOffset ; } } break ; case Const . IFEQ : case Const . IFNE : case Const . IFLT : case Const . IFLE : case Const . IF_ICMPEQ : case Const . IF_ICMPNE : case Const . IF_ICMPLT : case Const . IF_ICMPGE : case Const . IF_ICMPGT : case Const . IF_ICMPLE : case Const . IF_ACMPEQ : case Const . IF_ACMPNE : case Const . GOTO : case Const . GOTO_W : if ( getBranchOffset ( ) < 0 ) { if ( branchBasedOnUnsizedObject ( seen ) ) { break ; } int target = getBranchTarget ( ) ; Iterator < Map . Entry < Integer , List < Integer > > > it = allocToAddPCs . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry < Integer , List < Integer > > entry = it . next ( ) ; Integer allocLoc = allocLocation . get ( entry . getKey ( ) ) ; if ( ( allocLoc != null ) && ( allocLoc . intValue ( ) < target ) ) { List < Integer > pcs = entry . getValue ( ) ; for ( int pc : pcs ) { if ( pc > target ) { if ( hasSinglePossiblySizedBranch ( allocLoc . intValue ( ) , pc ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . PSC_PRESIZE_COLLECTIONS . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this , pc ) ) ; it . remove ( ) ; } break ; } } } } } else { CodeRange db = new CodeRange ( getPC ( ) , getBranchTarget ( ) , ! branchBasedOnUnsizedObject ( seen ) ) ; optionalRanges . add ( db ) ; } break ; case Const . IFNULL : case Const . IFNONNULL : case Const . IFGE : case Const . IFGT : // null check and > , > = branches are hard to presize
if ( getBranchOffset ( ) > 0 ) { CodeRange db = new CodeRange ( getPC ( ) , getBranchTarget ( ) , false ) ; optionalRanges . add ( db ) ; } break ; case Const . ASTORE : case Const . ASTORE_0 : case Const . ASTORE_1 : case Const . ASTORE_2 : case Const . ASTORE_3 : { if ( stack . getStackDepth ( ) > 0 ) { PSCUserValue uv = ( PSCUserValue ) stack . getStackItem ( 0 ) . getUserValue ( ) ; if ( uv != null ) { storeToUserValue . put ( getRegisterOperand ( ) , uv ) ; } } } break ; case Const . ALOAD : case Const . ALOAD_0 : case Const . ALOAD_1 : case Const . ALOAD_2 : case Const . ALOAD_3 : { userValue = storeToUserValue . get ( getRegisterOperand ( ) ) ; } break ; case Const . PUTFIELD : { if ( stack . getStackDepth ( ) > 0 ) { PSCUserValue uv = ( PSCUserValue ) stack . getStackItem ( 0 ) . getUserValue ( ) ; if ( uv != null ) { storeToUserValue . put ( getNameConstantOperand ( ) , uv ) ; } } } break ; case Const . GETFIELD : { userValue = storeToUserValue . get ( getNameConstantOperand ( ) ) ; } break ; } } finally { stack . sawOpcode ( this , seen ) ; if ( ( userValue != null ) && ( stack . getStackDepth ( ) > 0 ) ) { OpcodeStack . Item item = stack . getStackItem ( 0 ) ; item . setUserValue ( userValue ) ; if ( sawAlloc ) { allocLocation . put ( userValue . getAllocationNumber ( ) , Integer . valueOf ( getPC ( ) ) ) ; } } } |
public class GhostMe { /** * Check if the IP is in a blacklist
* @ param ip IP to check
* @ return whether the ip is blacklisted or not */
public synchronized static boolean isBlacklisted ( String ip ) { } } | if ( blacklistCache == null || blacklistCache . isEmpty ( ) ) { blacklistCache = new HashSet < > ( ) ; for ( IBlackListProvider provider : BLACKLIST_PROVIDERS ) { try { blacklistCache . addAll ( provider . getIPs ( ) ) ; } catch ( IOException e ) { LOGGER . warn ( "Error fetching blacklist records" , e ) ; } } } return blacklistCache . contains ( ip ) ; |
public class BigtableVeneerSettingsFactory { /** * Creates { @ link CredentialsProvider } based on { @ link CredentialOptions } . */
private static CredentialsProvider buildCredentialProvider ( CredentialOptions credentialOptions ) throws IOException { } } | try { final Credentials credentials = CredentialFactory . getCredentials ( credentialOptions ) ; if ( credentials == null ) { LOG . info ( "Enabling the use of null credentials. This should not be used in production." ) ; return NoCredentialsProvider . create ( ) ; } return FixedCredentialsProvider . create ( credentials ) ; } catch ( GeneralSecurityException exception ) { throw new IOException ( "Could not initialize credentials." , exception ) ; } |
public class SenBotReferenceService { /** * Find a { @ link GenericUser } by its reference name
* @ param userType
* @ return { @ link GenericUser } */
public GenericUser getUserForUserReference ( String userReference ) { } } | GenericUser user = getReference ( GenericUser . class , userReference ) ; if ( user == null ) { fail ( "No user of type '" + userReference + "' is found. Available user references are: " + getObjectReferenceMap ( GenericUser . class ) . keySet ( ) . toString ( ) ) ; } return user ; |
public class ArrayOfDoublesUpdatableSketch { /** * Updates this sketch with a byte [ ] key and double values .
* The values will be stored or added to the ones associated with the key
* @ param key The given byte [ ] key
* @ param values The given values */
public void update ( final byte [ ] key , final double [ ] values ) { } } | if ( key == null || key . length == 0 ) { return ; } insertOrIgnore ( MurmurHash3 . hash ( key , seed_ ) [ 0 ] >>> 1 , values ) ; |
public class UserHandlerImpl { /** * Persists new user . */
private void createUser ( Session session , UserImpl user , boolean broadcast ) throws Exception { } } | Node userStorageNode = utils . getUsersStorageNode ( session ) ; Node userNode = userStorageNode . addNode ( user . getUserName ( ) ) ; if ( user . getCreatedDate ( ) == null ) { Calendar calendar = Calendar . getInstance ( ) ; user . setCreatedDate ( calendar . getTime ( ) ) ; } user . setInternalId ( userNode . getUUID ( ) ) ; if ( broadcast ) { preSave ( user , true ) ; } writeUser ( user , userNode ) ; session . save ( ) ; putInCache ( user ) ; if ( broadcast ) { postSave ( user , true ) ; } |
public class ConnectionDataGroup { /** * Remove the connection from the group
* @ param cd */
public void removeConnectionDataFromGroup ( ConnectionData cd ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeConnectionDataFromGroup" , new Object [ ] { cd } ) ; boolean removed = false ; synchronized ( connectionData ) { removed = connectionData . remove ( cd ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeConnectionDataFromGroup" , new Object [ ] { removed } ) ; |
public class EmptyFieldsCountAccumulator { @ SuppressWarnings ( "unchecked" ) private static DataSet < StringTriple > getDataSet ( ExecutionEnvironment env , ParameterTool params ) { } } | if ( params . has ( "input" ) ) { return env . readCsvFile ( params . get ( "input" ) ) . fieldDelimiter ( ";" ) . pojoType ( StringTriple . class ) ; } else { System . out . println ( "Executing EmptyFieldsCountAccumulator example with default input data set." ) ; System . out . println ( "Use --input to specify file input." ) ; return env . fromCollection ( getExampleInputTuples ( ) ) ; } |
public class AnnotationUtils { /** * Returns the annotation object for the specified annotation class of the
* method if it can be found , otherwise null . The annotation is searched in
* the method which and if a stereotype annotation is found , the annotations
* present on an annotation are also examined . If the annotation can not be
* found , null is returned .
* @ param < T > The annotation type
* @ param m The method in which to look for the annotation
* @ param annotationClazz The type of the annotation to look for
* @ return The annotation with the given type if found , otherwise null */
public static < T extends Annotation > T findAnnotation ( Method m , Class < T > annotationClazz ) { } } | T annotation = m . getAnnotation ( annotationClazz ) ; if ( annotation != null ) { return annotation ; } if ( stereotypeAnnotationClass != null ) { List < Class < ? > > annotations = new ArrayList < > ( ) ; for ( Annotation a : m . getAnnotations ( ) ) { annotations . add ( a . annotationType ( ) ) ; } return findAnnotation ( annotations , annotationClazz ) ; } return null ; |
public class CommerceAvailabilityEstimatePersistenceImpl { /** * Creates a new commerce availability estimate with the primary key . Does not add the commerce availability estimate to the database .
* @ param commerceAvailabilityEstimateId the primary key for the new commerce availability estimate
* @ return the new commerce availability estimate */
@ Override public CommerceAvailabilityEstimate create ( long commerceAvailabilityEstimateId ) { } } | CommerceAvailabilityEstimate commerceAvailabilityEstimate = new CommerceAvailabilityEstimateImpl ( ) ; commerceAvailabilityEstimate . setNew ( true ) ; commerceAvailabilityEstimate . setPrimaryKey ( commerceAvailabilityEstimateId ) ; String uuid = PortalUUIDUtil . generate ( ) ; commerceAvailabilityEstimate . setUuid ( uuid ) ; commerceAvailabilityEstimate . setCompanyId ( companyProvider . getCompanyId ( ) ) ; return commerceAvailabilityEstimate ; |
public class ApiOvhHostingprivateDatabase { /** * Dumps available for your private database service
* REST : GET / hosting / privateDatabase / { serviceName } / dump
* @ param databaseName [ required ] Filter the value of databaseName property ( like )
* @ param orphan [ required ] Filter the value of orphan property ( = )
* @ param serviceName [ required ] The internal name of your private database */
public ArrayList < Long > serviceName_dump_GET ( String serviceName , String databaseName , Boolean orphan ) throws IOException { } } | String qPath = "/hosting/privateDatabase/{serviceName}/dump" ; StringBuilder sb = path ( qPath , serviceName ) ; query ( sb , "databaseName" , databaseName ) ; query ( sb , "orphan" , orphan ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t3 ) ; |
public class Admin { /** * @ throws PageException */
private void doGetMapping ( ) throws PageException { } } | Mapping [ ] mappings = config . getMappings ( ) ; Struct sct = new StructImpl ( ) ; String virtual = getString ( "admin" , action , "virtual" ) ; for ( int i = 0 ; i < mappings . length ; i ++ ) { MappingImpl m = ( MappingImpl ) mappings [ i ] ; if ( ! m . getVirtual ( ) . equals ( virtual ) ) continue ; sct . set ( "archive" , m . getArchive ( ) ) ; sct . set ( "strarchive" , m . getStrArchive ( ) ) ; sct . set ( "physical" , m . getPhysical ( ) ) ; sct . set ( "strphysical" , m . getStrPhysical ( ) ) ; sct . set ( "virtual" , m . getVirtual ( ) ) ; sct . set ( KeyConstants . _hidden , Caster . toBoolean ( m . isHidden ( ) ) ) ; sct . set ( "physicalFirst" , Caster . toBoolean ( m . isPhysicalFirst ( ) ) ) ; sct . set ( "readonly" , Caster . toBoolean ( m . isReadonly ( ) ) ) ; sct . set ( "inspect" , ConfigWebUtil . inspectTemplate ( m . getInspectTemplateRaw ( ) , "" ) ) ; sct . set ( "toplevel" , Caster . toBoolean ( m . isTopLevel ( ) ) ) ; pageContext . setVariable ( getString ( "admin" , action , "returnVariable" ) , sct ) ; return ; } throw new ApplicationException ( "there is no mapping with virtual [" + virtual + "]" ) ; |
public class Apptentive { /** * Retrieves the user ' s name . This name may be set via { @ link # setPersonName ( String ) } ,
* or by the user through Message Center .
* @ return The person ' s name if set , else null . */
public static String getPersonName ( ) { } } | try { if ( ApptentiveInternal . isApptentiveRegistered ( ) ) { ConversationProxy conversation = ApptentiveInternal . getInstance ( ) . getConversationProxy ( ) ; if ( conversation != null ) { return conversation . getPersonName ( ) ; } } } catch ( Exception e ) { ApptentiveLog . e ( CONVERSATION , "Exception while getting person name" ) ; logException ( e ) ; } return null ; |
public class LanguageTranslator { /** * List identifiable languages .
* Lists the languages that the service can identify . Returns the language code ( for example , ` en ` for English or ` es `
* for Spanish ) and name of each language .
* @ param listIdentifiableLanguagesOptions the { @ link ListIdentifiableLanguagesOptions } containing the options for the
* call
* @ return a { @ link ServiceCall } with a response type of { @ link IdentifiableLanguages } */
public ServiceCall < IdentifiableLanguages > listIdentifiableLanguages ( ListIdentifiableLanguagesOptions listIdentifiableLanguagesOptions ) { } } | String [ ] pathSegments = { "v3/identifiable_languages" } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "language_translator" , "v3" , "listIdentifiableLanguages" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( listIdentifiableLanguagesOptions != null ) { } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( IdentifiableLanguages . class ) ) ; |
public class Main { /** * Main entry point .
* Process arguments as would a normal Java program . Also
* create a new Context and associate it with the current thread .
* Then set up the execution environment and begin to
* execute scripts . */
public static void main ( String args [ ] ) { } } | try { if ( Boolean . getBoolean ( "rhino.use_java_policy_security" ) ) { initJavaPolicySecuritySupport ( ) ; } } catch ( SecurityException ex ) { ex . printStackTrace ( System . err ) ; } int result = exec ( args ) ; if ( result != 0 ) { System . exit ( result ) ; } |
public class Output { /** * { @ inheritDoc } */
@ Override public void writeMap ( Collection < ? > array ) { } } | writeAMF3 ( ) ; buf . put ( AMF3 . TYPE_ARRAY ) ; if ( hasReference ( array ) ) { putInteger ( getReferenceId ( array ) << 1 ) ; return ; } storeReference ( array ) ; // TODO : we could optimize this by storing the first integer
// keys after the key - value pairs
amf3_mode += 1 ; putInteger ( 1 ) ; int idx = 0 ; for ( Object item : array ) { if ( item != null ) { putString ( String . valueOf ( idx ) ) ; Serializer . serialize ( this , item ) ; } idx ++ ; } amf3_mode -= 1 ; putString ( "" ) ; |
public class TextToSpeech { /** * Get a custom word .
* Gets the translation for a single word from the specified custom model . The output shows the translation as it is
* defined in the model . You must use credentials for the instance of the service that owns a model to list its words .
* * * Note : * * This method is currently a beta release .
* * * See also : * * [ Querying a single word from a custom
* model ] ( https : / / cloud . ibm . com / docs / services / text - to - speech / custom - entries . html # cuWordQueryModel ) .
* @ param getWordOptions the { @ link GetWordOptions } containing the options for the call
* @ return a { @ link ServiceCall } with a response type of { @ link Translation } */
public ServiceCall < Translation > getWord ( GetWordOptions getWordOptions ) { } } | Validator . notNull ( getWordOptions , "getWordOptions cannot be null" ) ; String [ ] pathSegments = { "v1/customizations" , "words" } ; String [ ] pathParameters = { getWordOptions . customizationId ( ) , getWordOptions . word ( ) } ; RequestBuilder builder = RequestBuilder . get ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "text_to_speech" , "v1" , "getWord" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Translation . class ) ) ; |
public class TileWriter { /** * Write the tile table tile image set within the GeoPackage file to the
* provided directory
* @ param geoPackage
* open GeoPackage
* @ param tileTable
* tile table
* @ param directory
* output directory
* @ param imageFormat
* image format
* @ param width
* optional image width
* @ param height
* optional image height
* @ param tileType
* tile type
* @ param rawImage
* use raw image flag
* @ throws IOException
* upon failure
* @ since 1.2.0 */
public static void writeTiles ( GeoPackage geoPackage , String tileTable , File directory , String imageFormat , Integer width , Integer height , TileFormatType tileType , boolean rawImage ) throws IOException { } } | // Get a tile data access object for the tile table
TileDao tileDao = geoPackage . getTileDao ( tileTable ) ; // If no format , use the default
if ( imageFormat == null ) { imageFormat = DEFAULT_IMAGE_FORMAT ; } // If no tiles type , use the default
if ( tileType == null ) { tileType = DEFAULT_TILE_TYPE ; } LOGGER . log ( Level . INFO , "GeoPackage: " + geoPackage . getName ( ) + ", Tile Table: " + tileTable + ", Output Directory: " + directory + ( rawImage ? ", Raw Images" : "" ) + ", Image Format: " + imageFormat + ", Image Width: " + width + ", Image Height: " + height + ", Tiles Type: " + tileType + ", Tile Zoom Range: " + tileDao . getMinZoom ( ) + " - " + tileDao . getMaxZoom ( ) ) ; int totalCount = 0 ; switch ( tileType ) { case GEOPACKAGE : totalCount = writeGeoPackageFormatTiles ( tileDao , directory , imageFormat , width , height , rawImage ) ; break ; case STANDARD : case TMS : totalCount = writeFormatTiles ( tileDao , directory , imageFormat , width , height , tileType , rawImage ) ; break ; default : throw new UnsupportedOperationException ( "Tile Type Not Supported: " + tileType ) ; } // If GeoPackage format , write a properties file
if ( tileType == TileFormatType . GEOPACKAGE ) { tileDao = geoPackage . getTileDao ( tileTable ) ; TileProperties tileProperties = new TileProperties ( directory ) ; tileProperties . writeFile ( tileDao ) ; } LOGGER . log ( Level . INFO , "Total Tiles: " + totalCount ) ; |
public class ScanResult { /** * Load a class given a class name . If ignoreExceptions is false , and the class cannot be loaded ( due to
* classloading error , or due to an exception being thrown in the class initialization block ) , an
* IllegalArgumentException is thrown ; otherwise , the class will simply be skipped if an exception is thrown .
* Enable verbose scanning to see details of any exceptions thrown during classloading , even if ignoreExceptions
* is false .
* @ param < T >
* the superclass or interface type .
* @ param className
* the class to load .
* @ param superclassOrInterfaceType
* The class type to cast the result to .
* @ param returnNullIfClassNotFound
* If true , null is returned if there was an exception during classloading , otherwise
* IllegalArgumentException is thrown if a class could not be loaded .
* @ return a reference to the loaded class , or null if the class could not be loaded and ignoreExceptions is
* true .
* @ throws IllegalArgumentException
* if ignoreExceptions is false , IllegalArgumentException is thrown if there were problems loading
* the class , initializing the class , or casting it to the requested type . ( Note that class
* initialization on load is disabled by default , you can enable it with
* { @ code ClassGraph # initializeLoadedClasses ( true ) } . ) Otherwise exceptions are suppressed , and null
* is returned if any of these problems occurs . */
public < T > Class < T > loadClass ( final String className , final Class < T > superclassOrInterfaceType , final boolean returnNullIfClassNotFound ) throws IllegalArgumentException { } } | if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( className == null || className . isEmpty ( ) ) { throw new NullPointerException ( "className cannot be null or empty" ) ; } if ( superclassOrInterfaceType == null ) { throw new NullPointerException ( "superclassOrInterfaceType parameter cannot be null" ) ; } final Class < ? > loadedClass ; try { loadedClass = Class . forName ( className , scanSpec . initializeLoadedClasses , classGraphClassLoader ) ; } catch ( final ClassNotFoundException | LinkageError e ) { if ( returnNullIfClassNotFound ) { return null ; } else { throw new IllegalArgumentException ( "Could not load class " + className + " : " + e ) ; } } if ( loadedClass != null && ! superclassOrInterfaceType . isAssignableFrom ( loadedClass ) ) { if ( returnNullIfClassNotFound ) { return null ; } else { throw new IllegalArgumentException ( "Loaded class " + loadedClass . getName ( ) + " cannot be cast to " + superclassOrInterfaceType . getName ( ) ) ; } } @ SuppressWarnings ( "unchecked" ) final Class < T > castClass = ( Class < T > ) loadedClass ; return castClass ; |
public class ValidationBundle { /** * Gets the message .
* @ param class1 the class 1
* @ param string the string
* @ param objects the objects
* @ return the message */
public static String getMessage ( final Class class1 , final String string , final Object [ ] objects ) { } } | return JKMessage . get ( string , objects ) ; |
public class Closeables2 { /** * Create a composite { @ link Closeable } that will close all the wrapped
* { @ code closeables } references . The { @ link Closeable # close ( ) } method will
* perform a safe close of all wrapped Closeable objects . This is needed
* since successive calls of the { @ link # closeAll ( Logger , Closeable . . . ) }
* method is not exception safe without an extra layer of try / finally .
* This method iterates the provided
* { @ code Iterable < ? extends Iterable < ? extends Closeable > > } and closes
* all subsequent Closeable objects .
* @ param log The logger to write error messages out to .
* @ param closeables An iterator over iterable Closeables .
* @ param < C > A class that implements the { @ link Closeable } interface .
* @ param < T > An iterable collection that contains { @ link Closeable } objects .
* @ return A composite closeable that wraps all underlying { @ code closeables } . */
public static < C extends Closeable , T extends Iterable < C > > Closeable forIterable2 ( @ Nonnull final Logger log , @ Nonnull final Iterable < T > closeables ) { } } | return new Closeable ( ) { public void close ( ) throws IOException { closeAll ( log , Iterables . transform ( closeables , new Function < T , Closeable > ( ) { public Closeable apply ( final @ Nullable T input ) { if ( input == null ) { return new Closeable ( ) { public void close ( ) throws IOException { } } ; } else { return forIterable ( log , input ) ; } } } ) ) ; } } ; |
public class BaseKdDao { /** * { @ inheritDoc } */
@ Override public boolean keyExists ( String spaceId , String key ) throws IOException { } } | /* * Call get ( spaceId , key ) ! = null or delegate to kdStorage . keyExists ( spaceId , key ) ?
* Since DELETE and PUT operations can be async , delegating to kdStorage . keyExists ( spaceId ,
* key ) would be preferred to avoid out - of - date data . */
return kdStorage . keyExists ( spaceId , key ) ; |
public class MInteger { /** * generate a list containing values from integer represented by this object < br >
* to given integer ( exclusive ) < br >
* e . g . < code > $ ( 0 ) . until ( 20 ) < / code > means list ( 0,1,2 , . . . , 19)
* @ param end end integer ( exclusive )
* @ return a list */
public List < Integer > until ( int end ) { } } | List < Integer > list = new ArrayList < > ( ) ; for ( int i = this . n ; i < end ; ++ i ) { list . add ( i ) ; } return list ; |
public class IonContainerLite { /** * Does not validate the child or check locks . */
protected int add_child ( int idx , IonValueLite child ) { } } | _isNullValue ( false ) ; // if we add children we ' re not null anymore
child . setContext ( this . getContextForIndex ( child , idx ) ) ; if ( _children == null || _child_count >= _children . length ) { int old_len = ( _children == null ) ? 0 : _children . length ; int new_len = this . nextSize ( old_len , true ) ; assert ( new_len > idx ) ; IonValueLite [ ] temp = new IonValueLite [ new_len ] ; if ( old_len > 0 ) { System . arraycopy ( _children , 0 , temp , 0 , old_len ) ; } _children = temp ; } if ( idx < _child_count ) { System . arraycopy ( _children , idx , _children , idx + 1 , _child_count - idx ) ; } _child_count ++ ; _children [ idx ] = child ; structuralModificationCount ++ ; child . _elementid ( idx ) ; if ( ! _isSymbolIdPresent ( ) && child . _isSymbolIdPresent ( ) ) { cascadeSIDPresentToContextRoot ( ) ; } return idx ; |
public class FindInconsistentSync2 { /** * Determine whether or not the the given method is a getter method . I . e . ,
* if it just returns the value of an instance field .
* @ param classContext
* the ClassContext for the class containing the method
* @ param method
* the method */
public static boolean isGetterMethod ( ClassContext classContext , Method method ) { } } | MethodGen methodGen = classContext . getMethodGen ( method ) ; if ( methodGen == null ) { return false ; } InstructionList il = methodGen . getInstructionList ( ) ; // System . out . println ( " Checking getter method : " + method . getName ( ) ) ;
if ( il . getLength ( ) > 60 ) { return false ; } int count = 0 ; Iterator < InstructionHandle > it = il . iterator ( ) ; while ( it . hasNext ( ) ) { InstructionHandle ih = it . next ( ) ; switch ( ih . getInstruction ( ) . getOpcode ( ) ) { case Const . GETFIELD : count ++ ; if ( count > 1 ) { return false ; } break ; case Const . PUTFIELD : case Const . BALOAD : case Const . CALOAD : case Const . DALOAD : case Const . FALOAD : case Const . IALOAD : case Const . LALOAD : case Const . SALOAD : case Const . AALOAD : case Const . BASTORE : case Const . CASTORE : case Const . DASTORE : case Const . FASTORE : case Const . IASTORE : case Const . LASTORE : case Const . SASTORE : case Const . AASTORE : case Const . PUTSTATIC : return false ; case Const . INVOKESTATIC : case Const . INVOKEVIRTUAL : case Const . INVOKEINTERFACE : case Const . INVOKESPECIAL : case Const . GETSTATIC : // no - op
} } // System . out . println ( " Found getter method : " + method . getName ( ) ) ;
return true ; |
public class AbstractComponent { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) @ Override public void setup ( ) throws CoreException { } } | final boolean canProcessAnnotation = ComponentEnhancer . canProcessAnnotation ( ( Class < ? extends Component < ? > > ) this . getClass ( ) ) ; if ( canProcessAnnotation ) { // Search Singleton and Multiton annotation on field
ComponentEnhancer . injectComponent ( this ) ; // Attach custom method configured with custom Lifecycle annotation
this . lifecycleMethod = ComponentEnhancer . defineLifecycleMethod ( this ) ; // Search OnWave annotation to manage auto wave handler setup
ComponentEnhancer . manageOnWaveAnnotation ( this ) ; } callAnnotatedMethod ( BeforeInit . class ) ; manageOptionalData ( ) ; if ( canProcessAnnotation ) { ComponentEnhancer . injectInnerComponent ( this ) ; } // Initialize all inner components
initInternalInnerComponents ( ) ; // Prepare the current component
ready ( ) ; callAnnotatedMethod ( AfterInit . class ) ; |
public class Factor { /** * Create a FactorCreator to execute create .
* @ param pathServiceSid Service Sid .
* @ param pathIdentity Unique identity of the Entity
* @ param binding A unique binding for this Factor
* @ param friendlyName The friendly name of this Factor
* @ param factorType The Type of this Factor
* @ return FactorCreator capable of executing the create */
public static FactorCreator creator ( final String pathServiceSid , final String pathIdentity , final String binding , final String friendlyName , final Factor . FactorTypes factorType ) { } } | return new FactorCreator ( pathServiceSid , pathIdentity , binding , friendlyName , factorType ) ; |
public class OntologyTermRepository { /** * Calculate the distance between nodePaths , e . g . 0[0 ] . 1[1 ] . 2[2 ] , 0[0 ] . 2[1 ] . 2[2 ] . The distance is
* the non - overlap part of the strings
* @ return distance */
public int calculateNodePathDistance ( String nodePath1 , String nodePath2 ) { } } | String [ ] nodePathFragment1 = nodePath1 . split ( "\\." ) ; String [ ] nodePathFragment2 = nodePath2 . split ( "\\." ) ; int overlapBlock = 0 ; while ( overlapBlock < nodePathFragment1 . length && overlapBlock < nodePathFragment2 . length && nodePathFragment1 [ overlapBlock ] . equals ( nodePathFragment2 [ overlapBlock ] ) ) { overlapBlock ++ ; } return nodePathFragment1 . length + nodePathFragment2 . length - overlapBlock * 2 ; |
public class MemcachedClient { /** * Perform a synchronous CAS operation with the default transcoder .
* @ param key the key
* @ param casId the CAS identifier ( from a gets operation )
* @ param value the new value
* @ return a CASResponse
* @ throws OperationTimeoutException if the global operation timeout is
* exceeded
* @ throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests */
@ Override public CASResponse cas ( String key , long casId , Object value ) { } } | return cas ( key , casId , value , transcoder ) ; |
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 422:1 : voidMethodDeclaratorRest : formalParameters ( ' throws ' qualifiedNameList ) ? ( methodBody | ' ; ' ) ; */
public final void voidMethodDeclaratorRest ( ) throws RecognitionException { } } | int voidMethodDeclaratorRest_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 32 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 423:5 : ( formalParameters ( ' throws ' qualifiedNameList ) ? ( methodBody | ' ; ' ) )
// src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 423:7 : formalParameters ( ' throws ' qualifiedNameList ) ? ( methodBody | ' ; ' )
{ pushFollow ( FOLLOW_formalParameters_in_voidMethodDeclaratorRest1100 ) ; formalParameters ( ) ; state . _fsp -- ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 423:24 : ( ' throws ' qualifiedNameList ) ?
int alt46 = 2 ; int LA46_0 = input . LA ( 1 ) ; if ( ( LA46_0 == 113 ) ) { alt46 = 1 ; } switch ( alt46 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 423:25 : ' throws ' qualifiedNameList
{ match ( input , 113 , FOLLOW_113_in_voidMethodDeclaratorRest1103 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_qualifiedNameList_in_voidMethodDeclaratorRest1105 ) ; qualifiedNameList ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 424:9 : ( methodBody | ' ; ' )
int alt47 = 2 ; int LA47_0 = input . LA ( 1 ) ; if ( ( LA47_0 == 121 ) ) { alt47 = 1 ; } else if ( ( LA47_0 == 52 ) ) { alt47 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 47 , 0 , input ) ; throw nvae ; } switch ( alt47 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 424:13 : methodBody
{ pushFollow ( FOLLOW_methodBody_in_voidMethodDeclaratorRest1121 ) ; methodBody ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; case 2 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 425:13 : ' ; '
{ match ( input , 52 , FOLLOW_52_in_voidMethodDeclaratorRest1135 ) ; if ( state . failed ) return ; } break ; } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
if ( state . backtracking > 0 ) { memoize ( input , 32 , voidMethodDeclaratorRest_StartIndex ) ; } } |
public class NodeUtil { /** * Adds the given features to a SCRIPT node ' s FeatureSet property . */
static void addFeatureToScript ( Node scriptNode , Feature feature ) { } } | checkState ( scriptNode . isScript ( ) , scriptNode ) ; FeatureSet currentFeatures = getFeatureSetOfScript ( scriptNode ) ; FeatureSet newFeatures = currentFeatures != null ? currentFeatures . with ( feature ) : FeatureSet . BARE_MINIMUM . with ( feature ) ; scriptNode . putProp ( Node . FEATURE_SET , newFeatures ) ; |
public class DefaultGroovyMethodsSupport { /** * Attempts to close the closeable returning rather than throwing
* any Exception that may occur .
* @ param closeable the thing to close
* @ param logWarning if true will log a warning if an exception occurs
* @ return throwable Exception from the close method , else null */
static Throwable tryClose ( AutoCloseable closeable , boolean logWarning ) { } } | Throwable thrown = null ; if ( closeable != null ) { try { closeable . close ( ) ; } catch ( Exception e ) { thrown = e ; if ( logWarning ) { LOG . warning ( "Caught exception during close(): " + e ) ; } } } return thrown ; |
public class CopyFileExtensions { /** * Copies all files that match to the FileFilter from the given source directory to the given
* destination directory with the option to set the lastModified time from the given destination
* file or directory .
* @ param source
* The source directory .
* @ param destination
* The destination directory .
* @ param fileFilter
* The FileFilter for the files to be copied . If null all files will be copied .
* @ param lastModified
* Flag the tells if the attribute lastModified has to be set with the attribute from
* the destination file .
* @ return ' s true if the directory is copied , otherwise false .
* @ throws IOException
* Is thrown if an error occurs by reading or writing .
* @ throws FileIsNotADirectoryException
* Is thrown if the source file is not a directory .
* @ throws FileIsADirectoryException
* Is thrown if the destination file is a directory .
* @ throws FileIsSecurityRestrictedException
* Is thrown if the source file is security restricted .
* @ throws DirectoryAlreadyExistsException
* Is thrown if the directory all ready exists . */
public static boolean copyDirectoryWithFileFilter ( final File source , final File destination , final FileFilter fileFilter , final boolean lastModified ) throws IOException , FileIsNotADirectoryException , FileIsADirectoryException , FileIsSecurityRestrictedException , DirectoryAlreadyExistsException { } } | return copyDirectoryWithFileFilter ( source , destination , fileFilter , null , lastModified ) ; |
public class StatefulRedisPubSubConnectionImpl { /** * Re - subscribe to all previously subscribed channels and patterns .
* @ return list of the futures of the { @ literal subscribe } and { @ literal psubscribe } commands . */
protected List < RedisFuture < Void > > resubscribe ( ) { } } | List < RedisFuture < Void > > result = new ArrayList < > ( ) ; if ( endpoint . hasChannelSubscriptions ( ) ) { result . add ( async ( ) . subscribe ( toArray ( endpoint . getChannels ( ) ) ) ) ; } if ( endpoint . hasPatternSubscriptions ( ) ) { result . add ( async ( ) . psubscribe ( toArray ( endpoint . getPatterns ( ) ) ) ) ; } return result ; |
public class GetWorkerIdPRequest { /** * < pre >
* * the worker network address
* < / pre >
* < code > optional . alluxio . grpc . WorkerNetAddress workerNetAddress = 1 ; < / code > */
public alluxio . grpc . WorkerNetAddress getWorkerNetAddress ( ) { } } | return workerNetAddress_ == null ? alluxio . grpc . WorkerNetAddress . getDefaultInstance ( ) : workerNetAddress_ ; |
public class StandardMatchingStrategy { /** * To get a match with a standard HTTP method ,
* < pre >
* 1 . Determine if the method matches
* 2 . Perform a URL match
* < / pre > */
@ Override protected CollectionMatch getCollectionMatchForWebResourceCollection ( WebResourceCollection webResourceCollection , String resourceName , String method ) { } } | CollectionMatch match = null ; if ( webResourceCollection . isMethodMatched ( method ) ) { match = webResourceCollection . performUrlMatch ( resourceName ) ; if ( match == null ) { match = CollectionMatch . RESPONSE_NO_MATCH ; } } else if ( webResourceCollection . deniedDueToDenyUncoveredHttpMethods ( method ) ) { if ( webResourceCollection . isSpecifiedOmissionMethod ( method ) ) { match = webResourceCollection . performUrlMatch ( resourceName ) ; if ( match != null && ! CollectionMatch . RESPONSE_NO_MATCH . equals ( match ) && ! CollectionMatch . RESPONSE_DENY_MATCH . equals ( match ) ) { // meaning we have a match , so the url matches but the method is uncovered . We return response deny by omission
match = CollectionMatch . RESPONSE_DENY_MATCH_BY_OMISSION ; } } else { match = webResourceCollection . performUrlMatch ( resourceName ) ; if ( match != null && ! CollectionMatch . RESPONSE_NO_MATCH . equals ( match ) && ! CollectionMatch . RESPONSE_DENY_MATCH . equals ( match ) ) { // meaning we have a match , so the url matches but the method is uncovered . We return response deny
match = CollectionMatch . RESPONSE_DENY_MATCH ; } } } return match ; |
public class AbstractHibernateCriteriaBuilder { /** * Adds a projection that allows the criteria to retrieve a minimum property value
* @ param alias The alias to use */
public org . grails . datastore . mapping . query . api . ProjectionList min ( String propertyName , String alias ) { } } | final AggregateProjection aggregateProjection = Projections . min ( calculatePropertyName ( propertyName ) ) ; addProjectionToList ( aggregateProjection , alias ) ; return this ; |
public class MavenConverter { /** * converts repository policy */
private static org . apache . maven . model . RepositoryPolicy asMavenRepositoryPolicy ( org . apache . maven . settings . RepositoryPolicy policy ) { } } | org . apache . maven . model . RepositoryPolicy mavenPolicy = new org . apache . maven . model . RepositoryPolicy ( ) ; if ( policy != null ) { mavenPolicy . setChecksumPolicy ( policy . getChecksumPolicy ( ) ) ; mavenPolicy . setUpdatePolicy ( policy . getUpdatePolicy ( ) ) ; mavenPolicy . setEnabled ( policy . isEnabled ( ) ) ; } return mavenPolicy ; |
public class MultiPartParser { /** * Parse the message headers and return true if the handler has signaled for a return */
protected boolean parseMimePartHeaders ( ByteBuffer buffer ) { } } | // Process headers
while ( _state == State . BODY_PART && hasNextByte ( buffer ) ) { // process each character
HttpTokens . Token t = next ( buffer ) ; if ( t == null ) break ; if ( t . getType ( ) != HttpTokens . Type . LF ) _totalHeaderLineLength ++ ; if ( _totalHeaderLineLength > MAX_HEADER_LINE_LENGTH ) throw new IllegalStateException ( "Header Line Exceeded Max Length" ) ; switch ( _fieldState ) { case FIELD : switch ( t . getType ( ) ) { case SPACE : case HTAB : { // Folded field value !
if ( _fieldName == null ) throw new IllegalStateException ( "First field folded" ) ; if ( _fieldValue == null ) { _string . reset ( ) ; _length = 0 ; } else { setString ( _fieldValue ) ; _string . append ( ' ' ) ; _length ++ ; _fieldValue = null ; } setState ( FieldState . VALUE ) ; break ; } case LF : handleField ( ) ; setState ( State . FIRST_OCTETS ) ; _partialBoundary = 2 ; // CRLF is option for empty parts
if ( LOG . isDebugEnabled ( ) ) LOG . debug ( "headerComplete {}" , this ) ; if ( _handler . headerComplete ( ) ) return true ; break ; case ALPHA : case DIGIT : case TCHAR : // process previous header
handleField ( ) ; // New header
setState ( FieldState . IN_NAME ) ; _string . reset ( ) ; _string . append ( t . getChar ( ) ) ; _length = 1 ; break ; default : throw new IllegalCharacterException ( _state , t , buffer ) ; } break ; case IN_NAME : switch ( t . getType ( ) ) { case COLON : _fieldName = takeString ( ) ; _length = - 1 ; setState ( FieldState . VALUE ) ; break ; case SPACE : // Ignore trailing whitespaces
setState ( FieldState . AFTER_NAME ) ; break ; case LF : { if ( LOG . isDebugEnabled ( ) ) LOG . debug ( "Line Feed in Name {}" , this ) ; handleField ( ) ; setState ( FieldState . FIELD ) ; break ; } case ALPHA : case DIGIT : case TCHAR : _string . append ( t . getChar ( ) ) ; _length = _string . length ( ) ; break ; default : throw new IllegalCharacterException ( _state , t , buffer ) ; } break ; case AFTER_NAME : switch ( t . getType ( ) ) { case COLON : _fieldName = takeString ( ) ; _length = - 1 ; setState ( FieldState . VALUE ) ; break ; case LF : _fieldName = takeString ( ) ; _string . reset ( ) ; _fieldValue = "" ; _length = - 1 ; break ; case SPACE : break ; default : throw new IllegalCharacterException ( _state , t , buffer ) ; } break ; case VALUE : switch ( t . getType ( ) ) { case LF : _string . reset ( ) ; _fieldValue = "" ; _length = - 1 ; setState ( FieldState . FIELD ) ; break ; case SPACE : case HTAB : break ; case ALPHA : case DIGIT : case TCHAR : case VCHAR : case COLON : case OTEXT : _string . append ( t . getByte ( ) ) ; _length = _string . length ( ) ; setState ( FieldState . IN_VALUE ) ; break ; default : throw new IllegalCharacterException ( _state , t , buffer ) ; } break ; case IN_VALUE : switch ( t . getType ( ) ) { case SPACE : case HTAB : _string . append ( ' ' ) ; break ; case LF : if ( _length > 0 ) { _fieldValue = takeString ( ) ; _length = - 1 ; _totalHeaderLineLength = - 1 ; } setState ( FieldState . FIELD ) ; break ; case ALPHA : case DIGIT : case TCHAR : case VCHAR : case COLON : case OTEXT : _string . append ( t . getByte ( ) ) ; _length = _string . length ( ) ; break ; default : throw new IllegalCharacterException ( _state , t , buffer ) ; } break ; default : throw new IllegalStateException ( _state . toString ( ) ) ; } } return false ; |
public class ResourceLoader { /** * Loads a resource as { @ link InputStream } .
* @ param baseDir
* If not { @ code null } , the directory relative to which resources are loaded .
* @ param resource
* The resource to be loaded . If { @ code baseDir } is not { @ code null } , it is loaded
* relative to { @ code baseDir } .
* @ return The stream */
public static InputStream getInputStream ( final String baseDir , final String resource ) throws IOException { } } | return getInputStream ( new File ( baseDir ) , resource ) ; |
public class ChainImpl { /** * { @ inheritDoc } */
@ Override public Group [ ] getGroupsByPDB ( ResidueNumber start , ResidueNumber end ) throws StructureException { } } | return getGroupsByPDB ( start , end , false ) ; |
public class NodeImpl { /** * { @ inheritDoc } */
public void removeMixin ( String mixinName ) throws NoSuchNodeTypeException , ConstraintViolationException , RepositoryException { } } | checkValid ( ) ; InternalQName [ ] mixinTypes = nodeData ( ) . getMixinTypeNames ( ) ; InternalQName name = locationFactory . parseJCRName ( mixinName ) . getInternalName ( ) ; // find mixin
InternalQName removedName = null ; // Prepare mixin values
List < InternalQName > newMixin = new ArrayList < InternalQName > ( ) ; List < ValueData > values = new ArrayList < ValueData > ( ) ; for ( InternalQName mt : mixinTypes ) { if ( mt . equals ( name ) ) { removedName = mt ; } else { newMixin . add ( mt ) ; values . add ( new TransientValueData ( mt ) ) ; } } // no mixin found
if ( removedName == null ) { throw new NoSuchNodeTypeException ( "No mixin type found " + mixinName + " for node " + getPath ( ) ) ; } // A ConstraintViolationException will be thrown either
// immediately or on save if the removal of a mixin is not
// allowed . Implementations are free to enforce any policy
// they like with regard to mixin removal and may differ on
// when this validation is done .
// Check if versionable ancestor is not checked - in
if ( ! checkedOut ( ) ) { throw new VersionException ( "Node " + getPath ( ) + " or its nearest ancestor is checked-in" ) ; } // Check locking
if ( ! checkLocking ( ) ) { throw new LockException ( "Node " + getPath ( ) + " is locked " ) ; } session . getActionHandler ( ) . preRemoveMixin ( this , name ) ; PropertyData propData = ( PropertyData ) dataManager . getItemData ( nodeData ( ) , new QPathEntry ( Constants . JCR_MIXINTYPES , 0 ) , ItemType . PROPERTY ) ; // create new property data with new values
TransientPropertyData prop = new TransientPropertyData ( propData . getQPath ( ) , propData . getIdentifier ( ) , propData . getPersistedVersion ( ) , propData . getType ( ) , propData . getParentIdentifier ( ) , propData . isMultiValued ( ) , values ) ; NodeTypeDataManager ntmanager = session . getWorkspace ( ) . getNodeTypesHolder ( ) ; // remove mix : versionable stuff
if ( ntmanager . isNodeType ( Constants . MIX_VERSIONABLE , removedName ) ) { removeVersionable ( ) ; } // remove mix : lockable stuff
if ( ntmanager . isNodeType ( Constants . MIX_LOCKABLE , removedName ) ) { removeLockable ( ) ; } // Set mixin property and locally
updateMixin ( newMixin ) ; // Remove mixin nt definition node / properties from this node
QPath ancestorToSave = nodeData ( ) . getQPath ( ) ; for ( PropertyDefinitionData pd : ntmanager . getAllPropertyDefinitions ( removedName ) ) { // to skip remove propertyDefinition with existed another nodeType property definition
PropertyDefinitionDatas propertyDefinitions = ntmanager . getPropertyDefinitions ( pd . getName ( ) , nodeData ( ) . getPrimaryTypeName ( ) , newMixin . toArray ( new InternalQName [ ] { } ) ) ; if ( propertyDefinitions == null || propertyDefinitions . getDefinition ( pd . isMultiple ( ) ) == null || propertyDefinitions . getDefinition ( pd . isMultiple ( ) ) . isResidualSet ( ) ) { ItemData p = dataManager . getItemData ( nodeData ( ) , new QPathEntry ( pd . getName ( ) , 1 ) , ItemType . PROPERTY , false ) ; if ( p != null && ! p . isNode ( ) ) { // remove it
dataManager . delete ( p , ancestorToSave ) ; } } } for ( NodeDefinitionData nd : ntmanager . getAllChildNodeDefinitions ( removedName ) ) { ItemData n = dataManager . getItemData ( nodeData ( ) , new QPathEntry ( nd . getName ( ) , 1 ) , ItemType . NODE ) ; if ( n != null && n . isNode ( ) ) { // remove node with subtree
ItemDataRemoveVisitor remover = new ItemDataRemoveVisitor ( dataManager , ancestorToSave ) ; n . accept ( remover ) ; for ( ItemState deleted : remover . getRemovedStates ( ) ) { dataManager . delete ( deleted . getData ( ) , ancestorToSave ) ; } } } if ( newMixin . size ( ) > 0 ) { dataManager . update ( new ItemState ( prop , ItemState . UPDATED , true , ancestorToSave ) , false ) ; } else { dataManager . delete ( prop , ancestorToSave ) ; } |
public class AnyImageDerivative { /** * Computes derivative images using previously computed lower level derivatives . Only
* computes / declares images as needed . */
public D getDerivative ( boolean ... isX ) { } } | if ( derivatives == null ) { declareTree ( isX . length ) ; } else if ( isX . length > stale . length ) { growTree ( isX . length ) ; } int index = 0 ; int prevIndex = 0 ; for ( int level = 0 ; level < isX . length ; level ++ ) { index |= isX [ level ] ? 0 : 1 << level ; if ( stale [ level ] [ index ] ) { stale [ level ] [ index ] = false ; derivatives [ level ] [ index ] . reshape ( inputImage . getWidth ( ) , inputImage . getHeight ( ) ) ; if ( level == 0 ) { if ( isX [ level ] ) { derivX . process ( inputImage , derivatives [ level ] [ index ] ) ; } else { derivY . process ( inputImage , derivatives [ level ] [ index ] ) ; } } else { D prev = derivatives [ level - 1 ] [ prevIndex ] ; if ( isX [ level ] ) { derivDerivX . process ( prev , derivatives [ level ] [ index ] ) ; } else { derivDerivY . process ( prev , derivatives [ level ] [ index ] ) ; } } } prevIndex = index ; } return derivatives [ isX . length - 1 ] [ index ] ; |
public class ClientFactory { /** * Return the named client from map if already created . Otherwise creates the client using the configuration returned by { @ link # createNamedClient ( String , Class ) } .
* @ throws RuntimeException if an error occurs in creating the client . */
public static synchronized IClient getNamedClient ( String name , Class < ? extends IClientConfig > configClass ) { } } | if ( simpleClientMap . get ( name ) != null ) { return simpleClientMap . get ( name ) ; } try { return createNamedClient ( name , configClass ) ; } catch ( ClientException e ) { throw new RuntimeException ( "Unable to create client" , e ) ; } |
public class JobState { /** * Get the number of completed tasks .
* @ return number of completed tasks */
public int getCompletedTasks ( ) { } } | int completedTasks = 0 ; for ( TaskState taskState : this . taskStates . values ( ) ) { if ( taskState . isCompleted ( ) ) { completedTasks ++ ; } } return completedTasks ; |
public class SnorocketOWLReasoner { /** * Asks the reasoner to precompute certain types of inferences . Note that it
* is NOT necessary to call this method before asking any other queries -
* the reasoner will answer all queries correctly regardless of whether
* inferences are precomputed or not . For example , if the imports closure of
* the root ontology entails < code > SubClassOf ( A B ) < / code > then the result of
* < code > getSubClasses ( B ) < / code > will contain < code > A < / code > , regardless of
* whether
* < code > precomputeInferences ( { @ link InferenceType # CLASS _ HIERARCHY } ) < / code >
* has been called .
* If the reasoner does not support the precomputation of a particular type
* of inference then it will silently ignore the request .
* @ param inferenceTypes
* Suggests a list of the types of inferences that should be
* precomputed . If the list is empty then the reasoner will
* determine which types of inferences are precomputed . Note that
* the order of the list is unimportant - the reasoner will
* determine the order in which inferences are computed .
* @ throws InconsistentOntologyException
* if the imports closure of the root ontology is inconsistent
* @ throws ReasonerInterruptedException
* if the reasoning process was interrupted for any particular
* reason ( for example if reasoning was cancelled by a client
* process )
* @ throws TimeOutException
* if the reasoner timed out during a basic reasoning operation .
* See { @ link # getTimeOut ( ) } . */
@ Override public void precomputeInferences ( InferenceType ... inferenceTypes ) throws ReasonerInterruptedException , TimeOutException , InconsistentOntologyException { } } | for ( InferenceType inferenceType : inferenceTypes ) { if ( inferenceType . equals ( InferenceType . CLASS_HIERARCHY ) ) { classify ( ) ; } } |
public class Filter { /** * Builds an EqualsFilter */
public static Filter equalsFilter ( String column , Object operand ) { } } | return new Filter ( column , FilterOperator . EQUALS , operand ) ; |
public class AddCampaignGroupsAndPerformanceTargets { /** * Adds multiple campaigns to a campaign group . */
private static void addCampaignsToGroup ( AdWordsServicesInterface adWordsServices , AdWordsSession session , CampaignGroup campaignGroup , List < Long > campaignIds ) throws ApiException , RemoteException { } } | // Get the CampaignService .
CampaignServiceInterface campaignService = adWordsServices . get ( session , CampaignServiceInterface . class ) ; List < CampaignOperation > operations = new ArrayList < > ( ) ; for ( Long campaignId : campaignIds ) { Campaign campaign = new Campaign ( ) ; campaign . setId ( campaignId ) ; campaign . setCampaignGroupId ( campaignGroup . getId ( ) ) ; CampaignOperation operation = new CampaignOperation ( ) ; operation . setOperand ( campaign ) ; operation . setOperator ( Operator . SET ) ; operations . add ( operation ) ; } CampaignReturnValue returnValue = campaignService . mutate ( operations . toArray ( new CampaignOperation [ operations . size ( ) ] ) ) ; System . out . printf ( "The following campaign IDs were added to the campaign group with ID %d:%n" , campaignGroup . getId ( ) ) ; for ( Campaign campaign : returnValue . getValue ( ) ) { System . out . printf ( "\t%d%n" , campaign . getId ( ) ) ; } |
public class CommerceOrderPersistenceImpl { /** * Returns the commerce order where uuid = & # 63 ; and groupId = & # 63 ; or returns < code > null < / code > if it could not be found . Uses the finder cache .
* @ param uuid the uuid
* @ param groupId the group ID
* @ return the matching commerce order , or < code > null < / code > if a matching commerce order could not be found */
@ Override public CommerceOrder fetchByUUID_G ( String uuid , long groupId ) { } } | return fetchByUUID_G ( uuid , groupId , true ) ; |
public class GISTreeSetUtil { /** * Replies if the given geolocation is outside the building bounds of the given node . */
@ Pure private static boolean isOutsideNodeBuildingBounds ( AbstractGISTreeSetNode < ? , ? > node , Rectangle2afp < ? , ? , ? , ? , ? , ? > location ) { } } | final Rectangle2d b2 = getNormalizedNodeBuildingBounds ( node , location ) ; if ( b2 == null ) { return false ; } return Rectangle2afp . classifiesRectangleRectangle ( b2 . getMinX ( ) , b2 . getMinY ( ) , b2 . getMaxX ( ) , b2 . getMaxY ( ) , location . getMinX ( ) , location . getMinY ( ) , location . getMaxX ( ) , location . getMaxY ( ) ) != IntersectionType . INSIDE ; |
public class IsoInterval { /** * / * [ deutsch ]
* < p > Formatiert die kanonische Form dieses Intervalls in einem benutzerdefinierten Format . < / p >
* < p > Beispiel : < / p >
* < pre >
* DateInterval interval = DateInterval . since ( PlainDate . of ( 2015 , 1 , 1 ) ) ;
* ChronoFormatter & lt ; PlainDate & gt ; formatter =
* ChronoFormatter . ofDatePattern ( & quot ; d . MMMM uuuu & quot ; , PatternType . CLDR , Locale . GERMANY ) ;
* System . out . println ( interval . print ( formatter , & quot ; seit { 0 } & quot ; ) ) ;
* / / Ausgabe : seit 1 . Januar 2015
* < / pre >
* @ param printer format object for printing start and end components
* @ param intervalPattern interval pattern containing placeholders { 0 } and { 1 } ( for start and end )
* @ return formatted string in given pattern format
* @ throws IllegalStateException if the canonicalization of this interval fails
* @ throws IllegalArgumentException if an interval boundary is not formattable
* @ see # toCanonical ( )
* @ since 3.9/4.6 */
public String print ( ChronoPrinter < T > printer , String intervalPattern ) { } } | I interval = this . toCanonical ( ) ; AttributeQuery attrs = printer . getAttributes ( ) ; StringBuilder sb = new StringBuilder ( 32 ) ; int i = 0 ; int n = intervalPattern . length ( ) ; while ( i < n ) { char c = intervalPattern . charAt ( i ) ; if ( ( c == '{' ) && ( i + 2 < n ) && ( intervalPattern . charAt ( i + 2 ) == '}' ) ) { char next = intervalPattern . charAt ( i + 1 ) ; if ( next == '0' ) { if ( interval . getStart ( ) . isInfinite ( ) ) { sb . append ( "-\u221E" ) ; } else { printer . print ( interval . getStart ( ) . getTemporal ( ) , sb , attrs ) ; } i += 3 ; continue ; } else if ( next == '1' ) { if ( interval . getEnd ( ) . isInfinite ( ) ) { sb . append ( "+\u221E" ) ; } else { printer . print ( interval . getEnd ( ) . getTemporal ( ) , sb , attrs ) ; } i += 3 ; continue ; } } sb . append ( c ) ; i ++ ; } return sb . toString ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.