signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class GetObjectProperties { /** * Uses the new RetrievePropertiesEx method to emulate the now deprecated * RetrieveProperties method * @ param propertyFilterSpecList * @ return list of object content * @ throws Exception */ private static List < ObjectContent > retrievePropertiesAllObjects ( ConnectionRe...
VimPortType vimPort = connectionResources . getVimPortType ( ) ; ManagedObjectReference serviceInstance = connectionResources . getServiceInstance ( ) ; ServiceContent serviceContent = vimPort . retrieveServiceContent ( serviceInstance ) ; ManagedObjectReference propertyCollectorReference = serviceContent . getProperty...
public class Chrono { /** * JAXB compatible dataTime Stamp * Java 6 does not format Timezone with - 05:00 format , and JAXB XML breaks without it . * @ return */ public static String dateTime ( Date date ) { } }
GregorianCalendar gc = new GregorianCalendar ( ) ; gc . setTime ( date ) ; return dateTime ( gc ) ;
public class CSVDumper { /** * - - - - - Private methods */ private static void usage ( ) { } }
display ( "Usage: CSVDumper <params>" ) ; display ( "where <params> are:" ) ; display ( " -app <name> Doradus application name. Default is: {}" , CSVConfig . DEFAULT_APPNAME ) ; display ( " -batchsize <#> Batch size. Default is: {}" , CSVConfig . DEFAULT_BATCH_SIZE ) ; display ( " -compress [T|F] ...
public class DefaultGroovyMethods { /** * Iterates through the given array as with inject ( Object [ ] , initialValue , closure ) , but * using the first element of the array as the initialValue , and then iterating * the remaining elements of the array . * @ param self an Object [ ] * @ param closure a closure...
return inject ( ( Object ) self , closure ) ;
public class AudioChannel { /** * Use the RTPManager API to create sessions for each jmf * track of the processor . * @ return description */ private String createTransmitter ( ) { } }
// Cheated . Should have checked the type . PushBufferDataSource pbds = ( PushBufferDataSource ) dataOutput ; PushBufferStream [ ] pbss = pbds . getStreams ( ) ; rtpMgrs = new RTPManager [ pbss . length ] ; SessionAddress localAddr , destAddr ; InetAddress ipAddr ; SendStream sendStream ; audioReceiver = new AudioRecei...
public class Alignments { /** * Factory method which computes a similarity score for the given { @ link Sequence } pair . * @ param < S > each { @ link Sequence } of the pair is of type S * @ param < C > each element of a { @ link Sequence } is a { @ link Compound } of type C * @ param query the first { @ link Se...
return getPairwiseScorer ( query , target , type , gapPenalty , subMatrix ) . getScore ( ) ;
public class HCHelper { /** * Recursively iterate all child nodes of the passed node . * @ param aNode * The node who ' s children should be iterated . * @ param aCallback * The callback to be invoked on every child */ public static void iterateChildrenNonBreakable ( @ Nonnull final IHCNode aNode , @ Nonnull fi...
ValueEnforcer . notNull ( aNode , "node" ) ; ValueEnforcer . notNull ( aCallback , "callback" ) ; final ICommonsList < IHCNode > aParentNodes = new CommonsArrayList < > ( ) ; final ICommonsList < IHCNode > aNodes = new CommonsArrayList < > ( ) ; if ( aNode . hasChildren ( ) ) for ( final IHCNode aChild : aNode . getChi...
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getERG ( ) { } }
if ( ergEClass == null ) { ergEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 259 ) ; } return ergEClass ;
public class StreamScanner { /** * Simple parsing method that parses system ids , which are generally * used in entities ( from DOCTYPE declaration to internal / external * subsets ) . * NOTE : returned String is not canonicalized , on assumption that * external ids may be longish , and are not shared all that ...
char [ ] buf = getNameBuffer ( - 1 ) ; int ptr = 0 ; while ( true ) { char c = ( mInputPtr < mInputEnd ) ? mInputBuffer [ mInputPtr ++ ] : getNextChar ( errorMsg ) ; if ( c == quoteChar ) { break ; } /* ? ? ? 14 - Jun - 2004 , TSa : Should we normalize linefeeds or not ? * It seems like we should , for all input . . ...
public class MaF15 { /** * Evaluates a solution * @ param solution The solution to evaluate */ @ Override public void evaluate ( DoubleSolution solution ) { } }
int numberOfVariables = solution . getNumberOfVariables ( ) ; int numberOfObjectives = solution . getNumberOfObjectives ( ) ; double [ ] x = new double [ numberOfVariables ] ; double [ ] f = new double [ numberOfObjectives ] ; for ( int i = 0 ; i < numberOfVariables ; i ++ ) { x [ i ] = solution . getVariableValue ( i ...
public class Proxy { protected void startSession ( ) throws SocksException { } }
System . out . println ( "Session: " + proxyHost + ":" + proxyPort ) ; try { if ( chainProxy == null ) proxySocket = new Socket ( proxyIP , proxyPort ) ; else if ( proxyIP != null ) proxySocket = new SocksSocket ( chainProxy , proxyIP , proxyPort ) ; else proxySocket = new SocksSocket ( chainProxy , proxyHost , proxyPo...
public class CassQuery { /** * Returns bytes value for given value . * @ param jpaFieldName * field name . * @ param m * entity metadata * @ param value * value . * @ return bytes value . */ ByteBuffer getBytesValue ( String jpaFieldName , EntityMetadata m , Object value ) { } }
Attribute idCol = m . getIdAttribute ( ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; EntityType entity = metaModel . entity ( m . getEntityClazz ( ) ) ; Field f = null ; boolean isId = false ; if ( ( ( AbstractAttribute ) idC...
public class StateConsumerImpl { /** * not used in scattered cache */ private void requestSegments ( IntSet segments , Map < Address , IntSet > sources , Set < Address > excludedSources ) { } }
if ( sources . isEmpty ( ) ) { findSources ( segments , sources , excludedSources ) ; } for ( Map . Entry < Address , IntSet > e : sources . entrySet ( ) ) { addTransfer ( e . getKey ( ) , e . getValue ( ) ) ; }
public class Blade { /** * Stop current blade application * Will stop synchronization waiting netty service */ public void stop ( ) { } }
this . eventManager . fireEvent ( EventType . SERVER_STOPPING , new Event ( ) . attribute ( "blade" , this ) ) ; this . server . stopAndWait ( ) ; this . eventManager . fireEvent ( EventType . SERVER_STOPPED , new Event ( ) . attribute ( "blade" , this ) ) ;
public class EntityListenersIntrospector { /** * Returns the metadata of various registered listeners for the given entity class . * @ param entityClass * the entity class to introspect * @ return the metadata of various listeners . */ public static EntityListenersMetadata introspect ( Class < ? > entityClass ) {...
EntityListenersIntrospector introspector = new EntityListenersIntrospector ( entityClass ) ; introspector . introspect ( ) ; return introspector . metadata ;
public class ResourceLoader { /** * Loads a resource into a { @ link List } of strings , each entry representing one line . * @ param resource * The resource to be loaded . * @ return The list */ public static List < String > readIntoLines ( final String resource ) throws IOException { } }
BufferedReader br = null ; try { br = ResourceLoader . getBufferedReader ( resource ) ; return doReadIntoLines ( br ) ; } finally { IOUtils . closeQuietly ( br ) ; }
public class CartUrl { /** * Get Resource Url for GetCart * @ param cartId Identifier of the cart to delete . * @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting ...
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/{cartId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cartId" , cartId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
public class MimeTypeParser { /** * Check if the passed string is a valid MIME token by checking that the * length is at least 1 and all chars match the { @ link # isTokenChar ( char ) } * condition . * @ param sToken * The token to be checked . May be < code > null < / code > . * @ return < code > true < / c...
// Check length if ( StringHelper . hasNoText ( sToken ) ) return false ; // Check that all chars are token chars final char [ ] aChars = sToken . toCharArray ( ) ; for ( final char c : aChars ) if ( ! isTokenChar ( c ) ) return false ; return true ;
public class DelegatingClassResolver { /** * { @ inheritDoc } */ public Iterator < URL > getResources ( String name ) { } }
ArrayList < URL > collectedResources = new ArrayList < URL > ( ) ; for ( IClassResolver resolver : resolvers ) { try { Iterator < URL > iterator = resolver . getResources ( name ) ; if ( iterator == null ) { continue ; } while ( iterator . hasNext ( ) ) { collectedResources . add ( iterator . next ( ) ) ; } } catch ( R...
public class AddressUtil { /** * Creates a address to the given host , or the wildcard host if the hostname is * { @ link StringUtil # blank } . */ public static InetSocketAddress getAddress ( String hostname , int port ) { } }
return StringUtil . isBlank ( hostname ) ? new InetSocketAddress ( port ) : new InetSocketAddress ( hostname , port ) ;
public class S3Utils { /** * Retries S3 operations that fail due to io - related exceptions . Service - level exceptions ( access denied , file not * found , etc ) are not retried . */ public static < T > T retryS3Operation ( Task < T > f ) throws Exception { } }
final int maxTries = 10 ; return RetryUtils . retry ( f , S3RETRY , maxTries ) ;
public class ScopedRequestImpl { /** * Add a parameter to the request . * @ param name the parameter name . * @ param value the parameter value . */ public void addParameter ( String name , String value ) { } }
if ( _additionalParameters == null ) { _additionalParameters = new HashMap ( ) ; } _additionalParameters . put ( name , value ) ;
public class MessageAttributeValue { /** * Not implemented . Reserved for future use . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setStringListValues ( java . util . Collection ) } or { @ link # withStringListValues ( java . util . Collection ) } if you ...
if ( this . stringListValues == null ) { setStringListValues ( new com . amazonaws . internal . SdkInternalList < String > ( stringListValues . length ) ) ; } for ( String ele : stringListValues ) { this . stringListValues . add ( ele ) ; } return this ;
public class ScriptUtil { /** * return lua script String * @ param path * @ return */ public static String getScript ( String path ) { } }
StringBuilder sb = new StringBuilder ( ) ; InputStream stream = ScriptUtil . class . getClassLoader ( ) . getResourceAsStream ( path ) ; try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( stream ) ) ) { String str ; while ( ( str = br . readLine ( ) ) != null ) { sb . append ( str ) . append ( Syste...
public class SarlBatchCompiler { /** * Change the boot classpath . * This option is only supported on JDK 8 and older and will be ignored when source level is 9 or newer . * < p > The boot classpath is a list the names of folders or jar files that are separated by { @ link File # pathSeparator } . * @ param bootC...
final JavaVersion version = JavaVersion . fromQualifier ( getJavaSourceVersion ( ) ) ; if ( version . isAtLeast ( JavaVersion . JAVA9 ) ) { reportInternalWarning ( MessageFormat . format ( Messages . SarlBatchCompiler_63 , bootClasspath ) ) ; } if ( Strings . isEmpty ( bootClasspath ) ) { this . bootClasspath = null ; ...
public class BottomSheet { /** * Set the icon of the bottom sheet . * @ param attributeId * The id of the theme attribute , which supplies the icon , which should be set , as an * { @ link Integer } value . The id must point to a valid drawable resource */ public final void setIconAttribute ( @ AttrRes final int ...
TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( new int [ ] { attributeId } ) ; this . icon = typedArray . getDrawable ( 0 ) ; this . iconBitmap = null ; this . iconId = - 1 ; this . iconAttributeId = attributeId ; adaptIcon ( ) ;
public class NetUtil { /** * 构建InetSocketAddress < br > * 当host中包含端口时 ( 用 “ : ” 隔开 ) , 使用host中的端口 , 否则使用默认端口 < br > * 给定host为空时使用本地host ( 127.0.0.1) * @ param host Host * @ param defaultPort 默认端口 * @ return InetSocketAddress */ public static InetSocketAddress buildInetSocketAddress ( String host , int default...
if ( StrUtil . isBlank ( host ) ) { host = LOCAL_IP ; } String destHost = null ; int port = 0 ; int index = host . indexOf ( ":" ) ; if ( index != - 1 ) { // host : port形式 destHost = host . substring ( 0 , index ) ; port = Integer . parseInt ( host . substring ( index + 1 ) ) ; } else { destHost = host ; port = default...
public class EncodingUtils { /** * Returns a Vector of locales from the passed in request object . * @ param req The request object to extract the locales from . * @ return The extracted locales . */ public static Vector getLocales ( HttpServletRequest req ) { } }
init ( ) ; String acceptLanguage = req . getHeader ( "Accept-Language" ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "getLocales" , "Accept-Language --> " + acceptLanguage ) ; } // Short circuit with an e...
public class MtasSolrStatus { /** * Gets the long map . * @ param response * the response * @ param args * the args * @ return the long map */ private final Map < String , Long > getLongMap ( NamedList < Object > response , String ... args ) { } }
Object objectItem = response . findRecursive ( args ) ; if ( objectItem != null && objectItem instanceof Map ) { return ( Map ) objectItem ; } else { return null ; }
public class DTMManagerDefault { /** * Release the DTMManager ' s reference ( s ) to a DTM , making it unmanaged . * This is typically done as part of returning the DTM to the heap after * we ' re done with it . * @ param dtm the DTM to be released . * @ param shouldHardDelete If false , this call is a suggesti...
if ( DEBUG ) { System . out . println ( "Releasing " + ( shouldHardDelete ? "HARD" : "soft" ) + " dtm=" + // Following shouldn ' t need a nodeHandle , but does . . . // and doesn ' t seem to report the intended value dtm . getDocumentBaseURI ( ) ) ; } if ( dtm instanceof SAX2DTM ) { ( ( SAX2DTM ) dtm ) . clearCoRoutine...
public class MySQLBaseDAO { /** * Execute a statement with no expected return value within a given transaction . * @ param tx The transactional { @ link Connection } to use . * @ param query The query string to prepare . * @ param function The functional callback to pass a { @ link Query } to . */ protected void ...
try ( Query q = new Query ( objectMapper , tx , query ) ) { function . apply ( q ) ; } catch ( SQLException ex ) { throw new ApplicationException ( ApplicationException . Code . BACKEND_ERROR , ex ) ; }
public class MetricsLongValue { /** * Push the metric to the mr . * The metric is pushed only if it was updated since last push * Note this does NOT push to JMX * ( JMX gets the info via { @ link # get ( ) } * @ param mr */ public synchronized void pushMetric ( final MetricsRecord mr ) { } }
if ( changed ) mr . setMetric ( getName ( ) , value ) ; changed = false ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getFontDescriptorSpecificationFtWtClass ( ) { } }
if ( fontDescriptorSpecificationFtWtClassEEnum == null ) { fontDescriptorSpecificationFtWtClassEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 112 ) ; } return fontDescriptorSpecificationFtWtClassEEnum ;
public class FileUtil { /** * Create a soft link between a src and destination * only on a local disk . HDFS does not support this * @ param target the target for symlink * @ param linkname the symlink * @ return value returned by the command */ public static int symLink ( String target , String linkname ) thro...
String cmd = "ln -s " + target + " " + linkname ; Process p = Runtime . getRuntime ( ) . exec ( cmd , null ) ; int returnVal = - 1 ; try { returnVal = p . waitFor ( ) ; } catch ( InterruptedException e ) { // do nothing as of yet } return returnVal ;
public class JsonUtils { /** * Create and configure the { @ link ObjectMapper } used for serializing and deserializing * JSON requests and responses . * @ return a configured { @ link ObjectMapper } */ public static ObjectMapper buildObjectMapper ( ) { } }
ObjectMapper objectMapper = new ObjectMapper ( ) ; objectMapper . setDateFormat ( new StdDateFormat ( ) ) ; objectMapper . setPropertyNamingStrategy ( new PropertyNamingStrategy . SnakeCaseStrategy ( ) ) ; objectMapper . setSerializationInclusion ( JsonInclude . Include . NON_EMPTY ) ; objectMapper . configure ( Deseri...
public class XmlInputStream { /** * Read n characters . * @ param n the number of characters to read * @ return the characters read * @ throws IOException thrown when an error occurs */ private StringBuilder read ( int n ) throws IOException { } }
// Input stream finished ? boolean eof = false ; // Read that many . final StringBuilder s = new StringBuilder ( n ) ; while ( s . length ( ) < n && ! eof ) { // Always get from the pushBack buffer . if ( pushBack . length ( ) == 0 ) { // Read something from the stream into pushBack . eof = readIntoPushBack ( ) ; } // ...
public class ClassUseWriter { /** * Add the packages elements that use the given class . * @ param contentTree the content tree to which the packages elements will be added */ protected void addPackageList ( Content contentTree ) { } }
Content caption = getTableCaption ( configuration . getContent ( "doclet.ClassUse_Packages.that.use.0" , getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS_USE_HEADER , typeElement ) ) ) ) ; Content table = ( configuration . isOutputHtml5 ( ) ) ? HtmlTree . TABLE ( HtmlStyle . useSummary , caption...
public class RegistryQuery { /** * deletes a value or a key * @ param branch * @ param entry * @ throws IOException * @ throws InterruptedException */ public static void deleteValue ( String branch , String entry ) throws IOException , InterruptedException { } }
if ( entry == null ) { String [ ] cmd = new String [ ] { "reg" , "delete" , cleanBrunch ( branch ) , "/f" } ; executeQuery ( cmd ) ; // executeQuery ( " reg delete \ " " + List . trim ( branch , " \ \ " ) + " \ " / f " ) ; } else { String [ ] cmd = new String [ ] { "reg" , "delete" , cleanBrunch ( branch ) , "/v" , ent...
public class DefaultIdStrategy { /** * Registers a delegate . Returns true if registration is successful . */ public < T > boolean registerDelegate ( Delegate < T > delegate ) { } }
return null == delegateMapping . putIfAbsent ( delegate . typeClass ( ) . getName ( ) , delegate ) ;
public class AJAXBroadcastComponent { /** * Evaluates an EL expression into an object . * @ param p _ expression * the expression * @ throws PropertyNotFoundException * if the attribute doesn ' t exist at all ( as opposed to being * null ) * @ return the object */ public static MethodExpression evalAsMethod...
FacesContext context = FacesContext . getCurrentInstance ( ) ; ExpressionFactory expressionFactory = context . getApplication ( ) . getExpressionFactory ( ) ; ELContext elContext = context . getELContext ( ) ; MethodExpression mex = expressionFactory . createMethodExpression ( elContext , p_expression , Object . class ...
public class ListRootsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListRootsRequest listRootsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listRootsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listRootsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listRootsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exce...
public class ZipUtils { /** * Zips a collection of files to a destination zip output stream . * @ param files A collection of files and directories * @ param outputStream The output stream of the destination zip file * @ throws FileNotFoundException * @ throws IOException */ public static void zipFiles ( List <...
ZipOutputStream zos = new ZipOutputStream ( outputStream ) ; for ( File file : files ) { if ( file . isDirectory ( ) ) { // if it ' s a folder addFolderToZip ( "" , file , zos ) ; } else { addFileToZip ( "" , file , zos ) ; } } zos . finish ( ) ;
public class LevelHandler { /** * Flush the handler . */ public void flush ( ) { } }
int level = getLevel ( ) . intValue ( ) ; for ( int i = 0 ; i < _handlers . length ; i ++ ) { Handler handler = _handlers [ i ] ; if ( level <= handler . getLevel ( ) . intValue ( ) ) handler . flush ( ) ; }
public class Calendar { /** * Sets the WEEK _ OF _ MONTH and WEEK _ OF _ YEAR fields to new values with the * new parameter value if they have been calculated internally . */ private void invalidateWeekFields ( ) { } }
if ( stamp [ WEEK_OF_MONTH ] != COMPUTED && stamp [ WEEK_OF_YEAR ] != COMPUTED ) { return ; } // We have to check the new values of these fields after changing // firstDayOfWeek and / or minimalDaysInFirstWeek . If the field values // have been changed , then set the new values . ( 4822110) Calendar cal = ( Calendar ) ...
public class ControllerUtil { /** * Return a 200 OK application / binary response with content - disposition attachment . * @ param is The stream to copy . Content is streamed . * @ param name Name of file user is downloading . * @ param length Stream ' s size in bytes . */ protected static void renderBinary ( In...
throw new BinaryResult ( is , name , length , false ) ;
public class Authenticator { /** * Called by the connection management code when an authenticating connection has received its * authentication request from the client . */ public void authenticateConnection ( Invoker invoker , final AuthingConnection conn , final ResultListener < AuthingConnection > onComplete ) { }...
final AuthRequest req = conn . getAuthRequest ( ) ; final AuthResponseData rdata = createResponseData ( ) ; final AuthResponse rsp = new AuthResponse ( rdata ) ; invoker . postUnit ( new Invoker . Unit ( "authenticateConnection" ) { @ Override public boolean invoke ( ) { try { processAuthentication ( conn , rsp ) ; if ...
public class Shape { /** * Applies this shape ' s Shadow . * @ param context * @ param attr * @ return boolean */ protected final void doApplyShadow ( final Context2D context , final Attributes attr ) { } }
if ( ( false == isAppliedShadow ( ) ) && ( attr . hasShadow ( ) ) ) { setAppliedShadow ( true ) ; final Shadow shadow = attr . getShadow ( ) ; if ( null != shadow ) { context . setShadow ( shadow ) ; } }
public class ReadOnlyStorageEngine { /** * Rollback to the specified push version * @ param rollbackToDir The version directory to rollback to */ public void rollback ( File rollbackToDir ) { } }
logger . info ( "Rolling back store '" + getName ( ) + "'" ) ; fileModificationLock . writeLock ( ) . lock ( ) ; try { if ( rollbackToDir == null ) throw new VoldemortException ( "Version directory specified to rollback is null" ) ; if ( ! rollbackToDir . exists ( ) ) throw new VoldemortException ( "Version directory "...
public class DnsServerAddresses { /** * Returns the { @ link DnsServerAddresses } that yields only a single { @ code address } . */ public static DnsServerAddresses singleton ( final InetSocketAddress address ) { } }
if ( address == null ) { throw new NullPointerException ( "address" ) ; } if ( address . isUnresolved ( ) ) { throw new IllegalArgumentException ( "cannot use an unresolved DNS server address: " + address ) ; } return new SingletonDnsServerAddresses ( address ) ;
public class ST_Rotate { /** * Rotates a geometry by a given angle ( in radians ) about the center * of the geometry ' s envelope . * @ param geom Geometry * @ param theta Angle * @ return The geometry rotated about the center of its envelope */ public static Geometry rotate ( Geometry geom , double theta ) { }...
if ( geom != null ) { Coordinate center = geom . getEnvelopeInternal ( ) . centre ( ) ; return rotate ( geom , theta , center . x , center . y ) ; } else { return null ; }
public class PropertyListSerialization { /** * Serialize a Number as a real element . * @ param real * number to serialize . * @ param handler * destination of serialization events . * @ throws SAXException * if exception during serialization . */ private static void serializeReal ( final Number real , fina...
serializeElement ( "real" , String . valueOf ( real . doubleValue ( ) ) , handler ) ;
public class PaginatedResult { /** * Retrieves a List of objects from the result . * @ param < T > the type defined in the List * @ param clazz the type defined in the List * @ return a Collection of objects from the result . * @ since 1.0.0 */ @ SuppressWarnings ( "unchecked" ) public < T > List < T > getList ...
return ( List < T > ) objects ;
public class Maze2D { /** * Find the maximum length of the rows of the maze . * @ param maze instance of maze * @ return max lenght of all rows */ private int findMaxRowLength ( String maze [ ] ) { } }
int max = 0 ; for ( String rowMaze : maze ) { if ( rowMaze . length ( ) > max ) max = rowMaze . length ( ) ; } return max ;
public class FilterCriteriaReader14 { /** * { @ inheritDoc } */ @ Override protected FieldType getFieldType ( byte [ ] block ) { } }
int fieldIndex = MPPUtility . getInt ( block , 8 ) ; return FieldTypeHelper . mapTextFields ( FieldTypeHelper . getInstance14 ( fieldIndex ) ) ;
public class SecurityRealm { /** * Handles the logout processing . * The default implementation erases the session and do a few other clean up , then * redirect the user to the URL specified by { @ link # getPostLogOutUrl ( StaplerRequest , Authentication ) } . * @ since 1.314 */ public void doLogout ( StaplerReq...
HttpSession session = req . getSession ( false ) ; if ( session != null ) session . invalidate ( ) ; Authentication auth = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; SecurityContextHolder . clearContext ( ) ; // reset remember - me cookie Cookie cookie = new Cookie ( ACEGI_SECURITY_HASHED_REMEMBER...
public class VirtualFile { /** * Get the children * @ param filter to filter the children * @ return the children * @ throws IOException for any problem accessing the virtual file system * @ throws IllegalStateException if the file is closed or it is a leaf node */ public List < VirtualFile > getChildren ( Virt...
// isDirectory does the read security check if ( ! isDirectory ( ) ) { return Collections . emptyList ( ) ; } if ( filter == null ) { filter = MatchAllVirtualFileFilter . INSTANCE ; } FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor ( filter , null ) ; visit ( visitor ) ; return visitor . getMatched ( ) ...
public class GreenMailUtil { /** * Counts the number of lines . * @ param str the input string * @ return Returns the number of lines terminated by ' \ n ' in string */ public static int getLineCount ( String str ) { } }
if ( null == str || str . isEmpty ( ) ) { return 0 ; } int count = 1 ; for ( char c : str . toCharArray ( ) ) { if ( '\n' == c ) { count ++ ; } } return count ;
public class MediaApi { /** * Log out of all media channels * Log out the current agent on all media channels . You can make a [ / media / { mediatype } / ready ] ( / reference / workspace / Media / index . html # readyAgentState ) or [ / media / { mediatype } / not - ready ] ( / reference / workspace / Media / index...
ApiResponse < ApiSuccessResponse > resp = logoutAgentStateWithHttpInfo ( mediaLogoutData ) ; return resp . getData ( ) ;
public class RenderUiTemplateRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RenderUiTemplateRequest renderUiTemplateRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( renderUiTemplateRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( renderUiTemplateRequest . getUiTemplate ( ) , UITEMPLATE_BINDING ) ; protocolMarshaller . marshall ( renderUiTemplateRequest . getTask ( ) , TASK_BINDING ) ; pro...
public class Sets { /** * Duplicate set . * This allow ' s the default Set implementation to be swapped * easily . * @ param set The set to dupplicate . * @ return a new empty set . */ public static < T > Set < T > dup ( Collection < T > collection ) { } }
if ( isEmpty ( collection ) ) return new HashSet < T > ( ) ; return new HashSet < T > ( collection ) ;
public class BTreeIndex { /** * Traverses the directory to find the leaf page corresponding to the lower * bound of the specified key range . The method then position the page * before the first record ( if any ) matching the that lower bound . The leaf * page is kept open , for use by the methods { @ link # next...
if ( ! searchRange . isValid ( ) ) return ; search ( searchRange , SearchPurpose . READ ) ;
public class CacheInvocationContextFactory { /** * Create { @ link CacheInvocationContext } parametrized with { @ link CacheRemove } annotation . * @ param metaHolder the meta holder , see { @ link com . netflix . hystrix . contrib . javanica . command . MetaHolder } * @ return initialized and configured { @ link C...
Method method = metaHolder . getMethod ( ) ; if ( method . isAnnotationPresent ( CacheRemove . class ) ) { CacheRemove cacheRemove = method . getAnnotation ( CacheRemove . class ) ; MethodExecutionAction cacheKeyMethod = createCacheKeyAction ( cacheRemove . cacheKeyMethod ( ) , metaHolder ) ; return new CacheInvocation...
public class FunctionType { /** * Returns interfaces implemented directly by a class or its superclass . */ public final ImmutableList < ObjectType > getImplementedInterfaces ( ) { } }
FunctionType superCtor = isConstructor ( ) ? getSuperClassConstructor ( ) : null ; if ( superCtor == null ) { return implementedInterfaces ; } ImmutableList . Builder < ObjectType > builder = ImmutableList . builder ( ) ; builder . addAll ( implementedInterfaces ) ; while ( superCtor != null ) { builder . addAll ( supe...
public class AbstractBundleLinkRenderer { /** * Renders the links for the global bundles * @ param ctx * the context * @ param out * the writer * @ param debugOn * the debug flag * @ throws IOException * if an IOException occurs . */ protected void renderGlobalBundleLinks ( BundleRendererContext ctx , W...
if ( debugOn ) { addComment ( "Start adding global members." , out ) ; } performGlobalBundleLinksRendering ( ctx , out , debugOn ) ; ctx . setGlobalBundleAdded ( true ) ; if ( debugOn ) { addComment ( "Finished adding global members." , out ) ; }
public class SortedIntArrayList { /** * Performs a binary search for the provide value . * It will return any matching element , not necessarily * the first or the last . */ protected int binarySearch ( int value ) { } }
int left = 0 ; int right = size - 1 ; while ( left <= right ) { int mid = ( left + right ) >> 1 ; int midValue = elementData [ mid ] ; if ( value == midValue ) return mid ; if ( value < midValue ) right = mid - 1 ; else left = mid + 1 ; } return - ( left + 1 ) ;
public class JavaOutputType { /** * Calculate the crisp output value . * @ param method the calling method * @ param variable the output variable */ private void addCalculateCrispValue ( Program program , Java . CLASS clazz ) { } }
Java . METHOD calc = clazz . addMETHOD ( "private" , "Number" , "calculateCrispValue" ) ; calc . setComment ( "Calculate the crisp value" ) ; calc . setReturnComment ( "the crisp value" ) ; calc . addArg ( "Number" , "from" , "Start interval" ) ; calc . addArg ( "Number" , "to" , "End interval" ) ; calc . addArg ( "Num...
public class Replication { /** * Set the filter to be used by this replication */ @ InterfaceAudience . Public public void setFilter ( String filterName ) { } }
properties . put ( ReplicationField . FILTER_NAME , filterName ) ; replicationInternal . setFilter ( filterName ) ;
public class DITableInfo { /** * Retrieves , for [ TEMP ] TEXT tables , whether the table ' s data source * descriptor requests descending read semantics . That is , when this * value is true , it indicate that the text file is to be read from * the bottom up . < p > * @ return whether the table ' s data source...
if ( table . isText ( ) ) { return ( ( TextTable ) table ) . isDescDataSource ( ) ? Boolean . TRUE : Boolean . FALSE ; } return Boolean . FALSE ;
public class InjectionSimpleProcessor { /** * Calls { @ link # createInjectionBinding ( Annotation , Member ) } . Simple * injection processors do not support JNDI names . */ @ Override public final InjectionBinding < A > createInjectionBinding ( A annotation , Class < ? > instanceClass , Member member , String jndiN...
return createInjectionBinding ( annotation , instanceClass , member ) ;
public class DebugWsDelegate { /** * Checks the DM is correctly connected with the messaging server . * @ param message a customized message content * @ return the content of the response */ public String checkMessagingConnectionForTheDm ( String message ) throws DebugWsException { } }
this . logger . finer ( "Checking messaging connection with the DM: message=" + message ) ; WebResource path = this . resource . path ( UrlConstants . DEBUG ) . path ( "check-dm" ) ; if ( message != null ) path = path . queryParam ( "message" , message ) ; ClientResponse response = this . wsClient . createBuilder ( pat...
public class AmazonRedshiftClient { /** * Modifies the parameters of a parameter group . * For more information about parameters and parameter groups , go to < a * href = " https : / / docs . aws . amazon . com / redshift / latest / mgmt / working - with - parameter - groups . html " > Amazon Redshift * Parameter...
request = beforeClientExecution ( request ) ; return executeModifyClusterParameterGroup ( request ) ;
public class Probe { /** * set the payload type for the response from the Responder . It only support * XML and JSON . * @ param respondToPayloadType a payload type string - XML or JSON * @ throws UnsupportedPayloadType if you don ' t pass in XML or JSON */ public void setRespondToPayloadType ( String respondToPa...
// Sanity check on the payload type values . Should be XML or JSON // If the probe goes out with a bad value here , then the Responder may have // problems if ( respondToPayloadType == null || respondToPayloadType . isEmpty ( ) || ( ! respondToPayloadType . equals ( ProbeWrapper . JSON ) && ! respondToPayloadType . equ...
public class FeatureListGrid { /** * This method is used only when selection is enabled ( see setSelectionEnabled ) . When a feature selection event is * sent out from the MapModel , check if we have that row deselected and select it . */ public void onFeatureSelected ( FeatureSelectedEvent event ) { } }
Feature feature = event . getFeature ( ) ; // Only select if it is actually deselected : boolean selected = false ; ListGridRecord [ ] selections = getSelection ( ) ; for ( ListGridRecord selection : selections ) { if ( selection . getAttribute ( FIELD_NAME_FEATURE_ID ) . equals ( feature . getId ( ) ) ) { selected = t...
public class GenericTypeResolver { /** * Resolve the type arguments of the given generic interface against the given target class which is assumed to implement * the generic interface and possibly declare concrete types for its type variables . * @ param clazz the target class to check against * @ param genericIf...
ResolvableType type = ResolvableType . forClass ( clazz ) . as ( genericIfc ) ; if ( ! type . hasGenerics ( ) || type . isEntirelyUnresolvable ( ) ) { return null ; } return type . resolveGenerics ( Object . class ) ;
public class VariableReferenceCheck { /** * that we can run it after goog . scope processing , and get rid of the inGoogScope check . */ private void checkForUnusedLocalVar ( Var v , Reference unusedAssignment ) { } }
if ( ! v . isLocal ( ) ) { return ; } JSDocInfo jsDoc = NodeUtil . getBestJSDocInfo ( unusedAssignment . getNode ( ) ) ; if ( jsDoc != null && jsDoc . hasTypedefType ( ) ) { return ; } boolean inGoogScope = false ; Scope s = v . getScope ( ) ; if ( s . isFunctionBlockScope ( ) ) { Node function = s . getRootNode ( ) . ...
public class JmsJcaManagedConnection { /** * Associates the given session with this managed connection . Removes the * session from its previous managed connection , if any , and adds it to the * set for this connection . Sets this managed connection on the session . * @ param object * the session to associate ...
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "associateConnection" , object ) ; } if ( object instanceof JmsJcaSessionImpl ) { final JmsJcaSessionImpl session = ( JmsJcaSessionImpl ) object ; session . associate ( this ) ; _sessions . add ( session ) ; }...
public class HttpServerBuilder { /** * Sets the connectors . * @ param connectors * @ return */ public HttpServerBuilder connectors ( List < Connector > connectors ) { } }
endpoint . setConnectors ( connectors . toArray ( new Connector [ connectors . size ( ) ] ) ) ; return this ;
public class Jackson { /** * Creates a new { @ link ObjectMapper } with a custom { @ link com . fasterxml . jackson . core . JsonFactory } * with Guava , Logback , and Joda Time support , as well as support for { @ link JsonSnakeCase } . * Also includes all { @ link Discoverable } interface implementations . * @ ...
final ObjectMapper mapper = new ObjectMapper ( jsonFactory ) ; return configure ( mapper ) ;
public class FillOptions { /** * Creates FillOptions out of a Feature . * @ param feature feature to be converted */ @ Nullable static FillOptions fromFeature ( @ NonNull Feature feature ) { } }
if ( feature . geometry ( ) == null ) { throw new RuntimeException ( "geometry field is required" ) ; } if ( ! ( feature . geometry ( ) instanceof Polygon ) ) { return null ; } FillOptions options = new FillOptions ( ) ; options . geometry = ( Polygon ) feature . geometry ( ) ; if ( feature . hasProperty ( PROPERTY_FIL...
public class FactoryFinder { /** * Try to find provider using Jar Service Provider Mechanism * @ return instance of provider class if found or null */ private static Object findJarServiceProvider ( final String factoryId ) throws ConfigurationError { } }
final String serviceId = "META-INF/services/" + factoryId ; InputStream is = null ; // First try the Context ClassLoader ClassLoader cl = ss . getContextClassLoader ( ) ; if ( cl != null ) { is = ss . getResourceAsStream ( cl , serviceId ) ; // If no provider found then try the current ClassLoader if ( is == null ) { c...
public class SheetBase { /** * Update the sort direction * @ param sortOrder */ public void setSortOrder ( final java . lang . String sortOrder ) { } }
// when updating , make sure we store off the original so it may be // restored final String orig = ( String ) getStateHelper ( ) . get ( PropertyKeys . origSortOrder ) ; if ( orig == null ) { // do not call getSortOrder as it defaults to ascending , we want // null // if this is the first call and there is no previous...
public class NodeIndexer { /** * Adds the property name to the lucene _ : PROPERTIES _ SET field . * @ param doc the document . * @ param name the name of the property . * @ throws RepositoryException */ private void addPropertyName ( Document doc , InternalQName name ) throws RepositoryException { } }
String fieldName = name . getName ( ) ; try { fieldName = resolver . createJCRName ( name ) . getAsString ( ) ; } catch ( NamespaceException e ) { // will never happen if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "An exception occurred: " + e . getMessage ( ) ) ; } } doc . add ( new Field ( FieldNames . PROPERTIES_S...
public class SubsequentRequestDispatcher { /** * http : / / code . google . com / p / mobicents / issues / detail ? id = 2547 * Allows to route subsequent requests statelessly to proxy applications to * improve perf and mem usage . */ private static void handleOrphanRequest ( final SipProvider sipProvider , final S...
final String applicationName = sipContext . getApplicationName ( ) ; final Request request = ( Request ) sipServletRequest . getMessage ( ) ; // Making sure to nullify those ref so that if there is a race condition as in // http : / / code . google . com / p / mobicents / issues / detail ? id = 2937 // we return null i...
public class StringProducers { /** * build the global producer ( thread - safety ) * @ param zookeeperConfig connect config of zookeeper ; ex : 127.0.0.1:2181 / jafka * @ return the global producer */ public static StringProducers buildGlobal ( String zookeeperConfig ) { } }
if ( instance == null ) { synchronized ( StringProducers . class ) { if ( instance == null ) { final Properties props = new Properties ( ) ; props . put ( "zk.connect" , zookeeperConfig ) ; props . put ( "serializer.class" , StringEncoder . class . getName ( ) ) ; final String JAFKA_PREFIX = "jafka." ; for ( Map . Entr...
public class AdapterUtil { /** * Display the java . sql . ResultSet concurrency mode constant corresponding to the value * supplied . * @ param level a valid java . sql . ResultSet concurrency mode constant . * @ return the name of the constant , or a string indicating the constant is unknown . */ public static S...
switch ( concurrency ) { case ResultSet . CONCUR_READ_ONLY : return "CONCUR READ ONLY (" + concurrency + ')' ; case ResultSet . CONCUR_UPDATABLE : return "CONCUR UPDATABLE (" + concurrency + ')' ; case CONCUR_SS_SCROLL_LOCKS : return "CONCUR SS SCROLL LOCKS (" + concurrency + ')' ; case CONCUR_SS_OPTIMISTIC_CCVAL : ret...
public class DocumentIndexer { /** * @ param metadata * @ param entity * @ param document * @ param metaModel * Add indexes for associated columns */ protected void addAssociatedEntitiesToDocument ( EntityMetadata metadata , Object entity , Document document , MetamodelImpl metaModel ) { } }
try { IndexCollection indexes = metadata . getEntityClazz ( ) . getAnnotation ( IndexCollection . class ) ; if ( indexes != null ) { List < String > columnsNameToBeIndexed = new ArrayList < String > ( ) ; for ( com . impetus . kundera . index . Index indexedColumn : indexes . columns ( ) ) { Attribute attrib = metaMode...
public class TimestampProcessor { /** * Method updates the timestamp field of the given message with the given time in the given timeUnit . * @ param < M > the message type of the message which is updated * @ param time the time which is put in the timestamp field * @ param messageOrBuilder the message * @ para...
long milliseconds = TimeUnit . MILLISECONDS . convert ( time , timeUnit ) ; try { if ( messageOrBuilder == null ) { throw new NotAvailableException ( "messageOrBuilder" ) ; } try { // handle builder if ( messageOrBuilder . getClass ( ) . getSimpleName ( ) . equals ( "Builder" ) ) { messageOrBuilder . getClass ( ) . get...
public class Where { /** * Add a ' IS NOT NULL ' clause so the column must not be null . ' & lt ; & gt ; ' NULL does not work . */ public Where < T , ID > isNotNull ( String columnName ) throws SQLException { } }
addClause ( new IsNotNull ( columnName , findColumnFieldType ( columnName ) ) ) ; return this ;
public class NavMesh { /** * Gets the polygon reference for the tile ' s base polygon . * @ param tile * The tile . * @ return The polygon reference for the base polygon in the specified tile . */ public long getPolyRefBase ( MeshTile tile ) { } }
if ( tile == null ) { return 0 ; } int it = tile . index ; return encodePolyId ( tile . salt , it , 0 ) ;
public class JDBCUtils { /** * Verifies that the connection is still alive . Returns true if it * is , false if it is not . If the connection is broken we try * closing everything , too , so that the caller need only open a new * connection . */ public static boolean validate ( Statement stmt ) { } }
try { Connection conn = stmt . getConnection ( ) ; if ( conn == null ) return false ; if ( ! conn . isClosed ( ) && conn . isValid ( 10 ) ) return true ; stmt . close ( ) ; conn . close ( ) ; } catch ( SQLException e ) { // this may well fail . that doesn ' t matter . we ' re just making an // attempt to clean up , and...
public class ApiOvhTelephony { /** * Alter this object properties * REST : PUT / telephony / { billingAccount } / voicemail / { serviceName } * @ param body [ required ] New object properties * @ param billingAccount [ required ] The name of your billingAccount * @ param serviceName [ required ] */ public void ...
String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ;
public class Dataset { /** * Add a datum item into the dataset . * @ param x a datum item . * @ return the added datum item . */ public Datum < E > add ( Datum < E > x ) { } }
data . add ( x ) ; return x ;
public class DataFramePrinter { /** * Returns the 2 - D array of data tokens from the frame specified * @ param frame the DataFrame from which to create 2D array of formatted tokens * @ return the array of data tokens */ private String [ ] [ ] getDataTokens ( Relation frame ) { } }
if ( frame . rowCount ( ) == 0 ) return new String [ 0 ] [ 0 ] ; final int rowCount = Math . min ( maxRows , frame . rowCount ( ) ) ; final boolean truncated = frame . rowCount ( ) > maxRows ; final int colCount = frame . columnCount ( ) ; final String [ ] [ ] data ; if ( truncated ) { data = new String [ rowCount + 1 ...
public class InventoryNavigator { /** * Retrieve content recursively with multiple properties . * the typeinfo array contains typename + properties to retrieve . * @ param typeinfo 2D array of properties for each typename * @ param recurse retrieve contents recursively from the root down * @ return retrieved ob...
ObjectContent [ ] ocs = retrieveObjectContents ( typeinfo , recurse ) ; return createManagedEntities ( ocs ) ;
public class AbstractTriangle3F { /** * Tests if the point { @ code ( px , py , pz ) } * lies inside a 3D triangle * given by { @ code ( x1 , y1 , z1 ) } , { @ code ( x2 , y2 , z2 ) } * and { @ code ( x3 , y3 , z3 ) } points . * < strong > Caution : Tests are " epsiloned . " < / strong > * Parameter < var > f...
// Compute vectors // v0 = C - A double v0x = cx - ax ; double v0y = cy - ay ; double v0z = cz - az ; // v1 = B - A double v1x = bx - ax ; double v1y = by - ay ; double v1z = bz - az ; // v2 = P - A double v2x = px - ax ; double v2y = py - ay ; double v2z = pz - az ; // Compute dot products // dot01 = dot ( v0 , v0) do...
public class WxPayApi { /** * 企业付款到银行 * @ param params * 请求参数 * @ param certPath * 证书文件目录 * @ param certPassword * 证书密码 * @ return { String } */ public static String payBank ( Map < String , String > params , String certPath , String certPassword ) { } }
return WxPayApi . doPostSSL ( PAY_BANK_URL , params , certPath , certPassword ) ;
public class SerializerIntrinsics { /** * ! st ( 0 ) ( FPU ) . */ public final void fisub ( Mem src ) { } }
assert ( src . size ( ) == 2 || src . size ( ) == 4 ) ; emitX86 ( INST_FISUB , src ) ;
public class MessageStack { /** * Send this message to the message queue . * @ param strCommand Command to perform remotely . * @ return boolean success . */ public void sendMessage ( Message message ) { } }
if ( message == null ) return ; // Don ' t allow a null message to be sent . m_stack . add ( message ) ; if ( m_bWaiting ) { synchronized ( m_thread ) { if ( m_bWaiting ) // Inside the sync block m_thread . notify ( ) ; } }
public class ConfigFactory { /** * Loads an application ' s configuration from the given classpath resource or * classpath resource basename , sandwiches it between default reference * config and default overrides , and then resolves it . The classpath * resource is " raw " ( it should have no " / " prefix , and ...
return load ( resourceBasename , ConfigParseOptions . defaults ( ) , ConfigResolveOptions . defaults ( ) ) ;
public class IconResolver { /** * Searches for the unicode character value for the Font Icon Code . This method searches all * active FontIcons in the application . * @ param iconCode the font icon code * @ return the unicode character matching the icon , or null if none matches */ private static IconSet resolveI...
CharSequence unicode ; for ( IconSet set : getRegisteredIconSets ( ) ) { if ( set . fontPath ( ) . equals ( FontAwesome . FONT_PATH ) || set . fontPath ( ) . equals ( Typicon . FONT_PATH ) || set . fontPath ( ) . equals ( MaterialIcons . FONT_PATH ) ) { continue ; // already checked previously , ignore } unicode = set ...