signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class TaskSendTargets { /** * direct send tuple to special task */ public List < Integer > get ( Integer out_task_id , String stream , List < Object > tuple , Collection < Tuple > anchors , Object root_id ) { } }
// in order to improve acker ' s performance , skip checking // String target _ component = // topologyContext . getComponentId ( out _ task _ id ) ; // Map < String , MkGrouper > component _ prouping = streamComponentGrouper // . get ( stream ) ; // MkGrouper grouping = component _ prouping . get ( target _ component ...
public class PluginRepositoryUtil { /** * Parses a plugin option XML definition . * @ param option * The plugin option XML definition * @ return The parsed plugin option */ private static PluginOption parsePluginOption ( final Element option ) { } }
PluginOption po = new PluginOption ( ) ; po . setArgName ( option . attributeValue ( "argName" ) ) ; po . setArgsCount ( Integer . valueOf ( option . attributeValue ( "argsCount" , "1" ) ) ) ; po . setArgsOptional ( Boolean . valueOf ( option . attributeValue ( "optionalArgs" , "false" ) ) ) ; po . setDescription ( opt...
public class FulltextIndexerModule { /** * ~ - - - private methods - - - - - */ private static int flushWordBuffer ( final StringBuilder lineBuffer , final StringBuilder wordBuffer , final boolean prepend ) { } }
int wordCount = 0 ; if ( wordBuffer . length ( ) > 0 ) { final String word = wordBuffer . toString ( ) . replaceAll ( "[\\n\\t]+" , " " ) ; if ( StringUtils . isNotBlank ( word ) ) { if ( prepend ) { lineBuffer . insert ( 0 , word ) ; } else { lineBuffer . append ( word ) ; } // increase word count wordCount = 1 ; } wo...
public class Utils { /** * Truncate the given GregorianCalendar date to the nearest week . This is done by * cloning it and rounding the value down to the closest Monday . If the given date * already occurs on a Monday , a copy of the same date is returned . * @ param date A GregorianCalendar object . * @ retur...
// Round the date down to the MONDAY of the same week . GregorianCalendar result = ( GregorianCalendar ) date . clone ( ) ; switch ( result . get ( Calendar . DAY_OF_WEEK ) ) { case Calendar . TUESDAY : result . add ( Calendar . DAY_OF_MONTH , - 1 ) ; break ; case Calendar . WEDNESDAY : result . add ( Calendar . DAY_OF...
public class Dates { /** * 添加毫秒 * @ param date * @ param millis * @ return */ public static Date plusMillis ( Date date , int millis ) { } }
return plus ( date , millis , DateTimeField . MILLIS ) ;
public class ServerCommandClient { /** * Stop the server by issuing a " stop " instruction to the server listener */ public ReturnCode stopServer ( boolean force ) { } }
return write ( force ? FORCE_STOP_COMMAND : STOP_COMMAND , ReturnCode . REDUNDANT_ACTION_STATUS , ReturnCode . ERROR_SERVER_STOP ) ;
public class SpdyHttpEncoder { /** * Checks if the given HTTP message should be considered as a last SPDY frame . * @ param httpMessage check this HTTP message * @ return whether the given HTTP message should generate a < em > last < / em > SPDY frame . */ private static boolean isLast ( HttpMessage httpMessage ) {...
if ( httpMessage instanceof FullHttpMessage ) { FullHttpMessage fullMessage = ( FullHttpMessage ) httpMessage ; if ( fullMessage . trailingHeaders ( ) . isEmpty ( ) && ! fullMessage . content ( ) . isReadable ( ) ) { return true ; } } return false ;
public class GridFile { /** * Checks whether the parent directories are present ( and are directories ) . If create _ if _ absent is true , * creates missing dirs * @ param path * @ param create _ if _ absent * @ return */ protected boolean checkParentDirs ( String path , boolean create_if_absent ) throws IOExc...
String [ ] components = Util . components ( path , File . separator ) ; if ( components == null ) return false ; if ( components . length == 1 ) // no parent directories to create , e . g . " data . txt " return true ; StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( int i = 0 ; i < components . ...
public class PostCodeBuilder { /** * { @ inheritDoc } */ @ Override public PostCode buildObject ( String namespaceURI , String localName , String namespacePrefix ) { } }
return new PostCodeImpl ( namespaceURI , localName , namespacePrefix ) ;
public class BindTableGenerator { /** * ( non - Javadoc ) * @ see com . abubusoft . kripton . processor . core . ModelElementVisitor # visit ( com . abubusoft . kripton . processor . sqlite . model . SQLiteDatabaseSchema , * com . abubusoft . kripton . processor . core . ModelClass ) */ @ Override public void visit...
int indexCounter = 0 ; // generate the class name that represents the table String classTableName = getTableClassName ( entity . getSimpleName ( ) ) ; FindIndexesVisitor indexVisitor = new FindIndexesVisitor ( ) ; List < ? extends AnnotationMirror > annotationMirrors = entity . getElement ( ) . getAnnotationMirrors ( )...
public class WebSocketNodeService { /** * 更改用户ID , 需要更新到CacheSource * @ param olduserid Serializable * @ param newuserid Serializable * @ param sncpAddr InetSocketAddress * @ return 无返回值 */ @ Override public CompletableFuture < Void > changeUserid ( Serializable olduserid , Serializable newuserid , InetSocketAd...
tryAcquireSemaphore ( ) ; CompletableFuture < Void > future = sncpNodeAddresses . appendSetItemAsync ( SOURCE_SNCP_USERID_PREFIX + newuserid , InetSocketAddress . class , sncpAddr ) ; future = future . thenAccept ( ( a ) -> sncpNodeAddresses . removeSetItemAsync ( SOURCE_SNCP_USERID_PREFIX + olduserid , InetSocketAddre...
public class Item { /** * Sets this item to a { @ link ClassWriter # LONG LONG } item . * @ param longVal the value of this item . */ Item set ( final int type , final Number number ) { } }
this . type = type ; this . number = number ; this . hashCode = 0x7FFFFFFF & ( type + number . intValue ( ) ) ; return this ;
public class AbstractChronology { /** * Resolves parsed { @ code ChronoField } values into a date during parsing . * Most { @ code TemporalField } implementations are resolved using the * resolve method on the field . By contrast , the { @ code ChronoField } class * defines fields that only have meaning relative ...
// check epoch - day before inventing era if ( fieldValues . containsKey ( EPOCH_DAY ) ) { return dateEpochDay ( fieldValues . remove ( EPOCH_DAY ) ) ; } // fix proleptic month before inventing era resolveProlepticMonth ( fieldValues , resolverStyle ) ; // invent era if necessary to resolve year - of - era ChronoLocalD...
public class JCufft { /** * Convenience method for { @ link JCufft # cufftExecZ2Z ( cufftHandle , Pointer , Pointer , int ) } . * Accepts arrays for input and output data and automatically performs the host - device * and device - host copies . * @ see jcuda . jcufft . JCufft # cufftExecZ2Z ( cufftHandle , Pointe...
int cudaResult = 0 ; boolean inPlace = ( cIdata == cOdata ) ; // Allocate space for the input data on the device Pointer hostCIdata = Pointer . to ( cIdata ) ; Pointer deviceCIdata = new Pointer ( ) ; cudaResult = JCuda . cudaMalloc ( deviceCIdata , cIdata . length * Sizeof . DOUBLE ) ; if ( cudaResult != cudaError . c...
public class EndpointMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Endpoint endpoint , ProtocolMarshaller protocolMarshaller ) { } }
if ( endpoint == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( endpoint . getAddress ( ) , ADDRESS_BINDING ) ; protocolMarshaller . marshall ( endpoint . getCachePeriodInMinutes ( ) , CACHEPERIODINMINUTES_BINDING ) ; } catch ( Exception e ...
public class JFapByteBuffer { /** * This method releases the ReceivedData instance but does not release any of the WsByteBuffers * associated with this JFapByteBuffer . This can be used instead of the normal * < code > release ( ) < / code > call where the actual buffer has been used as the underlying backing * s...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "releasePreservingBuffers" ) ; released = true ; valid = false ; if ( receivedData != null ) { receivedData . release ( ) ; receivedData = null ; } // Simply null out the received buffer receivedBuffer = null ; dataLi...
public class TaskSlot { /** * Mark the slot as free . A slot can only be marked as free if it ' s empty . * @ return True if the new state is free ; otherwise false */ public boolean markFree ( ) { } }
if ( isEmpty ( ) ) { state = TaskSlotState . FREE ; this . jobId = null ; this . allocationId = null ; return true ; } else { return false ; }
public class VelocityEngineFactory { /** * Returns the VelocityEngine associated with this factory . If this is the first time we are using the engine , * create it and initialise it . < / p > * Note that velocity engines are hugely resource intensive , so we don ' t want too many of them . For the time being * w...
if ( engine == null ) { String fileTemplates = ConfigurationProperties . getVelocityFileTemplates ( ) ; boolean cacheTemplates = ConfigurationProperties . getVelocityCacheTemplates ( ) ; VelocityEngine newEngine = new VelocityEngine ( ) ; Properties props = new Properties ( ) ; // Configure the velocity template differ...
public class DocumentSubscriptions { /** * It opens a subscription and starts pulling documents since a last processed document for that subscription . * The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client * needs to acknowledge t...
return getSubscriptionWorkerForRevisions ( clazz , subscriptionName , null ) ;
public class SparkStorageUtils { /** * Save a { @ code JavaRDD < List < Writable > > } to a Hadoop { @ link org . apache . hadoop . io . MapFile } . Each record is * given a < i > unique and contiguous < / i > { @ link LongWritable } key , and values are stored as * { @ link RecordWritable } instances . < br > * ...
saveMapFile ( path , rdd , DEFAULT_MAP_FILE_INTERVAL , null ) ;
public class CertificateWriter { /** * Write the given { @ link X509Certificate } into the given { @ link File } in the given * { @ link KeyFileFormat } format . * @ param certificate * the certificate * @ param file * the file to write in * @ param fileFormat * the file format to write * @ throws IOExc...
write ( certificate , new FileOutputStream ( file ) , fileFormat ) ;
public class DescribeTrustedAdvisorChecksResult { /** * Information about all available Trusted Advisor checks . * @ param checks * Information about all available Trusted Advisor checks . */ public void setChecks ( java . util . Collection < TrustedAdvisorCheckDescription > checks ) { } }
if ( checks == null ) { this . checks = null ; return ; } this . checks = new com . amazonaws . internal . SdkInternalList < TrustedAdvisorCheckDescription > ( checks ) ;
public class UIUtil { /** * Show keyboard and focus to given EditText * @ param context Context * @ param target EditText to focus */ public static void showKeyboard ( Context context , EditText target ) { } }
if ( context == null || target == null ) { return ; } InputMethodManager imm = getInputMethodManager ( context ) ; imm . showSoftInput ( target , InputMethodManager . SHOW_IMPLICIT ) ;
public class AbstractAuditEventMessageImpl { /** * Create and add an Active Participant block to this audit event message but automatically * determine the Network Access Point ID Type Code * @ param userID The Active Participant ' s UserID * @ param altUserID The Active Participant ' s Alternate UserID * @ par...
// Does lookup to see if using IP Address or hostname in Network Access Point ID return addActiveParticipant ( userID , altUserID , userName , userIsRequestor , roleIdCodes , networkAccessPointID , getNetworkAccessPointCodeFromAddress ( networkAccessPointID ) ) ;
public class Sets { /** * Create a subset using a { @ code Criteria } * @ param set original set * @ param criteria criteria * @ param < T > type * @ return a new subset containing items form the original set that met the criteria */ public static < T > Set < T > subset ( Set < T > set , Criteria < T > criteria...
Set < T > subset = new HashSet < T > ( ) ; for ( T item : set ) { if ( criteria . meetsCriteria ( item ) ) { subset . add ( item ) ; } } return subset ;
public class JXMapViewer { /** * the method that does the actual painting */ private void doPaintComponent ( Graphics g ) { } }
/* * if ( isOpaque ( ) | | isDesignTime ( ) ) { g . setColor ( getBackground ( ) ) ; g . fillRect ( 0,0 , getWidth ( ) , getHeight ( ) ) ; } */ if ( isDesignTime ( ) ) { // do nothing } else { int z = getZoom ( ) ; Rectangle viewportBounds = getViewportBounds ( ) ; drawMapTiles ( g , z , viewportBounds ) ; drawOverlays...
public class MapOutputCorrectness { /** * Which mapper sent this key sum ? * @ param key Key to check * @ param numReducers Number of reducers * @ param maxKeySpace Max key space * @ return Mapper that send this key sum */ private static int getMapperId ( long key , int numReducers , int maxKeySpace ) { } }
key = key - getFirstSumKey ( numReducers , maxKeySpace ) ; return ( int ) ( key / numReducers ) ;
public class TableUtils { /** * Guava { @ link Function } to transform a cell to its column key . */ public static < R , C , V > Function < Table . Cell < R , C , V > , C > toColumnKeyFunction ( ) { } }
return new Function < Table . Cell < R , C , V > , C > ( ) { @ Override public C apply ( final Table . Cell < R , C , V > input ) { return input . getColumnKey ( ) ; } } ;
public class Secp256k1Loader { /** * Deleted old native libraries e . g . on Windows the DLL file is not removed * on VM - Exit ( bug # 80) */ static void cleanup ( ) { } }
String tempFolder = getTempDir ( ) . getAbsolutePath ( ) ; File dir = new File ( tempFolder ) ; File [ ] nativeLibFiles = dir . listFiles ( new FilenameFilter ( ) { private final String searchPattern = "secp256k1-" ; public boolean accept ( File dir , String name ) { return name . startsWith ( searchPattern ) && ! name...
public class ContentsDao { /** * Delete the collection of Contents , cascading optionally including the * user table * @ param contentsCollection * contents collection * @ param userTable * true if a user table * @ return deleted count * @ throws SQLException * upon deletion error */ public int deleteCa...
int count = 0 ; if ( contentsCollection != null ) { for ( Contents contents : contentsCollection ) { count += deleteCascade ( contents , userTable ) ; } } return count ;
public class ApiClientTransportFactory { /** * < p > newTransport . < / p > * @ param apitraryApi a { @ link com . apitrary . api . ApitraryApi } object . * @ return a { @ link com . apitrary . api . transport . Transport } object . */ public Transport newTransport ( ApitraryApi apitraryApi ) { } }
List < Class < Transport > > knownTransports = getAvailableTransports ( ) ; if ( knownTransports . isEmpty ( ) ) { throw new ApiTransportException ( "No transport provider available. Is there one on the classpath?" ) ; } return newTransport ( apitraryApi , knownTransports . get ( knownTransports . size ( ) - 1 ) ) ;
public class Decoder { /** * Reads a code of length 8 in an array of bits , padding with zeros */ private static byte readByte ( boolean [ ] rawbits , int startIndex ) { } }
int n = rawbits . length - startIndex ; if ( n >= 8 ) { return ( byte ) readCode ( rawbits , startIndex , 8 ) ; } return ( byte ) ( readCode ( rawbits , startIndex , n ) << ( 8 - n ) ) ;
public class TrainingsImpl { /** * Queues project for training . * @ param projectId The project id * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the Iteration object */ public Observable < Iteration > trainProjectAsync ( UUID projectId ) { } }
return trainProjectWithServiceResponseAsync ( projectId ) . map ( new Func1 < ServiceResponse < Iteration > , Iteration > ( ) { @ Override public Iteration call ( ServiceResponse < Iteration > response ) { return response . body ( ) ; } } ) ;
public class WebApp { /** * ServletContextFactories */ public boolean isFeatureEnabled ( com . ibm . websphere . servlet . container . WebContainer . Feature feature ) { } }
return this . features . contains ( feature ) ;
public class RequestHandler { /** * Add the service to the node . * @ param request the request which contains infos about the service and node to add . * @ return an observable which contains the newly created service . */ public Observable < Service > addService ( final AddServiceRequest request ) { } }
LOGGER . debug ( "Got instructed to add Service {}, to Node {}" , request . type ( ) , request . hostname ( ) ) ; return nodeBy ( request . hostname ( ) ) . addService ( request ) ;
public class DateTime { /** * Returns a copy of this datetime minus the specified number of hours . * The calculation will subtract a duration equivalent to the number of * hours expressed in milliseconds . * For example , if a spring daylight savings cutover is from 01:59 to 03:00 * then subtracting one hour f...
if ( hours == 0 ) { return this ; } long instant = getChronology ( ) . hours ( ) . subtract ( getMillis ( ) , hours ) ; return withMillis ( instant ) ;
public class ClassProject { /** * GetFullPackage Method . */ public String getFullPackage ( CodeType codeType , String packageName ) { } }
if ( packageName == null ) packageName = DBConstants . BLANK ; if ( packageName . length ( ) > 0 ) if ( ! packageName . startsWith ( "." ) ) return packageName ; Record programControl = null ; if ( this . getRecordOwner ( ) != null ) programControl = ( Record ) this . getRecordOwner ( ) . getRecord ( ProgramControl . P...
public class DecodedBitStreamParser { /** * Text Compaction mode ( see 5.4.1.5 ) permits all printable ASCII characters to be * encoded , i . e . values 32 - 126 inclusive in accordance with ISO / IEC 646 ( IRV ) , as * well as selected control characters . * @ param codewords The array of codewords ( data + erro...
// 2 character per codeword int [ ] textCompactionData = new int [ ( codewords [ 0 ] - codeIndex ) * 2 ] ; // Used to hold the byte compaction value if there is a mode shift int [ ] byteCompactionData = new int [ ( codewords [ 0 ] - codeIndex ) * 2 ] ; int index = 0 ; boolean end = false ; while ( ( codeIndex < codewor...
public class ExceptionWrapper { /** * Simulates a printing of a stack trace by printing the string * stack trace */ public void printStackTrace ( PrintStream printStream ) { } }
if ( mStackTrace == null ) { printStream . print ( getMessage ( ) ) ; } else { printStream . print ( mStackTrace ) ; }
public class WSHelper { /** * Returns required attachment value from webservice deployment . * @ param < A > expected value * @ param dep webservice deployment * @ param key attachment key * @ return required attachment * @ throws IllegalStateException if attachment value is null */ public static < A > A getR...
final A value = dep . getAttachment ( key ) ; if ( value == null ) { throw Messages . MESSAGES . cannotFindAttachmentInDeployment ( key , dep . getSimpleName ( ) ) ; } return value ;
public class Color { /** * Converts HSL ( hue , saturation , lightness ) to RGB . * HSL values should already be normalized to [ 0,1] * @ param h in [ 0,1] * @ param s in [ 0,1] * @ param l in [ 0,1] * @ return Color with RGB values */ public static final Color fromNormalizedHSL ( final double h , final doubl...
// see http : / / www . w3 . org / TR / css3 - color / // HOW TO RETURN hsl . to . rgb ( h , s , l ) : // SELECT : // l < = 0.5 : PUT l * ( s + 1 ) IN m2 // ELSE : PUT l + s - l * s IN m2 // PUT l * 2 - m2 IN m1 // PUT hue . to . rgb ( m1 , m2 , h + 1/3 ) IN r // PUT hue . to . rgb ( m1 , m2 , h ) IN g // PUT hue . to ...
public class KernelPoints { /** * Adds a new Kernel Point to the internal list this object represents . The * new Kernel Point will be equivalent to creating a new KernelPoint * directly . */ public void addNewKernelPoint ( ) { } }
KernelPoint source = points . get ( 0 ) ; KernelPoint toAdd = new KernelPoint ( k , errorTolerance ) ; toAdd . setMaxBudget ( maxBudget ) ; toAdd . setBudgetStrategy ( budgetStrategy ) ; standardMove ( toAdd , source ) ; toAdd . kernelAccel = source . kernelAccel ; toAdd . vecs = source . vecs ; toAdd . alpha = new Dou...
public class ContentKeyPoliciesInner { /** * Update a Content Key Policy . * Updates an existing Content Key Policy in the Media Services account . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ param content...
return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , accountName , contentKeyPolicyName , parameters ) , serviceCallback ) ;
public class FieldAnnotationParser { /** * Parse { @ link ViewId } annotation and try to assign the view with that id to the annotated field . * It will throw a { @ link ClassCastException } if the field and the view with the given ID have different types . * @ param object object where the annotation is . * @ pa...
setViewFields ( object , new ViewFinder ( ) { @ Override public View findViewById ( int viewId ) { return view . findViewById ( viewId ) ; } } ) ;
public class SimpleBase { /** * Sets all the elements in this matrix equal to the specified value . < br > * < br > * a < sub > ij < / sub > = val < br > * @ see CommonOps _ DDRM # fill ( DMatrixD1 , double ) * @ param val The value each element is set to . */ public void fill ( double val ) { } }
try { ops . fill ( mat , val ) ; } catch ( ConvertToDenseException e ) { convertToDense ( ) ; fill ( val ) ; }
public class SwingGUIListener { /** * Processes the IOSettings by listing the question , giving the options * and asking the user to provide their choice . * < p > Note : if the input reader is < code > null < / code > , then the method * does not wait for an answer , and takes the default . */ @ Override public ...
// post the question if ( setting . getLevel ( ) . ordinal ( ) <= this . level . ordinal ( ) ) { String answer = setting . getSetting ( ) ; if ( setting instanceof BooleanIOSetting ) { int n = JOptionPane . showConfirmDialog ( frame , setting . getQuestion ( ) , setting . getName ( ) , JOptionPane . YES_NO_OPTION ) ; i...
public class S3Utils { /** * { @ inheritDoc } */ @ Override public void delete ( String path ) throws IOException , URISyntaxException { } }
URI uri = new URI ( path ) ; String bucketName = uri . getHost ( ) ; String key = uri . getPath ( ) . substring ( 1 , uri . getPath ( ) . length ( ) ) ; List < DeleteObjectsRequest . KeyVersion > keys = new ArrayList < DeleteObjectsRequest . KeyVersion > ( ) ; String marker = null ; for ( ; ; ) { ObjectListing ol = s3 ...
public class Director { /** * Clean up the downloaded install assets ; * reset installAssets and uninstallAssets . */ public void cleanUp ( ) { } }
fireProgressEvent ( InstallProgressEvent . CLEAN_UP , 98 , Messages . INSTALL_KERNEL_MESSAGES . getLogMessage ( "STATE_CLEANING" ) ) ; if ( installAssets != null ) { for ( List < InstallAsset > iaList : installAssets ) { for ( InstallAsset asset : iaList ) { asset . delete ( ) ; } } } boolean del = InstallUtils . delet...
public class RuleBasedBreakIterator { /** * The State Machine Engine for moving forward is here . * This function is the heart of the RBBI run time engine . * @ param stateTable * @ return the new iterator position * A note on supplementary characters and the position of underlying * Java CharacterIterator : ...
if ( TRACE ) { System . out . println ( "Handle Next pos char state category" ) ; } // No matter what , handleNext alway correctly sets the break tag value . fLastStatusIndexValid = true ; fLastRuleStatusIndex = 0 ; // caches for quicker access CharacterIterator text = fText ; CharTrie trie = fRData . fTrie ; /...
public class Counters { /** * Returns the value of the smallest entry in this counter . * @ param c * The Counter ( not modified ) * @ return The minimum value in the Counter */ public static < E > double min ( Counter < E > c ) { } }
double min = Double . POSITIVE_INFINITY ; for ( double v : c . values ( ) ) { min = Math . min ( min , v ) ; } return min ;
public class Directories { /** * The snapshot must exist */ public long snapshotCreationTime ( String snapshotName ) { } }
for ( File dir : dataPaths ) { File snapshotDir = new File ( dir , join ( SNAPSHOT_SUBDIR , snapshotName ) ) ; if ( snapshotDir . exists ( ) ) return snapshotDir . lastModified ( ) ; } throw new RuntimeException ( "Snapshot " + snapshotName + " doesn't exist" ) ;
public class JsonSerializer { /** * Serializes the given object in JSON and returns the resulting string . In * case of errors , null is returned . In particular , this happens if the * object is not based on a Jackson - annotated class . An error is logged in * this case . * @ param object * object to serial...
try { return mapper . writeValueAsString ( object ) ; } catch ( JsonProcessingException e ) { logger . error ( "Failed to serialize JSON data: " + e . toString ( ) ) ; return null ; }
public class CommerceShippingFixedOptionRelUtil { /** * Returns an ordered range of all the commerce shipping fixed option rels where commerceShippingMethodId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < /...
return getPersistence ( ) . findByCommerceShippingMethodId ( commerceShippingMethodId , start , end , orderByComparator ) ;
public class BuildableType_Builder { /** * Sets the value to be returned by { @ link BuildableType # partialToBuilder ( ) } . * @ return this { @ code Builder } object * @ throws NullPointerException if { @ code partialToBuilder } is null */ public BuildableType . Builder partialToBuilder ( PartialToBuilderMethod p...
this . partialToBuilder = Objects . requireNonNull ( partialToBuilder ) ; _unsetProperties . remove ( Property . PARTIAL_TO_BUILDER ) ; return ( BuildableType . Builder ) this ;
public class BplusTree { /** * Put the key / value in the subtree rooted for nodeid ( this function is recursive ) * If node is split by this operation then the return value is the Node * that was created when node was split * @ param key the key to add * @ param value the value to add * @ param nodeid the no...
final Node < K , V > nodeFind = getNode ( nodeid ) ; if ( nodeFind == null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( this . getClass ( ) . getName ( ) + "::putRecursive getNode(" + nodeid + ")=null" ) ; } } int slot = nodeFind . findSlotByKey ( key ) ; if ( slot >= 0 ) { if ( nodeFind . isLeaf ( ) ) { // leaf...
public class WidgetUtil { /** * Gets the pre - made HTML Widget for the specified guild using the specified * settings . The widget will only display correctly if the guild in question * has the Widget enabled . * @ param guild * the guild * @ param theme * the theme , light or dark * @ param width * th...
Checks . notNull ( guild , "Guild" ) ; return getPremadeWidgetHtml ( guild . getId ( ) , theme , width , height ) ;
public class WorkflowClient { /** * Skips a given task from a current RUNNING workflow * @ param workflowId the id of the workflow instance * @ param taskReferenceName the reference name of the task to be skipped */ public void skipTaskFromWorkflow ( String workflowId , String taskReferenceName ) { } }
Preconditions . checkArgument ( StringUtils . isNotBlank ( workflowId ) , "workflow id cannot be blank" ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( taskReferenceName ) , "Task reference name cannot be blank" ) ; put ( "workflow/{workflowId}/skiptask/{taskReferenceName}" , null , workflowId , taskRefe...
public class SwaggerController { /** * Serves the Swagger UI which allows you to try out the documented endpoints . Sets the url * parameter to the swagger yaml that describes the REST API . Creates an apiKey token for the * current user . */ @ GetMapping public String init ( Model model ) { } }
final UriComponents uriComponents = ServletUriComponentsBuilder . fromCurrentContextPath ( ) . build ( ) ; model . addAttribute ( "molgenisUrl" , uriComponents . toUriString ( ) + URI + "/swagger.yml" ) ; model . addAttribute ( "baseUrl" , uriComponents . toUriString ( ) ) ; final String currentUsername = SecurityUtils...
public class BasePersistence { /** * { @ inheritDoc } */ @ Override public List < T > findAll ( int firstResult , int maxResults ) { } }
return getPersistenceProvider ( ) . findAll ( persistenceClass , firstResult , maxResults ) ;
public class Proxies { /** * Create a proxy for the given { @ link Class } type and { @ link ForgeProxy } handler . */ @ SuppressWarnings ( "unchecked" ) public static < T > T enhance ( Class < T > type , ForgeProxy handler ) { } }
Assert . notNull ( type , "Class type to proxy must not be null" ) ; Assert . notNull ( handler , "ForgeProxy handler must not be null" ) ; Object result = null ; Class < ? > proxyType = getCachedProxyType ( type . getClassLoader ( ) , type ) ; if ( proxyType == null ) { Class < ? > [ ] hierarchy = null ; Class < ? > s...
public class Settings { /** * Gets setting or throws an IllegalArgumentException if not found * @ param name of setting to search for * @ return found value * @ throws IllegalArgumentException in case setting is not present */ private Object get ( String name ) { } }
Object value = find ( name ) ; if ( value == null ) { throw new IllegalArgumentException ( "Setting: '" + name + "', not found!" ) ; } return value ;
public class DateTimeExpression { /** * Create a month expression ( range 1-12 / JAN - DEC ) * @ return month */ public NumberExpression < Integer > month ( ) { } }
if ( month == null ) { month = Expressions . numberOperation ( Integer . class , Ops . DateTimeOps . MONTH , mixin ) ; } return month ;
public class RaftServiceManager { /** * Compacts logs up to the given index . * @ param compactIndex the index to which to compact logs */ private void compactLogs ( long compactIndex ) { } }
raft . getThreadContext ( ) . execute ( ( ) -> { logger . debug ( "Compacting logs up to index {}" , compactIndex ) ; try { raft . getLog ( ) . compact ( compactIndex ) ; } catch ( Exception e ) { logger . error ( "An exception occurred during log compaction: {}" , e ) ; } finally { this . compactFuture . complete ( nu...
public class LinkedList { /** * Removes the element from the list and saves the element data structure for later reuse . * @ param element The item which is to be removed from the list */ public void remove ( Element < T > element ) { } }
if ( element . next == null ) { last = element . previous ; } else { element . next . previous = element . previous ; } if ( element . previous == null ) { first = element . next ; } else { element . previous . next = element . next ; } size -- ; element . clear ( ) ; available . push ( element ) ;
public class ClassLoaderUtils { /** * Locates the resource stream with the specified name . For Java 2 callers , * the current thread ' s context class loader is preferred , falling back on * the class loader of the caller when the current thread ' s context is not * set , or the caller is pre Java 2 . If the cal...
_checkResourceName ( name ) ; InputStream stream = null ; ClassLoader loader = getContextClassLoader ( ) ; if ( loader != null ) { stream = loader . getResourceAsStream ( name ) ; } if ( stream == null ) { if ( callerClassLoader != null ) { stream = callerClassLoader . getResourceAsStream ( name ) ; } else { stream = C...
public class ResourceLocator { /** * 定位资源 。 首先查找指定类的加载路径 , 如果找不到 , 再由指定类的Class Loader从其CLASSPATH路径中查找 。 */ public static URL getResource ( Class < ? > c , String resName ) { } }
URL url = constructResourceURL ( c , resName ) ; if ( url == null ) return c . getResource ( resName ) ; InputStream is = null ; try { is = url . openStream ( ) ; is . read ( ) ; } catch ( Exception e ) { return c . getResource ( resName ) ; } finally { try { if ( is != null ) is . close ( ) ; } catch ( Exception e ) {...
public class ApacheHttpClientDelegate { private HttpUriRequest addDefaultHeaders ( HttpUriRequest req ) { } }
req . addHeader ( HttpHeaders . ACCEPT , "*/*" ) ; req . addHeader ( HttpHeaders . CONTENT_TYPE , "application/json" ) ; return req ;
public class MyViewsTabBar { /** * Returns all the registered { @ link ListViewColumn } descriptors . */ public static DescriptorExtensionList < MyViewsTabBar , Descriptor < MyViewsTabBar > > all ( ) { } }
return Jenkins . getInstance ( ) . < MyViewsTabBar , Descriptor < MyViewsTabBar > > getDescriptorList ( MyViewsTabBar . class ) ;
public class CoreServiceImpl { /** * Inject a ServiceReference for the required / dynamic WsLocationAdmin service . */ @ Reference ( policy = ReferencePolicy . DYNAMIC ) protected void setLocation ( WsLocationAdmin locRef ) { } }
locServiceRef . set ( locRef ) ;
public class JmxServer { /** * Register the object parameter for exposure with JMX . The object passed in must have a { @ link JmxResource } * annotation or must implement { @ link JmxSelfNaming } . */ public synchronized ObjectName register ( Object obj ) throws JMException { } }
if ( mbeanServer == null ) { throw new JMException ( "JmxServer has not be started" ) ; } ObjectName objectName = ObjectNameUtil . makeObjectName ( obj ) ; ReflectionMbean mbean ; try { mbean = new ReflectionMbean ( obj , getObjectDescription ( obj ) ) ; } catch ( Exception e ) { throw createJmException ( "Could not bu...
public class DFA { /** * Calculates the maximum length of accepted string . Returns Integer . MAX _ VALUE * if length is infinite . For " if | while " returns 5 . For " a + " returns Integer . MAX _ VALUE . * @ return */ public int maxDepth ( ) { } }
Map < DFAState < T > , Integer > indexOf = new NumMap < > ( ) ; Map < DFAState < T > , Long > depth = new NumMap < > ( ) ; Deque < DFAState < T > > stack = new ArrayDeque < > ( ) ; maxDepth ( root , indexOf , stack , depth ) ; long d = depth . get ( root ) ; assert d >= 0 ; if ( d >= Integer . MAX_VALUE ) { return Inte...
public class Security { /** * Returns true if the requested attribute value is supported ; * otherwise , returns false . */ private static boolean isConstraintSatisfied ( String attribute , String value , String prop ) { } }
// For KeySize , prop is the max key size the // provider supports for a specific < crypto _ service > . < algorithm > . if ( attribute . equalsIgnoreCase ( "KeySize" ) ) { int requestedSize = Integer . parseInt ( value ) ; int maxSize = Integer . parseInt ( prop ) ; if ( requestedSize <= maxSize ) { return true ; } el...
public class LogLevelConverter { /** * Converts log level to a number . * @ param level a log level to convert . * @ return log level number value . */ public static int toInteger ( LogLevel level ) { } }
if ( level == LogLevel . Fatal ) return 1 ; if ( level == LogLevel . Error ) return 2 ; if ( level == LogLevel . Warn ) return 3 ; if ( level == LogLevel . Info ) return 4 ; if ( level == LogLevel . Debug ) return 5 ; if ( level == LogLevel . Trace ) return 6 ; return 0 ;
public class Nodes { /** * Extracts a Node ' s name , namespace URI ( if any ) and prefix as a * QName . */ public static QName getQName ( Node n ) { } }
String s = n . getLocalName ( ) ; String p = n . getPrefix ( ) ; return s != null ? new QName ( n . getNamespaceURI ( ) , s , p != null ? p : XMLConstants . DEFAULT_NS_PREFIX ) : new QName ( n . getNodeName ( ) ) ;
public class OptionSet { /** * Add a value option with the given key and separator , no details , and the default prefix and multiplicity * @ param key The key for the option * @ param separator The separator for the option * @ return The set instance itself ( to support invocation chaining for < code > addOption...
return addOption ( key , false , separator , true , defaultMultiplicity ) ;
public class DiscretizedCircle { /** * Computes the offsets for a discretized circle of the specified radius for an * image with the specified width . * @ param radius The radius of the circle in pixels . * @ param imgWidth The row step of the image * @ return A list of offsets that describe the circle */ publi...
double PI2 = Math . PI * 2.0 ; double circumference = PI2 * radius ; int num = ( int ) Math . ceil ( circumference ) ; num = num - num % 4 ; double angleStep = PI2 / num ; int temp [ ] = new int [ ( int ) Math . ceil ( circumference ) ] ; int i = 0 ; int prev = 0 ; for ( double ang = 0 ; ang < PI2 ; ang += angleStep ) ...
public class PerfStats { /** * Format all stats in the format specified . * @ param format serialization format * @ return serialized stats */ public static String getAllStats ( OutputFormat format ) { } }
StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; Collection < PerfStatEntry > stats = perfStats . get ( ) . values ( ) ; switch ( format ) { case JSON : sb . append ( '{' ) ; for ( PerfStatEntry entry : stats ) { if ( entry . count > 0 ) { if ( first ) { first = false ; } else { sb . append ( ',' ) ; }...
public class CmsSearchTab { /** * Handles the change event of the locale select box . < p > * @ param event the change event */ @ UiHandler ( "m_localeSelection" ) protected void onLocaleChange ( ValueChangeEvent < String > event ) { } }
String value = event . getValue ( ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( value ) || value . equals ( NOT_SET_OPTION_VALUE ) ) { value = m_currentLocale ; } m_tabHandler . setLocale ( value ) ;
public class UnitResponse { /** * data to Page */ @ SuppressWarnings ( "unused" ) public Page dataToPage ( ) { } }
if ( data instanceof String ) { return Page . create ( data . toString ( ) ) ; } if ( data instanceof JSONObject ) { return Page . create ( ( JSONObject ) data ) ; } if ( data instanceof Page ) { return ( Page ) data ; } throw new RuntimeException ( toString ( ) + " 不是page!" ) ;
public class SingleSessionIoHandlerDelegate { /** * Delegates the method call to the * { @ link SingleSessionIoHandler # sessionClosed ( ) } method of the handler * assigned to this session . */ public void sessionClosed ( IoSession session ) throws Exception { } }
SingleSessionIoHandler handler = ( SingleSessionIoHandler ) session . getAttribute ( HANDLER ) ; handler . sessionClosed ( ) ;
public class AbstractHttpFileBuilder { /** * Sets the { @ code " cache - control " } header . This method is a shortcut of : * < pre > { @ code * builder . setHeader ( HttpHeaderNames . CACHE _ CONTROL , cacheControl ) ; * } < / pre > */ public final B cacheControl ( CacheControl cacheControl ) { } }
requireNonNull ( cacheControl , "cacheControl" ) ; return setHeader ( HttpHeaderNames . CACHE_CONTROL , cacheControl ) ;
public class OSGiUtil { /** * only installs a bundle , if the bundle does not already exist , if the bundle exists the existing * bundle is unloaded first . the bundle is not stored physically on the system . * @ param factory * @ param context * @ param bundle * @ return * @ throws IOException * @ throws...
// store locally to test the bundle String name = System . currentTimeMillis ( ) + ".tmp" ; Resource dir = SystemUtil . getTempDirectory ( ) ; Resource tmp = dir . getRealResource ( name ) ; int count = 0 ; while ( tmp . exists ( ) ) tmp = dir . getRealResource ( ( count ++ ) + "_" + name ) ; IOUtil . copy ( bundleIS ,...
public class GetPlaceTrends { /** * Usage : java twitter4j . examples . trends . GetPlaceTrends [ WOEID = 0] * @ param args message */ public static void main ( String [ ] args ) { } }
try { int woeid = args . length > 0 ? Integer . parseInt ( args [ 0 ] ) : 1 ; Twitter twitter = new TwitterFactory ( ) . getInstance ( ) ; Trends trends = twitter . getPlaceTrends ( woeid ) ; System . out . println ( "Showing trends for " + trends . getLocation ( ) . getName ( ) ) ; for ( Trend trend : trends . getTren...
public class ByteBuddyExtension { /** * Returns the method name transformer to use . * @ return The method name transformer to use . */ public MethodNameTransformer getMethodNameTransformer ( ) { } }
return suffix == null || suffix . length ( ) == 0 ? MethodNameTransformer . Suffixing . withRandomSuffix ( ) : new MethodNameTransformer . Suffixing ( suffix ) ;
public class CmsEditSiteForm { /** * Checks if an alias was entered twice . < p > * @ param aliasName to check * @ return true if it was defined double */ boolean isDoubleAlias ( String aliasName ) { } }
CmsSiteMatcher testAlias = new CmsSiteMatcher ( aliasName ) ; int count = 0 ; for ( Component c : m_aliases ) { if ( c instanceof CmsRemovableFormRow < ? > ) { String alName = ( String ) ( ( CmsRemovableFormRow < ? extends AbstractField < ? > > ) c ) . getInput ( ) . getValue ( ) ; if ( testAlias . equals ( new CmsSite...
public class Sanitizers { /** * Converts the input to HTML by entity escaping , stripping tags in sanitized content so the * result can safely be embedded in an HTML attribute value . */ public static String escapeHtmlAttribute ( SoyValue value ) { } }
value = normalizeNull ( value ) ; if ( isSanitizedContentOfKind ( value , SanitizedContent . ContentKind . HTML ) ) { // | escapeHtmlAttribute should only be used on attribute values that cannot have tags . return stripHtmlTags ( value . coerceToString ( ) , null , true ) ; } return escapeHtmlAttribute ( value . coerce...
public class FlowCatalog { /** * Persist { @ link Spec } into { @ link SpecStore } and notify { @ link SpecCatalogListener } if triggerListener * is set to true . * @ param spec The Spec to be added * @ param triggerListener True if listeners should be notified . * @ return */ public Map < String , AddSpecRespo...
Map < String , AddSpecResponse > responseMap = new HashMap < > ( ) ; try { Preconditions . checkState ( state ( ) == State . RUNNING , String . format ( "%s is not running." , this . getClass ( ) . getName ( ) ) ) ; Preconditions . checkNotNull ( spec ) ; long startTime = System . currentTimeMillis ( ) ; log . info ( S...
public class UpdateCompanyNetworkConfigurationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateCompanyNetworkConfigurationRequest updateCompanyNetworkConfigurationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateCompanyNetworkConfigurationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateCompanyNetworkConfigurationRequest . getFleetArn ( ) , FLEETARN_BINDING ) ; protocolMarshaller . marshall ( updateCompanyNetworkConfigurat...
public class WebSocketNode { /** * 获取在线用户总数 * @ return boolean */ public CompletableFuture < Integer > getUserSize ( ) { } }
if ( this . localEngine != null && this . sncpNodeAddresses == null ) { return CompletableFuture . completedFuture ( this . localEngine . getLocalUserSize ( ) ) ; } tryAcquireSemaphore ( ) ; CompletableFuture < Integer > rs = this . sncpNodeAddresses . queryKeysStartsWithAsync ( SOURCE_SNCP_USERID_PREFIX ) . thenApply ...
public class AmazonEC2Client { /** * Deletes a route from a Client VPN endpoint . You can only delete routes that you manually added using the * < b > CreateClientVpnRoute < / b > action . You cannot delete routes that were automatically added when associating a * subnet . To remove routes that have been automatica...
request = beforeClientExecution ( request ) ; return executeDeleteClientVpnRoute ( request ) ;
public class DirContextAdapter { /** * { @ inheritDoc } */ @ Override public ModificationItem [ ] getModificationItems ( ) { } }
if ( ! updateMode ) { return new ModificationItem [ 0 ] ; } List < ModificationItem > tmpList = new LinkedList < ModificationItem > ( ) ; NamingEnumeration < ? extends Attribute > attributesEnumeration = null ; try { attributesEnumeration = updatedAttrs . getAll ( ) ; // find attributes that have been changed , removed...
public class VoiceApi { /** * Perform a single - step conference to the specified destination . This adds the destination to the * existing call , creating a conference if necessary . * @ param connId The connection ID of the call to conference . * @ param destination The number to add to the call . * @ param u...
this . singleStepConference ( connId , destination , null , userData , null , null ) ;
public class WebSink { /** * Helper to prefix metric names , convert metric value to double and return as map * @ param prefix * @ param metrics * @ return Map of metric name to metric value */ static Map < String , Double > processMetrics ( String prefix , Iterable < MetricsInfo > metrics ) { } }
Map < String , Double > map = new HashMap < > ( ) ; for ( MetricsInfo r : metrics ) { try { map . put ( prefix + r . getName ( ) , Double . valueOf ( r . getValue ( ) ) ) ; } catch ( NumberFormatException ne ) { LOG . log ( Level . SEVERE , "Could not parse metric, Name: " + r . getName ( ) + " Value: " + r . getValue ...
public class SuppressCode { /** * Suppress all fields for these classes . */ public static synchronized void suppressField ( Class < ? > [ ] classes ) { } }
if ( classes == null || classes . length == 0 ) { throw new IllegalArgumentException ( "You must supply at least one class." ) ; } for ( Class < ? > clazz : classes ) { suppressField ( clazz . getDeclaredFields ( ) ) ; }
public class DevicesInner { /** * Scans for updates on a data box edge / gateway device . * @ param deviceName The device name . * @ param resourceGroupName The resource group name . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentExcepti...
return ServiceFuture . fromResponse ( scanForUpdatesWithServiceResponseAsync ( deviceName , resourceGroupName ) , serviceCallback ) ;
public class Scope { /** * If { @ code key } is not already associated with a value , associates it with { @ code value } . * @ return the original value , or { @ code null } if there was no value associated */ public < V > V putIfAbsent ( Key < V > key , V value ) { } }
requireNonNull ( key ) ; requireNonNull ( value ) ; if ( canStore ( key ) ) { @ SuppressWarnings ( "unchecked" ) V existingValue = ( V ) entries . get ( key ) ; if ( value == RECURSION_SENTINEL ) { throw new ConcurrentModificationException ( "Cannot access scope key " + key + " while computing its value" ) ; } else if ...
public class DFA2ETFWriter { /** * Write DFA specific parts in the ETF . * - initial state , * - the valuations for the state ' id ' , * - the letters in the alphabet , * - the transitions , * - the state labels ( rejecting / accepting ) , * - the mapping from states to state labels . * @ param pw the Wri...
writeETFInternal ( pw , dfa , inputs ) ;
public class CmsXmlContentEditor { /** * Makes sure the requested locale node is present in the content document * by either copying an existing locale node or creating an empty one . < p > * @ param locale the requested locale * @ return the locale */ protected Locale ensureLocale ( Locale locale ) { } }
// get the default locale for the resource List < Locale > locales = OpenCms . getLocaleManager ( ) . getDefaultLocales ( getCms ( ) , getParamResource ( ) ) ; if ( m_content != null ) { if ( ! m_content . hasLocale ( locale ) ) { try { // to copy anything we need at least one locale if ( ( m_content . getLocales ( ) ....
public class PTBConstituent { /** * setter for nullElement - sets * @ generated * @ param v value to set into the feature */ public void setNullElement ( String v ) { } }
if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_nullElement == null ) jcasType . jcas . throwFeatMissing ( "nullElement" , "de.julielab.jules.types.PTBConstituent" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_nullElement , v...
public class AndroidMobileCommandHelper { /** * This method forms a { @ link Map } of parameters for the element * value replacement . It is used against input elements * @ param remoteWebElement an instance which contains an element ID * @ param value a new value * @ return a key - value pair . The key is the ...
String [ ] parameters = new String [ ] { "id" , "value" } ; Object [ ] values = new Object [ ] { remoteWebElement . getId ( ) , value } ; return new AbstractMap . SimpleEntry < > ( REPLACE_VALUE , prepareArguments ( parameters , values ) ) ;