signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AddOperations { /** * In query protocol , the wrapped result is the real return type for the given operation . In the c2j model , * if the output shape has only one member , and the member shape is wrapped ( wrapper is true ) , then the * return type is the wrapped member shape instead of the output sh...
Output output = operation . getOutput ( ) ; if ( output == null ) return null ; Shape outputShape = shapes . get ( output . getShape ( ) ) ; if ( outputShape . getMembers ( ) . keySet ( ) . size ( ) != 1 ) return output . getShape ( ) ; Member wrappedMember = outputShape . getMembers ( ) . values ( ) . toArray ( new Me...
public class Immutables { /** * Wraps a map with an immutable map . There is no copying involved . * @ param map the map to wrap * @ return an immutable map wrapper that delegates to the original map */ public static < K , V > Map < K , V > immutableMapWrap ( Map < ? extends K , ? extends V > map ) { } }
return new ImmutableMapWrapper < > ( map ) ;
public class BuildReference { /** * Gets the build if still in memory . * @ return the actual build , or null if it has been collected * @ see Holder # get */ public @ CheckForNull R get ( ) { } }
Holder < R > h = holder ; // capture return h != null ? h . get ( ) : null ;
public class BitsUtil { /** * Fill a vector initialized with " bits " ones . * @ param v Vector to fill . * @ param bits Size */ public static void onesI ( long [ ] v , int bits ) { } }
final int fillWords = bits >>> LONG_LOG2_SIZE ; final int fillBits = bits & LONG_LOG2_MASK ; Arrays . fill ( v , 0 , fillWords , LONG_ALL_BITS ) ; if ( fillBits > 0 ) { v [ fillWords ] = ( 1L << fillBits ) - 1 ; } if ( fillWords + 1 < v . length ) { Arrays . fill ( v , fillWords + 1 , v . length , 0L ) ; }
public class JobGraphGenerator { /** * This method implements the post - visit during the depth - first traversal . When the post visit happens , * all of the descendants have been processed , so this method connects all of the current node ' s * predecessors to the current node . * @ param node * The node curr...
try { // - - - - - check special cases for which we handle post visit differently - - - - - // skip data source node ( they have no inputs ) // also , do nothing for union nodes , we connect them later when gathering the inputs for a task // solution sets have no input . the initial solution set input is connected when...
public class TridentTopology { public Stream newStream ( String txId , IRichSpout spout ) { } }
return newStream ( txId , new RichSpoutBatchExecutor ( spout ) ) ;
public class Messages { /** * Delete all messages . * Permanently deletes all messages held by the specified server . This operation cannot be undone . Also deletes any attachments related to each message . * @ param server The identifier of the server to be emptied . * @ throws MailosaurException thrown if the r...
HashMap < String , String > query = new HashMap < String , String > ( ) ; query . put ( "server" , server ) ; client . request ( "DELETE" , "api/messages" , query ) ;
public class RepositoryResourceImpl { /** * { @ inheritDoc } */ @ Override public void updateGeneratedFields ( boolean performEditionChecking ) throws RepositoryResourceCreationException { } }
// update the asset filter info . updateAssetFilterInfo ( performEditionChecking ) ; if ( ( _asset != null ) && ( _asset . getWlpInformation ( ) ) != null && ( _asset . getWlpInformation ( ) . getVanityRelativeURL ( ) ) == null ) { createVanityURL ( ) ; }
public class SearchIndexContextListener { /** * Rebuild the search index during context initialization . * @ param servletContextEvent The context event ( not really used ) . */ @ Override public void contextInitialized ( final ServletContextEvent servletContextEvent ) { } }
logger . info ( "Rebuilding Search Index..." ) ; // Build the session factory . SessionFactory factory = createSessionFactory ( ) ; // Build the hibernate session . Session session = factory . openSession ( ) ; // Create the fulltext session . FullTextSession fullTextSession = Search . getFullTextSession ( session ) ; ...
public class DateUtils { /** * Parse format { @ link # DATETIME _ FORMAT } . This method never throws exception . * @ param s any string * @ return the datetime , { @ code null } if parsing error or if parameter is { @ code null } * @ since 6.6 */ @ CheckForNull public static OffsetDateTime parseOffsetDateTimeQui...
OffsetDateTime datetime = null ; if ( s != null ) { try { datetime = parseOffsetDateTime ( s ) ; } catch ( RuntimeException e ) { // ignore } } return datetime ;
public class GSONHandle { /** * Creates a factory to create a GSONHandle instance for a JsonElement node . * @ returnthe factory */ static public ContentHandleFactory newFactory ( ) { } }
return new ContentHandleFactory ( ) { @ Override public Class < ? > [ ] getHandledClasses ( ) { return new Class < ? > [ ] { JsonElement . class } ; } @ Override public boolean isHandled ( Class < ? > type ) { return JsonElement . class . isAssignableFrom ( type ) ; } @ Override public < C > ContentHandle < C > newHand...
public class NetworkUtils { /** * Constructs a new instance of { @ link SocketAddress } bound to the given { @ link String host } and { @ link Integer port } . * @ param host { @ link String } containing the name of the host to whichthe { @ link SocketAddress } will be bound . * @ param port { @ link Integer } spec...
return Optional . ofNullable ( host ) . map ( hostname -> new InetSocketAddress ( host , port ) ) . orElseGet ( ( ) -> new InetSocketAddress ( port ) ) ;
public class JmsManagedConnectionFactoryImpl { /** * Gets the target * @ return The target * @ see com . ibm . websphere . sib . api . jms . JmsConnectionFactory # getTarget */ @ Override public String getTarget ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getTarget" ) ; String remoteTargetGroup = jcaConnectionFactory . getTarget ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getTarget" , remoteTargetGroup )...
public class ConversionContext { /** * Creates a new ConversionContext for the given { @ link ProviderContext } and the given { @ link RateType } . * < i > Note : < / i > for adding additional attributes use { @ link javax . money . convert . ConversionContextBuilder * ( ProviderContext , RateType ) } . * @ param...
return ConversionContextBuilder . create ( providerContext , rateType ) . build ( ) ;
public class UpdatePreferencesServlet { /** * Move an element to another location on the tab . * < p > Used by Respondr UI when moving portlets around in content area . Will be made more generic * to support ngPortal UI which supports arbitrary nesting of folders . When that code is merged * in , the behavior of ...
final Locale locale = RequestContextUtils . getLocale ( request ) ; if ( moveElementInternal ( request , sourceId , destinationId , method ) ) { return new ModelAndView ( "jsonView" , Collections . singletonMap ( "response" , getMessage ( "success.move.element" , "Element moved successfully" , locale ) ) ) ; } else { r...
public class Socks4ClientBootstrap { /** * try to look at the remoteAddress and decide to use SOCKS4 or SOCKS4a handshake * packet . */ private static ChannelFuture socksConnect ( Channel channel , InetSocketAddress remoteAddress ) { } }
channel . write ( createHandshake ( remoteAddress ) ) ; return ( ( Socks4HandshakeHandler ) channel . getPipeline ( ) . get ( "handshake" ) ) . getChannelFuture ( ) ;
public class CassAccess { /** * To create DCAwareRoundRobing Policy : * Need Properties * LATITUDE ( or AFT _ LATITUDE ) * LONGITUDE ( or AFT _ LONGITUDE ) * CASSANDRA CLUSTERS with additional information : * machine : DC : lat : long , machine : DC : lat : long * @ param env * @ param prefix * @ return...
if ( cb == null ) { String pre ; if ( prefix == null ) { pre = "" ; } else { env . info ( ) . log ( "Cassandra Connection for " , prefix ) ; pre = prefix + '.' ; } cb = Cluster . builder ( ) ; String str = env . getProperty ( pre + CASSANDRA_CLUSTERS_PORT , "9042" ) ; if ( str != null ) { env . init ( ) . log ( "Cass P...
public class CompactingHashTable { @ Override public < PT > HashTableProber < PT > getProber ( TypeComparator < PT > probeSideComparator , TypePairComparator < PT , T > pairComparator ) { } }
return new HashTableProber < PT > ( probeSideComparator , pairComparator ) ;
public class StandardStashReader { /** * Returns a new StashReader that is locked to the same stash time the instance is currently using . Future calls to * lock or unlock the stash time on this instance will not affect the returned instance . */ public StashReader getLockedView ( ) { } }
return new FixedStashReader ( URI . create ( String . format ( "s3://%s/%s" , _bucket , getRootPath ( ) ) ) , _s3 ) ;
public class DFSPath { /** * Gets a connection to the DFS * @ return a connection to the DFS * @ throws IOException */ DistributedFileSystem getDFS ( ) throws IOException { } }
if ( this . dfs == null ) { FileSystem fs = location . getDFS ( ) ; if ( ! ( fs instanceof DistributedFileSystem ) ) { ErrorMessageDialog . display ( "DFS Browser" , "The DFS Browser cannot browse anything else " + "but a Distributed File System!" ) ; throw new IOException ( "DFS Browser expects a DistributedFileSystem...
public class MonitorScheduler { /** * 取消注册对应的Monitor对象 * @ param monitor */ public static void unRegister ( Monitor monitor ) { } }
ScheduledFuture future = register . remove ( monitor ) ; if ( future != null ) { future . cancel ( true ) ; // 打断 }
public class BigQuerySnippets { /** * [ VARIABLE " my _ dataset _ name " ] */ public boolean deleteDatasetFromId ( String projectId , String datasetName ) { } }
// [ START bigquery _ delete _ dataset ] DatasetId datasetId = DatasetId . of ( projectId , datasetName ) ; boolean deleted = bigquery . delete ( datasetId , DatasetDeleteOption . deleteContents ( ) ) ; if ( deleted ) { // the dataset was deleted } else { // the dataset was not found } // [ END bigquery _ delete _ data...
public class HtmlValidationConfiguration { /** * Determines whether the validation result window should pop up for this * particular error . If just one error instructs that the window should pop * up , it does so . * @ param error * the validation error * @ return < code > true < / code > when the window sho...
for ( Pattern curIgnorePattern : ignoreErrorsForWindow ) { if ( curIgnorePattern . matcher ( error . getMessage ( ) ) . find ( ) ) return false ; } return true ;
public class BDDCache { /** * Resizes the cache to a new number of entries . The old cache entries are removed in this process . * @ param ns the new number of entries */ private void resize ( final int ns ) { } }
final int size = BDDPrime . primeGTE ( ns ) ; this . table = new BDDCacheEntry [ size ] ; for ( int n = 0 ; n < size ; n ++ ) this . table [ n ] = new BDDCacheEntry ( ) ;
public class Searcher { /** * Gets the refinement values for a faceted attribute . * @ param attribute the attribute refined on . * @ return the refinements enabled for the given attribute , or { @ code null } if there is none . */ @ SuppressWarnings ( { } }
"WeakerAccess" , "unused" , "SameParameterValue" } ) // For library users @ Nullable public List < String > getFacetRefinements ( @ NonNull String attribute ) { return refinementMap . get ( attribute ) ;
public class ImageLoading { /** * Loading bitmap with using reuse bitmap with the different size of source image . * If it is unable to load with reuse method tries to load without it . * Reuse works only for Android 4.4 + * @ param data image file contents * @ param dest reuse bitmap * @ return result of loa...
return loadBitmapReuse ( new MemorySource ( data ) , dest ) ;
public class MarkdownParser { /** * Create a validation component for an hyper reference . * @ param it the hyper reference . * @ param currentFile the current file . * @ param context the validation context . * @ return the validation components . */ protected Iterable < DynamicValidationComponent > createVali...
final Collection < DynamicValidationComponent > components = new ArrayList < > ( ) ; if ( isLocalFileReferenceValidation ( ) || isRemoteReferenceValidation ( ) ) { final int lineno = computeLineNo ( it ) ; final URL url = FileSystem . convertStringToURL ( it . getUrl ( ) . toString ( ) , true ) ; if ( URISchemeType . H...
public class AppServiceCertificateOrdersInner { /** * Reissue an existing certificate order . * Reissue an existing certificate order . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param certificateOrderName Name of the certificate order . * @ param reissueCertifica...
return ServiceFuture . fromResponse ( reissueWithServiceResponseAsync ( resourceGroupName , certificateOrderName , reissueCertificateOrderRequest ) , serviceCallback ) ;
public class ListSupertaggedSentence { /** * Creates a supertagged sentence where the supertags for each word * are unobserved . Using this sentence during CCG parsing allows any * syntactic category to be assigned to each word . * @ param words * @ param pos * @ return */ public static ListSupertaggedSentenc...
return new ListSupertaggedSentence ( WordAndPos . createExample ( words , pos ) , Collections . nCopies ( words . size ( ) , Collections . < HeadedSyntacticCategory > emptyList ( ) ) , Collections . nCopies ( words . size ( ) , Collections . < Double > emptyList ( ) ) ) ;
public class HyphenationState { /** * This method applies the { @ link HyphenationPattern pattern } matching at the given { @ code offset } . * @ param pattern is the matching { @ link HyphenationPattern pattern } . * @ param pos is the offset in the word to hyphenate . */ private void apply ( HyphenationPattern pa...
int internalOffset = pos - 2 ; HyphenationPatternPosition [ ] positions = pattern . getHyphenationPositions ( ) ; for ( HyphenationPatternPosition hyphenationPosition : positions ) { int i = hyphenationPosition . index + internalOffset ; if ( ( i >= 0 ) && ( i < this . rankings . length ) && ( hyphenationPosition . ran...
public class ElmBaseVisitor { /** * Visit a TupleElement . This method will be called for * every node in the tree that is a TupleElement . * @ param elm the ELM tree * @ param context the context passed to the visitor * @ return the visitor result */ public T visitTupleElement ( TupleElement elm , C context ) ...
visitElement ( elm . getValue ( ) , context ) ; return null ;
public class LoginButton { /** * Provides an implementation for { @ link Activity # onActivityResult * onActivityResult } that updates the Session based on information returned * during the authorization flow . The Activity containing this view * should forward the resulting onActivityResult call here to * upda...
Session session = sessionTracker . getSession ( ) ; if ( session != null ) { return session . onActivityResult ( ( Activity ) getContext ( ) , requestCode , resultCode , data ) ; } else { return false ; }
public class InterfaceService { /** * Hides current view ( if present ) and shows the view managed by the chosen controller * @ param viewController will be set as the current view and shown . */ public void show ( final ViewController viewController ) { } }
if ( currentController != null ) { if ( isControllerHiding ) { switchToView ( viewController ) ; } else { hideCurrentViewAndSchedule ( viewController ) ; } } else { switchToView ( viewController ) ; }
public class RuleBasedBreakIterator { /** * checkDictionary This function handles all processing of characters in * the " dictionary " set . It will determine the appropriate * course of action , and possibly set up a cache in the * process . */ private int checkDictionary ( int startPos , int endPos , boolean re...
// Reset the old break cache first . reset ( ) ; // note : code segment below assumes that dictionary chars are in the // startPos - endPos range // value returned should be next character in sequence if ( ( endPos - startPos ) <= 1 ) { return ( reverse ? startPos : endPos ) ; } // Starting from the starting point , sc...
public class BeanMap { /** * Returns the accessor for the property with the given name . * @ param name the name of the property * @ return the accessor method for the property , or null */ public BeanInvoker getReadInvoker ( String name ) { } }
BeanInvoker invoker ; if ( readInvokers . containsKey ( name ) ) { invoker = readInvokers . get ( name ) ; } else { invoker = getInvoker ( readHandleType . get ( name ) , name ) ; readInvokers . put ( name , invoker ) ; } return invoker ;
public class AnnotationTypeWriterImpl { /** * Add the navigation summary link . * @ param builder builder for the member to be documented * @ param label the label for the navigation * @ param type type to be documented * @ param liNav the content tree to which the navigation summary link will be added */ prote...
AbstractMemberWriter writer = ( ( AbstractMemberWriter ) builder . getMemberSummaryWriter ( type ) ) ; if ( writer == null ) { liNav . addContent ( getResource ( label ) ) ; } else { liNav . addContent ( writer . getNavSummaryLink ( null , ! builder . getVisibleMemberMap ( type ) . noVisibleMembers ( ) ) ) ; }
public class ClustersInner { /** * Get the IP address , port of all the compute nodes in the Cluster . * ServiceResponse < PageImpl < RemoteLoginInformationInner > > * @ param resourceGroupName Name of the resource group to which the resource belongs . * ServiceResponse < PageImpl < RemoteLoginInformationInner > > ...
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( workspaceName == null ) { throw new IllegalArgumentException ( "Parameter workspaceName is required and cannot be null." ) ; } if ( clusterName == null ) { throw new IllegalAr...
public class HiveOrcSerDeManager { /** * Determine if a file is ORC format . * Steal ideas & code from presto / OrcReader under Apache License 2.0. */ private static boolean isORC ( Path file , FileSystem fs ) throws IOException { } }
try { FSDataInputStream inputStream = fs . open ( file ) ; long size = fs . getFileStatus ( file ) . getLen ( ) ; byte [ ] buffer = new byte [ Math . toIntExact ( Math . min ( size , EXPECTED_FOOTER_SIZE ) ) ] ; if ( size < buffer . length ) { return false ; } inputStream . readFully ( size - buffer . length , buffer )...
public class Expression { /** * Returns true if all referenced expressions are { @ linkplain # isCheap ( ) cheap } . */ public static boolean areAllCheap ( Expression first , Expression ... rest ) { } }
return areAllCheap ( ImmutableList . < Expression > builder ( ) . add ( first ) . add ( rest ) . build ( ) ) ;
public class AlertService { /** * Creates a new trigger . * @ param alertId The ID of the alert that will own the trigger . * @ param trigger The trigger to create having an un - populated ID field . * @ return The trigger having a populated ID field . * @ throws IOException If the server cannot be reached . ...
String requestUrl = RESOURCE + "/" + alertId . toString ( ) + "/triggers" ; ArgusResponse response = getClient ( ) . executeHttpRequest ( ArgusHttpClient . RequestType . POST , requestUrl , trigger ) ; assertValidResponse ( response , requestUrl ) ; return fromJson ( response . getResult ( ) , new TypeReference < List ...
public class DataColumnConstraintsDao { /** * Query by the unique column values * @ param constraintName * constraint name * @ param constraintType * constraint type * @ param value * value * @ return data column constraints * @ throws SQLException * upon failure */ public DataColumnConstraints queryB...
DataColumnConstraints constraint = null ; QueryBuilder < DataColumnConstraints , Void > qb = queryBuilder ( ) ; setUniqueWhere ( qb . where ( ) , constraintName , constraintType , value ) ; List < DataColumnConstraints > constraints = qb . query ( ) ; if ( ! constraints . isEmpty ( ) ) { if ( constraints . size ( ) > 1...
public class HlpEntitiesPage { /** * < p > Make SQL WHERE clause for date - time if need . < / p > * @ param pSbWhere result clause * @ param pRequestData - Request Data * @ param pNameEntity - entity name * @ param pFldNm - field name * @ param pParSuffix - parameter suffix * @ param pFilterMap - map to st...
String nmRnd = pRequestData . getParameter ( "nmRnd" ) ; String fltOrdPrefix ; if ( nmRnd != null && nmRnd . contains ( "pickerDub" ) ) { fltOrdPrefix = "fltordPD" ; } else if ( nmRnd != null && nmRnd . contains ( "picker" ) ) { fltOrdPrefix = "fltordP" ; } else { fltOrdPrefix = "fltordM" ; } String fltforcedName = flt...
public class DateUtil { /** * 根据特定格式格式化日期 * @ param date 被格式化的日期 * @ param format { @ link DatePrinter } 或 { @ link FastDateFormat } * @ return 格式化后的字符串 */ public static String format ( Date date , DatePrinter format ) { } }
if ( null == format || null == date ) { return null ; } return format . format ( date ) ;
public class AmazonElastiCacheClient { /** * Creates a new cache subnet group . * Use this parameter only when you are creating a cluster in an Amazon Virtual Private Cloud ( Amazon VPC ) . * @ param createCacheSubnetGroupRequest * Represents the input of a < code > CreateCacheSubnetGroup < / code > operation . ...
request = beforeClientExecution ( request ) ; return executeCreateCacheSubnetGroup ( request ) ;
public class IOUtil { /** * Writes text to file */ public static void writeText ( String text , File output ) { } }
PrintWriter pw = null ; try { pw = new PrintWriter ( new FileWriter ( output ) ) ; pw . write ( text ) ; } catch ( Exception e ) { throw new MockitoException ( "Problems writing text to file: " + output , e ) ; } finally { close ( pw ) ; }
public class BlurDialogEngine { /** * Retrieve offset introduce by the navigation bar . * @ return bottom offset due to navigation bar . */ private int getNavigationBarOffset ( ) { } }
int result = 0 ; Resources resources = mHoldingActivity . getResources ( ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { int resourceId = resources . getIdentifier ( "navigation_bar_height" , "dimen" , "android" ) ; if ( resourceId > 0 ) { result = resources . getDimensionPixelSize ( resource...
public class ResourceGridScreen { /** * Process the command . * < br / > Step 1 - Process the command if possible and return true if processed . * < br / > Step 2 - If I can ' t process , pass to all children ( with me as the source ) . * < br / > Step 3 - If children didn ' t process , pass to parent ( with me a...
if ( strCommand . equalsIgnoreCase ( MenuConstants . FORMDETAIL ) ) return ( this . onForm ( null , ScreenConstants . DETAIL_MODE , true , iCommandOptions , null ) != null ) ; else return super . doCommand ( strCommand , sourceSField , iCommandOptions ) ;
public class OSGiInjectionScopeData { /** * Unregister this scope data with its parent if necessary for deferred * reference data processing . */ private synchronized void disableDeferredReferenceData ( ) { } }
deferredReferenceDataEnabled = false ; if ( parent != null && deferredReferenceDatas != null ) { parent . removeDeferredReferenceData ( this ) ; deferredReferenceDatas = null ; }
public class BasicQueryOutputProcessor { /** * { @ inheritDoc } */ public List < Map < String , Object > > toMapList ( List < QueryParameters > paramsList ) { } }
List < Map < String , Object > > result = new ArrayList < Map < String , Object > > ( ) ; Iterator < QueryParameters > iterator = paramsList . iterator ( ) ; // skipping header if ( iterator . hasNext ( ) == true ) { iterator . next ( ) ; } while ( iterator . hasNext ( ) == true ) { result . add ( iterator . next ( ) ....
public class LostExceptionStackTrace { /** * implements the visitor to find throwing alternative exceptions from a catch block , without forwarding along the original exception */ @ Override public void sawOpcode ( int seen ) { } }
boolean markAsValid = false ; try { stack . precomputation ( this ) ; int pc = getPC ( ) ; for ( CodeException ex : exceptions ) { if ( pc == ex . getEndPC ( ) ) { if ( OpcodeUtils . isReturn ( seen ) ) { addCatchBlock ( ex . getHandlerPC ( ) , Integer . MAX_VALUE ) ; } else if ( ( seen == Const . GOTO ) || ( seen == C...
public class HandlerSocketConnectorImpl { /** * ( non - Javadoc ) * @ see * com . google . code . hs4j . network . hs . HandlerCOnnector # send ( com . google . code * . hs4j . Command ) */ public void send ( final Command msg ) throws HandlerSocketException { } }
Session session = this . selectSession ( ) ; session . write ( msg ) ;
public class DemuxingIoHandler { /** * Registers a { @ link MessageHandler } that handles the sent messages of the * specified < code > type < / code > . * @ return the old handler if there is already a registered handler for * the specified < tt > type < / tt > . < tt > null < / tt > otherwise . */ @ SuppressWar...
sentMessageHandlerCache . clear ( ) ; return ( MessageHandler < ? super E > ) sentMessageHandlers . put ( type , handler ) ;
public class Iterators { /** * Filters another iterator by eliminating duplicates . */ public static < T > Iterable < T > removeDups ( final Iterable < T > base ) { } }
return new Iterable < T > ( ) { public Iterator < T > iterator ( ) { return removeDups ( base . iterator ( ) ) ; } } ;
public class UpdateExchangeRates { /** * Runs the example . * @ param adManagerServices the services factory . * @ param session the session . * @ param exchangeRateId the ID of the exchange rate to update . * @ throws ApiException if the API request failed with one or more service errors . * @ throws RemoteE...
// Get the ExchangeRateService . ExchangeRateServiceInterface exchangeRateService = adManagerServices . get ( session , ExchangeRateServiceInterface . class ) ; // Create a statement to only select a single exchange rate by ID . StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "id = :id and refres...
public class Log { /** * Send a { @ link # Constants . WARN } log message . * @ param msg * The message you would like logged . */ public static int w ( String msg ) { } }
// This is a quick check to avoid the expensive stack trace reflection . if ( ! activated ) { return 0 ; } String caller = LogHelper . getCaller ( ) ; if ( caller != null ) { return w ( caller , msg ) ; } return 0 ;
public class BCFRecordReader { /** * For compressed BCF , unless the end has been reached , this is quite * inaccurate . */ @ Override public float getProgress ( ) { } }
if ( length == 0 ) return 1 ; if ( ! isBGZF ) return ( float ) ( in . getPosition ( ) - fileStart ) / length ; try { if ( in . peek ( ) == - 1 ) return 1 ; } catch ( IOException e ) { return 1 ; } // Add 1 to the denominator to make sure that we never report 1 here . return ( float ) ( ( bci . getFilePointer ( ) >>> 16...
public class EditShape { /** * always succeeds */ void setClosedPath ( int path , boolean b_yes_no ) { } }
if ( isClosedPath ( path ) == b_yes_no ) return ; if ( getPathSize ( path ) > 0 ) { int first = getFirstVertex ( path ) ; int last = getLastVertex ( path ) ; if ( b_yes_no ) { // make a circular list setNextVertex_ ( last , first ) ; setPrevVertex_ ( first , last ) ; // set segment to NULL ( just in case ) int vindex =...
public class cachepolicy { /** * Use this API to add cachepolicy . */ public static base_response add ( nitro_service client , cachepolicy resource ) throws Exception { } }
cachepolicy addresource = new cachepolicy ( ) ; addresource . policyname = resource . policyname ; addresource . rule = resource . rule ; addresource . action = resource . action ; addresource . storeingroup = resource . storeingroup ; addresource . invalgroups = resource . invalgroups ; addresource . invalobjects = re...
public class ClosureBundler { /** * Append the contents of the string to the supplied appendable . */ public void appendTo ( Appendable out , DependencyInfo info , String content ) throws IOException { } }
appendTo ( out , info , CharSource . wrap ( content ) ) ;
public class ObjectEnvelope { /** * Sets the initial MoificationState of the wrapped object myObj . The initial state will be StateNewDirty if myObj * is not persisten already . The state will be set to StateOldClean if the object is already persistent . */ private void prepareInitialState ( boolean isNewObject ) { }...
// determine appropriate modification state ModificationState initialState ; if ( isNewObject ) { // if object is not already persistent it must be marked as new // it must be marked as dirty because it must be stored even if it will not modified during tx initialState = StateNewDirty . getInstance ( ) ; } else if ( is...
public class GetApiMappingsResult { /** * The elements from this collection . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setItems ( java . util . Collection ) } or { @ link # withItems ( java . util . Collection ) } if you want to override the * existi...
if ( this . items == null ) { setItems ( new java . util . ArrayList < ApiMapping > ( items . length ) ) ; } for ( ApiMapping ele : items ) { this . items . add ( ele ) ; } return this ;
public class TensorInfo { /** * < code > optional . tensorflow . DataType dtype = 2 ; < / code > */ public org . tensorflow . framework . DataType getDtype ( ) { } }
org . tensorflow . framework . DataType result = org . tensorflow . framework . DataType . valueOf ( dtype_ ) ; return result == null ? org . tensorflow . framework . DataType . UNRECOGNIZED : result ;
public class MapPrinter { /** * Return the available format ids . */ public final Set < String > getOutputFormatsNames ( ) { } }
SortedSet < String > formats = new TreeSet < > ( ) ; for ( String formatBeanName : this . outputFormat . keySet ( ) ) { int endingIndex = formatBeanName . indexOf ( MAP_OUTPUT_FORMAT_BEAN_NAME_ENDING ) ; if ( endingIndex < 0 ) { endingIndex = formatBeanName . indexOf ( OUTPUT_FORMAT_BEAN_NAME_ENDING ) ; } formats . add...
public class ApiOvhEmaildomain { /** * Create new rule for filter * REST : POST / email / domain / { domain } / account / { accountName } / filter / { name } / rule * @ param value [ required ] Rule parameter of filter * @ param operand [ required ] Rule of filter * @ param header [ required ] Header to be filt...
String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/rule" ; StringBuilder sb = path ( qPath , domain , accountName , name ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "header" , header ) ; addBody ( o , "operand" , operand ) ; addBody ( o , "value" , val...
public class KnowledgeBaseManagerSparql { /** * This method checks a set of fetching tasks that are pending to validate their adequate conclusion . * For each of the fetching tasks launched we will track the models that were not adequately loaded for ulterior * uploading . * @ param concurrentTasks the Map with t...
boolean result = true ; Boolean fetched ; for ( URI modelUri : concurrentTasks . keySet ( ) ) { Future < Boolean > f = concurrentTasks . get ( modelUri ) ; try { fetched = f . get ( ) ; result = result && fetched ; // Track unreachability if ( fetched && this . unreachableModels . containsKey ( modelUri ) ) { this . un...
public class ParsePackage { /** * Method processFormula . * Parse a formula which is just one action expression followed by * a semicolon . * @ return Rule * @ throws ParserException */ private AbstractRule processFormula ( RulesTextProvider textProvider ) { } }
log . debug ( "processFormula" ) ; Formula rule = new Formula ( ) ; int start = textProvider . getPos ( ) ; LoadCommonRuleData ( rule , textProvider ) ; textProvider . addTOCElement ( null , rule . getDescription ( ) , start , textProvider . getPos ( ) , TYPE_FORMULA ) ; exactOrError ( "{" , textProvider ) ; Expression...
public class AuthCallsIpAccessControlListMappingReader { /** * Make the request to the Twilio API to perform the read . * @ param client TwilioRestClient with which to make the request * @ return AuthCallsIpAccessControlListMapping ResourceSet */ @ Override public ResourceSet < AuthCallsIpAccessControlListMapping >...
return new ResourceSet < > ( this , client , firstPage ( client ) ) ;
public class ImageLoader { /** * Loads and decodes image synchronously . < br / > * Default display image options * { @ linkplain ImageLoaderConfiguration . Builder # defaultDisplayImageOptions ( DisplayImageOptions ) from * configuration } will be used . < br / > * < b > NOTE : < / b > { @ link # init ( ImageL...
return loadImageSync ( uri , targetImageSize , null ) ;
public class DeleteInvitationsResult { /** * A list of account ID and email address pairs of the AWS accounts that could not be processed . * @ param unprocessedAccounts * A list of account ID and email address pairs of the AWS accounts that could not be processed . */ public void setUnprocessedAccounts ( java . ut...
if ( unprocessedAccounts == null ) { this . unprocessedAccounts = null ; return ; } this . unprocessedAccounts = new java . util . ArrayList < Result > ( unprocessedAccounts ) ;
public class SysUtil { /** * Determine how preferred a given ABI is on this system . * @ param supportedAbis ABIs on this system * @ param abi ABI of a shared library we might want to unpack * @ return - 1 if not supported or an integer , smaller being more preferred */ public static int findAbiScore ( String [ ]...
for ( int i = 0 ; i < supportedAbis . length ; ++ i ) { if ( supportedAbis [ i ] != null && abi . equals ( supportedAbis [ i ] ) ) { return i ; } } return - 1 ;
public class UriEscape { /** * Perform am URI fragment identifier < strong > escape < / strong > operation * on a < tt > Reader < / tt > input using < tt > UTF - 8 < / tt > as encoding , * writing results to a < tt > Writer < / tt > . * The following are the only allowed chars in an URI fragment identifier ( will...
escapeUriFragmentId ( reader , writer , DEFAULT_ENCODING ) ;
public class VFSUtils { /** * Add manifest paths * @ param file the file * @ param paths the paths to add to * @ throws IOException if there is an error reading the manifest or the virtual file is closed * @ throws IllegalStateException if the file has no parent * @ throws IllegalArgumentException for a null ...
if ( file == null ) { throw MESSAGES . nullArgument ( "file" ) ; } if ( paths == null ) { throw MESSAGES . nullArgument ( "paths" ) ; } boolean trace = VFSLogger . ROOT_LOGGER . isTraceEnabled ( ) ; Manifest manifest = getManifest ( file ) ; if ( manifest == null ) { return ; } Attributes mainAttributes = manifest . ge...
public class ClassBuilder { /** * Handles the { @ literal < TypeElement > } tag . * @ param node the XML element that specifies which components to document * @ param contentTree the content tree to which the documentation will be added * @ throws DocletException if there is a problem while building the documenta...
String key ; if ( isInterface ) { key = "doclet.Interface" ; } else if ( isEnum ) { key = "doclet.Enum" ; } else { key = "doclet.Class" ; } contentTree = writer . getHeader ( configuration . getText ( key ) + " " + utils . getSimpleName ( typeElement ) ) ; Content classContentTree = writer . getClassContentHeader ( ) ;...
public class XDataManager { /** * Get the XDataManager for the given XMPP connection . * @ param connection the XMPPConnection . * @ return the XDataManager */ public static synchronized XDataManager getInstanceFor ( XMPPConnection connection ) { } }
XDataManager xDataManager = INSTANCES . get ( connection ) ; if ( xDataManager == null ) { xDataManager = new XDataManager ( connection ) ; INSTANCES . put ( connection , xDataManager ) ; } return xDataManager ;
public class AbstractJobLauncher { /** * Takes a { @ link List } of { @ link Tag } s and returns a new { @ link List } with the original { @ link Tag } s as well as any * additional { @ link Tag } s returned by { @ link ClusterNameTags # getClusterNameTags ( ) } . * @ see ClusterNameTags */ private static List < Ta...
return ImmutableList . < Tag < ? > > builder ( ) . addAll ( tags ) . addAll ( Tag . fromMap ( ClusterNameTags . getClusterNameTags ( ) ) ) . build ( ) ;
public class ReduceOps { /** * Constructs a { @ code TerminalOp } that implements a mutable reduce on * { @ code long } values . * @ param < R > the type of the result * @ param supplier a factory to produce a new accumulator of the result type * @ param accumulator a function to incorporate an int into an * ...
Objects . requireNonNull ( supplier ) ; Objects . requireNonNull ( accumulator ) ; Objects . requireNonNull ( combiner ) ; class ReducingSink extends Box < R > implements AccumulatingSink < Long , R , ReducingSink > , Sink . OfLong { @ Override public void begin ( long size ) { state = supplier . get ( ) ; } @ Override...
public class DeletePlacementGroupRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional * parameters to enable operation dry - run . */ @ Override public Request < DeletePlacementGroupRequest > getDryRunRequest ( ) { } }
Request < DeletePlacementGroupRequest > request = new DeletePlacementGroupRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ;
public class OAuthProfileCreator { /** * Retrieve the user profile from the access token . * @ param context the web context * @ param accessToken the access token * @ return the user profile */ protected Optional < UserProfile > retrieveUserProfileFromToken ( final WebContext context , final T accessToken ) { } ...
final OAuthProfileDefinition < U , T , O > profileDefinition = configuration . getProfileDefinition ( ) ; final String profileUrl = profileDefinition . getProfileUrl ( accessToken , configuration ) ; final S service = this . configuration . buildService ( context , client , null ) ; final String body = sendRequestForDa...
public class PollCachingJdbcRegistry { /** * Checks the ES store to see if the ' dataVersion ' entry has been updated with a newer * version # . If it has , then we need to invalidate our cache . */ protected void checkCacheVersion ( ) { } }
// Be very aggressive in invalidating the cache . boolean invalidate = true ; QueryRunner run = new QueryRunner ( ds ) ; try { long latestVersion = run . query ( "SELECT version FROM gw_dataversion" , Handlers . LONG_HANDLER ) ; // $ NON - NLS - 1 $ if ( latestVersion > - 1 && dataVersion > - 1 && latestVersion == data...
public class CommonHelper { /** * Takes a map of salt node IDs to a value and return a new map that uses the * SNodes as keys instead of the IDs . * @ param < V > * @ param map * @ param graph * @ return */ public static < V > Map < SNode , V > createSNodeMapFromIDs ( Map < String , V > map , SDocumentGraph g...
HashMap < SNode , V > result = new LinkedHashMap < > ( ) ; if ( map != null && graph != null ) { for ( Map . Entry < String , V > e : map . entrySet ( ) ) { SNode n = graph . getNode ( e . getKey ( ) ) ; if ( n != null ) { result . put ( n , e . getValue ( ) ) ; } } } return result ;
public class WSKeyStore { /** * Set the physical location of this store to the input value . * This method will resolve all symbolic names in the location . * If location is just a file name , then we assume its location is * the LibertyConstants . DEFAULT _ CONFIG _ LOCATION . * @ param _ location */ private v...
String res = null ; File resFile = null ; boolean relativePath = true ; boolean defaultPath = false ; // try as " absolute " resource ( contains symbol , or absolute path ) try { res = cfgSvc . resolveString ( _location ) ; resFile = new File ( res ) ; relativePath = ! resFile . isAbsolute ( ) ; } catch ( IllegalStateE...
public class TimeMachine { /** * Transforms a Runnable into a Block , so that we need only one * implementation of the time - traveling code * @ param code * The Runnable to be converted * @ return A Block that , when called , executes the given Runnable */ private Block < Void > toBlock ( final Runnable code )...
return new Block < Void > ( ) { public Void run ( ) { code . run ( ) ; return null ; } } ;
public class OTMJCAManagedConnectionFactory { /** * return a new managed connection . This connection is wrapped around the real connection and delegates to it * to get work done . * @ param subject * @ param info * @ return */ public ManagedConnection createManagedConnection ( Subject subject , ConnectionReque...
Util . log ( "In OTMJCAManagedConnectionFactory.createManagedConnection" ) ; try { Kit kit = getKit ( ) ; PBKey key = ( ( OTMConnectionRequestInfo ) info ) . getPbKey ( ) ; OTMConnection connection = kit . acquireConnection ( key ) ; return new OTMJCAManagedConnection ( this , connection , key ) ; } catch ( ResourceExc...
public class DiSH { /** * Returns the parent of the specified cluster * @ param relation the relation storing the objects * @ param child the child to search the parent for * @ param clustersMap the map containing the clusters * @ return the parent of the specified cluster */ private Pair < long [ ] , ArrayModi...
Centroid child_centroid = ProjectedCentroid . make ( child . first , relation , child . second ) ; Pair < long [ ] , ArrayModifiableDBIDs > result = null ; int resultCardinality = - 1 ; long [ ] childPV = child . first ; int childCardinality = BitsUtil . cardinality ( childPV ) ; for ( long [ ] parentPV : clustersMap ....
public class DisplacedLognormalGARCH { /** * / * ( non - Javadoc ) * @ see net . finmath . timeseries . HistoricalSimulationModel # getBestParameters ( java . util . Map ) */ @ Override public Map < String , Object > getBestParameters ( Map < String , Object > guess ) { } }
// Create the objective function for the solver class GARCHMaxLikelihoodFunction implements MultivariateFunction , Serializable { private static final long serialVersionUID = 7072187082052755854L ; @ Override public double value ( double [ ] variables ) { /* * Transform variables : The solver variables are in ( - \ inf...
public class FieldTextBuilder { /** * Appends the specified fieldtext onto the builder using the WHEN operator . A simplification is made in the case * where the passed { @ code fieldText } is equal to { @ code this } : * < pre > ( A WHEN A ) { @ literal = > } A < / pre > * @ param fieldText A fieldtext expressio...
Validate . notNull ( fieldText , "FieldText should not be null" ) ; Validate . isTrue ( fieldText . size ( ) >= 1 , "FieldText must have a size greater or equal to 1" ) ; if ( size ( ) < 1 ) { throw new IllegalStateException ( "Size must be greater than or equal to 1" ) ; } // Here we assume that A WHEN A = > A but is ...
public class RestApiClient { /** * Unlock user . * @ param username * the username * @ return the response */ public Response unlockUser ( String username ) { } }
return restClient . delete ( "lockouts/" + username , new HashMap < String , String > ( ) ) ;
public class BlobOutputStream { /** * Flushes this output stream and forces any buffered output bytes to be written out . The general * contract of < code > flush < / code > is that calling it is an indication that , if any bytes * previously written have been buffered by the implementation of the output stream , s...
checkClosed ( ) ; try { if ( bpos > 0 ) { lo . write ( buf , 0 , bpos ) ; } bpos = 0 ; } catch ( SQLException se ) { throw new IOException ( se . toString ( ) ) ; }
public class SimpleFileDownloader { /** * Downloads file from HTTP or FTP . * @ param fileUrl source file * @ return path of downloaded file * @ throws IOException if IO problems * @ throws PluginException if validation fails or any other problems */ protected Path downloadFileHttp ( URL fileUrl ) throws IOExce...
Path destination = Files . createTempDirectory ( "pf4j-update-downloader" ) ; destination . toFile ( ) . deleteOnExit ( ) ; String path = fileUrl . getPath ( ) ; String fileName = path . substring ( path . lastIndexOf ( '/' ) + 1 ) ; Path file = destination . resolve ( fileName ) ; // set up the URL connection URLConne...
public class BusinessExceptionMappingStrategy { /** * This method is specifically designed for use during EJSContainer * postInvoke processing . It maps the internal exception indicating * a rollback has occurred to the appropriate one for the interface * ( i . e . local , remote , business , etc ) . < p > */ @ O...
Throwable cause = null ; Exception causeEx = null ; // If the invoked method threw a System exception , or an Application // exception that was marked for rollback , or the application called // setRollBackOnly . . . then use the exception thrown by the method // as the cause of the rollback exception . if ( s . exType...
public class HybridRunbookWorkerGroupsInner { /** * Update a hybrid runbook worker group . * @ param resourceGroupName Name of an Azure Resource group . * @ param automationAccountName The name of the automation account . * @ param hybridRunbookWorkerGroupName The hybrid runbook worker group name * @ param cred...
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( automationAccountName == null ) { throw new IllegalArgumentException ( "Parameter automationAccountName is required and cannot be null." ) ; } if ( hybridRunbookWorkerGroupNam...
public class PdfContentByte { /** * Restores the graphic state . < CODE > saveState < / CODE > and * < CODE > restoreState < / CODE > must be balanced . */ public void restoreState ( ) { } }
content . append ( "Q" ) . append_i ( separator ) ; int idx = stateList . size ( ) - 1 ; if ( idx < 0 ) throw new IllegalPdfSyntaxException ( "Unbalanced save/restore state operators." ) ; state = ( GraphicState ) stateList . get ( idx ) ; stateList . remove ( idx ) ;
public class JFunk { /** * Starts jFunk . * < pre > * - threadcount = & lt ; count & gt ; Optional Number of threads to be used . Allows for parallel * execution of test scripts . * - parallel Optional Allows a single script to be executed in parallel * depending on the number of threads specified . The * a...
SLF4JBridgeHandler . install ( ) ; boolean exitWithError = true ; StopWatch stopWatch = new StopWatch ( ) ; try { RESULT_LOG . info ( "jFunk started" ) ; stopWatch . start ( ) ; int threadCount = 1 ; boolean parallel = false ; Properties scriptProperties = new Properties ( ) ; List < File > scripts = Lists . newArrayLi...
public class DefaultInternalConfiguration { /** * Finds the start of a variable name in the given string . Variables use the " $ { < i > variableName < / i > } " notation . * @ param aKey the key to search . * @ return the index of the start of a variable name in the given string , or - 1 if not found . */ private ...
if ( aKey == null ) { return - 1 ; } // Look for the first occurence of $ { in the parameter . int index = aKey . indexOf ( '$' ) ; for ( ; index >= 0 ; index = aKey . indexOf ( '$' , index + 1 ) ) { if ( index == aKey . length ( ) - 1 ) { continue ; } if ( aKey . charAt ( index + 1 ) != '{' ) { continue ; } // Ahh - g...
public class Lazy { /** * Java object serialization */ private void writeObject ( final ObjectOutputStream out ) throws IOException { } }
final Object value = get ( ) ; out . defaultWriteObject ( ) ; out . writeObject ( value ) ;
public class OverlordAccessor { /** * Poll for task ' s status for tasks fired with 0 wait time . * @ param taskId * @ param reqHeaders * @ return */ public TaskStatus pollTaskStatus ( String taskId , Map < String , String > reqHeaders ) { } }
CloseableHttpResponse resp = null ; String url = format ( "%s/%s/status" , format ( overlordUrl , overlordHost , overlordPort ) , taskId ) ; try { resp = get ( url , reqHeaders ) ; // TODO : Check for nulls in the following . JSONObject respJson = new JSONObject ( IOUtils . toString ( resp . getEntity ( ) . getContent ...
public class MethodsBinding { /** * / * @ Override */ public S unmarshal ( T string ) { } }
try { return getBoundClass ( ) . cast ( unmarshalHandle . invoke ( string ) ) ; } catch ( Throwable ex ) { if ( ex . getCause ( ) instanceof RuntimeException ) { throw ( RuntimeException ) ex . getCause ( ) ; } throw new BindingException ( ex . getMessage ( ) , ex . getCause ( ) ) ; }
public class SubscriptionSchedule { /** * Retrieves the details of an existing subscription schedule . You only need to supply the unique * subscription schedule identifier that was returned upon subscription schedule creation . */ public static SubscriptionSchedule retrieve ( String schedule ) throws StripeException...
return retrieve ( schedule , ( Map < String , Object > ) null , ( RequestOptions ) null ) ;
public class NikeFS2SwapFileManager { /** * Deletes the given directory recursively , i . e . , bottom - up . * @ param directory Directory to be deleted . * @ return The number of files deleted . */ private static synchronized int deleteRecursively ( File directory ) { } }
int deleted = 0 ; if ( directory . isDirectory ( ) ) { File [ ] contents = directory . listFiles ( ) ; for ( File file : contents ) { deleted += deleteRecursively ( file ) ; } } else { deleted ++ ; } directory . delete ( ) ; return deleted ;
public class DigestUtils { /** * Hashes the source with SHA1 and returns the resulting hash as an hexadecimal string . * @ param source the text to hash . * @ return the SHA1 hash of the source , in hexadecimal form . */ public static String digestSha1Hex ( String source ) { } }
String sha1 = "" ; try { MessageDigest crypt = MessageDigest . getInstance ( "SHA-1" ) ; crypt . reset ( ) ; crypt . update ( source . getBytes ( "UTF-8" ) ) ; sha1 = byteToHex ( crypt . digest ( ) ) ; } catch ( NoSuchAlgorithmException e ) { e . printStackTrace ( ) ; } catch ( UnsupportedEncodingException e ) { e . pr...