signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Futures { /** * Create a promise that emits a { @ code Boolean } value on completion of the { @ code future } * @ param future the future . * @ return Promise emitting a { @ code Boolean } value . { @ literal true } if the { @ code future } completed successfully , otherwise * the cause wil be transp...
DefaultPromise < Boolean > result = new DefaultPromise < > ( GlobalEventExecutor . INSTANCE ) ; if ( future . isDone ( ) || future . isCancelled ( ) ) { if ( future . isSuccess ( ) ) { result . setSuccess ( true ) ; } else { result . setFailure ( future . cause ( ) ) ; } return result ; } future . addListener ( ( Gener...
public class BaselineProfile { /** * Check if the tags that define the image are correct and consistent . * @ param ifd the ifd * @ param n the ifd number * @ param metadata the ifd metadata */ public void checkImage ( IFD ifd , int n , IfdTags metadata ) { } }
CheckCommonFields ( ifd , n , metadata ) ; if ( ! metadata . containsTagId ( TiffTags . getTagId ( "PhotometricInterpretation" ) ) ) { validation . addErrorLoc ( "Missing Photometric Interpretation" , "IFD" + n ) ; } else if ( metadata . get ( TiffTags . getTagId ( "PhotometricInterpretation" ) ) . getValue ( ) . size ...
public class ChannelHelper { /** * Channel copy method 1 . This method copies data from the src channel and * writes it to the dest channel until EOF on src . This implementation makes * use of compact ( ) on the temp buffer to pack down the data if the buffer * wasn ' t fully drained . This may result in data co...
long nBytesWritten = 0 ; final ByteBuffer aBuffer = ByteBuffer . allocateDirect ( 16 * 1024 ) ; while ( aSrc . read ( aBuffer ) != - 1 ) { // Prepare the buffer to be drained aBuffer . flip ( ) ; // Write to the channel ; may block nBytesWritten += aDest . write ( aBuffer ) ; // If partial transfer , shift remainder do...
public class StateBuilder { /** * public State build ( ) { return new State ( state , fanIn . get ( ) , fanOut . get ( ) , getCandidates ( ) , * failedEvents . build ( ) ) ; } */ public State build ( ) { } }
return new State ( state , fanIn . get ( ) , fanOut . get ( ) , getCandidates ( ) , failedEvents . build ( ) , state . hasNearDuplicate ( ) , getNearestState ( ) , state . getDistToNearestState ( ) , timeAdded ) ;
public class QueryExprInvoker { /** * < p > invoke . < / p > * @ param queryExprMeta a { @ link ameba . db . dsl . QueryExprMeta } object . * @ return a T object . */ @ SuppressWarnings ( "unchecked" ) protected T invoke ( QueryExprMeta queryExprMeta ) { } }
List < Val < ? > > args = queryExprMeta . arguments ( ) ; if ( args == null ) { args = EMP_ARGS ; } int argCount = args . size ( ) ; Val < T > [ ] argsArray = new Val [ argCount ] ; String field = queryExprMeta . field ( ) ; String op = queryExprMeta . operator ( ) ; for ( int i = 0 ; i < argCount ; i ++ ) { Val < ? > ...
public class InstantSearch { /** * Enables the display of a spinning { @ link android . widget . ProgressBar ProgressBar } in the SearchView when waiting for results . */ @ SuppressWarnings ( { } }
"WeakerAccess" , "unused" } ) // For library users public void enableProgressBar ( ) { showProgressBar = true ; if ( searchBoxViewModel != null ) { progressController = new SearchProgressController ( new SearchProgressController . ProgressListener ( ) { @ Override public void onStart ( ) { updateProgressBar ( searchBox...
public class ValidationDriver { /** * Loads a schema . Subsequent calls to < code > validate < / code > will validate with * respect the loaded schema . This can be called more than once to allow * multiple documents to be validated against different schemas . * @ param in the InputSource for the schema * @ ret...
try { schema = sr . createSchema ( new SAXSource ( in ) , schemaProperties ) ; validator = null ; return true ; } catch ( IncorrectSchemaException e ) { return false ; }
public class BufferFileChannelReader { /** * Reads data from the object ' s file channel into the given buffer . * @ param buffer the buffer to read into * @ return whether the end of the file has been reached ( < tt > true < / tt > ) or not ( < tt > false < / tt > ) */ public boolean readBufferFromFileChannel ( Bu...
checkArgument ( fileChannel . size ( ) - fileChannel . position ( ) > 0 ) ; // Read header header . clear ( ) ; fileChannel . read ( header ) ; header . flip ( ) ; final boolean isBuffer = header . getInt ( ) == 1 ; final int size = header . getInt ( ) ; if ( size > buffer . getMaxCapacity ( ) ) { throw new IllegalStat...
public class DFSUtil { /** * Helper for extracting bytes either from " str " * or from the array of chars " charArray " , * depending if fast conversion is possible , * specified by " canFastConvert " */ private static byte [ ] extractBytes ( String str , int startIndex , int endIndex , char [ ] charArray , boole...
if ( canFastConvert ) { // fast conversion , just copy the raw bytes final int len = endIndex - startIndex ; byte [ ] strBytes = new byte [ len ] ; for ( int i = 0 ; i < len ; i ++ ) { strBytes [ i ] = ( byte ) charArray [ startIndex + i ] ; } return strBytes ; } // otherwise , do expensive conversion return str . subs...
public class GaliosFieldTableOps { /** * Computes the following the value of output such that : < br > * < p > divide ( multiply ( x , y ) , y ) = = x for any x and any nonzero y . < / p > */ public int divide ( int x , int y ) { } }
if ( y == 0 ) throw new ArithmeticException ( "Divide by zero" ) ; if ( x == 0 ) return 0 ; return exp [ log [ x ] + max_value - log [ y ] ] ;
public class AbstractPipeline { /** * Performs a parallel evaluation of the operation using the specified * { @ code PipelineHelper } which describes the upstream intermediate * operations . Only called on stateful operations . If { @ link * # opIsStateful ( ) } returns true then implementations must override the...
throw new UnsupportedOperationException ( "Parallel evaluation is not supported" ) ;
public class ModifySourceCollectionInStream { /** * TODO ( b / 125767228 ) : Consider a rigorous implementation to check tree structure equivalence . */ @ SuppressWarnings ( "TreeToString" ) // Indented to ignore whitespace , comments , and source position . private static boolean isSameExpression ( ExpressionTree left...
// The left tree and right tree must have the same symbol resolution . // This ensures the symbol kind on field , parameter or local var . if ( ASTHelpers . getSymbol ( leftTree ) != ASTHelpers . getSymbol ( rightTree ) ) { return false ; } String leftTreeTextRepr = stripPrefixIfPresent ( leftTree . toString ( ) , "thi...
public class HeaderInterceptor { /** * { @ inheritDoc } */ @ Override public < ReqT , RespT > ClientCall < ReqT , RespT > interceptCall ( MethodDescriptor < ReqT , RespT > method , CallOptions callOptions , Channel next ) { } }
return new CheckedForwardingClientCall < ReqT , RespT > ( next . newCall ( method , callOptions ) ) { @ Override protected void checkedStart ( Listener < RespT > responseListener , Metadata headers ) { updateHeaders ( headers ) ; delegate ( ) . start ( responseListener , headers ) ; } } ;
public class DEBBuilder { /** * Add debian / control Conflicts field . * @ param name * @ param version * @ param dependency * @ return */ @ Override public DEBBuilder addConflict ( String name , String version , Condition ... dependency ) { } }
control . addConflict ( release , version , dependency ) ; return this ;
public class MapMaker { /** * Specifies that each entry should be automatically removed from the map once a fixed duration * has elapsed after the entry ' s last read or write access . * < p > When { @ code duration } is zero , elements can be successfully added to the map , but are * evicted immediately . This h...
checkExpiration ( duration , unit ) ; this . expireAfterAccessNanos = unit . toNanos ( duration ) ; if ( duration == 0 && this . nullRemovalCause == null ) { // SIZE trumps EXPIRED this . nullRemovalCause = RemovalCause . EXPIRED ; } useCustomMap = true ; return this ;
public class CmsWorkplace { /** * Stores the settings in the given session . < p > * @ param session the session to store the settings in * @ param settings the settings */ static void storeSettings ( HttpSession session , CmsWorkplaceSettings settings ) { } }
// save the workplace settings in the session session . setAttribute ( CmsWorkplaceManager . SESSION_WORKPLACE_SETTINGS , settings ) ;
public class AWSMigrationHubClient { /** * Disassociate an Application Discovery Service ( ADS ) discovered resource from a migration task . * @ param disassociateDiscoveredResourceRequest * @ return Result of the DisassociateDiscoveredResource operation returned by the service . * @ throws AccessDeniedException ...
request = beforeClientExecution ( request ) ; return executeDisassociateDiscoveredResource ( request ) ;
public class YesterdayReader { /** * Make the request to the Twilio API to perform the read . * @ param client TwilioRestClient with which to make the request * @ return Yesterday ResourceSet */ @ Override public ResourceSet < Yesterday > read ( final TwilioRestClient client ) { } }
return new ResourceSet < > ( this , client , firstPage ( client ) ) ;
public class HBasePanel { /** * Print this screen ' s content area . * @ param out The out stream . * @ exception DBException File exception . */ public void printScreen ( PrintWriter out , ResourceBundle reg ) throws DBException { } }
String strParamHelp = this . getProperty ( DBParams . HELP ) ; // Display record if ( strParamHelp != null ) return ; // Don ' t do this for help screens this . printHtmlStartForm ( out ) ; int iHtmlOptions = this . getScreenField ( ) . getPrintOptions ( ) ; if ( ( iHtmlOptions & HtmlConstants . PRINT_TOOLBAR_BEFORE ) ...
public class Main { /** * This function takes a string of floating - point numbers separated by commas and converts it to an array of doubles . * Examples : * > > > stringToDoubleArray ( ' 1.2 , 1.3 , 2.3 , 2.4 , 6.5 ' ) * { 1.2 , 1.3 , 2.3 , 2.4 , 6.5} * > > > stringToDoubleArray ( ' 2.3 , 2.4 , 5.6 , 5.4 , 8....
String [ ] strArr = inputStr . split ( ", " ) ; double [ ] doubleArr = new double [ strArr . length ] ; for ( int i = 0 ; i < strArr . length ; i ++ ) { doubleArr [ i ] = Double . parseDouble ( strArr [ i ] ) ; } return doubleArr ;
public class GSPSImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . GSPS__LCID : setLCID ( LCID_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ;
public class AzureClient { /** * Handles an initial response from a PUT or PATCH operation response by polling the status of the operation * asynchronously , once the operation finishes emits the final response . * @ param observable the initial observable from the PUT or PATCH operation . * @ param resourceType ...
return this . < T > beginPutOrPatchAsync ( observable , resourceType ) . toObservable ( ) . flatMap ( new Func1 < PollingState < T > , Observable < PollingState < T > > > ( ) { @ Override public Observable < PollingState < T > > call ( PollingState < T > pollingState ) { return pollPutOrPatchAsync ( pollingState , reso...
public class QuestConfigPanel { /** * GEN - LAST : event _ chkRewriteActionPerformed */ private void chkAnnotationsActionPerformed ( java . awt . event . ActionEvent evt ) { } }
// GEN - FIRST : event _ chkAnnotationsActionPerformed preference . put ( OntopMappingSettings . QUERY_ONTOLOGY_ANNOTATIONS , String . valueOf ( chkAnnotations . isSelected ( ) ) ) ;
public class ApiResource { /** * URL - encode a string ID in url path formatting . */ public static String urlEncodeId ( String id ) throws InvalidRequestException { } }
try { return urlEncode ( id ) ; } catch ( UnsupportedEncodingException e ) { throw new InvalidRequestException ( String . format ( "Unable to encode `%s` in the url to %s. " + "Please contact support@stripe.com for assistance." , id , CHARSET ) , null , null , null , 0 , e ) ; }
public class JsonHandler { /** * { @ inheritDoc } */ @ Override protected String format ( String request ) { } }
String result = request ; if ( request != null && ! "" . equals ( request ) ) { try { JsonNode rootNode = mapper . readValue ( request , JsonNode . class ) ; result = mapper . writeValueAsString ( rootNode ) ; } catch ( Exception e ) { log . error ( null , e ) ; } } return result ;
public class Matrix4x3f { /** * / * ( non - Javadoc ) * @ see org . joml . Matrix4x3fc # normal ( org . joml . Matrix3f ) */ public Matrix3f normal ( Matrix3f dest ) { } }
if ( ( properties & PROPERTY_ORTHONORMAL ) != 0 ) return normalOrthonormal ( dest ) ; return normalGeneric ( dest ) ;
public class JodaBeanReferencingBinReader { /** * parses the bean using the class information */ private Object parseBean ( int propertyCount , ClassInfo classInfo ) { } }
String propName = "" ; if ( classInfo . metaProperties . length != propertyCount ) { throw new IllegalArgumentException ( "Invalid binary data: Expected " + classInfo . metaProperties . length + " properties but was: " + propertyCount ) ; } try { SerDeserializer deser = settings . getDeserializers ( ) . findDeserialize...
public class InitialBundleSelectorImpl { /** * / * ( non - Javadoc ) * @ see nz . co . senanque . workflow . BundleSelector # selectInitialBundle ( java . lang . Object ) */ @ Override public String selectInitialBundle ( Object o ) { } }
if ( o instanceof String ) { String processName = ( String ) o ; for ( ProcessDefinition processDefinition : m_queueProcessmanager . getVisibleProcesses ( m_permissionManager ) ) { if ( processDefinition . getName ( ) . equals ( processName ) ) { m_bundleManager . setBundle ( processDefinition . getVersion ( ) ) ; retu...
public class DecimalFormat { /** * Set roundingDouble , roundingDoubleReciprocal and actualRoundingIncrement * based on rounding mode and width of fractional digits . Whenever setting affecting * rounding mode , rounding increment and maximum width of fractional digits , then * this method must be called . * ro...
if ( roundingIncrementICU != null ) { BigDecimal byWidth = getMaximumFractionDigits ( ) > 0 ? BigDecimal . ONE . movePointLeft ( getMaximumFractionDigits ( ) ) : BigDecimal . ONE ; if ( roundingIncrementICU . compareTo ( byWidth ) >= 0 ) { actualRoundingIncrementICU = roundingIncrementICU ; } else { actualRoundingIncre...
public class MtasUpdateRequestProcessorResultWriter { /** * Adds the item . * @ param term the term * @ param offsetStart the offset start * @ param offsetEnd the offset end * @ param posIncr the pos incr * @ param payload the payload * @ param flags the flags */ public void addItem ( String term , Integer ...
if ( ! closed ) { tokenNumber ++ ; MtasUpdateRequestProcessorResultItem item = new MtasUpdateRequestProcessorResultItem ( term , offsetStart , offsetEnd , posIncr , payload , flags ) ; try { objectOutputStream . writeObject ( item ) ; objectOutputStream . reset ( ) ; objectOutputStream . flush ( ) ; } catch ( IOExcepti...
public class SystemInputDefBuilder { /** * Adds system functions . */ public SystemInputDefBuilder functions ( FunctionInputDef ... functions ) { } }
for ( FunctionInputDef function : functions ) { systemInputDef_ . addFunctionInputDef ( function ) ; } return this ;
public class SpoonUtils { /** * Get an { @ link com . android . ddmlib . AndroidDebugBridge } instance given an SDK path . */ public static AndroidDebugBridge initAdb ( File sdk , Duration timeOut ) { } }
AndroidDebugBridge . initIfNeeded ( false ) ; File adbPath = FileUtils . getFile ( sdk , "platform-tools" , "adb" ) ; AndroidDebugBridge adb = AndroidDebugBridge . createBridge ( adbPath . getAbsolutePath ( ) , false ) ; waitForAdb ( adb , timeOut ) ; return adb ;
public class Logging { /** * Removes logging target ( s ) from target list of the specified device ( s ) * @ param dvsa A string array where str [ i ] = dev - name and str [ i + 1 ] = target _ type : : target _ name */ public void remove_logging_target ( String [ ] dvsa ) throws DevFailed { } }
// - Fight against " zombie appender " synfrom kill_zombie_appenders ( ) ; // - N x [ device - name , ttype : : tname ] expected if ( ( dvsa . length % 2 ) != 0 ) { String desc = "Incorrect number of arguments" ; Except . throw_exception ( "API_MethodArgument" , desc , "Logging::remove_logging_target" ) ; } // - The de...
public class Slf4jLogger { /** * This method is similar to { @ link # trace ( String , Object , Object ) } * method except that the marker data is also taken into * consideration . * @ param marker the marker data specific to this log statement * @ param format the format string * @ param arg1 the first argum...
if ( m_delegate . isTraceEnabled ( ) ) { FormattingTuple tuple = MessageFormatter . format ( format , arg1 , arg2 ) ; setMDCMarker ( marker ) ; m_delegate . trace ( tuple . getMessage ( ) , tuple . getThrowable ( ) ) ; resetMDCMarker ( ) ; }
public class QueryByIdentity { /** * Answer the search class . * This is the class of the example object or * the class represented by Identity . * @ return Class */ public Class getSearchClass ( ) { } }
Object obj = getExampleObject ( ) ; if ( obj instanceof Identity ) { return ( ( Identity ) obj ) . getObjectsTopLevelClass ( ) ; } else { return obj . getClass ( ) ; }
public class MockEC2QueryHandler { /** * Handles " describeVpcs " request and returns response with a vpc . * @ return a DescribeVpcsResponseType with our predefined vpc in aws - mock . properties ( or if not overridden , as * defined in aws - mock - default . properties ) */ private DescribeVpcsResponseType descri...
DescribeVpcsResponseType ret = new DescribeVpcsResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; VpcSetType vpcSet = new VpcSetType ( ) ; for ( Iterator < MockVpc > mockVpc = mockVpcController . describeVpcs ( ) . iterator ( ) ; mockVpc . hasNext ( ) ; ) { MockVpc item = mockVpc . next ( ...
public class LiveEventsInner { /** * Create Live Event . * Creates a Live Event . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ param liveEventName The name of the Live Event . * @ param parameters Live Ev...
return beginCreateWithServiceResponseAsync ( resourceGroupName , accountName , liveEventName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class ImageHelper { /** * Load the specified url into this { @ link ImageView } . * @ param v the target view * @ param url the url to load * @ param transformation transformation to apply , can be null * @ return this helper */ public ImageHelper load ( ImageView v , String url , Transformation transfor...
return load ( v , new Request ( url , transformation ) ) ;
public class RequestCreator { /** * Resize the image to the specified dimension size . * Use 0 as desired dimension to resize keeping aspect ratio . */ @ NonNull public RequestCreator resizeDimen ( int targetWidthResId , int targetHeightResId ) { } }
Resources resources = picasso . context . getResources ( ) ; int targetWidth = resources . getDimensionPixelSize ( targetWidthResId ) ; int targetHeight = resources . getDimensionPixelSize ( targetHeightResId ) ; return resize ( targetWidth , targetHeight ) ;
public class ObjectSpace { /** * Registers an object to allow the remote end of the ObjectSpace ' s connections to access it using the specified ID . * If a connection is added to multiple ObjectSpaces , the same object ID should not be registered in more than one of those * ObjectSpaces . * @ param objectID Must...
if ( objectID == Integer . MAX_VALUE ) throw new IllegalArgumentException ( "objectID cannot be Integer.MAX_VALUE." ) ; if ( object == null ) throw new IllegalArgumentException ( "object cannot be null." ) ; idToObject . put ( objectID , object ) ; objectToID . put ( object , objectID ) ; if ( TRACE ) trace ( "kryonet"...
public class RemoteNeo4jHelper { /** * Check if the node matches the column values * @ param nodeProperties the properties on the node * @ param keyColumnNames the name of the columns to check * @ param keyColumnValues the value of the columns to check * @ return true if the properties of the node match the col...
for ( int i = 0 ; i < keyColumnNames . length ; i ++ ) { String property = keyColumnNames [ i ] ; Object expectedValue = keyColumnValues [ i ] ; boolean containsProperty = nodeProperties . containsKey ( property ) ; if ( containsProperty ) { Object actualValue = nodeProperties . get ( property ) ; if ( ! sameValue ( ex...
public class MinerAdapter { /** * Creates a SIF interaction for the given match . * @ param m match to use for SIF creation * @ param fetcher ID generator from BioPAX object * @ return SIF interaction */ public Set < SIFInteraction > createSIFInteraction ( Match m , IDFetcher fetcher ) { } }
BioPAXElement sourceBpe = m . get ( ( ( SIFMiner ) this ) . getSourceLabel ( ) , getPattern ( ) ) ; BioPAXElement targetBpe = m . get ( ( ( SIFMiner ) this ) . getTargetLabel ( ) , getPattern ( ) ) ; Set < String > sources = fetchIDs ( sourceBpe , fetcher ) ; Set < String > targets = fetchIDs ( targetBpe , fetcher ) ; ...
public class JDBC4ClientConnection { /** * Drop the client connection , e . g . when a NoConnectionsException is caught . * It will try to reconnect as needed and appropriate . * @ param clientToDrop caller - provided client to avoid re - nulling from another thread that comes in later */ protected synchronized voi...
Client currentClient = this . client . get ( ) ; if ( currentClient != null && currentClient == clientToDrop ) { try { currentClient . close ( ) ; this . client . set ( null ) ; } catch ( Exception x ) { // ignore } } this . users = 0 ;
public class CpcCompression { /** * the length of this array is known to the source sketch . */ private static int [ ] uncompressTheSurprisingValues ( final CompressedState source ) { } }
final int srcK = 1 << source . lgK ; final int numPairs = source . numCsv ; assert numPairs > 0 ; final int [ ] pairs = new int [ numPairs ] ; final int numBaseBits = CpcCompression . golombChooseNumberOfBaseBits ( srcK + numPairs , numPairs ) ; lowLevelUncompressPairs ( pairs , numPairs , numBaseBits , source . csvStr...
public class ClientSocketFactory { /** * Open a stream if the target server ' s heartbeat is active . * @ return the socket ' s read / write pair . */ public ClientSocket openIfHeartbeatActive ( ) { } }
if ( _state . isClosed ( ) ) { return null ; } if ( ! _isHeartbeatActive && _isHeartbeatServer ) { return null ; } ClientSocket stream = openRecycle ( ) ; if ( stream != null ) return stream ; return connect ( ) ;
public class RequestRouter { /** * Binds a new controller . * @ param controller the controller */ @ Bind ( aggregate = true , optional = true ) public synchronized void bindController ( Controller controller ) { } }
LOGGER . info ( "Adding routes from " + controller ) ; List < Route > newRoutes = new ArrayList < > ( ) ; try { List < Route > annotatedNewRoutes = RouteUtils . collectRouteFromControllerAnnotations ( controller ) ; newRoutes . addAll ( annotatedNewRoutes ) ; newRoutes . addAll ( controller . routes ( ) ) ; // check if...
public class FileSystem { /** * Opens an FSDataOutputStream at the indicated Path . * < p > This method is deprecated , because most of its parameters are ignored by most file systems . * To control for example the replication factor and block size in the Hadoop Distributed File system , * make sure that the resp...
return create ( f , overwrite ? WriteMode . OVERWRITE : WriteMode . NO_OVERWRITE ) ;
public class Activator { /** * { @ inheritDoc } */ @ Override public void start ( BundleContext context ) throws Exception { } }
context . registerService ( FeatureResolver . class , new FeatureResolverImpl ( ) , null ) ;
public class SimpleExpressionsFactoryImpl { /** * Creates the default factory implementation . * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public static SimpleExpressionsFactory init ( ) { } }
try { SimpleExpressionsFactory theSimpleExpressionsFactory = ( SimpleExpressionsFactory ) EPackage . Registry . INSTANCE . getEFactory ( SimpleExpressionsPackage . eNS_URI ) ; if ( theSimpleExpressionsFactory != null ) { return theSimpleExpressionsFactory ; } } catch ( Exception exception ) { EcorePlugin . INSTANCE . l...
public class ContextItems { /** * Remove all context items for the specified subject . * @ param subject Prefix whose items are to be removed . */ public void removeSubject ( String subject ) { } }
String prefix = normalizePrefix ( subject ) ; for ( String suffix : getSuffixes ( prefix ) . keySet ( ) ) { setItem ( prefix + suffix , null ) ; }
public class AsynchronousRequest { /** * For more info on delivery API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / commerce / delivery " > here < / a > < br / > * Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwabl...
isParamValid ( new ParamChecker ( ParamType . API , API ) ) ; gw2API . getTPDeliveryInfo ( API ) . enqueue ( callback ) ;
public class StringUtils { /** * Safely trims input string */ public static String trim ( String str ) { } }
return str != null && str . length ( ) > 0 ? str . trim ( ) : str ;
public class SelectColumn { /** * @ deprecated * class中的字段名 * @ param cols 排除的字段名集合 * @ param columns 排除的字段名集合 * @ return SelectColumn */ @ Deprecated public static SelectColumn createExcludes ( String [ ] cols , String ... columns ) { } }
return new SelectColumn ( Utility . append ( cols , columns ) , true ) ;
public class XPathImpl { /** * < p > Establishes a variable resolver . < / p > * @ param resolver Variable Resolver */ public void setXPathVariableResolver ( XPathVariableResolver resolver ) { } }
if ( resolver == null ) { String fmsg = XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_ARG_CANNOT_BE_NULL , new Object [ ] { "XPathVariableResolver" } ) ; throw new NullPointerException ( fmsg ) ; } this . variableResolver = resolver ;
public class Bag { /** * Retrieve a mapped element and return it as a Long . * @ param key A string value used to index the element . * @ param notFound A function to create a new Long if the requested key was not found * @ return The element as a Long , or notFound if the element is not found . */ public Long ge...
return getParsed ( key , Long :: new , notFound ) ;
public class MultipleFileTransfer { /** * Set the state based on the states of all file downloads . Assumes all file * downloads are done . * A single failed sub - transfer makes the entire transfer failed . If there * are no failed sub - transfers , a single canceled sub - transfer makes the * entire transfer ...
boolean seenCanceled = false ; for ( T download : subTransfers ) { if ( download . getState ( ) == TransferState . Failed ) { setState ( TransferState . Failed ) ; return ; } else if ( download . getState ( ) == TransferState . Canceled ) { seenCanceled = true ; } } if ( seenCanceled ) setState ( TransferState . Cancel...
public class Scte20PlusEmbeddedDestinationSettingsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Scte20PlusEmbeddedDestinationSettings scte20PlusEmbeddedDestinationSettings , ProtocolMarshaller protocolMarshaller ) { } }
if ( scte20PlusEmbeddedDestinationSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Links { /** * Returns whether the current { @ link Links } contain all given { @ link Link } s ( but potentially others ) . * @ param links must not be { @ literal null } . * @ return */ public boolean contains ( Iterable < Link > links ) { } }
return this . links . containsAll ( Links . of ( links ) . toList ( ) ) ;
public class OsmMapShapeConverter { /** * Convert a { @ link MultiPoint } to a { @ link MultiLatLng } * @ param multiPoint * @ return */ public MultiLatLng toLatLngs ( MultiPoint multiPoint ) { } }
MultiLatLng multiLatLng = new MultiLatLng ( ) ; for ( Point point : multiPoint . getPoints ( ) ) { GeoPoint latLng = toLatLng2 ( point ) ; multiLatLng . add ( latLng ) ; } return multiLatLng ;
public class AbstractQueryRunner { /** * Execute a batch of SQL INSERT , UPDATE , or DELETE queries . * @ param stmtHandler { @ link StatementHandler } implementation * @ param sql The SQL query to execute . * @ param params An array of query replacement parameters . Each row in * this array is one set of batch...
Connection conn = this . transactionHandler . getConnection ( ) ; if ( sql == null ) { this . transactionHandler . rollback ( ) ; this . transactionHandler . closeConnection ( ) ; throw new SQLException ( "Null SQL statement" ) ; } if ( params == null ) { this . transactionHandler . rollback ( ) ; this . transactionHan...
public class McGregor { /** * matrix will be stored in function partsearch . */ private boolean checkmArcs ( List < Integer > mArcsT , int neighborBondNumA , int neighborBondNumB ) { } }
int size = neighborBondNumA * neighborBondNumA ; List < Integer > posNumList = new ArrayList < Integer > ( size ) ; for ( int i = 0 ; i < posNumList . size ( ) ; i ++ ) { posNumList . add ( i , 0 ) ; } int yCounter = 0 ; int countEntries = 0 ; for ( int x = 0 ; x < ( neighborBondNumA * neighborBondNumB ) ; x ++ ) { if ...
public class MPApiResponse { /** * Parses the http request in a custom MPApiResponse object . * @ param httpMethod enum with the method executed * @ param request HttpRequestBase object * @ param payload JsonObject with the payload * @ throws MPException */ private void parseRequest ( HttpMethod httpMethod , Ht...
this . method = httpMethod . toString ( ) ; this . url = request . getURI ( ) . toString ( ) ; if ( payload != null ) { this . payload = payload . toString ( ) ; }
public class ApiOvhEmailexchange { /** * External contacts for this service * REST : GET / email / exchange / { organizationName } / service / { exchangeService } / externalContact * @ param lastName [ required ] Filter the value of lastName property ( like ) * @ param displayName [ required ] Filter the value of...
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/externalContact" ; StringBuilder sb = path ( qPath , organizationName , exchangeService ) ; query ( sb , "displayName" , displayName ) ; query ( sb , "externalEmailAddress" , externalEmailAddress ) ; query ( sb , "firstName" , firstName ) ; qu...
public class MatchAccumulator { /** * Invokes the { @ link Matcher # matches ( java . lang . Object ) } method on the supplied matcher against a given target object * and appends relevant text to the mismatch description if the match fails . * @ param matcher the matcher to invoke * @ param item the target object...
if ( ! matcher . matches ( item ) ) { handleMismatch ( matcher , item ) ; } appliedMatchers . add ( matcher ) ; return this ;
public class Matrix4d { /** * Pre - multiply the rotation - and possibly scaling - transformation of the given { @ link Quaterniondc } to this matrix and store * the result in < code > dest < / code > . * When used with a right - handed coordinate system , the produced rotation will rotate a vector * counter - cl...
double w2 = quat . w ( ) * quat . w ( ) , x2 = quat . x ( ) * quat . x ( ) ; double y2 = quat . y ( ) * quat . y ( ) , z2 = quat . z ( ) * quat . z ( ) ; double zw = quat . z ( ) * quat . w ( ) , dzw = zw + zw , xy = quat . x ( ) * quat . y ( ) , dxy = xy + xy ; double xz = quat . x ( ) * quat . z ( ) , dxz = xz + xz ,...
public class RpcServlet { /** * VisibleForTesting */ void writeResult ( final RpcResult < ? , ? > result , final HttpServletResponse resp ) throws IOException { } }
if ( result . isSuccess ( ) ) { resp . setStatus ( HttpServletResponse . SC_OK ) ; resp . setContentType ( JSON_CONTENT_TYPE ) ; } else { resp . setStatus ( APPLICATION_EXC_STATUS ) ; resp . setContentType ( JSON_CONTENT_TYPE ) ; } PrintWriter writer = resp . getWriter ( ) ; result . toJson ( writer , true ) ; writer ....
public class Resources { /** * Gets the integer from the properties . * @ param key the key of the property . * @ return the value of the key . return - 1 if the value is not found . */ public Integer getInteger ( String key ) { } }
try { return Integer . valueOf ( resource . getString ( key ) ) ; } catch ( MissingResourceException e ) { return new Integer ( - 1 ) ; }
public class CharMatcher { /** * Returns a string copy of the input character sequence , with each group of consecutive * characters that match this matcher replaced by a single replacement character . For example : * < pre > { @ code * CharMatcher . anyOf ( " eko " ) . collapseFrom ( " bookkeeper " , ' - ' ) } <...
// This implementation avoids unnecessary allocation . int len = sequence . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = sequence . charAt ( i ) ; if ( matches ( c ) ) { if ( c == replacement && ( i == len - 1 || ! matches ( sequence . charAt ( i + 1 ) ) ) ) { // a no - op replacement i ++ ; } else { Stri...
public class SparseIntArray { /** * Returns an index for which { @ link # valueAt } would return the * specified key , or a negative number if no keys map to the * specified value . * Beware that this is a linear search , unlike lookups by key , * and that multiple keys can map to the same value and this will ...
for ( int i = 0 ; i < mSize ; i ++ ) if ( mValues [ i ] == value ) return i ; return - 1 ;
public class JMPredicate { /** * Gets less or equal . * @ param target the target * @ return the less or equal */ public static Predicate < Number > getLessOrEqual ( Number target ) { } }
return number -> number . doubleValue ( ) <= target . doubleValue ( ) ;
public class RequestUrl { /** * Get the relative url to the current servlet . * Uses the request URI and removes : the context path , the servlet path if used . * @ param request * The current HTTP request * @ param servlet * true to remove the servlet path * @ return the url , relative to the servlet mappi...
// Raw request url String requestURI = request . getRequestURI ( ) ; // Application ( war ) context path String contextPath = request . getContextPath ( ) ; // Servlet mapping String servletPath = request . getServletPath ( ) ; String relativeUrl = requestURI ; // Remove application context path if ( contextPath != nul...
public class CoronaJobTracker { /** * Return this grant and request a different one . * This can happen because the task has failed , was killed * or the job tracker decided that the resource is bad * @ param grant The grant identifier . * @ param abandonHost - if true then this host will be excluded * from t...
synchronized ( lockObject ) { Set < String > excludedHosts = null ; TaskInProgress tip = requestToTipMap . get ( grant ) ; if ( ! job . canLaunchJobCleanupTask ( ) && ( ! tip . isRunnable ( ) || ( tip . isRunning ( ) && ! ( speculatedMaps . contains ( tip ) || speculatedReduces . contains ( tip ) ) ) ) ) { // The task ...
public class ApproximateHistogram { /** * Returns the approximate number of items less than or equal to b in the histogram * @ param b the cutoff * @ return the approximate number of items less than or equal to b */ public double sum ( final float b ) { } }
if ( b < min ) { return 0 ; } if ( b >= max ) { return count ; } int index = Arrays . binarySearch ( positions , 0 , binCount , b ) ; boolean exactMatch = index >= 0 ; index = exactMatch ? index : - ( index + 1 ) ; // we want positions [ index ] < = b < positions [ index + 1] if ( ! exactMatch ) { index -- ; } final bo...
public class EJSHome { /** * d142250 */ public EJBObject postCreate ( BeanO beanO , Object primaryKey , boolean inSupportOfEJBPostCreateChanges ) throws CreateException , RemoteException { } }
boolean supportEJBPostCreateChanges = inSupportOfEJBPostCreateChanges && ! ivAllowEarlyInsert ; // PQ89520 // If noLocalCopies and allowPrimaryKeyMutation are true then we // must create a deep copy of the primaryKey object to avoid data // corruption . PQ62081 d138865 // " Primary Key " should not be copied for a Stat...
public class CoalescingBufferQueue { /** * Remove a { @ link ByteBuf } from the queue with the specified number of bytes . Any added buffer who ' s bytes are * fully consumed during removal will have it ' s promise completed when the passed aggregate { @ link ChannelPromise } * completes . * @ param bytes the max...
return remove ( channel . alloc ( ) , bytes , aggregatePromise ) ;
public class WxCryptUtil { /** * 对密文进行解密 . * @ param cipherText 需要解密的密文 * @ return 解密得到的明文 */ public String decrypt ( String cipherText ) { } }
byte [ ] original ; try { // 设置解密模式为AES的CBC模式 Cipher cipher = Cipher . getInstance ( "AES/CBC/NoPadding" ) ; SecretKeySpec key_spec = new SecretKeySpec ( aesKey , "AES" ) ; IvParameterSpec iv = new IvParameterSpec ( Arrays . copyOfRange ( aesKey , 0 , 16 ) ) ; cipher . init ( Cipher . DECRYPT_MODE , key_spec , iv ) ; /...
public class Ransac { /** * Initialize internal data structures */ public void initialize ( List < Point > dataSet ) { } }
bestFitPoints . clear ( ) ; if ( dataSet . size ( ) > matchToInput . length ) { matchToInput = new int [ dataSet . size ( ) ] ; bestMatchToInput = new int [ dataSet . size ( ) ] ; }
public class QueryResultUtil { /** * Get value by column type . * @ param resultSet result set * @ param columnIndex column index * @ return column value * @ throws SQLException SQL exception */ public static Object getValueByColumnType ( final ResultSet resultSet , final int columnIndex ) throws SQLException {...
ResultSetMetaData metaData = resultSet . getMetaData ( ) ; switch ( metaData . getColumnType ( columnIndex ) ) { case Types . BIT : case Types . BOOLEAN : return resultSet . getBoolean ( columnIndex ) ; case Types . TINYINT : return resultSet . getByte ( columnIndex ) ; case Types . SMALLINT : return resultSet . getSho...
public class DFSInputStream { /** * / * This is a used by regular read ( ) and handles ChecksumExceptions . * name readBuffer ( ) is chosen to imply similarity to readBuffer ( ) in * ChecksumFileSystem */ private synchronized int readBuffer ( byte buf [ ] , int off , int len ) throws IOException { } }
IOException ioe ; /* we retry current node only once . So this is set to true only here . * Intention is to handle one common case of an error that is not a * failure on datanode or client : when DataNode closes the connection * since client is idle . If there are other cases of " non - errors " then * then a d...
public class CmsSearchManager { /** * Sets the timeout to abandon threads indexing a resource as a String . < p > * @ param value the timeout in milliseconds */ public void setTimeout ( String value ) { } }
try { setTimeout ( Long . parseLong ( value ) ) ; } catch ( Exception e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_PARSE_TIMEOUT_FAILED_2 , value , new Long ( DEFAULT_TIMEOUT ) ) , e ) ; setTimeout ( DEFAULT_TIMEOUT ) ; }
public class CommerceWishListItemUtil { /** * Returns the first commerce wish list item in the ordered set where commerceWishListId = & # 63 ; and CProductId = & # 63 ; . * @ param commerceWishListId the commerce wish list ID * @ param CProductId the c product ID * @ param orderByComparator the comparator to orde...
return getPersistence ( ) . fetchByCW_CP_First ( commerceWishListId , CProductId , orderByComparator ) ;
public class WarUtils { /** * < p > This method updates a template war with the following settings . < / p > * @ param templateWar The name of the template war to pull from the classpath . * @ param war The path of an external war to update ( optional ) . * @ param newWarNames The name to give the new war . ( not...
ZipFile inZip = null ; ZipOutputStream outZip = null ; InputStream in = null ; OutputStream out = null ; try { if ( war != null ) { if ( war . equals ( newWarNames . get ( 0 ) ) ) { File tmpZip = File . createTempFile ( war , null ) ; tmpZip . delete ( ) ; tmpZip . deleteOnExit ( ) ; new File ( war ) . renameTo ( tmpZi...
public class ServiceStarter { /** * region main ( ) */ public static void main ( String [ ] args ) throws Exception { } }
AtomicReference < ServiceStarter > serviceStarter = new AtomicReference < > ( ) ; try { System . err . println ( System . getProperty ( ServiceBuilderConfig . CONFIG_FILE_PROPERTY_NAME , "config.properties" ) ) ; // Load up the ServiceBuilderConfig , using this priority order ( lowest to highest ) : // 1 . Configuratio...
public class AmazonIdentityManagementClient { /** * Generates a credential report for the AWS account . For more information about the credential report , see < a * href = " https : / / docs . aws . amazon . com / IAM / latest / UserGuide / credential - reports . html " > Getting Credential Reports < / a > in * the...
request = beforeClientExecution ( request ) ; return executeGenerateCredentialReport ( request ) ;
public class ComputationGraph { /** * Set the mask arrays for features and labels . Mask arrays are typically used in situations such as one - to - many * and many - to - one learning with recurrent neural networks , as well as for supporting time series of varying lengths * within the same minibatch . < br > * F...
this . clearLayerMaskArrays ( ) ; this . inputMaskArrays = featureMaskArrays ; this . labelMaskArrays = labelMaskArrays ; if ( featureMaskArrays != null ) { if ( featureMaskArrays . length != numInputArrays ) { throw new IllegalArgumentException ( "Invalid number of feature mask arrays" ) ; } long minibatchSize = - 1 ;...
public class TouchExplorationHelper { /** * Requests accessibility focus be placed on the specified item . * @ param item The item to place focus on . */ public void setFocusedItem ( T item ) { } }
final int itemId = getIdForItem ( item ) ; if ( itemId == INVALID_ID ) { return ; } performAction ( itemId , AccessibilityNodeInfoCompat . ACTION_ACCESSIBILITY_FOCUS , null ) ;
public class JavaSQLDataSourceExample { /** * $ example off : schema _ merging $ */ public static void main ( String [ ] args ) { } }
SparkSession spark = SparkSession . builder ( ) . appName ( "Java Spark SQL data sources example" ) . config ( "spark.some.config.option" , "some-value" ) . getOrCreate ( ) ; runBasicDataSourceExample ( spark ) ; runBasicParquetExample ( spark ) ; runParquetSchemaMergingExample ( spark ) ; runJsonDatasetExample ( spark...
public class FileUtil { /** * Create a directory . The parent directories will be created if < i > createParents < / i > is passed as true . * @ param directory * directory * @ param createParents * whether to create all parents * @ return true if directory was created ; false if it already existed * @ thro...
boolean created = false ; File dir = new File ( directory ) ; if ( createParents ) { created = dir . mkdirs ( ) ; if ( created ) { log . debug ( "Directory created: {}" , dir . getAbsolutePath ( ) ) ; } else { log . debug ( "Directory was not created: {}" , dir . getAbsolutePath ( ) ) ; } } else { created = dir . mkdir...
public class GetOperationsForResourceRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetOperationsForResourceRequest getOperationsForResourceRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getOperationsForResourceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getOperationsForResourceRequest . getResourceName ( ) , RESOURCENAME_BINDING ) ; protocolMarshaller . marshall ( getOperationsForResourceRequest . getPag...
public class SequenceAlgorithms { /** * Returns the longest common subsequence between two strings . * @ return a list of size 2 int arrays that corresponds * to match of index in sequence 1 to index in sequence 2. */ public static List < int [ ] > longestCommonSubsequence ( String s0 , String s1 ) { } }
int [ ] [ ] lengths = new int [ s0 . length ( ) + 1 ] [ s1 . length ( ) + 1 ] ; for ( int i = 0 ; i < s0 . length ( ) ; i ++ ) for ( int j = 0 ; j < s1 . length ( ) ; j ++ ) if ( s0 . charAt ( i ) == ( s1 . charAt ( j ) ) ) lengths [ i + 1 ] [ j + 1 ] = lengths [ i ] [ j ] + 1 ; else lengths [ i + 1 ] [ j + 1 ] = Math ...
public class Channel { /** * Removes the peer connection from the channel . * This does NOT unjoin the peer from from the channel . * Fabric does not support that at this time - - maybe some day , but not today * @ param peer */ public void removePeer ( Peer peer ) throws InvalidArgumentException { } }
if ( shutdown ) { throw new InvalidArgumentException ( format ( "Can not remove peer from channel %s already shutdown." , name ) ) ; } logger . debug ( format ( "removePeer %s from channel %s" , peer , toString ( ) ) ) ; checkPeer ( peer ) ; removePeerInternal ( peer ) ; peer . shutdown ( true ) ;
public class GuiceWatchableRegistrationContainer { /** * returns all the watchers associated to the type of the given id . */ @ SuppressWarnings ( "unchecked" ) private < T > List < WatcherRegistration < T > > getWatcherRegistrations ( Id < T > id ) { } }
return ( List < WatcherRegistration < T > > ) ( ( Container ) watcherRegistry ) . getAll ( id . type ( ) ) ;
public class LazyUtil { /** * Check is current property was initialized * @ param method - hibernate static method , which check * is initilized property * @ param obj - object which need for lazy check * @ return boolean value */ private static boolean checkInitialize ( Method method , Object obj ) { } }
boolean isInitialized = true ; try { isInitialized = ( Boolean ) method . invoke ( null , new Object [ ] { obj } ) ; } catch ( IllegalArgumentException e ) { // do nothing } catch ( IllegalAccessException e ) { // do nothing } catch ( InvocationTargetException e ) { // do nothing } return isInitialized ;
public class Speed { /** * Create a new GPS { @ code Speed } object . * @ param speed the GPS speed value * @ param unit the speed unit * @ return a new GPS { @ code Speed } object * @ throws NullPointerException if the given speed { @ code unit } is * { @ code null } */ public static Speed of ( final double ...
requireNonNull ( unit ) ; return new Speed ( Unit . METERS_PER_SECOND . convert ( speed , unit ) ) ;
public class MediaApi { /** * Remove the attachment of the open - media interaction * Remove the attachment of the interaction specified in the documentId path parameter * @ param mediatype media - type of interaction to remove attachment ( required ) * @ param id id of interaction ( required ) * @ param docume...
ApiResponse < ApiSuccessResponse > resp = removeAttachmentWithHttpInfo ( mediatype , id , documentId , removeAttachmentData ) ; return resp . getData ( ) ;
public class ModelImporter { /** * This method is used to ensure backwards compatible loading , type names in model info may be qualified with the model name */ private String ensureUnqualified ( String name ) { } }
if ( name . startsWith ( String . format ( "%s." , this . modelInfo . getName ( ) ) ) ) { return name . substring ( name . indexOf ( '.' ) + 1 ) ; } return name ;
public class AmazonLightsailClient { /** * Returns a list of available database blueprints in Amazon Lightsail . A blueprint describes the major engine * version of a database . * You can use a blueprint ID to create a new database that runs a specific database engine . * @ param getRelationalDatabaseBlueprintsRe...
request = beforeClientExecution ( request ) ; return executeGetRelationalDatabaseBlueprints ( request ) ;
public class CommerceWarehousePersistenceImpl { /** * Returns the first commerce warehouse in the ordered set where groupId = & # 63 ; and active = & # 63 ; and primary = & # 63 ; . * @ param groupId the group ID * @ param active the active * @ param primary the primary * @ param orderByComparator the comparato...
CommerceWarehouse commerceWarehouse = fetchByG_A_P_First ( groupId , active , primary , orderByComparator ) ; if ( commerceWarehouse != null ) { return commerceWarehouse ; } StringBundler msg = new StringBundler ( 8 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "groupId=" ) ; msg . append ( groupId ) ;...
public class ResourceUtil { /** * Checks the access control policies for enabled changes ( node creation and property change ) . * @ param resource * @ param relPath * @ return * @ throws RepositoryException */ public static boolean isWriteEnabled ( Resource resource , String relPath ) throws RepositoryExceptio...
ResourceResolver resolver = resource . getResourceResolver ( ) ; Session session = resolver . adaptTo ( Session . class ) ; AccessControlManager accessManager = AccessControlUtil . getAccessControlManager ( session ) ; String resourcePath = resource . getPath ( ) ; Privilege [ ] addPrivileges = new Privilege [ ] { acce...
public class ConnectivityInfoMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ConnectivityInfo connectivityInfo , ProtocolMarshaller protocolMarshaller ) { } }
if ( connectivityInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( connectivityInfo . getHostAddress ( ) , HOSTADDRESS_BINDING ) ; protocolMarshaller . marshall ( connectivityInfo . getId ( ) , ID_BINDING ) ; protocolMarshaller . marsh...