signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class LazyReact { /** * Build an FutureStream that reacts Asynchronously to the Suppliers within the * specified Iterator * < pre > * { @ code * List < Supplier < Data > > list = Arrays . asList ( this : : load1 , this : : looad2 , this : : load3 ) ; * LazyReact ( ) . fromIteratorAsync ( list . iterato...
return this . < U > constructFutures ( StreamSupport . < Supplier < U > > stream ( Spliterators . < Supplier < U > > spliteratorUnknownSize ( actions , Spliterator . ORDERED ) , false ) . map ( next -> CompletableFuture . supplyAsync ( next , getExecutor ( ) ) ) ) ;
public class HttpConnection { /** * Handling the webservice call * @ param url URL to call * @ return Input stream as a result , or an exception * @ throws IOException In case of an IO error * @ throws NsApiException In case of any other error */ InputStream getContent ( String url ) throws IOException , NsApiE...
Request request = new Request . Builder ( ) . url ( url ) . get ( ) . build ( ) ; try { Response response = client . newCall ( request ) . execute ( ) ; if ( response . body ( ) == null ) { log . error ( "Error while calling the webservice, entity is null" ) ; throw new NsApiException ( "Error while calling the webserv...
public class UpdateApplicationBase { /** * Error generating shortcut method */ static protected CompletableFuture < ClientResponse > makeQuickResponse ( byte statusCode , String msg ) { } }
ClientResponseImpl cri = new ClientResponseImpl ( statusCode , new VoltTable [ 0 ] , msg ) ; CompletableFuture < ClientResponse > f = new CompletableFuture < > ( ) ; f . complete ( cri ) ; return f ;
public class SceneStructureMetric { /** * Call this function first . Specifies number of each type of data which is available . * @ param totalCameras Number of cameras * @ param totalViews Number of views * @ param totalPoints Number of points * @ param totalRigid Number of rigid objects */ public void initial...
cameras = new Camera [ totalCameras ] ; views = new View [ totalViews ] ; points = new Point [ totalPoints ] ; rigids = new Rigid [ totalRigid ] ; for ( int i = 0 ; i < cameras . length ; i ++ ) { cameras [ i ] = new Camera ( ) ; } for ( int i = 0 ; i < views . length ; i ++ ) { views [ i ] = new View ( ) ; } for ( int...
public class FlowTypeCheck { /** * Type check a < code > return < / code > statement . If a return expression is given , * then we must check that this is well - formed and is a subtype of the enclosing * function or method ' s declared return type . The environment after a return * statement is " bottom " becaus...
// Determine the set of return types for the enclosing function or // method . This then allows us to check the given operands are // appropriate subtypes . Decl . FunctionOrMethod fm = scope . getEnclosingScope ( FunctionOrMethodScope . class ) . getDeclaration ( ) ; Tuple < Type > types = fm . getType ( ) . getReturn...
public class HttpChannelConfig { /** * Check the input configuration for the timeout to use when writing data * during the connection . * @ param props */ private void parseWriteTimeout ( Map < Object , Object > props ) { } }
Object value = props . get ( HttpConfigConstants . PROPNAME_WRITE_TIMEOUT ) ; if ( null != value ) { try { this . writeTimeout = TIMEOUT_MODIFIER * minLimit ( convertInteger ( value ) , HttpConfigConstants . MIN_TIMEOUT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "...
public class SearchRange { /** * Converts this range into a { @ link SearchKey } . We expect the caller will * call { @ link # isSingleValue ( ) } before calling this method . * @ return a SearchKey represents the range */ public SearchKey asSearchKey ( ) { } }
Constant [ ] vals = new Constant [ ranges . length ] ; for ( int i = 0 ; i < vals . length ; i ++ ) vals [ i ] = ranges [ i ] . asConstant ( ) ; return new SearchKey ( vals ) ;
public class IPAddressString { /** * Produces the { @ link IPAddress } of the specified address version corresponding to this IPAddressString . * In most cases the string indicates the address version and calling { @ link # toAddress ( ) } is sufficient , with a few exceptions . * When this object represents only a...
validate ( ) ; // call validate so that we throw consistently , cover type = = INVALID , and ensure the addressProvider exists return addressProvider . getProviderAddress ( version ) ;
public class WebGL10 { /** * < p > { @ code glBindFramebuffer } binds the framebuffer object with name framebuffer to the framebuffer target * specified by target . target must be { @ link # GL _ FRAMEBUFFER } . If a framebuffer object is bound , it becomes the * target for rendering or readback operations , respec...
checkContextCompatibility ( ) ; nglBindFramebuffer ( target , WebGLObjectMap . get ( ) . toFramebuffer ( frameBuffer ) ) ;
public class TypeCheckingExtension { /** * Lookup a ClassNode by its name from the source unit * @ param type the name of the class whose ClassNode we want to lookup * @ return a ClassNode representing the class */ public ClassNode lookupClassNodeFor ( String type ) { } }
for ( ClassNode cn : typeCheckingVisitor . getSourceUnit ( ) . getAST ( ) . getClasses ( ) ) { if ( cn . getName ( ) . equals ( type ) ) return cn ; } return null ;
public class Tuple0 { /** * Concatenate a tuple to this tuple . */ public final < T1 , T2 > Tuple2 < T1 , T2 > concat ( Tuple2 < T1 , T2 > tuple ) { } }
return new Tuple2 < > ( tuple . v1 , tuple . v2 ) ;
public class ManagementModelNode { /** * Refresh children using read - resource operation . */ public void explore ( ) { } }
if ( isLeaf ) return ; if ( isGeneric ) return ; removeAllChildren ( ) ; try { String addressPath = addressPath ( ) ; ModelNode resourceDesc = executor . doCommand ( addressPath + ":read-resource-description" ) ; resourceDesc = resourceDesc . get ( "result" ) ; ModelNode response = executor . doCommand ( addressPath + ...
public class ListT { /** * Construct an ListT from an AnyM that contains a monad type that contains type other than List * The values in the underlying monad will be mapped to List < A > * @ param anyM AnyM that doesn ' t contain a monad wrapping an List * @ return ListT */ public static < W extends WitnessType <...
AnyM < W , ListX < A > > y = anyM . map ( i -> ListX . of ( i ) ) ; return of ( y ) ;
public class AbstractETFWriter { /** * Write the full ETF . * @ param printWriter the Writer . * @ param a the automaton to write . * @ param inputs the alphabet . */ protected final void write ( PrintWriter printWriter , A a , Alphabet < I > inputs ) { } }
writeState ( printWriter ) ; writeEdge ( printWriter ) ; writeETF ( printWriter , a , inputs ) ; printWriter . close ( ) ;
public class VTensor { /** * Normalizes the values so that they sum to 1 */ public double normalize ( ) { } }
double propSum = this . getSum ( ) ; if ( propSum == s . zero ( ) ) { this . fill ( s . divide ( s . one ( ) , s . fromReal ( this . size ( ) ) ) ) ; } else if ( propSum == s . posInf ( ) ) { int count = count ( s . posInf ( ) ) ; if ( count == 0 ) { throw new RuntimeException ( "Unable to normalize since sum is infini...
public class JsonService { /** * this class loader interface can be used by other plugins to lookup * resources from the bundles . A temporary class loader interface is set * during other configuration loading as well * @ return ClassLoaderInterface ( BundleClassLoaderInterface ) */ private ClassLoaderInterface g...
Map < String , Object > application = ActionContext . getContext ( ) . getApplication ( ) ; if ( application != null ) { return ( ClassLoaderInterface ) application . get ( ClassLoaderInterface . CLASS_LOADER_INTERFACE ) ; } return null ;
public class AWSElasticBeanstalkClient { /** * Update the list of tags applied to an AWS Elastic Beanstalk resource . Two lists can be passed : * < code > TagsToAdd < / code > for tags to add or update , and < code > TagsToRemove < / code > . * Currently , Elastic Beanstalk only supports tagging of Elastic Beanstal...
request = beforeClientExecution ( request ) ; return executeUpdateTagsForResource ( request ) ;
public class RadixSort { /** * Specialization of sort ( ) for key - prefix arrays . In this type of array , each record consists * of two longs , only the second of which is sorted on . * @ param startIndex starting index in the array to sort from . This parameter is not supported * in the plain sort ( ) implemen...
assert startByteIndex >= 0 : "startByteIndex (" + startByteIndex + ") should >= 0" ; assert endByteIndex <= 7 : "endByteIndex (" + endByteIndex + ") should <= 7" ; assert endByteIndex > startByteIndex ; assert numRecords * 4 <= array . size ( ) ; long inIndex = startIndex ; long outIndex = startIndex + numRecords * 2L ...
public class Intersectionf { /** * Test whether the ray with given origin < code > ( originX , originY ) < / code > and direction < code > ( dirX , dirY ) < / code > intersects the line * containing the given point < code > ( pointX , pointY ) < / code > and having the normal < code > ( normalX , normalY ) < / code >...
float denom = normalX * dirX + normalY * dirY ; if ( denom < epsilon ) { float t = ( ( pointX - originX ) * normalX + ( pointY - originY ) * normalY ) / denom ; if ( t >= 0.0f ) return t ; } return - 1.0f ;
public class MessageBirdClient { /** * Starts a conversation by sending an initial message . * @ param request Data for this request . * @ return The created Conversation . */ public Conversation startConversation ( ConversationStartRequest request ) throws UnauthorizedException , GeneralException { } }
String url = String . format ( "%s%s/start" , CONVERSATIONS_BASE_URL , CONVERSATION_PATH ) ; return messageBirdService . sendPayLoad ( url , request , Conversation . class ) ;
public class ProxiedFileSystemCache { /** * Cached version of { @ link ProxiedFileSystemUtils # createProxiedFileSystemUsingToken ( String , Token , URI , Configuration ) } . * @ deprecated use { @ link # fromToken } . */ @ Deprecated public static FileSystem getProxiedFileSystemUsingToken ( @ NonNull final String us...
try { return getProxiedFileSystemUsingToken ( userNameToProxyAs , userNameToken , fsURI , conf , null ) ; } catch ( IOException ioe ) { throw new ExecutionException ( ioe ) ; }
public class RolloutGroupConditionBuilder { /** * Sets condition defaults . * @ return the builder itself */ public RolloutGroupConditionBuilder withDefaults ( ) { } }
successCondition ( RolloutGroupSuccessCondition . THRESHOLD , "50" ) ; successAction ( RolloutGroupSuccessAction . NEXTGROUP , "" ) ; errorCondition ( RolloutGroupErrorCondition . THRESHOLD , "50" ) ; errorAction ( RolloutGroupErrorAction . PAUSE , "" ) ; return this ;
public class Config { /** * Loads the static class variables for values that are called often . This * should be called any time the configuration changes . */ public void loadStaticVariables ( ) { } }
auto_metric = this . getBoolean ( "tsd.core.auto_create_metrics" ) ; auto_tagk = this . getBoolean ( "tsd.core.auto_create_tagks" ) ; auto_tagv = this . getBoolean ( "tsd.core.auto_create_tagvs" ) ; enable_compactions = this . getBoolean ( "tsd.storage.enable_compaction" ) ; enable_appends = this . getBoolean ( "tsd.st...
public class ChineseCalendar { /** * Adjust this calendar to be delta months before or after a given * start position , pinning the day of month if necessary . The start * position is given as a local days number for the start of the month * and a day - of - month . Used by add ( ) and roll ( ) . * @ param newM...
// Move to the middle of the month before our target month . newMoon += ( int ) ( CalendarAstronomer . SYNODIC_MONTH * ( delta - 0.5 ) ) ; // Search forward to the target month ' s new moon newMoon = newMoonNear ( newMoon , true ) ; // Find the target dom int jd = newMoon + EPOCH_JULIAN_DAY - 1 + dom ; // Pin the dom ....
public class LogPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getUserRemovedFromProject ( ) { } }
if ( userRemovedFromProjectEClass == null ) { userRemovedFromProjectEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( LogPackage . eNS_URI ) . getEClassifiers ( ) . get ( 16 ) ; } return userRemovedFromProjectEClass ;
public class JmsMessage { /** * Gets the JMS type header . * @ return */ public String getType ( ) { } }
Object type = getHeader ( JmsMessageHeaders . TYPE ) ; if ( type != null ) { return type . toString ( ) ; } return null ;
public class BaseDenseHog { /** * Specifies input image . Gradient is computed immediately * @ param input input image */ public void setInput ( I input ) { } }
derivX . reshape ( input . width , input . height ) ; derivY . reshape ( input . width , input . height ) ; // pixel gradient gradient . process ( input , derivX , derivY ) ;
public class AbstractUserObject { /** * Assign this user object to the given JAAS system under the given JAAS * key . * @ param _ jaasSystem JAAS system to which the person is assigned * @ param _ jaasKey key under which the person is know in the JAAS * system * @ throws EFapsException if the assignment could...
Connection con = null ; try { final Context context = Context . getThreadContext ( ) ; con = Context . getConnection ( ) ; final Type keyType = CIAdminUser . JAASKey . getType ( ) ; PreparedStatement stmt = null ; final StringBuilder cmd = new StringBuilder ( ) ; try { long keyId = 0 ; if ( Context . getDbType ( ) . su...
public class ColorHolder { /** * a small helper to get the color from the colorHolder * @ param ctx * @ return */ public int color ( Context ctx ) { } }
if ( mColorInt == 0 && mColorRes != - 1 ) { mColorInt = ContextCompat . getColor ( ctx , mColorRes ) ; } return mColorInt ;
public class DefaultEffector { /** * mergeEffects merges all matching results collected by the enforcer into a single decision . */ public boolean mergeEffects ( String expr , Effect [ ] effects , float [ ] results ) { } }
boolean result ; if ( expr . equals ( "some(where (p_eft == allow))" ) ) { result = false ; for ( Effect eft : effects ) { if ( eft == Effect . Allow ) { result = true ; break ; } } } else if ( expr . equals ( "!some(where (p_eft == deny))" ) ) { result = true ; for ( Effect eft : effects ) { if ( eft == Effect . Deny ...
public class UserPreferences { /** * Put hash table . * @ param name the name * @ param hash the hash */ public static void putHashTable ( final String name , final Hashtable hash ) { } }
final Enumeration < String > keys = hash . keys ( ) ; final StringBuffer buf = new StringBuffer ( "" ) ; while ( keys . hasMoreElements ( ) ) { if ( ! buf . toString ( ) . equals ( "" ) ) { // end the previous record buf . append ( ";" ) ; } final String key = keys . nextElement ( ) ; final String value = hash . get ( ...
public class D6Crud { /** * Execute the SQL for number search < br > * @ param preparedSql * @ param searchKeys * @ return number of result */ public int execSelectCount ( String preparedSql , Object [ ] searchKeys ) { } }
log ( "#execSelectCount preparedSql=" + preparedSql + " searchKeys=" + searchKeys ) ; int retVal = 0 ; PreparedStatement preparedStmt = null ; ResultSet rs = null ; final Connection conn = createConnection ( ) ; try { preparedStmt = conn . prepareStatement ( preparedSql , ResultSet . TYPE_SCROLL_INSENSITIVE , ResultSet...
public class XmlEscape { /** * Perform an XML 1.0 level 2 ( markup - significant and all non - ASCII chars ) < strong > escape < / strong > operation * on a < tt > Reader < / tt > input meant to be an XML attribute value , writing results to a < tt > Writer < / tt > . * < em > Level 2 < / em > means this method wil...
escapeXml ( reader , writer , XmlEscapeSymbols . XML10_ATTRIBUTE_SYMBOLS , XmlEscapeType . CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA , XmlEscapeLevel . LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT ) ;
public class PropertiesUtils { /** * printing - - - - - */ public static void printProperties ( String message , Properties properties , PrintStream stream ) { } }
if ( message != null ) { stream . println ( message ) ; } if ( properties . isEmpty ( ) ) { stream . println ( " [empty]" ) ; } else { List < Map . Entry < String , String > > entries = getSortedEntries ( properties ) ; for ( Map . Entry < String , String > entry : entries ) { if ( ! "" . equals ( entry . getKey ( ) )...
public class CmsPreEditorAction { /** * Returns if an action has to be performed before opening the editor depending on the resource to edit * and request parameter values . < p > * @ return true if an action has to be performed , then the editor frameset is not generated */ public boolean doPreAction ( ) { } }
String resourceName = getParamResource ( ) ; try { boolean preActionDone = Boolean . valueOf ( getParamPreActionDone ( ) ) . booleanValue ( ) ; if ( ! preActionDone ) { // pre editor action not executed yet now check if a pre action class is given for the resource type CmsResource resource = getCms ( ) . readResource (...
public class TxtStorer { /** * Prints one line to the given writer ; the line includes path to file and * hash . Subclasses may include more fields . */ protected void printLine ( State state , Writer pw , String externalForm , String hash ) throws IOException { } }
pw . write ( externalForm ) ; pw . write ( SEPARATOR ) ; pw . write ( hash ) ; pw . write ( '\n' ) ;
public class Types { /** * Find the type of an object boxed or not . * @ param arg the object to query . * @ param boxed whether to get a primitive or boxed type . * @ return null if arg null , type of Primitive or getClass . */ public static Class < ? > getType ( Object arg , boolean boxed ) { } }
if ( null == arg || Primitive . NULL == arg ) return null ; if ( arg instanceof Primitive && ! boxed ) return ( ( Primitive ) arg ) . getType ( ) ; return Primitive . unwrap ( arg ) . getClass ( ) ;
public class Constraints { /** * Get a { @ link Predicate } for testing entity objects . * @ param < E > The type of entities to be matched * @ return a Predicate to test if entity objects satisfy this constraint set */ public < E > Predicate < E > toEntityPredicate ( EntityAccessor < E > accessor ) { } }
return entityPredicate ( constraints , schema , accessor , strategy ) ;
public class DefaultAuthenticationTransaction { /** * Wrap credentials into an authentication transaction , as a factory method , * and return the final result . * @ param service the service * @ param credentials the credentials * @ return the authentication transaction */ public static DefaultAuthenticationTr...
val creds = sanitizeCredentials ( credentials ) ; return new DefaultAuthenticationTransaction ( service , creds ) ;
public class XMLUtil { /** * Replies the value that corresponds to the specified attribute ' s path . * < p > The path is an ordered list of tag ' s names and ended by the name of * the attribute . * @ param document is the XML document to explore . * @ param caseSensitive indicates of the { @ code path } ' s c...
assert document != null : AssertMessages . notNullParameter ( 0 ) ; assert path != null && ( path . length - idxStart ) >= 0 : AssertMessages . invalidValue ( 2 ) ; if ( ( path . length - idxStart ) > 1 ) { final NodeList nodes = document . getChildNodes ( ) ; final int len = nodes . getLength ( ) ; for ( int i = 0 ; i...
public class BaseHolder { /** * Handle the command send from my client peer . * @ param in The ( optional ) Inputstream to get the params from . * @ param out The stream to write the results . * @ param properties Temporary session properties . */ public void doProcess ( InputStream in , PrintWriter out , Map < S...
Utility . getLogger ( ) . warning ( "Command not handled: " + this . getProperty ( REMOTE_COMMAND , properties ) ) ;
public class AssetUtil { /** * Helper to convert from java package name to class loader package name < br / > * < br / > * ie : javax . test + my . txt = javax / test / + my . txt * @ param resourcePackage * The base package * @ param resourceName * The resource inside the package . * @ return { @ link Cl...
String resourcePackaeName = resourcePackage . getName ( ) . replaceAll ( DELIMITER_CLASS_NAME_PATH , DELIMITER_RESOURCE_PATH ) ; return resourcePackaeName + DELIMITER_RESOURCE_PATH + resourceName ;
public class HostCertificateManager { /** * Requests the server to generate a certificate - signing request ( CSR ) for itself . The CSR is then typically * provided to a Certificate Authority to sign and issue the SSL certificate for the server . Use * InstallServerCertificate to install this certificate . * @ p...
return getVimService ( ) . generateCertificateSigningRequest ( getMOR ( ) , useIpAddressAsCommonName ) ;
public class ProfilePictureView { /** * Apply a preset size to this profile photo * @ param sizeType The size type to apply : SMALL , NORMAL or LARGE */ public final void setPresetSize ( int sizeType ) { } }
switch ( sizeType ) { case SMALL : case NORMAL : case LARGE : case CUSTOM : this . presetSizeType = sizeType ; break ; default : throw new IllegalArgumentException ( "Must use a predefined preset size" ) ; } requestLayout ( ) ;
public class SAXProcessor { /** * Converts the input time series into a SAX data structure via sliding window and Z * normalization . * @ param ts the input data . * @ param windowSize the sliding window size . * @ param paaSize the PAA size . * @ param cuts the Alphabet cuts . * @ param nThreshold the norm...
if ( windowSize > ts . length ) { throw new SAXException ( "Unable to saxify via window, window size is greater than the timeseries length..." ) ; } // the resulting data structure init SAXRecords saxFrequencyData = new SAXRecords ( ) ; // scan across the time series extract sub sequences , and convert them to strings ...
public class ChannelConsumer { /** * Resolve the channel by name . * @ param channelName the name to resolve * @ param context * @ return the MessageChannel object */ protected MessageChannel resolveChannelName ( String channelName , TestContext context ) { } }
if ( endpointConfiguration . getChannelResolver ( ) == null ) { if ( endpointConfiguration . getBeanFactory ( ) != null ) { endpointConfiguration . setChannelResolver ( new BeanFactoryChannelResolver ( endpointConfiguration . getBeanFactory ( ) ) ) ; } else { endpointConfiguration . setChannelResolver ( new BeanFactory...
public class Input { /** * Creates an InputReader * @ param in * @ param shared Shared ringbuffer . * @ return */ public static InputReader getInstance ( Reader in , char [ ] shared ) { } }
Set < ParserFeature > features = NO_FEATURES ; return new ReadableInput ( getFeaturedReader ( in , shared . length , features ) , shared , features ) ;
public class Thing { /** * Returns the device ' s metadata . * @ return a map */ @ JsonIgnore public Map < String , Object > getDeviceMetadata ( ) { } }
if ( deviceMetadata == null ) { deviceMetadata = new LinkedHashMap < > ( 20 ) ; } return deviceMetadata ;
public class Single { /** * Signals true if the current Single signals a success value that is equal with * the value provided by calling a bi - predicate . * < dl > * < dt > < b > Scheduler : < / b > < / dt > * < dd > { @ code contains } does not operate by default on a particular { @ link Scheduler } . < / dd...
ObjectHelper . requireNonNull ( value , "value is null" ) ; ObjectHelper . requireNonNull ( comparer , "comparer is null" ) ; return RxJavaPlugins . onAssembly ( new SingleContains < T > ( this , value , comparer ) ) ;
public class Restrictors { /** * 对两个ICriterion进行 " 逻辑与 " 合并 * @ param c1 Restrictor left * @ param c2 Restrictor right * @ return Restrictor */ public static Restrictor and ( Restrictor c1 , Restrictor c2 ) { } }
return new LogicRestrictor ( c1 , c2 , RestrictType . and ) ;
public class SourceStream { /** * Get an unmodifiable list of all of the message items in the VALUE * state on this stream and , optionally , in the Uncommitted state */ public synchronized List < TickRange > getAllMessageItemsOnStream ( boolean includeUncommitted ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getAllMessageItemsOnStream" , Boolean . valueOf ( includeUncommitted ) ) ; List < TickRange > msgs = new LinkedList < TickRange > ( ) ; oststream . setCursor ( 0 ) ; // Get the first TickRange TickRange tr = oststrea...
public class HttpDecodingClient { /** * Creates a new { @ link HttpDecodingClient } decorator with the specified { @ link StreamDecoderFactory } s . */ public static Function < Client < HttpRequest , HttpResponse > , HttpDecodingClient > newDecorator ( Iterable < ? extends StreamDecoderFactory > decoderFactories ) { } ...
return client -> new HttpDecodingClient ( client , decoderFactories ) ;
public class WebSocketScopeManager { /** * Returns the enable state of a given path . * @ param path * scope / context path * @ return enabled if registered as active and false otherwise */ public boolean isEnabled ( String path ) { } }
if ( path . startsWith ( "/" ) ) { // start after the leading slash int roomSlashPos = path . indexOf ( '/' , 1 ) ; if ( roomSlashPos == - 1 ) { // check application level scope path = path . substring ( 1 ) ; } else { // check room level scope path = path . substring ( 1 , roomSlashPos ) ; } } boolean enabled = active...
public class CapacityCommand { /** * Generates capacity report . * @ param options GetWorkerReportOptions to get worker report */ public void generateCapacityReport ( GetWorkerReportOptions options ) throws IOException { } }
List < WorkerInfo > workerInfoList = mBlockMasterClient . getWorkerReport ( options ) ; if ( workerInfoList . size ( ) == 0 ) { print ( "No workers found." ) ; return ; } Collections . sort ( workerInfoList , new WorkerInfo . LastContactSecComparator ( ) ) ; collectWorkerInfo ( workerInfoList ) ; printAggregatedInfo ( ...
public class ColumnInfo { /** * Make a column - info instance from a Java Field . */ public static < T > ColumnInfo < T > fromAnnotation ( CsvField csvField , String fieldName , Class < T > type , Field field , Method getMethod , Method setMethod , Converter < T , ? > converter ) { } }
return fromAnnoation ( csvField . converterClass ( ) , csvField . format ( ) , csvField . converterFlags ( ) , csvField . columnName ( ) , csvField . defaultValue ( ) , null , csvField . mustNotBeBlank ( ) , csvField . mustBeSupplied ( ) , csvField . trimInput ( ) , fieldName , type , field , getMethod , setMethod , co...
public class ConvertUtils { /** * Konwertuje struień wejściowy na tablicę bajtów . * @ param stream Strumień wejściowy do konwersji . * @ return Tablica bajtów odczytanych ze strumienia . * @ throws IOException W przypadku błędu odczytu strumienia . */ public static byte [ ] toByteArray ( InputStream stre...
// Wyznaczanie rozmiaru strumienia : long length = stream . available ( ) ; // Nie można utworzyć tablicy używając typu long . Wymagany jest do tego // typ int . Przed konwersją sprawdzamy , czy strumień nie jest zbyt duży : if ( length > Integer . MAX_VALUE ) { throw new RuntimeException ( "Stream is to large."...
public class MapReduceIndexManagement { /** * TODO make this future actually async and update javadoc @ return accordingly */ public TitanManagement . IndexJobFuture updateIndex ( TitanIndex index , SchemaAction updateAction ) throws BackendException { } }
Preconditions . checkNotNull ( index , "Index parameter must not be null" , index ) ; Preconditions . checkNotNull ( updateAction , "%s parameter must not be null" , SchemaAction . class . getSimpleName ( ) ) ; Preconditions . checkArgument ( SUPPORTED_ACTIONS . contains ( updateAction ) , "Only these %s parameters are...
public class ParameterSerializer { /** * Serialize array of object to a SFSArray * @ param unwrapper structure of java class * @ param array array of objects * @ return the SFSArray */ private ISFSArray parseObjectArray ( ClassUnwrapper unwrapper , Object [ ] array ) { } }
ISFSArray result = new SFSArray ( ) ; for ( Object obj : array ) { result . addSFSObject ( object2params ( unwrapper , obj ) ) ; } return result ;
public class FinalizePromotionOperation { /** * Calls rollback on all { @ link MigrationAwareService } . */ private void rollbackServices ( ) { } }
PartitionMigrationEvent event = getPartitionMigrationEvent ( ) ; for ( MigrationAwareService service : getMigrationAwareServices ( ) ) { try { service . rollbackMigration ( event ) ; } catch ( Throwable e ) { logger . warning ( "While promoting " + getPartitionMigrationEvent ( ) , e ) ; } }
public class TemporaryFiles { /** * Set the directory into which create temporary files . */ public void setTemporaryDirectory ( File dir ) throws IOException { } }
if ( dir != null ) { if ( ! dir . exists ( ) || ! dir . isDirectory ( ) ) if ( ! dir . mkdirs ( ) ) throw new IOException ( "Unable to create temporary directory: " + dir . getAbsolutePath ( ) ) ; } tempDir = dir ;
public class RestoreServerRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RestoreServerRequest restoreServerRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( restoreServerRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( restoreServerRequest . getBackupId ( ) , BACKUPID_BINDING ) ; protocolMarshaller . marshall ( restoreServerRequest . getServerName ( ) , SERVERNAME_BINDING ) ; prot...
public class Discovery { /** * Create a collection . * @ param createCollectionOptions the { @ link CreateCollectionOptions } containing the options for the call * @ return a { @ link ServiceCall } with a response type of { @ link Collection } */ public ServiceCall < Collection > createCollection ( CreateCollection...
Validator . notNull ( createCollectionOptions , "createCollectionOptions cannot be null" ) ; String [ ] pathSegments = { "v1/environments" , "collections" } ; String [ ] pathParameters = { createCollectionOptions . environmentId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ...
public class SpringApplication { /** * Apply any { @ link ApplicationContextInitializer } s to the context before it is * refreshed . * @ param context the configured ApplicationContext ( not refreshed yet ) * @ see ConfigurableApplicationContext # refresh ( ) */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) protected void applyInitializers ( ConfigurableApplicationContext context ) { for ( ApplicationContextInitializer initializer : getInitializers ( ) ) { Class < ? > requiredType = GenericTypeResolver . resolveTypeArgument ( initializer . getClass ( ) , ApplicationContextInitializer . class )...
public class BeanProcessor { /** * { @ inheritDoc } */ @ Override public boolean process ( final Set < ? extends TypeElement > annotations , final RoundEnvironment roundEnv ) { } }
final Map < String , VariableElement > fields = new ConcurrentHashMap < > ( ) ; final Map < String , ExecutableElement > methods = new ConcurrentHashMap < > ( ) ; for ( final Element element : roundEnv . getElementsAnnotatedWith ( Bean . class ) ) { if ( element . getKind ( ) == ElementKind . CLASS ) { final Bean bean ...
public class XMLSerializer { /** * Returns an escaped version of the input string . The string is guaranteed * to not contain illegal XML characters ( { @ code & < > } ) . * If no escaping is needed , the input string is returned as is . * @ param pValue the input string that might need escaping . * @ return an...
int startEscape = needsEscapeElement ( pValue ) ; if ( startEscape < 0 ) { // If no escaping is needed , simply return original return pValue ; } else { // Otherwise , start replacing StringBuilder builder = new StringBuilder ( pValue . substring ( 0 , startEscape ) ) ; builder . ensureCapacity ( pValue . length ( ) + ...
public class FileIoUtil { /** * Writes a properties Object to file . * Returns true on success , false otherwise . * @ param _ file * @ param _ props * @ return true on success , false otherwise */ public static boolean writeProperties ( File _file , Properties _props ) { } }
LOGGER . debug ( "Trying to write Properties to file: " + _file ) ; try ( FileOutputStream out = new FileOutputStream ( _file ) ) { _props . store ( out , _file . getName ( ) ) ; LOGGER . debug ( "Successfully wrote properties to file: " + _file ) ; } catch ( IOException _ex ) { LOGGER . warn ( "Could not save File: " ...
public class AcpService { /** * 功能 : 将批量文件内容使用DEFLATE压缩算法压缩 , Base64编码生成字符串并返回 < br > * 适用到的交易 : 批量代付 , 批量代收 , 批量退货 < br > * @ param filePath 批量文件 - 全路径文件名 < br > * @ return */ public static String enCodeFileContent ( String filePath , String encoding ) { } }
String baseFileContent = "" ; File file = new File ( filePath ) ; if ( ! file . exists ( ) ) { try { file . createNewFile ( ) ; } catch ( IOException e ) { LogUtil . writeErrorLog ( e . getMessage ( ) , e ) ; } } InputStream in = null ; try { in = new FileInputStream ( file ) ; int fl = in . available ( ) ; if ( null !...
public class UIComponent { /** * On button release . * @ param button the button * @ return true , if successful */ public boolean onButtonRelease ( MouseButton button ) { } }
if ( ! isEnabled ( ) ) return false ; return parent != null ? parent . onButtonRelease ( button ) : false ;
public class ThriftCodecByteCodeGenerator { /** * Defines the code that calls the builder factory method . */ private void invokeFactoryMethod ( MethodDefinition read , Map < Short , LocalVariableDefinition > structData , LocalVariableDefinition instance ) { } }
if ( metadata . getBuilderMethod ( ) . isPresent ( ) ) { ThriftMethodInjection builderMethod = metadata . getBuilderMethod ( ) . get ( ) ; read . loadVariable ( instance ) ; // push parameters on stack for ( ThriftParameterInjection parameter : builderMethod . getParameters ( ) ) { read . loadVariable ( structData . ge...
public class LockedInodePath { /** * Downgrades from the current locking scheme to the desired locking scheme . * @ param desiredLockPattern the pattern to downgrade to */ public void downgradeToPattern ( LockPattern desiredLockPattern ) { } }
switch ( desiredLockPattern ) { case READ : if ( mLockPattern == LockPattern . WRITE_INODE ) { Preconditions . checkState ( ! isImplicitlyLocked ( ) ) ; mLockList . downgradeLastInode ( ) ; } else if ( mLockPattern == LockPattern . WRITE_EDGE ) { downgradeEdgeToInode ( LockMode . READ ) ; } break ; case WRITE_INODE : i...
public class QuestOWL { /** * The caller is in charge of closing the connection after usage . * ( the reasoner is not responsible of connections ) */ @ Override public OntopOWLConnection getConnection ( ) throws ReasonerInternalException { } }
if ( ! questready ) { OWLReasonerRuntimeException owlReasonerRuntimeException = new ReasonerInternalException ( "Ontop was not initialized properly. This is generally indicates, " + "connection problems or error during ontology or mapping pre-processing. " + "\n\nOriginal error message:\n" + questException . getMessage...
public class FessMessages { /** * Add the created action message for the key ' success . delete _ file ' with parameters . * < pre > * message : Deleted { 0 } file . * < / pre > * @ param property The property name for the message . ( NotNull ) * @ param arg0 The parameter arg0 for message . ( NotNull ) * @...
assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( SUCCESS_delete_file , arg0 ) ) ; return this ;
public class StatsThread { /** * Starst all progress loggers . * @ param previousCrawlDuration the duration of the previous crawl , or zero for a new crawl . */ public void start ( long previousCrawlDuration ) { } }
requestLogger . start ( previousCrawlDuration ) ; resourceLogger . start ( previousCrawlDuration ) ; transferredBytesLogger . start ( previousCrawlDuration ) ; receivedURLsLogger . start ( previousCrawlDuration ) ;
public class JSONObject { /** * Convert this object into a String of JSON text , specifying verbosity . * @ param verbose Whether or not to serialize in compressed for formatted Strings . * @ throws IOException Thrown on IO errors during serialization . */ public String serialize ( boolean verbose ) throws IOExcept...
Serializer serializer ; StringWriter writer = new StringWriter ( ) ; if ( verbose ) { serializer = new SerializerVerbose ( writer ) ; } else { serializer = new Serializer ( writer ) ; } serializer . writeObject ( this ) . flush ( ) ; return writer . toString ( ) ;
public class TraceFactory { /** * Specify what to trace and start tracing it . * @ param activeNames of classes to be activated separated by " : " * " * " represents any name . * @ param traceLevel to be applied . * @ throws java . io . IOException */ public void setActiveTrace ( String activeNames , int traceL...
TraceFactory . activeNames = activeNames ; TraceFactory . traceLevel = traceLevel ; ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcFooting ( ) { } }
if ( ifcFootingEClass == null ) { ifcFootingEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 257 ) ; } return ifcFootingEClass ;
public class MultiDbJDBCConnection { /** * { @ inheritDoc } */ @ Override protected ResultSet findLastOrderNumberByParentIdentifier ( String parentIdentifier ) throws SQLException { } }
if ( findLastOrderNumberByParentId == null ) { findLastOrderNumberByParentId = dbConnection . prepareStatement ( FIND_LAST_ORDER_NUMBER_BY_PARENTID ) ; } else { findLastOrderNumberByParentId . clearParameters ( ) ; } findLastOrderNumberByParentId . setString ( 1 , parentIdentifier ) ; return findLastOrderNumberByParent...
public class StringUtils { /** * < p > Uncapitalizes a String , changing the first character to lower case as * per { @ link Character # toLowerCase ( int ) } . No other characters are changed . < / p > * < p > For a word based algorithm , see { @ link org . apache . commons . lang3 . text . WordUtils # uncapitaliz...
int strLen ; if ( str == null || ( strLen = str . length ( ) ) == 0 ) { return str ; } final int firstCodepoint = str . codePointAt ( 0 ) ; final int newCodePoint = Character . toLowerCase ( ( char ) firstCodepoint ) ; if ( firstCodepoint == newCodePoint ) { // already capitalized return str ; } final int newCodePoints...
public class IndexUpdateTransactionEventHandler { /** * in async mode add the index action to a collection for consumption in { @ link # afterCommit ( TransactionData , Collection ) } , in sync mode , run it directly */ private Void indexUpdate ( Collection < Consumer < Void > > state , Consumer < Void > indexAction ) ...
if ( async ) { state . add ( indexAction ) ; } else { indexAction . accept ( null ) ; } return null ;
public class InstanceDetailsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( InstanceDetails instanceDetails , ProtocolMarshaller protocolMarshaller ) { } }
if ( instanceDetails == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( instanceDetails . getAvailabilityZone ( ) , AVAILABILITYZONE_BINDING ) ; protocolMarshaller . marshall ( instanceDetails . getIamInstanceProfile ( ) , IAMINSTANCEPROFILE...
public class SxRestClient { /** * Executes REST request and return results for a given IPs . * Normally there is only 1 result in the list per IP . * @ param ip IP to get geo info for . Multiple IPs can be used with comma as separator . * @ return list of SxGeoResult results * @ throws IllegalArgumentException ...
if ( ! IPV4_COMMA_SEPARATED_PATTERN . matcher ( ip ) . matches ( ) ) { throw new IllegalArgumentException ( "Illegal IP address or list: " + ip ) ; } clientQueriesCount ++ ; List < SxGeoResult > cachedResult = cache == null ? null : cache . getList ( ip ) ; if ( cachedResult != null ) { return cachedResult ; } try { No...
public class LazyInitializer { /** * Returns the object wrapped by this instance . On first access the object * is created . After that it is cached and can be accessed pretty fast . * @ return the object initialized by this { @ code LazyInitializer } * @ throws ConcurrentException if an error occurred during ini...
// use a temporary variable to reduce the number of reads of the // volatile field T result = object ; if ( result == NO_INIT ) { synchronized ( this ) { result = object ; if ( result == NO_INIT ) { object = result = initialize ( ) ; } } } return result ;
public class ConditionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Condition condition , ProtocolMarshaller protocolMarshaller ) { } }
if ( condition == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( condition . getEq ( ) , EQ_BINDING ) ; protocolMarshaller . marshall ( condition . getGt ( ) , GT_BINDING ) ; protocolMarshaller . marshall ( condition . getGte ( ) , GTE_BIND...
public class Singles { /** * Wait until all the provided Future ' s to complete * @ see CompletableFuture # allOf ( CompletableFuture . . . ) * @ param fts Singles to wait on * @ return Single that completes when all the provided Futures Complete . Empty Future result , or holds an Exception * from a provided F...
return Single . fromPublisher ( Future . allOf ( futures ( fts ) ) ) ;
public class TwitterObjectFactory { /** * Constructs a User object from rawJSON string . * @ param rawJSON raw JSON form as String * @ return User * @ throws TwitterException when provided string is not a valid JSON string . * @ since Twitter4J 2.1.7 */ public static User createUser ( String rawJSON ) throws Tw...
try { return new UserJSONImpl ( new JSONObject ( rawJSON ) ) ; } catch ( JSONException e ) { throw new TwitterException ( e ) ; }
public class EJSDeployedSupport { /** * d194342.1.1 - added entire method . */ @ Override public void enlistInvocationCallback ( InvocationCallback callback , Object cookie ) { } }
if ( ivEJBMethodCallback == null ) { ivEJBMethodCallback = new ArrayList < InvocationCallback > ( ) ; ivEJBMethodCallbackCookie = new ArrayList < Object > ( ) ; } ivEJBMethodCallback . add ( callback ) ; ivEJBMethodCallbackCookie . add ( cookie ) ;
public class HeapCache { /** * Remove the entry from the hash table . The entry is already removed from the replacement list . * Stop the timer , if needed . The remove races with a clear . The clear * is not updating each entry state to e . isGone ( ) but just drops the whole hash table instead . * < p > With co...
boolean f = hash . remove ( e ) ; checkForHashCodeChange ( e ) ; timing . cancelExpiryTimer ( e ) ; e . setGone ( ) ;
public class DiffieHellmanGroup1Sha1 { /** * Calculates the exchange hash as an SHA1 hash of the following data . * < blockquote > * < pre > * String the client ' s version string ( CR and NL excluded ) * String the server ' s version string ( CR and NL excluded ) * String the payload of the client ' s SSH _ ...
Digest hash = ( Digest ) ComponentManager . getInstance ( ) . supportedDigests ( ) . getInstance ( "SHA-1" ) ; // The local software version comments hash . putString ( clientId ) ; // The remote software version comments hash . putString ( serverId ) ; // The local kex init payload hash . putInt ( clientKexInit . leng...
public class HttpContinue { /** * Sends a continue response using blocking IO * @ param exchange The exchange */ public static void sendContinueResponseBlocking ( final HttpServerExchange exchange ) throws IOException { } }
if ( ! exchange . isResponseChannelAvailable ( ) ) { throw UndertowMessages . MESSAGES . cannotSendContinueResponse ( ) ; } if ( exchange . getAttachment ( ALREADY_SENT ) != null ) { return ; } HttpServerExchange newExchange = exchange . getConnection ( ) . sendOutOfBandResponse ( exchange ) ; exchange . putAttachment ...
public class BitmapUtil { /** * Decodes the bounds of an image and returns its width and height or null if the size can ' t be * determined * @ param is the InputStream containing the image data * @ return dimensions of the image */ public static @ Nullable Pair < Integer , Integer > decodeDimensions ( InputStrea...
Preconditions . checkNotNull ( is ) ; ByteBuffer byteBuffer = DECODE_BUFFERS . acquire ( ) ; if ( byteBuffer == null ) { byteBuffer = ByteBuffer . allocate ( DECODE_BUFFER_SIZE ) ; } BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inJustDecodeBounds = true ; try { options . inTempStorage =...
public class ConnectController { /** * Adds a ConnectInterceptor to receive callbacks during the connection process . * Useful for programmatic configuration . * @ param interceptor the connect interceptor to add */ public void addInterceptor ( ConnectInterceptor < ? > interceptor ) { } }
Class < ? > serviceApiType = GenericTypeResolver . resolveTypeArgument ( interceptor . getClass ( ) , ConnectInterceptor . class ) ; connectInterceptors . add ( serviceApiType , interceptor ) ;
public class Comparables { /** * Checks the provided { @ link Comparable } instances for equality . * Special numeric comparison logic is used for { @ link Double } , { @ link Long } , * { @ link Float } , { @ link Integer } , { @ link Short } and { @ link Byte } . See * { @ link Numbers # equal ( Number , Number...
assert lhs != null ; if ( rhs == null ) { return false ; } if ( lhs . getClass ( ) == rhs . getClass ( ) ) { return lhs . equals ( rhs ) ; } if ( lhs instanceof Number && rhs instanceof Number ) { return Numbers . equal ( ( Number ) lhs , ( Number ) rhs ) ; } return lhs . equals ( rhs ) ;
public class Choice3 { /** * Static factory method for wrapping a value of type < code > A < / code > in a { @ link Choice3 } . * @ param b the value * @ param < A > the first possible type * @ param < B > the second possible type * @ param < C > the third possible type * @ return the wrapped value as a { @ l...
return new _B < > ( b ) ;
public class ZonedDateTime { /** * Obtains an instance of { @ code ZonedDateTime } from a temporal object . * A { @ code TemporalAccessor } represents some form of date and time information . * This factory converts the arbitrary temporal object to an instance of { @ code ZonedDateTime } . * The conversion will f...
if ( temporal instanceof ZonedDateTime ) { return ( ZonedDateTime ) temporal ; } try { ZoneId zone = ZoneId . from ( temporal ) ; if ( temporal . isSupported ( INSTANT_SECONDS ) ) { try { long epochSecond = temporal . getLong ( INSTANT_SECONDS ) ; int nanoOfSecond = temporal . get ( NANO_OF_SECOND ) ; return create ( e...
public class Card { /** * Retrieves an Issuing < code > Card < / code > object . */ public static Card retrieve ( String card ) throws StripeException { } }
return retrieve ( card , ( Map < String , Object > ) null , ( RequestOptions ) null ) ;
public class VisualizrReporter { /** * Report a histogram using fields max / mean / min / stddev , p50 / p75 / p95 / p98 / p99 / p999 / count * @ param name * @ param histogram */ private void reportHistogram ( String name , Histogram histogram ) { } }
final Snapshot snapshot = histogram . getSnapshot ( ) ; String prefixedName = prefix ( name ) ; if ( ! snapshots . hasDescriptor ( prefixedName ) ) { MetricItem . Builder builder = MetricItem . Builder . create ( ) ; builder . count ( "max" ) ; builder . count ( "mean" ) ; builder . count ( "min" ) ; builder . count ( ...
public class CSSErrorStrategy { /** * Consumes token until lexer state is function - balanced and * token from follow is matched . Matched token is also consumed */ protected void consumeUntilGreedy ( Parser recognizer , IntervalSet set , CSSLexerState . RecoveryMode mode ) { } }
CSSToken t ; do { Token next = recognizer . getInputStream ( ) . LT ( 1 ) ; if ( next instanceof CSSToken ) { t = ( CSSToken ) recognizer . getInputStream ( ) . LT ( 1 ) ; if ( t . getType ( ) == Token . EOF ) { logger . trace ( "token eof " ) ; break ; } } else break ; /* not a CSSToken , probably EOF */ logger . trac...
public class JaxWsHttpServletRequestAdapter { /** * ( non - Javadoc ) * @ see javax . servlet . ServletRequest # getLocalName ( ) */ @ Override public String getLocalName ( ) { } }
try { collaborator . preInvoke ( componentMetaData ) ; return request . getLocalName ( ) ; } finally { collaborator . postInvoke ( ) ; }
public class CmsGitToolOptionsPanel { /** * Sets an additional info value if it ' s not empty . < p > * @ param user the user on which to set the additional info * @ param key the additional info key * @ param value the additional info value */ private void setUserInfo ( CmsUser user , String key , String value )...
if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( value ) ) { user . getAdditionalInfo ( ) . put ( key , value ) ; }
public class Vectors { /** * Creates a product function accumulator , that calculates the product of * all elements in the vector after applying given { @ code function } to * each of them . * @ param neutral the neutral value * @ param function the vector function * @ return a product function accumulator */...
return new VectorAccumulator ( ) { private final VectorAccumulator productAccumulator = Vectors . asProductAccumulator ( neutral ) ; @ Override public void update ( int i , double value ) { productAccumulator . update ( i , function . evaluate ( i , value ) ) ; } @ Override public double accumulate ( ) { return product...