signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class StringUtils { /** * < p > Finds the first index within a String , handling < code > null < / code > . * This method uses { @ link String # indexOf ( String , int ) } . < / p > * < p > A < code > null < / code > String will return < code > - 1 < / code > . * A negative start position is treated as zer...
if ( str == null || searchStr == null ) { return INDEX_NOT_FOUND ; } // JDK1.2 / JDK1.3 have a bug , when startPos > str . length for " " , hence if ( searchStr . length ( ) == 0 && startPos >= str . length ( ) ) { return str . length ( ) ; } return str . indexOf ( searchStr , startPos ) ;
public class CookieHelper { /** * Gets the value of the cookie having the given name . The cookie is looked from the given cookies set . * @ param name the name of the cookie * @ param cookies the set of cookie * @ return the value of the cookie , { @ literal null } if there are no cookie with the given name in t...
Cookie c = cookies . get ( name ) ; if ( c != null ) { return c . value ( ) ; } return null ;
public class FileMessageSet { /** * Recover log up to the last complete entry . Truncate off any bytes from any incomplete * messages written * @ throws IOException any exception */ private long recover ( ) throws IOException { } }
checkMutable ( ) ; long len = channel . size ( ) ; ByteBuffer buffer = ByteBuffer . allocate ( 4 ) ; long validUpTo = 0 ; long next = 0L ; do { next = validateMessage ( channel , validUpTo , len , buffer ) ; if ( next >= 0 ) validUpTo = next ; } while ( next >= 0 ) ; channel . truncate ( validUpTo ) ; setSize . set ( v...
public class CmsWorkplace { /** * Returns the URI to static resources served from the class path . < p > * @ param resourceName the resource name * @ param versionInfo add an additional version info parameter to avoid browser caching issues * @ return the URI */ public static String getStaticResourceUri ( String ...
resourceName = CmsStaticResourceHandler . removeStaticResourcePrefix ( resourceName ) ; String uri = CmsStringUtil . joinPaths ( OpenCms . getSystemInfo ( ) . getStaticResourceContext ( ) , resourceName ) ; if ( versionInfo != null ) { uri += "?v=" + versionInfo ; } return uri ;
public class MathUtil { /** * Quadrary min , < i > without < / i > handling of special values . * Because of the lack of special case handling , this is faster than * { @ link Math # min } . But usually , it should be written inline . * @ param a First value * @ param b Second value * @ param c Third value ...
return a <= b ? a <= c ? ( a <= d ? a : d ) : ( c <= d ? c : d ) : b <= c ? ( b <= d ? b : d ) : ( c <= d ? c : d ) ;
public class AbstractLayoutManager { /** * Sets a default style for every element that doesn ' t have one * @ throws JRException */ protected void ensureDJStyles ( ) { } }
// first of all , register all parent styles if any for ( Style style : getReport ( ) . getStyles ( ) . values ( ) ) { addStyleToDesign ( style ) ; } Style defaultDetailStyle = getReport ( ) . getOptions ( ) . getDefaultDetailStyle ( ) ; Style defaultHeaderStyle = getReport ( ) . getOptions ( ) . getDefaultHeaderStyle ...
public class SelectExampleAction { /** * { @ inheritDoc } */ @ Override public void execute ( final ActionEvent event ) { } }
ExampleData data = ( ExampleData ) event . getActionObject ( ) ; WComponent source = ( WComponent ) event . getSource ( ) ; TreePicker picker = WebUtilities . getAncestorOfClass ( TreePicker . class , source ) ; picker . selectExample ( data ) ; MenuPanel panel = WebUtilities . getAncestorOfClass ( MenuPanel . class , ...
public class AbstractBridgeSession { /** * Behave similarly to connection reset by peer at NIO layer . This method should be called * from handlers ' exceptionCaught method instead of calling fireExceptionCaught and * IoProcessor . remove , because the latter will fail if we ' re not on its IO thread . * @ param ...
if ( cause == null ) { throw new NullPointerException ( "cause must not be null in AbstractBridgeSession.reset" ) ; } if ( ! isIoAligned ( ) || getIoThread ( ) == Thread . currentThread ( ) ) { reset0 ( cause ) ; } else { getIoExecutor ( ) . execute ( new Runnable ( ) { @ Override public void run ( ) { reset0 ( cause )...
public class ProcessClosureProvidesAndRequires { /** * Rewrites all provides and requires in the given namespace . * < p > Call this instead of { @ link # collectProvidedNames ( Node , Node ) } if you want rewriting . */ void rewriteProvidesAndRequires ( Node externs , Node root ) { } }
checkState ( ! hasRewritingOccurred , "Cannot call rewriteProvidesAndRequires twice per instance" ) ; hasRewritingOccurred = true ; collectProvidedNames ( externs , root ) ; for ( ProvidedName pn : providedNames . values ( ) ) { pn . replace ( ) ; } deleteNamespaceInitializationsFromPreviousProvides ( ) ; if ( requires...
public class ItemRule { /** * Puts the specified value with the specified key to this Map type item . * @ param name the value name ; may be null * @ param text the value to be analyzed for use as the value of this item * @ see # putValue ( String , Token [ ] ) */ public void putValue ( String name , String text ...
Token [ ] tokens = TokenParser . makeTokens ( text , isTokenize ( ) ) ; putValue ( name , tokens ) ;
public class ChargeOperations { /** * Confirms a charge that was made with the option capture set to false . */ public Charge confirmCapture ( final ConfirmCaptureParams params ) throws OpenpayServiceException , ServiceUnavailableException { } }
String path = String . format ( CAPTURE_FOR_MERCHANT_PATH , this . getMerchantId ( ) , params . getChargeId ( ) ) ; return this . getJsonClient ( ) . post ( path , params . asMap ( ) , Charge . class ) ;
public class CharsetIssues { /** * implements the visitor to look for method calls that take a parameter that either represents a encoding via a string , or takes a Charset . If the method * can take both , and a string is presented for a standard charset available in jdk 7 , and the code is compiled against 7 , then...
try { stack . precomputation ( this ) ; switch ( seen ) { case Const . INVOKESPECIAL : case Const . INVOKESTATIC : case Const . INVOKEINTERFACE : case Const . INVOKEVIRTUAL : String encoding = null ; String className = getClassConstantOperand ( ) ; String methodName = getNameConstantOperand ( ) ; String methodSig = get...
public class FieldMap9 { /** * { @ inheritDoc } */ @ Override protected FieldItem [ ] getDefaultTaskData ( ) { } }
FieldItem [ ] result = new FieldItem [ ] { new FieldItem ( TaskField . UNIQUE_ID , FieldLocation . FIXED_DATA , 0 , 0 , 0 , 0 , 0 ) , new FieldItem ( TaskField . ID , FieldLocation . FIXED_DATA , 0 , 4 , 0 , 0 , 0 ) , new FieldItem ( TaskField . EARLY_FINISH , FieldLocation . FIXED_DATA , 0 , 8 , 0 , 0 , 0 ) , new Fiel...
public class GrailsASTUtils { /** * Returns a map containing the names and types of the given association type . eg . GrailsDomainClassProperty . HAS _ MANY * @ param classNode The target class ndoe * @ param associationType The associationType * @ return A map */ public static Map < String , ClassNode > getAssoc...
PropertyNode property = classNode . getProperty ( associationType ) ; Map < String , ClassNode > associationMap = new HashMap < String , ClassNode > ( ) ; if ( property != null && property . isStatic ( ) ) { Expression e = property . getInitialExpression ( ) ; if ( e instanceof MapExpression ) { MapExpression me = ( Ma...
public class CommerceShippingFixedOptionPersistenceImpl { /** * Clears the cache for all commerce shipping fixed options . * The { @ link EntityCache } and { @ link FinderCache } are both cleared by this method . */ @ Override public void clearCache ( ) { } }
entityCache . clearCache ( CommerceShippingFixedOptionImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ;
public class OASValidator { /** * { @ inheritDoc } */ @ Override public void addValidationEvent ( ValidationEvent event ) { } }
if ( result != null && event != null ) { result . getEvents ( ) . add ( event ) ; }
public class Filelistener { /** * This is a helper method that let ' s you initialize mFilelistenerToPaths * with all the filelisteners that have been stored in the filesystem . * @ param pListenerFilePaths * @ throws IOException */ private static void getFileListenersFromSystem ( File pListenerFilePaths ) throws...
if ( ! pListenerFilePaths . exists ( ) ) { java . nio . file . Files . createFile ( pListenerFilePaths . toPath ( ) ) ; } else { byte [ ] bytes = java . nio . file . Files . readAllBytes ( pListenerFilePaths . toPath ( ) ) ; ByteArrayDataInput input = ByteStreams . newDataInput ( bytes ) ; String key ; while ( ( key = ...
public class Graphics { /** * Draw an oval to the canvas * @ param x1 * The x coordinate of the top left corner of a box containing * the oval * @ param y1 * The y coordinate of the top left corner of a box containing * the oval * @ param width * The width of the oval * @ param height * The height o...
drawArc ( x1 , y1 , width , height , segments , 0 , 360 ) ;
public class ServletUtil { /** * 设定返回给客户端的Cookie < br > * Path : " / " < br > * No Domain * @ param response 响应对象 { @ link HttpServletResponse } * @ param name cookie名 * @ param value cookie值 * @ param maxAgeInSeconds - 1 : 关闭浏览器清除Cookie . 0 : 立即清除Cookie . & gt ; 0 : Cookie存在的秒数 . */ public final static voi...
addCookie ( response , name , value , maxAgeInSeconds , "/" , null ) ;
public class XsdAsmInterfaces { /** * Creates the inner classes that are used to support the sequence behaviour and the respective sequence methods . * @ param className The name of the class which contains the sequence . * @ param typeName The name of the next type to return . * @ param apiName The name of the g...
ClassWriter classWriter = generateInnerSequenceClass ( typeName , className , apiName ) ; sequenceElements . forEach ( sequenceElement -> generateSequenceMethod ( classWriter , className , getJavaType ( sequenceElement . getType ( ) ) , getCleanName ( sequenceElement . getName ( ) ) , typeName , nextTypeName , apiName ...
public class AsyncReadResultProcessor { /** * Processes the given ReadResult using the given AsyncReadResultHandler . * @ param readResult The ReadResult to process . * @ param entryHandler An AsyncReadResultHandler to be used for callbacks . * @ param executor An Executor to run asynchronous tasks on . * @ ret...
Preconditions . checkNotNull ( executor , "executor" ) ; AsyncReadResultProcessor processor = new AsyncReadResultProcessor ( readResult , entryHandler ) ; processor . processResult ( executor ) ; return processor ;
public class WorkflowTemplateServiceClient { /** * Lists workflows that match the specified filter in the request . * < p > Sample code : * < pre > < code > * try ( WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient . create ( ) ) { * RegionName parent = RegionName . of ...
ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . build ( ) ; return listWorkflowTemplates ( request ) ;
public class DynamoDBReflector { /** * Returns the set of getter methods which are relevant when marshalling or * unmarshalling an object . */ Collection < Method > getRelevantGetters ( Class < ? > clazz ) { } }
synchronized ( getterCache ) { if ( ! getterCache . containsKey ( clazz ) ) { List < Method > relevantGetters = new LinkedList < Method > ( ) ; for ( Method m : clazz . getMethods ( ) ) { if ( isRelevantGetter ( m ) ) { relevantGetters . add ( m ) ; } } getterCache . put ( clazz , relevantGetters ) ; } } return getterC...
public class ExtensionsInner { /** * Disables the Operations Management Suite ( OMS ) on the HDInsight cluster . * @ param resourceGroupName The name of the resource group . * @ param clusterName The name of the cluster . * @ param serviceCallback the async ServiceCallback to handle successful and failed response...
return ServiceFuture . fromResponse ( beginDisableMonitoringWithServiceResponseAsync ( resourceGroupName , clusterName ) , serviceCallback ) ;
public class Input { /** * Reads a string of a set length . This does not use the string reference table . * @ param length the length of the string * @ return String */ public String readString ( int length ) { } }
log . debug ( "readString - length: {}" , length ) ; int limit = buf . limit ( ) ; final ByteBuffer strBuf = buf . buf ( ) ; strBuf . limit ( strBuf . position ( ) + length ) ; final String string = AMF . CHARSET . decode ( strBuf ) . toString ( ) ; log . debug ( "String: {}" , string ) ; buf . limit ( limit ) ; // che...
public class ObjectReferenceDescriptor { /** * Returns an Object array of all FK field values of the specified object . * If the specified object is an unmaterialized Proxy , it will be materialized * to read the FK values . * @ throws MetadataException if an error occours while accessing ForeingKey values on obj...
FieldDescriptor [ ] fks = getForeignKeyFieldDescriptors ( mif ) ; // materialize object only if FK fields are declared if ( fks . length > 0 ) obj = ProxyHelper . getRealObject ( obj ) ; Object [ ] result = new Object [ fks . length ] ; for ( int i = 0 ; i < result . length ; i ++ ) { FieldDescriptor fmd = fks [ i ] ; ...
public class DOValidatorImpl { /** * Validates a digital object . * @ param objectAsStream * The digital object provided as a stream . * @ param format * The format URI of the object serialization . * @ param validationType * The level of validation to perform on the digital object . This is * an integer ...
if ( validationType == VALIDATE_NONE ) return ; checkFormat ( format ) ; switch ( validationType ) { case VALIDATE_NONE : break ; case VALIDATE_ALL : try { // FIXME We need to use the object Inputstream twice , once for XML // Schema validation and once for Schematron validation . // We may want to consider implementin...
public class Storage { /** * Opens a new { @ link MetaStore } , recovering metadata from disk if it exists . * The meta store will be loaded using based on the configured { @ link StorageLevel } . If the storage level is persistent * then the meta store will be loaded from disk , otherwise a new meta store will be ...
return new MetaStore ( name , this , ThreadContext . currentContextOrThrow ( ) . serializer ( ) . clone ( ) ) ;
public class TransactionContextImpl { /** * { @ inheritDoc } */ @ Override public void taskStarting ( ) throws RejectedExecutionException { } }
if ( suspendTranOfExecutionThread ) { // Suspend whatever is currently on the thread . try { UOWManager uowManager = UOWManagerFactory . getUOWManager ( ) ; suspendedUOW = uowManager . suspend ( ) ; } catch ( com . ibm . ws . uow . embeddable . SystemException e ) { } // begin a local transaction . LocalTransactionCurr...
public class InternalListenerIntrospector { /** * Validates the given method to ensure if it is a valid callback method for the given event type . * @ param method * the method to validate * @ param callbackType * the callback type */ private void validateMethod ( Method method , CallbackType callbackType ) { }...
int modifiers = method . getModifiers ( ) ; if ( ! Modifier . isPublic ( modifiers ) ) { String message = String . format ( "Method %s in class %s must be public" , method . getName ( ) , method . getDeclaringClass ( ) . getName ( ) ) ; throw new EntityManagerException ( message ) ; } if ( Modifier . isStatic ( modifie...
public class ContentSpecValidator { /** * Validates that a Content Specification is valid by checking the META data , child levels and topics . * @ param contentSpec The content specification to be validated . * @ param username The user who requested the content spec validation . * @ return True if the content s...
// Check if the app should be shutdown if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } boolean valid = true ; // If editing then check that the ID exists & the CHECKSUM / SpecRevision match if ( contentSpec . getId ( ) != null ) { ContentSpecWrapper contentSpecEntity = null ; String serverC...
public class ClusterOrder { /** * Get the predecessor . * @ param id Current id . * @ param out Output variable to store the predecessor . */ public void getPredecessor ( DBIDRef id , DBIDVar out ) { } }
if ( predecessor == null ) { out . unset ( ) ; return ; } predecessor . assignVar ( id , out ) ;
public class MeshHeading { /** * setter for descriptorNameMajorTopic - sets see MeSH * @ generated * @ param v value to set into the feature */ public void setDescriptorNameMajorTopic ( boolean v ) { } }
if ( MeshHeading_Type . featOkTst && ( ( MeshHeading_Type ) jcasType ) . casFeat_descriptorNameMajorTopic == null ) jcasType . jcas . throwFeatMissing ( "descriptorNameMajorTopic" , "de.julielab.jules.types.MeshHeading" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( MeshHeading_Type ) jcasType ) . casFeatCode_...
public class EntityImpl { /** * If not already created , a new < code > named - stored - procedure - query < / code > element will be created and returned . * Otherwise , the first existing < code > named - stored - procedure - query < / code > element will be returned . * @ return the instance defined for the elem...
List < Node > nodeList = childNode . get ( "named-stored-procedure-query" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new NamedStoredProcedureQueryImpl < Entity < T > > ( this , "named-stored-procedure-query" , childNode , nodeList . get ( 0 ) ) ; } return createNamedStoredProcedureQuery ( ) ;
public class IntTupleCollections { /** * Create the specified number of tuples with the given dimensions * ( { @ link Tuple # getSize ( ) size } ) , all initialized to zero , and * return them as a list * @ param dimensions The dimensions ( { @ link Tuple # getSize ( ) size } ) * of the tuples to create * @ p...
List < MutableIntTuple > list = new ArrayList < MutableIntTuple > ( numElements ) ; create ( dimensions , numElements , list ) ; return list ;
public class ClassFileWriter { /** * Add a pc as the start of super block . * A pc is the beginning of a super block if : - pc = = 0 - it is the target of a branch instruction * - it is the beginning of an exception handler - it is directly after an unconditional jump */ private void addSuperBlockStart ( int pc ) {...
if ( GenerateStackMap ) { if ( itsSuperBlockStarts == null ) { itsSuperBlockStarts = new int [ SuperBlockStartsSize ] ; } else if ( itsSuperBlockStarts . length == itsSuperBlockStartsTop ) { int [ ] tmp = new int [ itsSuperBlockStartsTop * 2 ] ; System . arraycopy ( itsSuperBlockStarts , 0 , tmp , 0 , itsSuperBlockStar...
public class TreeGraphNode { /** * Uses the specified { @ link HeadFinder < code > HeadFinder < / code > } * to determine the heads for this node and all its descendants , * and to store references to the head word node and head tag node * in this node ' s { @ link CyclicCoreLabel < code > CyclicCoreLabel < / cod...
if ( isLeaf ( ) ) { TreeGraphNode hwn = headWordNode ( ) ; if ( hwn == null ) { setHeadWordNode ( this ) ; } } else { for ( Tree child : children ( ) ) { child . percolateHeads ( hf ) ; } TreeGraphNode head = safeCast ( hf . determineHead ( this , parent ) ) ; if ( head != null ) { TreeGraphNode hwn = head . headWordNo...
public class DecimalFormat { /** * Set the positive prefix . * < P > Examples : + 123 , $ 123 , sFr123 * @ param newValue the new positive prefix */ public void setPositivePrefix ( String newValue ) { } }
positivePrefix = newValue ; posPrefixPattern = null ; positivePrefixFieldPositions = null ; fastPathCheckNeeded = true ;
public class ByteBuffer { /** * Writes the given int to the specified index of this buffer . * The int is converted to bytes using the current byte order . The position is not changed . * @ param index the index , must not be negative and equal or less than { @ code limit - 4 } . * @ param value the int to write ...
if ( order == ByteOrder . BIG_ENDIAN ) { for ( int i = 3 ; i >= 0 ; i -- ) { byteArray . set ( baseOffset + i , ( byte ) ( value & 0xFF ) ) ; value = value >> 8 ; } } else { for ( int i = 0 ; i <= 3 ; i ++ ) { byteArray . set ( baseOffset + i , ( byte ) ( value & 0xFF ) ) ; value = value >> 8 ; } } return this ;
public class DateTimeUtils { /** * Gets the interval handling null . * If the interval is < code > null < / code > , an interval representing now * to now in the { @ link ISOChronology # getInstance ( ) ISOChronology } * will be returned . Otherwise , the interval specified is returned . * @ param interval the ...
if ( interval == null ) { long now = DateTimeUtils . currentTimeMillis ( ) ; interval = new Interval ( now , now ) ; } return interval ;
public class Ekstazi { /** * Initializes this facade . This method should be invoked only once . * The following steps are performed : 1 ) load configuration , 2 ) establish if * this Tool is enabled , 3 ) set paths needed for instrumentation ( if * instrumentation is enabled and agent is not already present ) . ...
// Load configuration . Config . loadConfig ( ) ; // Initialize storer , hashes , and analyzer . mDependencyAnalyzer = Config . createDepenencyAnalyzer ( ) ; // Establish if Tool is enabled . boolean isEnabled = establishIfEnabled ( ) ; // Return if not enabled or code should not be instrumented . if ( ! isEnabled || !...
public class ClientAppBase { /** * < p > The non - static method to print a log message to the console . < / p > * < p > This method will automatically use the name of the current class as class name . < / p > * @ param msg The log message that needs to be printed . * @ param args The arguments that may be needed...
printLogStatic ( this . getClass ( ) . getSimpleName ( ) , msg , args ) ;
public class StateRunner { /** * Defines the initial state of the state machine . * @ param stateClass * @ throws InitializationException */ @ Override public void init ( final Class < ? extends State > stateClass ) throws InitializationException { } }
try { currentState = getState ( stateClass ) ; change . firePropertyChange ( STATE_CHANGE , null , currentState . getClass ( ) ) ; } catch ( NotAvailableException ex ) { throw new InitializationException ( this , ex ) ; }
public class OptionValueImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case SimpleAntlrPackage . OPTION_VALUE__KEY : return getKey ( ) ; case SimpleAntlrPackage . OPTION_VALUE__VALUE : return getValue ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class KeyedStream { /** * Publishes the keyed stream as a queryable FoldingState instance . * @ param queryableStateName Name under which to the publish the queryable state instance * @ param stateDescriptor State descriptor to create state instance from * @ return Queryable state instance * @ deprecated...
transform ( "Queryable state: " + queryableStateName , getType ( ) , new QueryableAppendingStateOperator < > ( queryableStateName , stateDescriptor ) ) ; stateDescriptor . initializeSerializerUnlessSet ( getExecutionConfig ( ) ) ; return new QueryableStateStream < > ( queryableStateName , stateDescriptor , getKeyType (...
public class ReflectExtensions { /** * Sets the given value on an the receivers ' s accessible field with the given name . * @ param receiver the receiver , never < code > null < / code > * @ param fieldName the field ' s name , never < code > null < / code > * @ param value the value to set * @ throws NoSuchFi...
Preconditions . checkNotNull ( receiver , "receiver" ) ; Preconditions . checkNotNull ( fieldName , "fieldName" ) ; Class < ? extends Object > clazz = receiver . getClass ( ) ; Field f = getDeclaredField ( clazz , fieldName ) ; if ( ! f . isAccessible ( ) ) f . setAccessible ( true ) ; f . set ( receiver , value ) ;
public class GameContainer { /** * Update and render the game * @ param delta The change in time since last update and render * @ throws SlickException Indicates an internal fault to the game . */ protected void updateAndRender ( int delta ) throws SlickException { } }
if ( smoothDeltas ) { if ( getFPS ( ) != 0 ) { delta = 1000 / getFPS ( ) ; } } input . poll ( width , height ) ; Music . poll ( delta ) ; if ( ! paused ) { storedDelta += delta ; if ( storedDelta >= minimumLogicInterval ) { try { if ( maximumLogicInterval != 0 ) { long cycles = storedDelta / maximumLogicInterval ; for ...
public class MessageAPI { /** * 高级群发 构成 MassMPvideoMessage 对象的前置请求接口 * @ param access _ token access _ token * @ param uploadvideo uploadvideo * @ return Media */ public static Media mediaUploadvideo ( String access_token , Uploadvideo uploadvideo ) { } }
return MediaAPI . mediaUploadvideo ( access_token , uploadvideo ) ;
public class nsip { /** * Use this API to enable nsip of given name . */ public static base_response enable ( nitro_service client , String ipaddress ) throws Exception { } }
nsip enableresource = new nsip ( ) ; enableresource . ipaddress = ipaddress ; return enableresource . perform_operation ( client , "enable" ) ;
public class JobsImpl { /** * Lists the jobs that have been created under the specified job schedule . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList &...
return listFromJobScheduleNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponseWithHeaders < Page < CloudJob > , JobListFromJobScheduleHeaders > , Page < CloudJob > > ( ) { @ Override public Page < CloudJob > call ( ServiceResponseWithHeaders < Page < CloudJob > , JobListFromJobScheduleHeade...
public class MapComposedElement { /** * Insert the specified point at the given index in the specified group . * @ param point is the point to insert * @ param indexGroup is the index of the group * @ param indexInGroup is the index of the ponit in the group ( 0 for the * first point of the group . . . ) . * ...
return insertPointAt ( point . getX ( ) , point . getY ( ) , indexGroup , indexInGroup ) ;
public class ConfigClient { /** * Creates a sink that exports specified log entries to a destination . The export of * newly - ingested log entries begins immediately , unless the sink ' s ` writer _ identity ` is not * permitted to write to the destination . A sink can export log entries only from the resource *...
CreateSinkRequest request = CreateSinkRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setSink ( sink ) . build ( ) ; return createSink ( request ) ;
public class TextUtil { /** * Extracts the extension of the file . * @ param filename file name * @ return extension or emtpy string if file has no extension */ public static String getExtension ( String filename ) { } }
int index = filename . lastIndexOf ( '.' ) ; if ( index >= 0 ) { return filename . substring ( index + 1 ) ; } return "" ;
public class DJResult { /** * Returns the object pointed by the result - type parameter " parameters " * @ param _ invocation * @ return */ protected Map getParametersMap ( ActionInvocation _invocation ) { } }
Map map = ( Map ) _invocation . getStack ( ) . findValue ( this . parameters ) ; if ( map == null ) map = new HashMap ( ) ; return map ;
public class TraceImpl { /** * Event tracing when a throwable is caught in a static class . * @ param sourceClass The type of class which called this method * @ param methodName The method where the event took place * @ param throwable The exception to trace */ public final void event ( Class sourceClass , String...
internalEvent ( null , sourceClass , methodName , throwable ) ;
public class XMLBuilder { /** * Same as above but using an attribute set . */ public void addDataElement ( String elemName , String content , Attributes attrs ) { } }
writeDataElement ( elemName , attrs , content ) ;
public class MessageTransport { /** * GetMessageTransport Method . */ public MessageTransport getMessageTransport ( String strMessageTransport ) { } }
if ( ( strMessageTransport == null ) || ( strMessageTransport . length ( ) == 0 ) ) return null ; if ( Utility . isNumeric ( strMessageTransport ) ) { this . setKeyArea ( MessageTransport . ID_KEY ) ; this . getField ( MessageTransport . ID ) . setString ( strMessageTransport ) ; } else { this . setKeyArea ( MessageTra...
public class Validators { /** * Creates and returns a validator , which allows to validate texts to ensure , that they are * equal to the text , which is contained by an { @ link EditText } widget . * @ param context * The context , which should be used to retrieve the error message , as an instance of * the cl...
return new EqualValidator ( context , R . string . default_error_message , editText ) ;
public class Gather { /** * Returns a new { @ link Gather } that applies a function to each element of this delegate as they are retrieved . */ public < R > Gather < R > map ( final Function < ? super T , ? extends R > function ) { } }
return from ( Iterators . transform ( each ( ) . iterator ( ) , function ) ) ;
public class HttpConnection { /** * 设置请求头 < br > * 当请求头存在时 , 覆盖之 * @ param header 头名 * @ param value 头值 * @ param isOverride 是否覆盖旧值 * @ return HttpConnection */ public HttpConnection header ( Header header , String value , boolean isOverride ) { } }
return header ( header . toString ( ) , value , isOverride ) ;
public class TableRow { /** * Add a span across rows * @ param rowIndex the index of the first row * @ param n the number of rows in the span * @ throws IOException if the cells can ' t be merged */ public void setRowsSpanned ( final int rowIndex , final int n ) throws IOException { } }
if ( n <= 1 ) return ; final TableCell firstCell = this . getOrCreateCell ( rowIndex ) ; if ( firstCell . isCovered ( ) ) return ; this . parent . setRowsSpanned ( this . rowIndex , rowIndex , n ) ;
public class OssIndexAnalyzer { /** * Batch request component - reports for all dependencies . */ private Map < PackageUrl , ComponentReport > requestReports ( final Dependency [ ] dependencies ) throws Exception { } }
log . debug ( "Requesting component-reports for {} dependencies" , dependencies . length ) ; // create requests for each dependency which has a PURL identifier List < PackageUrl > packages = new ArrayList < > ( ) ; for ( Dependency dependency : dependencies ) { for ( Identifier id : dependency . getSoftwareIdentifiers ...
public class ImageSizeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setUNITBASE ( Integer newUNITBASE ) { } }
Integer oldUNITBASE = unitbase ; unitbase = newUNITBASE ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . IMAGE_SIZE__UNITBASE , oldUNITBASE , unitbase ) ) ;
public class WmsServerExtension { /** * Get the value for a specific WMS hint . All hints have a default value , so this method will never return * < code > null < / code > . * @ param hint The hint to retrieve the current value for . * @ return The map hint value . */ @ SuppressWarnings ( "unchecked" ) public < ...
return ( T ) hintValues . get ( hint ) ;
public class CurrentAddressTypeUnmarshaller { /** * Helper method to { @ link # getNamespaceBindings ( Element ) } * @ param element * the element to parse * @ param namespaceMap * the map to fill */ private static void getNamespaceBindings ( Element element , Map < String , String > namespaceMap ) { } }
if ( element == null ) { return ; } NamedNodeMap attrs = element . getAttributes ( ) ; for ( int i = 0 ; i < attrs . getLength ( ) ; i ++ ) { Node node = attrs . item ( i ) ; String name = node . getNodeName ( ) ; if ( ( name != null && ( XMLConstants . XMLNS_ATTRIBUTE . equals ( name ) || name . startsWith ( XMLConsta...
public class GenericDenseDescribeImageDense { /** * Configures size of the descriptor and the frequency at which it ' s computed * @ param descriptorRegionScale Relative size of the descriptor region to its canonical size * @ param periodX Period in pixels along x - axis of samples * @ param periodY Period in pix...
this . radius = descriptorRegionScale * scaleToRadius ; this . periodX = ( int ) ( periodX + 0.5 ) ; this . periodY = ( int ) ( periodY + 0.5 ) ; this . featureWidth = ( int ) ( alg . getCanonicalWidth ( ) * descriptorRegionScale + 0.5 ) ; descriptions = new FastQueue < Desc > ( alg . getDescriptionType ( ) , true ) { ...
public class AbstractCollectionBindTransform { /** * Generate parse on jackson internal . * @ param context * the context * @ param methodBuilder * the method builder * @ param parserName * the parser name * @ param beanClass * the bean class * @ param beanName * the bean name * @ param property ...
TypeName elementTypeName = extractTypeParameterName ( property ) ; // @ formatter : off methodBuilder . beginControlFlow ( "if ($L.currentToken()==$T.START_ARRAY)" , parserName , JsonToken . class ) ; if ( collectionType == CollectionType . ARRAY ) { methodBuilder . addStatement ( "$T<$T> collection=new $T<>()" , Array...
public class MetaModelBuilder { /** * Returns true , if attribute belongs plural hierarchy . * @ param attribute * the attribute * @ return true , if attribute belongs plural hierarchy . else false . */ private boolean isPluralAttribute ( Field attribute ) { } }
return attribute . getType ( ) . equals ( Collection . class ) || attribute . getType ( ) . equals ( Set . class ) || attribute . getType ( ) . equals ( List . class ) || attribute . getType ( ) . equals ( Map . class ) ;
public class FileColumn { /** * Converts the given string value to the output string format . * @ param str The value to be converted * @ param format The format to use for the value * @ param expr A regex to use for formatting the value * @ return The formatted value */ private String convertString ( String st...
String ret = str ; String [ ] params = null ; if ( format . length ( ) > 0 ) { ret = "" ; if ( expr . length ( ) > 0 ) // Indicates a format using regex { Pattern pattern = getPattern ( expr ) ; Matcher m = pattern . matcher ( str ) ; if ( m . find ( ) ) { params = new String [ m . groupCount ( ) ] ; for ( int i = 0 ; ...
public class AmazonLexModelBuildingClient { /** * Creates an intent or replaces an existing intent . * To define the interaction between the user and your bot , you use one or more intents . For a pizza ordering bot , * for example , you would create an < code > OrderPizza < / code > intent . * To create an inten...
request = beforeClientExecution ( request ) ; return executePutIntent ( request ) ;
public class PropertiesManager { /** * Returns the value of a property for a given name . This method can be used if the property is * boolean in nature and you want to make sure that < code > true < / code > is returned if the * property is set to " true " , " yes " , " y " , or " on " ( regardless of case ) , and...
if ( PropertiesManager . props == null ) loadProps ( ) ; boolean retValue = false ; String value = getProperty ( name ) ; if ( value != null ) { if ( value . equalsIgnoreCase ( "true" ) || value . equalsIgnoreCase ( "yes" ) || value . equalsIgnoreCase ( "y" ) || value . equalsIgnoreCase ( "on" ) ) { retValue = true ; }...
public class JacksonConfiguration { /** * Reads the configuration . * @ param inputStream The input stream to read from . * @ throws ConfigurationException * @ throws IOException */ @ Override public void read ( final InputStream inputStream ) throws ConfigurationException , IOException { } }
try ( Reader reader = new InputStreamReader ( inputStream ) ) { read ( reader ) ; }
public class OptimizerNode { /** * Sets the parallelism for this optimizer node . * The parallelism denotes how many parallel instances of the operator will be * spawned during the execution . * @ param parallelism The parallelism to set . If this value is { @ link ExecutionConfig # PARALLELISM _ DEFAULT } * th...
if ( parallelism < 1 && parallelism != ExecutionConfig . PARALLELISM_DEFAULT ) { throw new IllegalArgumentException ( "Parallelism of " + parallelism + " is invalid." ) ; } this . parallelism = parallelism ;
public class PathFinder { /** * Gets the file or directory from the given parent File object and the relative path given over * the list as String objects . * @ param parent * The parent directory . * @ param separator * The separator for separate the String folders . * @ param folders * The relative path...
final List < String > list = new ArrayList < > ( Arrays . asList ( folders . split ( separator ) ) ) ; if ( filename != null && ! filename . isEmpty ( ) ) { list . add ( filename ) ; } return getRelativePathTo ( parent , list ) ;
public class UIComponent { /** * Respecting the fact that someone may have decorated FacesContextFactory * and thus skipped our saving of this init param , look for the init * param and return its value . The return is saved in a transient ivar * to provide performance while not perturbing state saving . */ priva...
if ( null != isSetCurrentComponent ) { return isSetCurrentComponent ; } Boolean bool = ( Boolean ) context . getAttributes ( ) . get ( HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME ) ; if ( null != bool ) { isSetCurrentComponent = bool ; } else { String val = context . getExternalContext ( ) . getInitParameter ( UIComp...
public class WImage { /** * Retrieve the image size . * Returns the size set via { @ link # setSize ( Dimension ) } . If this has not been set and an image resource is * provideing the image then the size of the image resource is returned . Otherwise return null . * @ return the size of the image . */ public Dime...
Dimension size = getComponentModel ( ) . size ; if ( size != null ) { return size ; } Image image = getImage ( ) ; if ( image != null ) { return image . getSize ( ) ; } return null ;
public class ClassByImplementationBenchmark { /** * Sets up this benchmark . */ @ Setup public void setup ( ) { } }
baseClassDescription = TypePool . Default . ofSystemLoader ( ) . describe ( baseClass . getName ( ) ) . resolve ( ) ;
public class ScopeUtils { /** * Returns the application scope for specified scope . Application scope has depth of 1 and has no parent . * See * < pre > * isApp * < / pre > * method for details . * @ param from * Scope to find application for * @ return Application scope . */ public static IScope findAp...
IScope current = from ; while ( current . hasParent ( ) && ! current . getType ( ) . equals ( ScopeType . APPLICATION ) ) { current = current . getParent ( ) ; } return current ;
public class SourceResource { /** * Polling of the sessionInfo * @ param authorizationIdentifier The session authorizationIdentifier * @ return The session for the given authorizationIdentifier */ @ POST @ Path ( "/session" ) public Response getSession ( String authorizationIdentifier ) { } }
return Response . ok ( ) . entity ( sourceSessionRepository . findSessionInfoByAuthorizationId ( authorizationIdentifier ) ) . build ( ) ;
public class LocationUtil { /** * Returns a Location URI from a source URI and table name . */ public static URI toLocation ( URI sourceUri , String table ) { } }
getLocationType ( sourceUri ) ; // Raises an exception if the location type is invalid . return UriBuilder . fromUri ( sourceUri ) . path ( table ) . build ( ) ;
public class AccountsInner { /** * Lists the Data Lake Store firewall rules within the specified Data Lake Store account . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudExceptio...
ServiceResponse < Page < FirewallRuleInner > > response = listFirewallRulesNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < FirewallRuleInner > ( response . body ( ) ) { @ Override public Page < FirewallRuleInner > nextPage ( String nextPageLink ) { return listFirewallRulesNex...
public class Iterables { /** * Apply a predicate to an iterable , returning an optional of the first element where the predicate is true , * or empty if no true is found . * @ param iterable the iterable to traverse * @ param predicate the predicate to test * @ param < T > they type of the iterable and predicat...
checkNotNull ( iterable , "iterable may not be null" ) ; checkNotNull ( predicate , "the predicate may not be null" ) ; for ( T t : iterable ) { if ( predicate . test ( t ) ) { return of ( t ) ; } } return Optional . empty ( ) ;
public class Evidence { /** * Wrapper around * { @ link java . lang . String # compareToIgnoreCase ( java . lang . String ) String . compareToIgnoreCase } * with an exhaustive , possibly duplicative , check against nulls . * @ param me the value to be compared * @ param other the other value to be compared * ...
if ( me == null && other == null ) { return 0 ; } else if ( me == null ) { return - 1 ; // the other string is greater than me } else if ( other == null ) { return 1 ; // me is greater than the other string } return me . compareToIgnoreCase ( other ) ;
public class SesameGraphBuilder { /** * / * ( non - Javadoc ) * @ see org . openprovenance . prov . rdf . GraphBuilder # assertStatement ( org . openrdf . model . Statement ) */ @ Override public void assertStatement ( org . openrdf . model . Statement stmnt ) { } }
try { if ( currentContext == null ) { manager . getConnection ( ) . add ( stmnt ) ; } else { manager . getConnection ( ) . add ( stmnt , currentContext ) ; } } catch ( org . openrdf . repository . RepositoryException e ) { }
public class SpectatorExecutionInterceptor { /** * Extract the attempt number from the { @ code amz - sdk - retry } header . */ private IpcAttempt extractAttempt ( SdkHttpRequest request ) { } }
int attempt = 0 ; List < String > vs = request . headers ( ) . get ( "amz-sdk-retry" ) ; if ( vs != null ) { for ( String v : vs ) { // Format is : { requestCount - 1 } / { lastBackoffDelay } / { availableRetryCapacity } // See internal RetryHandler for more details . int pos = v . indexOf ( '/' ) ; if ( pos > 0 ) { tr...
public class ComponentsInner { /** * Purges data in an Application Insights component by a set of user - defined filters . * @ param resourceGroupName The name of the resource group . * @ param resourceName The name of the Application Insights component resource . * @ param body Describes the body of a request to...
return purgeWithServiceResponseAsync ( resourceGroupName , resourceName , body ) . toBlocking ( ) . single ( ) . body ( ) ;
public class PagedList { /** * { @ inheritDoc } */ public Page < E > moveTo ( int pageIndex ) { } }
if ( pageIndex < 1 ) { throw new RuntimeException ( "error pageIndex:" + pageIndex ) ; } this . pageIndex = pageIndex ; int toIndex = pageIndex * pageSize ; SinglePage < E > newPage = new SinglePage < E > ( pageIndex , pageSize , datas . size ( ) , datas . subList ( ( pageIndex - 1 ) * pageSize , ( toIndex < datas . si...
public class World { /** * Registers the { @ code supervisorClass } plugin by { @ code name } that will supervise all { @ code Actors } that implement the { @ code supervisedProtocol } . * @ param stageName the { @ code String } name of the { @ code Stage } in which the { @ code supervisorClass } is to be registered ...
try { final String actualStageName = stageName . equals ( "default" ) ? DEFAULT_STAGE : stageName ; final Stage stage = stageNamed ( actualStageName ) ; final Supervisor common = stage . actorFor ( Supervisor . class , Definition . has ( supervisorClass , Definition . NoParameters , name ) ) ; stage . registerCommonSup...
public class StringConverter { /** * Writes a string to the specified DataOutput using UTF - 8 encoding in a * machine - independent manner . * @ param str a string to be written . * @ param out destination to write to * @ return The number of bytes written out . */ public static int stringToUTFBytes ( String s...
int strlen = str . length ( ) ; int c , count = 0 ; if ( out . count + strlen + 8 > out . buffer . length ) { out . ensureRoom ( strlen + 8 ) ; } char [ ] arr = str . toCharArray ( ) ; for ( int i = 0 ; i < strlen ; i ++ ) { c = arr [ i ] ; if ( c >= 0x0001 && c <= 0x007F ) { out . buffer [ out . count ++ ] = ( byte ) ...
public class MemcachedClient { /** * Asynchronous decrement . * @ param key key to decrement * @ param by the amount to decrement the value by * @ param def the default value ( if the counter does not exist ) * @ param exp the expiration of this object * @ return a future with the decremented value , or - 1 i...
return asyncMutate ( Mutator . decr , key , by , def , exp ) ;
public class AddCSRFTokenInterceptor { /** * Injects a CSRF token into the result if the request is eligible . * @ param configuration the interception configuration * @ param context the interception context * @ return the result with the token if a token was added * @ throws Exception if anything bad happen *...
if ( csrf . eligibleForCSRF ( context . context ( ) ) && ( csrf . extractTokenFromRequest ( context . context ( ) ) == null || configuration . newTokenOnEachRequest ( ) ) ) { // Generate a new token , it will be stored in the request scope . String token = csrf . generateToken ( context . context ( ) ) ; // Add it to t...
public class Property { /** * Create a { @ link Property . PositionFactory } for the optional property specified by { @ code accessor } , whose original * source form is expected to have been a method reference for a valid Java bean accessor method , in which case it * is required that the calling class be processe...
Validate . isInstanceOf ( Accessor . class , accessor , "Cannot detect property from %s; missing %s?" , accessor , THERIAN_PROPERTY_METHOD_WEAVER ) ; final boolean optional = true ; return new PositionFactory < > ( ( ( Accessor < ? super P , ? extends T > ) accessor ) . propertyName , optional ) ;
public class AbstractClassLoader { /** * Search for all resources with the same path . */ public final Iterable < URL > getResourcesURL ( String name ) { } }
URL url = loadResourceURL ( name ) ; if ( subLoaders == null ) return url != null ? Collections . singletonList ( url ) : null ; CompoundCollection < URL > list = new CompoundCollection < > ( ) ; if ( url != null ) list . addSingleton ( url ) ; for ( AbstractClassLoader sub : subLoaders ) { Iterable < URL > urls = sub ...
public class InvocationDecoder { /** * Converts the escaped URI to a string . * @ param rawUri the escaped URI * @ param i index into the URI * @ param len the length of the uri * @ param encoding the character encoding to handle % xx * @ return the converted URI */ private static String normalizeUriEscape ( ...
ByteToChar converter = allocateConverter ( ) ; // XXX : make this configurable if ( encoding == null ) { encoding = "utf-8" ; } try { converter . setEncoding ( encoding ) ; } catch ( UnsupportedEncodingException e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; } try { while ( i < len ) { int ch = rawUri [ i ++...
public class DictionaryLookup { /** * Apply partial string replacements from a given map . * Useful if the word needs to be normalized somehow ( i . e . , ligatures , * apostrophes and such ) . * @ param word The word to apply replacements to . * @ param replacements A map of replacements ( from - & gt ; to ) ....
// quite horrible from performance point of view ; this should really be a transducer . StringBuilder sb = new StringBuilder ( word ) ; for ( final Map . Entry < String , String > e : replacements . entrySet ( ) ) { String key = e . getKey ( ) ; int index = sb . indexOf ( e . getKey ( ) ) ; while ( index != - 1 ) { sb ...
public class LongTermRetentionBackupsInner { /** * Lists the long term retention backups for a given location . * @ param locationName The location of the database * @ param onlyLatestPerDatabase Whether or not to only get the latest backup for each database . * @ param databaseState Whether to query against just...
return listByLocationWithServiceResponseAsync ( locationName , onlyLatestPerDatabase , databaseState ) . map ( new Func1 < ServiceResponse < Page < LongTermRetentionBackupInner > > , Page < LongTermRetentionBackupInner > > ( ) { @ Override public Page < LongTermRetentionBackupInner > call ( ServiceResponse < Page < Lon...
public class ChoiceContentSpec { /** * Public API */ @ Override public StructValidator getSimpleValidator ( ) { } }
/* Can we create a simple validator ? Yes , if the sub - specs are * all simple ( leaves = = element tokens with no arity modifier ) ; * this is always true for mixed . */ ContentSpec [ ] specs = mContentSpecs ; int len = specs . length ; int i ; if ( mHasMixed ) { i = len ; } else { i = 0 ; for ( ; i < len ; ++ i ...
public class WorkerImpl { /** * Polls the queues for jobs and executes them . */ protected void poll ( ) { } }
int missCount = 0 ; String curQueue = null ; while ( RUNNING . equals ( this . state . get ( ) ) ) { try { if ( threadNameChangingEnabled ) { renameThread ( "Waiting for " + JesqueUtils . join ( "," , this . queueNames ) ) ; } curQueue = getNextQueue ( ) ; if ( curQueue != null ) { checkPaused ( ) ; // Might have been ...
public class A_CmsUploadDialog { /** * Adds the given file input field to this dialog . < p > * @ param fileInput the file input field to add */ protected void addFileInput ( CmsFileInput fileInput ) { } }
// add the files selected by the user to the list of files to upload if ( fileInput != null ) { addFiles ( Arrays . asList ( fileInput . getFiles ( ) ) ) ; } else { loadAndShow ( ) ; }
public class McGregorChecks { /** * The function is called in function partsearch . The function is given a temporary matrix and a position ( row / column ) * within this matrix . First the function sets all entries to zero , which can be exlcuded in respect to the current * atom by atom matching . After this the f...
int neighborBondNumA = mcGregorHelper . getNeighborBondNumA ( ) ; int neighborBondNumB = mcGregorHelper . getNeighborBondNumB ( ) ; List < Integer > iBondNeighborAtomsA = mcGregorHelper . getiBondNeighborAtomsA ( ) ; List < Integer > iBondNeighborAtomsB = mcGregorHelper . getiBondNeighborAtomsB ( ) ; int g1Atom = iBond...