signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CommercePriceListPersistenceImpl { /** * Returns the commerce price lists before and after the current commerce price list in the ordered set where displayDate & lt ; & # 63 ; and status = & # 63 ; . * @ param commercePriceListId the primary key of the current commerce price list * @ param displayDate ...
CommercePriceList commercePriceList = findByPrimaryKey ( commercePriceListId ) ; Session session = null ; try { session = openSession ( ) ; CommercePriceList [ ] array = new CommercePriceListImpl [ 3 ] ; array [ 0 ] = getByLtD_S_PrevAndNext ( session , commercePriceList , displayDate , status , orderByComparator , true...
public class GConvertImage { /** * Converts one type of between two types of images using a default method . Both are the same image type * then a simple type cast if performed at the pixel level . If the input is multi - band and the output * is single band then it will average the bands . If input is single band ...
ImageType typeIn = input . getImageType ( ) ; ImageType typeOut = output . getImageType ( ) ; if ( input instanceof ImageGray ) { ImageGray sb = ( ImageGray ) input ; if ( output instanceof ImageGray ) { if ( input . getClass ( ) == output . getClass ( ) ) { output . setTo ( input ) ; } else { try { Method m = ConvertI...
public class ApplicationExtensions { /** * Gets the resource stream from the given parameters . * @ param application * the application * @ param path * the path * @ param contentType * the content type * @ return the resource stream * @ throws IOException * Signals that an I / O exception has occurre...
return new ByteArrayResourceStreamWriter ( ) { private static final long serialVersionUID = 1L ; @ Override public String getContentType ( ) { return contentType ; } @ Override protected byte [ ] load ( ) throws IOException { final String realPath = ApplicationExtensions . getRealPath ( application , path ) ; final Fil...
public class OQL { /** * PropertyBinding */ private void _buildPropertyBinding ( final PropertyBinding binding , final StringBuilder stmt , final List < Object > params ) { } }
if ( binding instanceof RelationalBinding ) { _buildRelationalBinding ( ( RelationalBinding ) binding , stmt , params ) ; // throws SearchException } else if ( binding instanceof InBinding ) { _buildInBinding ( ( InBinding ) binding , stmt , params ) ; // throws SearchException } else if ( binding instanceof LikeBindin...
public class Assembly { /** * Prepares a file for tus upload . * @ param inptStream { @ link InputStream } * @ param fieldName the form field name assigned to the file . * @ param assemblyUrl the assembly url affiliated with the tus upload . * @ throws IOException when there ' s a failure with reading the input...
TusUpload upload = getTusUploadInstance ( inptStream , fieldName , assemblyUrl ) ; Map < String , String > metadata = new HashMap < String , String > ( ) ; metadata . put ( "filename" , fieldName ) ; metadata . put ( "assembly_url" , assemblyUrl ) ; metadata . put ( "fieldname" , fieldName ) ; upload . setMetadata ( me...
public class JCuda { /** * Map graphics resources for access by CUDA . * < pre > * cudaError _ t cudaGraphicsMapResources ( * int count , * cudaGraphicsResource _ t * resources , * cudaStream _ t stream = 0 ) * < / pre > * < div > * < p > Map graphics resources for access by * CUDA . Maps the < tt > c...
return checkResult ( cudaGraphicsMapResourcesNative ( count , resources , stream ) ) ;
public class MoreCollectors { /** * A Collector into an { @ link ImmutableList } . */ public static < T > Collector < T , List < T > , List < T > > toList ( ) { } }
return Collector . of ( ArrayList :: new , List :: add , ( left , right ) -> { left . addAll ( right ) ; return left ; } , ImmutableList :: copyOf ) ;
public class AbstractExceptionAwareLogic { /** * Handle exceptions . * @ param e the thrown exception * @ param httpActionAdapter the HTTP action adapter * @ param context the web context * @ return the final HTTP result */ protected R handleException ( final Exception e , final HttpActionAdapter < R , C > http...
if ( httpActionAdapter == null || context == null ) { throw runtimeException ( e ) ; } else if ( e instanceof HttpAction ) { final HttpAction action = ( HttpAction ) e ; logger . debug ( "extra HTTP action required in security: {}" , action . getCode ( ) ) ; return httpActionAdapter . adapt ( action , context ) ; } els...
public class CRCResourceManagementImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . CRC_RESOURCE_MANAGEMENT__FMT_QUAL : return getFmtQual ( ) ; case AfplibPackage . CRC_RESOURCE_MANAGEMENT__RM_VALUE : return getRMValue ( ) ; case AfplibPackage . CRC_RESOURCE_MANAGEMENT__RES_CLASS_FLG : return getResClassFlg ( ) ; } return super . eGet ( featureID , resolve ,...
public class BrowserConfig { /** * Initializes the default fonts . Current implementation just defines the same physical names for basic * AWT logical fonts . */ protected void initDefaultFonts ( ) { } }
defaultFonts = new HashMap < String , String > ( 3 ) ; defaultFonts . put ( Font . SERIF , Font . SERIF ) ; defaultFonts . put ( Font . SANS_SERIF , Font . SANS_SERIF ) ; defaultFonts . put ( Font . MONOSPACED , Font . MONOSPACED ) ;
public class AverageBondLengthCalculator { /** * Calculate the average bond length for the bonds in a reaction . * @ param reaction the reaction to use * @ return the average bond length */ public static double calculateAverageBondLength ( IReaction reaction ) { } }
IAtomContainerSet reactants = reaction . getReactants ( ) ; double reactantAverage = 0.0 ; if ( reactants != null ) { reactantAverage = calculateAverageBondLength ( reactants ) / reactants . getAtomContainerCount ( ) ; } IAtomContainerSet products = reaction . getProducts ( ) ; double productAverage = 0.0 ; if ( produc...
public class DocumentObjectMapper { /** * Setter for column value , by default converted from string value , in case * of map it is automatically converted into map using BasicDBObject . * @ param document * mongo document * @ param entityObject * searched entity . * @ param column * column field . */ sta...
Object value = null ; if ( document != null ) { value = isLob ? ( ( DBObject ) document . get ( "metadata" ) ) . get ( ( ( AbstractAttribute ) column ) . getJPAColumnName ( ) ) : document . get ( ( ( AbstractAttribute ) column ) . getJPAColumnName ( ) ) ; } if ( value != null ) { Class javaType = column . getJavaType (...
public class EditText { /** * Sets the Drawables ( if any ) to appear to the start of , above , to the end * of , and below the text . Use { @ code null } if you do not want a Drawable * there . The Drawables must already have had { @ link Drawable # setBounds } * called . * Calling this method will overwrite a...
if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 ) mInputView . setCompoundDrawablesRelative ( start , top , end , bottom ) ; else mInputView . setCompoundDrawables ( start , top , end , bottom ) ;
public class Allure { /** * Syntax sugar for { @ link # step ( ThrowableContextRunnable ) } . * @ param name the name of step . * @ param runnable the step ' s body . */ public static < T > T step ( final String name , final ThrowableRunnable < T > runnable ) { } }
return step ( step -> { step . name ( name ) ; return runnable . run ( ) ; } ) ;
public class BaseValidator { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public boolean validateCharset ( Charset charset , DiagnosticChain diagnostics , Map < Object , Object > context ) { } }
return true ;
public class AnnotationAwareOrderComparator { /** * This implementation checks for the { @ link Order } annotation * on various kinds of elements , in addition to the * { @ link com . freetmp . common . core . Ordered } check in the superclass . */ protected Integer findOrder ( Object obj ) { } }
// Check for regular Ordered interface Integer order = super . findOrder ( obj ) ; if ( order != null ) { return order ; } // Check for @ Order annotation on various kinds of elements if ( obj instanceof Class ) { return OrderUtils . getOrder ( ( Class ) obj ) ; } else if ( obj instanceof Method ) { Order ann = Annotat...
public class DataFlow { /** * Run the { @ code transfer } dataflow analysis over the method or lambda which is the leaf of the * { @ code methodPath } . * < p > For caching , we make the following assumptions : - if two paths to methods are { @ code equal } , * their control flow graph is the same . - if two tran...
final ProcessingEnvironment env = JavacProcessingEnvironment . instance ( context ) ; final ControlFlowGraph cfg ; try { cfg = cfgCache . getUnchecked ( CfgParams . create ( methodPath , env ) ) ; } catch ( UncheckedExecutionException e ) { throw e . getCause ( ) instanceof CompletionFailure ? ( CompletionFailure ) e ....
public class Convert { /** * 转换为Short < br > * 如果给定的值为 < code > null < / code > , 或者转换失败 , 返回默认值 < br > * 转换失败不会报错 * @ param value 被转换的值 * @ param defaultValue 转换错误时的默认值 * @ return 结果 */ public static Short toShort ( Object value , Short defaultValue ) { } }
return convert ( Short . class , value , defaultValue ) ;
public class MSLocale { /** * 既知のIDかどうか 。 * < p > プロパティファイルに定義されているかで確認する 。 * @ since 0.5 * @ param id ロケールID ( 10進数 ) 。 */ public static boolean isKnownById ( int id ) { } }
final String hexId = Utils . supplyZero ( Integer . toHexString ( id ) . toUpperCase ( ) , 4 ) ; String code = messageResolver . getMessage ( String . format ( "locale.%s.code" , hexId ) ) ; return Utils . isNotEmpty ( code ) ;
public class OMVRBTree { /** * Return SimpleImmutableEntry for entry , or null if null */ static < K , V > Map . Entry < K , V > exportEntry ( final OMVRBTreeEntryPosition < K , V > omvrbTreeEntryPosition ) { } }
return omvrbTreeEntryPosition == null ? null : new OSimpleImmutableEntry < K , V > ( omvrbTreeEntryPosition . entry ) ;
public class FrameworkProjectMgr { /** * @ return an existing Project object and returns it * @ param name The name of the project */ public FrameworkProject getFrameworkProject ( final String name ) { } }
FrameworkProject frameworkProject = loadChild ( name ) ; if ( null != frameworkProject ) { return frameworkProject ; } throw new NoSuchResourceException ( "Project does not exist: " + name , this ) ;
public class BufferedSeekInputStream { /** * Positions the underlying stream at the given position , then refills * the buffer . * @ param p the position to set * @ throws IOException if an IO error occurs */ private void positionDirect ( long p ) throws IOException { } }
long newBlockStart = p / buffer . length * buffer . length ; input . position ( newBlockStart ) ; buffer ( ) ; offset = ( int ) ( p % buffer . length ) ;
public class Context { /** * The method must NOT be public or protected */ SecurityController getSecurityController ( ) { } }
SecurityController global = SecurityController . global ( ) ; if ( global != null ) { return global ; } return securityController ;
public class SparseWeightedGraph { /** * { @ inheritDoc } */ public double strength ( int vertex ) { } }
SparseWeightedEdgeSet e = getEdgeSet ( vertex ) ; return ( e == null ) ? 0 : e . sum ( ) ;
public class AWSOpsWorksClient { /** * Describes the available AWS OpsWorks Stacks agent versions . You must specify a stack ID or a configuration * manager . < code > DescribeAgentVersions < / code > returns a list of available agent versions for the specified stack or * configuration manager . * @ param describ...
request = beforeClientExecution ( request ) ; return executeDescribeAgentVersions ( request ) ;
public class AbstractTagger { /** * 序列标注方法 , 输入为文件 * @ param input 输入文件 UTF8编码 * @ return 标注结果 */ public String tagFile ( String input , String sep ) { } }
StringBuilder res = new StringBuilder ( ) ; try { InputStreamReader read = new InputStreamReader ( new FileInputStream ( input ) , "utf-8" ) ; BufferedReader lbin = new BufferedReader ( read ) ; String str = lbin . readLine ( ) ; while ( str != null ) { String s = ( String ) tag ( str ) ; res . append ( s ) ; res . app...
public class GroupService { /** * Create sub groups in group with { @ code groupId } * @ param config group hierarchy config * @ param groupId group id */ private void createSubgroups ( GroupHierarchyConfig config , String groupId ) { } }
config . getSubitems ( ) . forEach ( cfg -> { if ( cfg instanceof GroupHierarchyConfig ) { GroupMetadata curGroup = findGroup ( ( GroupHierarchyConfig ) cfg , groupId ) ; String subGroupId ; if ( curGroup != null ) { subGroupId = curGroup . getId ( ) ; } else { subGroupId = create ( converter . createGroupConfig ( ( Gr...
public class PowerIteration { /** * Calculate and normalize y = ( A - pI ) x . * Returns the largest element of y in magnitude . */ private static double ax ( Matrix A , double [ ] x , double [ ] y , double p ) { } }
A . ax ( x , y ) ; if ( p != 0.0 ) { for ( int i = 0 ; i < y . length ; i ++ ) { y [ i ] -= p * x [ i ] ; } } double lambda = y [ 0 ] ; for ( int i = 1 ; i < y . length ; i ++ ) { if ( Math . abs ( y [ i ] ) > Math . abs ( lambda ) ) { lambda = y [ i ] ; } } for ( int i = 0 ; i < y . length ; i ++ ) { x [ i ] = y [ i ]...
public class NativeAppCallAttachmentStore { /** * Removes any temporary files associated with a particular native app call . * @ param context the Context the call is being made from * @ param callId the unique ID of the call */ public void cleanupAttachmentsForCall ( Context context , UUID callId ) { } }
File dir = getAttachmentsDirectoryForCall ( callId , false ) ; Utility . deleteDirectory ( dir ) ;
public class LocalDateTime { /** * Returns a copy of this { @ code LocalDateTime } with the specified number of years added . * This method adds the specified amount to the years field in three steps : * < ol > * < li > Add the input years to the year field < / li > * < li > Check if the resulting date would be...
LocalDate newDate = date . plusYears ( years ) ; return with ( newDate , time ) ;
public class AWSStorageGatewayClient { /** * Lists virtual tapes in your virtual tape library ( VTL ) and your virtual tape shelf ( VTS ) . You specify the tapes * to list by specifying one or more tape Amazon Resource Names ( ARNs ) . If you don ' t specify a tape ARN , the * operation lists all virtual tapes in b...
request = beforeClientExecution ( request ) ; return executeListTapes ( request ) ;
public class RiakUserMetadata { /** * Get the user metadata entries * This method allows access to the user metadata entries directly as raw bytes . The * { @ code Set } is an unmodifiable view of all the entries . * @ return an unmodifiable view of all the entries . */ public Set < Map . Entry < BinaryValue , Bi...
return Collections . unmodifiableSet ( meta . entrySet ( ) ) ;
public class UploadListElementMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UploadListElement uploadListElement , ProtocolMarshaller protocolMarshaller ) { } }
if ( uploadListElement == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( uploadListElement . getMultipartUploadId ( ) , MULTIPARTUPLOADID_BINDING ) ; protocolMarshaller . marshall ( uploadListElement . getVaultARN ( ) , VAULTARN_BINDING ) ;...
public class BloomFilter { /** * Applies the MurmurHash3 ( x86_32 ) algorithm to the given data . * See this < a href = " https : / / github . com / aappleby / smhasher / blob / master / src / MurmurHash3 . cpp " > C + + code for the original . < / a > */ public static int murmurHash3 ( byte [ ] data , long nTweak , ...
int h1 = ( int ) ( hashNum * 0xFBA4C795L + nTweak ) ; final int c1 = 0xcc9e2d51 ; final int c2 = 0x1b873593 ; int numBlocks = ( object . length / 4 ) * 4 ; // body for ( int i = 0 ; i < numBlocks ; i += 4 ) { int k1 = ( object [ i ] & 0xFF ) | ( ( object [ i + 1 ] & 0xFF ) << 8 ) | ( ( object [ i + 2 ] & 0xFF ) << 16 )...
public class AllCallReply { /** * Note : this can be used as an accurate check whether the all call reply * has been received correctly without knowing the interrogator in advance . * @ return true if the interrogator ID is conformant with Annex 10 V4 */ public boolean hasValidInterrogatorID ( ) { } }
assert ( interrogator . length == 3 ) ; // 3.1.2.3.3.2 // the first 17 bits have to be zero if ( interrogator [ 0 ] != 0 || interrogator [ 1 ] != 0 || ( interrogator [ 2 ] & 0x80 ) != 0 ) return false ; int cl = ( interrogator [ 2 ] >> 4 ) & 0x7 ; // 3.1.2.5.2.1.3 // code label is only defined for 0-4 if ( cl > 4 ) ret...
public class NetworkInterfaceTapConfigurationsInner { /** * Creates or updates a Tap configuration in the specified NetworkInterface . * @ param resourceGroupName The name of the resource group . * @ param networkInterfaceName The name of the network interface . * @ param tapConfigurationName The name of the tap ...
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( networkInterfaceName == null ) { throw new IllegalArgumentException ( "Parameter networkInterfaceName is required and cannot be null." ) ; } if ( tapConfigurationName == null ...
public class DashboardResources { /** * Returns a dashboard by its ID . * @ param req The HTTP request . * @ param dashboardId The dashboard ID to retrieve . * @ return The corresponding dashboard . * @ throws WebApplicationException If no corresponding dashboard exists . */ @ GET @ Produces ( MediaType . APPLI...
if ( dashboardId == null || dashboardId . compareTo ( BigInteger . ZERO ) < 1 ) { throw new WebApplicationException ( "Dashboard Id cannot be null and must be a positive non-zero number." , Status . BAD_REQUEST ) ; } Dashboard dashboard = dService . findDashboardByPrimaryKey ( dashboardId ) ; if ( dashboard != null && ...
public class SlotPortsView { /** * todo : cause we don ' t support cgroup yet , now vcores is useless */ private int getSlotCount ( int memory , int vcores ) { } }
int cpuports = ( int ) Math . ceil ( vcores / JOYConstants . JSTORM_VCORE_WEIGHT ) ; int memoryports = ( int ) Math . floor ( memory / JOYConstants . JSTORM_MEMORY_WEIGHT ) ; // return cpuports > memoryports ? memoryports : cpuports ; return memoryports ;
public class HalParser { /** * Parse embedded items of a given link - relation type not as HalRepresentation , but as a sub - type of * HalRepresentation , so extra attributes of the embedded items can be accessed . * @ param type the Java class used to map JSON to . * @ param typeInfo type information of the emb...
final JsonNode jsonNode = objectMapper . readTree ( json ) ; final T halRepresentation = objectMapper . convertValue ( jsonNode , type ) ; resolveEmbeddedTypeInfo ( typeInfo , jsonNode , halRepresentation ) ; return halRepresentation ;
public class AutoAckErrorCommand { /** * one day in milliseconds */ @ Override public Date getScheduleTime ( ) { } }
if ( nextScheduleTimeAdd < 0 ) { return null ; } long current = System . currentTimeMillis ( ) ; Date nextSchedule = new Date ( current + nextScheduleTimeAdd ) ; logger . debug ( "Next schedule for job {} is set to {}" , this . getClass ( ) . getSimpleName ( ) , nextSchedule ) ; return nextSchedule ;
public class SystemEventTypeMappings { /** * Get Java model type for the given event type . * @ param eventType the event type . * @ return the Java model type if mapping exists , null otherwise . */ @ Beta public static Type getMapping ( final String eventType ) { } }
if ( ! containsMappingFor ( eventType ) ) { return null ; } else { return systemEventMappings . get ( canonicalizeEventType ( eventType ) ) ; }
public class Configuration { /** * Creates a new MetricRegistryInstance . * @ param api The api with which to register configuration - specific endpoints . * @ return A metric registry instance , initialized based on this configuration . * @ throws RuntimeException if anything goes wrong during registration , for...
return create ( constructor , ( ) -> DateTime . now ( DateTimeZone . UTC ) , api ) ;
public class StartupVerticle { /** * { @ inheritDoc } */ @ Override public void start ( Future < Void > startedResult ) throws Exception { } }
jerseyServer . createServer ( ) . then ( server -> { startedResult . complete ( ) ; return null ; } ) . otherwise ( t -> { startedResult . fail ( t ) ; return null ; } ) ;
public class GVRAccessibilityTalkBack { /** * Initialize { @ code TextToSpeech } and treats unsupported languages exceptions by setting a default language . */ private void init ( ) { } }
mTextToSpeech = new TextToSpeech ( mContext , new OnInitListener ( ) { @ Override public void onInit ( int status ) { if ( status == TextToSpeech . SUCCESS ) { checkCurrentLocale ( ) ; int result = mTextToSpeech . setLanguage ( mLocale ) ; if ( result == TextToSpeech . LANG_MISSING_DATA || result == TextToSpeech . LANG...
public class Supplier { /** * The predefined Supplier selects values using the given { @ link com . hazelcast . mapreduce . KeyPredicate } * and does not perform any kind of data transformation . Input value types need to match the * aggregations expected value type to make this Supplier work . * @ param < KeyIn ...
return new KeyPredicateSupplier < KeyIn , ValueIn , ValueOut > ( keyPredicate ) ;
public class DividerAdapterBuilder { /** * Sets the divider that appears before the wrapped adapters items . */ @ NonNull public DividerAdapterBuilder leadingView ( @ NonNull ViewFactory viewFactory ) { } }
mLeadingItem = new Item ( checkNotNull ( viewFactory , "viewFactory" ) , false ) ; return this ;
public class UserBS { /** * Verificar se usuário é de uma determinada instituição . * @ param user * Usuário para verificação . * @ param company * Instituição para verificação . * @ return CompanyUser Instituição que pertence a determinado usuário . */ public CompanyUser retrieveCompanyUser ( U...
Criteria criteria = this . dao . newCriteria ( CompanyUser . class ) ; criteria . add ( Restrictions . eq ( "company" , company ) ) ; criteria . add ( Restrictions . eq ( "user" , user ) ) ; return ( CompanyUser ) criteria . uniqueResult ( ) ;
public class Execution { /** * Calculates the preferred locations based on the location preference constraint . * @ param locationPreferenceConstraint constraint for the location preference * @ return Future containing the collection of preferred locations . This might not be completed if not all inputs * have be...
final Collection < CompletableFuture < TaskManagerLocation > > preferredLocationFutures = getVertex ( ) . getPreferredLocations ( ) ; final CompletableFuture < Collection < TaskManagerLocation > > preferredLocationsFuture ; switch ( locationPreferenceConstraint ) { case ALL : preferredLocationsFuture = FutureUtils . co...
public class PngOptimizer { private List < byte [ ] > copyScanlines ( List < byte [ ] > original ) { } }
final List < byte [ ] > copy = new ArrayList < > ( original . size ( ) ) ; for ( byte [ ] scanline : original ) { copy . add ( scanline . clone ( ) ) ; } return copy ;
public class GlobusGSSContextImpl { protected void setGssMode ( Object value ) throws GSSException { } }
if ( ! ( value instanceof Integer ) ) { throw new GlobusGSSException ( GSSException . FAILURE , GlobusGSSException . BAD_OPTION_TYPE , "badType" , new Object [ ] { "GSS mode" , Integer . class } ) ; } Integer v = ( Integer ) value ; if ( v == GSIConstants . MODE_GSI || v == GSIConstants . MODE_SSL ) { this . gssMode = ...
public class CSSIdentifierSerializer { /** * See https : / / drafts . csswg . org / cssom / # escape - a - character - as - code - point . */ private boolean shouldEscapeAsCodePoint ( int codeUnit , int index , int firstCodeUnit ) { } }
// If the character is in the range [ \ 1 - \ 1F ] ( U + 0001 to U + 001F ) or is U + 007F , [ . . . ] if ( isInRange ( codeUnit , 0x0001 , 0x001F ) || codeUnit == 0x007F ) { return true ; } else if ( index == 0 && isInRange ( codeUnit , 0x0030 , 0x0039 ) ) { // If the character is the first character and is in the ran...
public class JMeterPluginsUtils { /** * Builds full URL from wiki page name unless a URL is already passed in . * @ param helpPage wiki page name ( not full URL ) or URL to external wiki * @ return full URL to helpPage */ public static String buildHelpPageUrl ( String helpPage ) { } }
try { if ( helpPage . matches ( "[hH][tT][tT][pP][sS]?://.*" ) ) { log . debug ( "Help page URL found, skipping building link to " + WIKI_BASE ) ; return helpPage ; } } catch ( PatternSyntaxException ex ) { log . warn ( "Invalid regex" , ex ) ; } if ( helpPage . endsWith ( "Gui" ) ) { helpPage = helpPage . substring ( ...
public class UTF8Reader { /** * / * Internal methods */ private void reportInvalidInitial ( int mask , int offset ) throws IOException { } }
// input ( byte ) ptr has been advanced by one , by now : int bytePos = _byteCount + _inputPtr - 1 ; int charPos = _charCount + offset + 1 ; throw new CharConversionException ( "Invalid UTF-8 start byte 0x" + Integer . toHexString ( mask ) + " (at char #" + charPos + ", byte #" + bytePos + ")" ) ;
public class FileUtils { /** * Get the file size in a human - readable string . * @ param size * @ return * @ author paulburke */ public static String getReadableFileSize ( int size ) { } }
final int BYTES_IN_KILOBYTES = 1024 ; final DecimalFormat dec = new DecimalFormat ( "###.#" ) ; final String KILOBYTES = " KB" ; final String MEGABYTES = " MB" ; final String GIGABYTES = " GB" ; float fileSize = 0 ; String suffix = KILOBYTES ; if ( size > BYTES_IN_KILOBYTES ) { fileSize = size / BYTES_IN_KILOBYTES ; if...
public class CnvTfsEnum { /** * < p > Convert from string . < / p > * @ param pAddParam additional params , e . g . IRequestData * to fill owner itsVersion . * @ param pStrVal name * @ return Enum value * @ throws Exception - an exception */ @ Override public final E fromString ( final Map < String , Object >...
if ( pStrVal == null || "" . equals ( pStrVal ) ) { return null ; } return Enum . valueOf ( this . enumClass , pStrVal ) ;
public class CodeModelUtils { /** * Returns a property file ( created if necessary ) . * @ param thePackage * package to create property file * @ param name * property file name . * @ return Property file . */ public static JPropertyFile getOrCreatePropertyFile ( JPackage thePackage , String name ) { } }
JPropertyFile propertyFile = null ; for ( Iterator < JResourceFile > iterator = thePackage . propertyFiles ( ) ; iterator . hasNext ( ) && ( null == propertyFile ) ; ) { final JResourceFile resourceFile = ( JResourceFile ) iterator . next ( ) ; if ( resourceFile instanceof JPropertyFile && name . equals ( resourceFile ...
public class ServletHelper { /** * Safe version of < code > ServletRequest . setAttribute ( String , Object ) < / code > to * work around an error in certain Tomcat versions . * < pre > * java . lang . NullPointerException * 1 . : org . apache . catalina . connector . Request . notifyAttributeAssigned ( Request...
try { aRequest . setAttribute ( sAttrName , aAttrValue ) ; } catch ( final Exception ex ) { // Happens in certain Tomcat versions ( e . g . 7.0.42 with JDK 8 ) : if ( isLogExceptions ( ) ) if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "[ServletHelper] Failed to set attribute '" + sAttrName + "' in HTTP request" , e...
public class ProcedureCompiler { /** * get the short name of the class ( no package ) * @ param className fully qualified ( or not ) class name * @ return short name of the class ( no package ) */ public static String deriveShortProcedureName ( String className ) { } }
if ( className == null || className . trim ( ) . isEmpty ( ) ) { return null ; } String [ ] parts = className . split ( "\\." ) ; String shortName = parts [ parts . length - 1 ] ; return shortName ;
public class NonBlockingBufferedReader { /** * Tells whether this stream is ready to be read . A buffered character stream * is ready if the buffer is not empty , or if the underlying character stream * is ready . * @ return < code > true < / code > if the reader is ready * @ exception IOException * If an I /...
_ensureOpen ( ) ; /* * If newline needs to be skipped and the next char to be read is a newline * character , then just skip it right away . */ if ( m_bSkipLF ) { /* * Note that in . ready ( ) will return true if and only if the next read on * the stream will not block . */ if ( m_nNextCharIndex >= m_nChars && m_aR...
public class CalligraphyFactory { /** * Handle the created view * @ param view nullable . * @ param context shouldn ' t be null . * @ param attrs shouldn ' t be null . * @ return null if null is passed in . */ public View onViewCreated ( View view , Context context , AttributeSet attrs ) { } }
if ( view != null && view . getTag ( R . id . calligraphy_tag_id ) != Boolean . TRUE ) { onViewCreatedInternal ( view , context , attrs ) ; view . setTag ( R . id . calligraphy_tag_id , Boolean . TRUE ) ; } return view ;
public class IncludeDescriptorsProcessor { /** * Replaces special include tags found in a descriptor document with the document tree of descriptors specified in * these include tags . If the include tag specifies a XPath query expression ( through the select attribute ) , only * the elements returned by the query w...
if ( item . getDescriptorDom ( ) != null ) { includeDescriptors ( context , cachingOptions , item ) ; } return item ;
public class DocumentObjectMapper { /** * Extract entity field . * @ param entity * the entity * @ param dbObj * the db obj * @ param column * the column * @ throws PropertyAccessException * the property access exception */ static void extractFieldValue ( Object entity , DBObject dbObj , Attribute colum...
try { Object valueObject = PropertyAccessorHelper . getObject ( entity , ( Field ) column . getJavaMember ( ) ) ; if ( valueObject != null ) { Class javaType = column . getJavaType ( ) ; switch ( AttributeType . getType ( javaType ) ) { case MAP : Map mapObj = ( Map ) valueObject ; // BasicDBObjectBuilder builder = // ...
public class C10NConfigBase { /** * < p > Create a custom implementation binding for the given c10n interface * < p > There are two basic usages : * < pre > < code > * bind ( Messages . class ) . to ( JapaneseMessagesImpl . class , Locale . JAPANESE ) ; * < / code > < / pre > * which will use the < code > Jap...
C10NImplementationBinder < T > binder = new C10NImplementationBinder < T > ( ) ; binders . put ( c10nInterface , binder ) ; return binder ;
public class B2BUAHelper { /** * Modify Messages with new headers and header attributes * Moved from CallManager and Call * The method deals with custom and standard headers , such as R - URI , Route etc * TODO : refactor / rename / handle more specific headers * @ param sipFactory SipFactory * @ param messag...
if ( headers != null && sipFactory != null ) { for ( Map . Entry < String , ArrayList < String > > entry : headers . entrySet ( ) ) { // check if header exists String headerName = entry . getKey ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "headerName=" + headerName + " headerVal=" + message . getHeader ...
public class DateListProperty { /** * Resets the timezone associated with the property . If utc is true , any TZID parameters are removed and the Java * timezone is updated to UTC time . If utc is false , TZID parameters are removed and the Java timezone is set to the * default timezone ( i . e . represents a " flo...
if ( dates == null || ! Value . DATE_TIME . equals ( dates . getType ( ) ) ) { throw new UnsupportedOperationException ( "TimeZone is not applicable to current value" ) ; } dates . setUtc ( utc ) ; getParameters ( ) . remove ( getParameter ( Parameter . TZID ) ) ;
public class MinDelta { /** * Checks whether the minimum delta observed during the current run of the given * search is still above the required minimum . * @ param search search for which the minimum delta has to be checked * @ return < code > true < / code > in case of a minimum delta below the required minimum...
return search . getMinDelta ( ) != JamesConstants . INVALID_DELTA && search . getMinDelta ( ) < minDelta ;
public class Validators { /** * Creates and returns a validator , which allows to validate texts to ensure , that they begin * with an uppercase letter . Empty texts are also accepted . * @ param context * The context , which should be used to retrieve the error message , as an instance of * the class { @ link ...
return new BeginsWithUppercaseLetterValidator ( context , R . string . default_error_message ) ;
public class OIDCClientAuthenticatorUtil { /** * This method handle the redirect to the OpenID Connect server with query parameters */ public ProviderAuthenticationResult handleRedirectToServer ( HttpServletRequest req , HttpServletResponse res , ConvergedClientConfig clientConfig ) { } }
String authorizationEndpoint = clientConfig . getAuthorizationEndpointUrl ( ) ; if ( ! checkHttpsRequirement ( clientConfig , authorizationEndpoint ) ) { Tr . error ( tc , "OIDC_CLIENT_URL_PROTOCOL_NOT_HTTPS" , authorizationEndpoint ) ; return new ProviderAuthenticationResult ( AuthResult . SEND_401 , HttpServletRespon...
public class FileSystemUtilities { /** * Filters all supplied files using the provided { @ code acceptFilter } . * @ param files The list of files to resolve , filter and return . If the { @ code files } List * contains directories , they are searched for Files recursively . Any found Files in such * a search are...
// Check sanity Validate . notNull ( files , "files" ) ; final List < File > toReturn = new ArrayList < File > ( ) ; if ( files . size ( ) > 0 ) { for ( File current : files ) { final boolean isAcceptedFile = EXISTING_FILE . accept ( current ) && acceptFilter . accept ( current ) ; final boolean isAcceptedDirectory = E...
public class DataTransferServiceClient { /** * Retrieves a supported data source and returns its settings , which can be used for UI rendering . * < p > Sample code : * < pre > < code > * try ( DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient . create ( ) ) { * DataSourceName name...
GetDataSourceRequest request = GetDataSourceRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return getDataSource ( request ) ;
public class AsynchronousHandlerInvocation { /** * { @ inheritDoc } */ @ Override public void invoke ( final Object listener , final Object message , final MessagePublication publication ) { } }
executor . execute ( new Runnable ( ) { @ Override public void run ( ) { delegate . invoke ( listener , message , publication ) ; } } ) ;
public class JDBCClob { /** * Retrieves the character position at which the specified substring * < code > searchstr < / code > appears in the SQL < code > CLOB < / code > value * represented by this < code > Clob < / code > object . The search * begins at position < code > start < / code > . * @ param searchst...
final String ldata = data ; checkValid ( ldata ) ; if ( start < MIN_POS ) { throw Util . outOfRangeArgument ( "start: " + start ) ; } if ( searchstr == null || start > MAX_POS ) { return - 1 ; } final int pos = ldata . indexOf ( searchstr , ( int ) -- start ) ; return ( pos < 0 ) ? - 1 : pos + 1 ;
public class CPDefinitionLocalizationPersistenceImpl { /** * Caches the cp definition localizations in the entity cache if it is enabled . * @ param cpDefinitionLocalizations the cp definition localizations */ @ Override public void cacheResult ( List < CPDefinitionLocalization > cpDefinitionLocalizations ) { } }
for ( CPDefinitionLocalization cpDefinitionLocalization : cpDefinitionLocalizations ) { if ( entityCache . getResult ( CPDefinitionLocalizationModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionLocalizationImpl . class , cpDefinitionLocalization . getPrimaryKey ( ) ) == null ) { cacheResult ( cpDefinitionLocalization ) ; }...
public class ConstantPropagationAnalysis { /** * Returns the value of the leaf of { @ code exprPath } , if it is determined to be a constant ( always * evaluates to the same numeric value ) , and null otherwise . Note that returning null does not * necessarily mean the expression is * not * a constant . */ @ Nullab...
Constant val = DataFlow . expressionDataflow ( exprPath , context , CONSTANT_PROPAGATION ) ; if ( val == null || ! val . isConstant ( ) ) { return null ; } return val . getValue ( ) ;
public class CmsSearchCategoryCollector { /** * Convenience method to format a map of categories in a nice 2 column list , for example * for display of debugging output . < p > * @ param categories the map to format * @ return the formatted category map */ public static final String formatCategoryMap ( Map < Stri...
StringBuffer result = new StringBuffer ( 256 ) ; result . append ( "Total categories: " ) ; result . append ( categories . size ( ) ) ; result . append ( '\n' ) ; Iterator < Map . Entry < String , Integer > > i = categories . entrySet ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { Map . Entry < String , Integer > ent...
public class GenericHibernateDao { /** * Deletes the passed entity . * @ param e The entity to remove from the database . */ public void delete ( E e ) { } }
LOG . trace ( "Deleting " + entityClass . getSimpleName ( ) + " with ID " + e . getId ( ) ) ; getSession ( ) . delete ( e ) ;
public class Expressions { /** * Create a new Path expression * @ param type type of expression * @ param metadata path metadata * @ param < T > type of expression * @ return path expression */ public static < T extends Enum < T > > EnumPath < T > enumPath ( Class < ? extends T > type , PathMetadata metadata ) ...
return new EnumPath < T > ( type , metadata ) ;
public class PropertyAdapter { /** * Generate a default example value for property . * @ param property property * @ param markupDocBuilder doc builder * @ return a generated example for the property */ public static Object generateExample ( Property property , MarkupDocBuilder markupDocBuilder ) { } }
if ( property . getType ( ) == null ) { return "untyped" ; } switch ( property . getType ( ) ) { case "integer" : return ExamplesUtil . generateIntegerExample ( property instanceof IntegerProperty ? ( ( IntegerProperty ) property ) . getEnum ( ) : null ) ; case "number" : return 0.0 ; case "boolean" : return true ; cas...
public class ShareActionProviders { /** * Creates a sharing { @ link Intent } . * @ return The sharing intent . */ private Intent createShareIntent ( ) { } }
Intent shareIntent = new Intent ( Intent . ACTION_SEND ) ; shareIntent . setType ( "image/*" ) ; Uri uri = Uri . fromFile ( getFileStreamPath ( "shared.png" ) ) ; shareIntent . putExtra ( Intent . EXTRA_STREAM , uri ) ; return shareIntent ;
public class VersionNumber { /** * Try to determine the version number of the operating system by parsing the user agent string . * @ param family * family of the operating system * @ param userAgent * user agent string * @ return extracted version number */ public static VersionNumber parseOperatingSystemVer...
Check . notNull ( family , "family" ) ; Check . notNull ( userAgent , "userAgent" ) ; return VersionParser . parseOperatingSystemVersion ( family , userAgent ) ;
public class MediaChannel { /** * Disables the channel and deactivates it ' s resources . * @ throws IllegalStateException * When an attempt is done to deactivate the channel while * inactive . */ public void close ( ) throws IllegalStateException { } }
if ( this . open ) { // Close channels this . rtpChannel . close ( ) ; if ( ! this . rtcpMux ) { this . rtcpChannel . close ( ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( this . mediaType + " channel " + this . ssrc + " is closed" ) ; } // Reset state reset ( ) ; this . open = false ; } else { throw new ...
public class CloseableReference { /** * Clones a collection of references and returns a list . Returns null if the list is null . If the * list is non - null , clones each reference . If a reference cannot be cloned due to already being * closed , the list will contain a null value in its place . * @ param refs t...
if ( refs == null ) { return null ; } List < CloseableReference < T > > ret = new ArrayList < > ( refs . size ( ) ) ; for ( CloseableReference < T > ref : refs ) { ret . add ( CloseableReference . cloneOrNull ( ref ) ) ; } return ret ;
public class I18nSpecificInList { /** * < p > Setter for lang . < / p > * @ param pLang reference */ public final void setLang ( final Languages pLang ) { } }
this . lang = pLang ; if ( this . itsId == null ) { this . itsId = new IdI18nSpecificInList ( ) ; } this . itsId . setLang ( this . lang ) ;
public class snmpgroup { /** * Use this API to delete snmpgroup . */ public static base_response delete ( nitro_service client , snmpgroup resource ) throws Exception { } }
snmpgroup deleteresource = new snmpgroup ( ) ; deleteresource . name = resource . name ; deleteresource . securitylevel = resource . securitylevel ; return deleteresource . delete_resource ( client ) ;
public class CollectionNumbers { /** * Returns either the wrapped array ( if exists and matches the type ) * or a copy - USE WITH CAUTION AS IT MAY EXPOSE THE INTERNAL STATE * OF THE COLLECTION . * @ param coll the collection * @ return the array */ public static short [ ] shortArrayWrappedOrCopy ( CollectionNu...
short [ ] array = wrappedShortArray ( coll ) ; if ( array != null ) { return array ; } return shortArrayCopyOf ( coll ) ;
public class SARLPackageExplorerPart { /** * Returns the package explorer part of the active perspective . If * there isn ' t any package explorer part < code > null < / code > is returned . * @ return the package explorer from the active perspective */ public static SARLPackageExplorerPart getFromActivePerspective...
final IWorkbenchPage activePage = JavaPlugin . getActivePage ( ) ; if ( activePage == null ) { return null ; } final IViewPart view = activePage . findView ( ID_PACKAGES ) ; if ( view instanceof PackageExplorerPart ) { return ( SARLPackageExplorerPart ) view ; } return null ;
public class IOGroovyMethods { /** * Write the byte [ ] to the output stream . * The stream is closed before this method returns . * @ param os an output stream * @ param bytes the byte [ ] to write to the output stream * @ throws IOException if an IOException occurs . * @ since 1.7.1 */ public static void se...
try { os . write ( bytes ) ; } finally { closeWithWarning ( os ) ; }
public class AbstractMarkupText { /** * Find all " tokens " that match the given pattern in this text . * A token is like a substring , except that it ' s aware of word boundaries . * For example , while " bc " is a string of " abc " , calling { @ code findTokens } * with " bc " as a pattern on string " abc " won...
String text = getText ( ) ; Matcher m = pattern . matcher ( text ) ; List < SubText > r = new ArrayList < > ( ) ; while ( m . find ( ) ) { int idx = m . start ( ) ; if ( idx > 0 ) { char ch = text . charAt ( idx - 1 ) ; if ( Character . isLetter ( ch ) || Character . isDigit ( ch ) ) continue ; // not at a word boundar...
public class HandlerSocketHandler { /** * Check if have to reconnect on session closed */ @ Override public final void onSessionClosed ( Session session ) { } }
this . hsClient . getConnector ( ) . removeSession ( session ) ; HandlerSocketSession hSession = ( HandlerSocketSession ) session ; hSession . destroy ( ) ; if ( this . hsClient . getConnector ( ) . isStarted ( ) && hSession . isAllowReconnect ( ) ) { this . reconnect ( session ) ; } for ( HSClientStateListener listene...
public class BlockSelectorMarkupHandler { /** * Text events */ @ Override public void handleText ( final char [ ] buffer , final int offset , final int len , final int line , final int col ) throws ParseException { } }
if ( ! this . insideAllSelectorMatchingBlock ) { this . someSelectorsMatch = false ; for ( int i = 0 ; i < this . selectorsLen ; i ++ ) { if ( this . matchingMarkupLevelsPerSelector [ i ] > this . markupLevel ) { this . selectorMatches [ i ] = this . selectorFilters [ i ] . matchText ( true , this . markupLevel , this ...
public class TemporaryFiles { /** * Create a temporary file . */ public AsyncWork < File , IOException > createFileAsync ( String prefix , String suffix ) { } }
return new Task . OnFile < File , IOException > ( tempDir , "Create temporary file" , Task . PRIORITY_NORMAL ) { @ Override public File run ( ) throws IOException { return createFileSync ( prefix , suffix ) ; } } . start ( ) . getOutput ( ) ;
public class AbstractBigtableAdmin { /** * { @ inheritDoc } */ @ Override public HTableDescriptor [ ] enableTables ( Pattern pattern ) throws IOException { } }
HTableDescriptor [ ] tableDescriptors = listTables ( pattern ) ; for ( HTableDescriptor descriptor : tableDescriptors ) { enableTable ( descriptor . getTableName ( ) ) ; } return tableDescriptors ;
public class LocalUniqueIndex { /** * Create a new index that allows only a single value for each unique key . * @ param name the name of the index ; may not be null or empty * @ param workspaceName the name of the workspace ; may not be null * @ param db the database in which the index information is to be store...
return new LocalUniqueIndex < > ( name , workspaceName , db , converter , valueSerializer , rawSerializer ) ;
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public IfcThermalLoadTypeEnum createIfcThermalLoadTypeEnumFromString ( EDataType eDataType , String initialValue ) { } }
IfcThermalLoadTypeEnum result = IfcThermalLoadTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class CPDefinitionUtil { /** * Returns the last cp definition in the ordered set where displayDate & lt ; & # 63 ; and status = & # 63 ; . * @ param displayDate the display date * @ param status the status * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ...
return getPersistence ( ) . findByLtD_S_Last ( displayDate , status , orderByComparator ) ;
public class DefaultPDUReader { /** * / * ( non - Javadoc ) * @ see org . jsmpp . PDUReader # readPDU ( java . io . InputStream , org . jsmpp . bean . Command ) */ public byte [ ] readPDU ( DataInputStream in , Command pduHeader ) throws IOException { } }
return readPDU ( in , pduHeader . getCommandLength ( ) , pduHeader . getCommandId ( ) , pduHeader . getCommandStatus ( ) , pduHeader . getSequenceNumber ( ) ) ;
public class BondImpl { /** * TODO first check if those bonds haven ' t been made already */ private void addSelfToAtoms ( ) { } }
List < Bond > bonds = atomA . getBonds ( ) ; if ( bonds == null ) { bonds = new ArrayList < Bond > ( AtomImpl . BONDS_INITIAL_CAPACITY ) ; atomA . setBonds ( bonds ) ; } boolean exists = false ; for ( Bond bond : bonds ) { // TODO is it equals ( ) what we want here , or is it = = ? - JD 2016-03-02 if ( bond . getOther ...
public class CuratorFrameworkFactory { /** * Create a new client with default session timeout and default connection timeout * @ param connectString list of servers to connect to * @ param retryPolicy retry policy to use * @ return client */ public static CuratorFramework newClient ( String connectString , RetryP...
return newClient ( connectString , DEFAULT_SESSION_TIMEOUT_MS , DEFAULT_CONNECTION_TIMEOUT_MS , retryPolicy ) ;
public class AbstractRegionPainter { /** * Decodes and returns a color , which is derived from a base color in UI * defaults . * @ param key A key corresponding to the value in the UI Defaults table * of UIManager where the base color is defined * @ param hOffset The hue offset used for derivation . * @ param...
if ( UIManager . getLookAndFeel ( ) instanceof SeaGlassLookAndFeel ) { SeaGlassLookAndFeel laf = ( SeaGlassLookAndFeel ) UIManager . getLookAndFeel ( ) ; return laf . getDerivedColor ( key , hOffset , sOffset , bOffset , aOffset , true ) ; } else { // can not give a right answer as painter should not be used outside //...
public class ExceptionSoftener { /** * Soften a CheckedLongSupplier to an LongSupplier that doesn ' t need to declare any checked exceptions thrown * e . g . * < pre > * { @ code * LongSupplier supplier = ExceptionSoftener . softenLongSupplier ( ( ) - > { throw new IOException ( ) ; } ) * supplier . getAsLong...
return ( ) -> { try { return s . getAsLong ( ) ; } catch ( final Throwable e ) { throw throwSoftenedException ( e ) ; } } ;