signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class EntityCachingAbstractSequencePrior { /** * extracts the entity starting at the given position
* and adds it to the entity list . returns the index
* of the last element in the entity ( < B > not < / b > index + 1) */
public Entity extractEntity ( int [ ] sequence , int position ) { } }
|
Entity entity = new Entity ( ) ; entity . type = sequence [ position ] ; entity . startPosition = position ; entity . words = new ArrayList < String > ( ) ; for ( ; position < sequence . length ; position ++ ) { if ( sequence [ position ] == entity . type ) { String word = doc . get ( position ) . get ( CoreAnnotations . TextAnnotation . class ) ; entity . words . add ( word ) ; if ( position == sequence . length - 1 ) { entity . otherOccurrences = otherOccurrences ( entity ) ; } } else { entity . otherOccurrences = otherOccurrences ( entity ) ; break ; } } return entity ;
|
public class DefaultHistoryManager { /** * / * ( non - Javadoc )
* @ see org . activiti . engine . impl . history . HistoryManagerInterface # recordTaskProcessDefinitionChange ( java . lang . String , java . lang . String ) */
@ Override public void recordTaskProcessDefinitionChange ( String taskId , String processDefinitionId ) { } }
|
if ( isHistoryLevelAtLeast ( HistoryLevel . ACTIVITY ) ) { HistoricTaskInstanceEntity historicTaskInstance = getHistoricTaskInstanceEntityManager ( ) . findById ( taskId ) ; if ( historicTaskInstance != null ) { historicTaskInstance . setProcessDefinitionId ( processDefinitionId ) ; } }
|
public class WrapperManager { /** * Return wrapper instance corresponding to the given object key . < p >
* This method is called whenever the ORB is attempting to invoke a
* method on an object identitied by an IOR . The byte array received
* by this method must be a serialized instance of a
* < code > BeanId < / code > . If an entry corresponding to this key is found
* in the wrapper cache the wrapper is returned , else a new wrapper
* instance is created and returned . < p >
* @ param key a byte array containing the
* serialized < code > BeanId < / code > of a wrapper < p >
* @ return a wrapper instance with the given < code > BeanId < / code > */
public EJSRemoteWrapper keyToObject ( byte [ ] key ) throws RemoteException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "keyToObject" ) ; EJSWrapperCommon wc = null ; EJSRemoteWrapper wrapper = null ; // The key into the wrapper cache is the serialized beanId , and the
// serialized beanId either is the wrapper key , or at least part of
// the wrapper key . For the EJB Component interface ( i . e . EJB 2.1 ) ,
// where there is only one remote interface , the wrapper key is the
// beanId . However , for EJB 3.0 Business interfaces , where there may
// be multiple remote interfaces , the wrapper key also contains the
// identity of the specific interface .
try { // If this is a Business Wrapper Key , extract the serialized beanId
// from it , and use that to find the Common / Factory in the Wrapper
// Cache , then use the rest of the Wrapper Key information to get
// the specific remote interface wrapper . d419704
if ( key [ 0 ] == ( byte ) 0xAD ) { WrapperId wrapperId = new WrapperId ( key ) ; ByteArray wrapperKey = wrapperId . getBeanIdArray ( ) ; wc = ( EJSWrapperCommon ) wrapperCache . findAndFault ( wrapperKey ) ; if ( wc != null ) { wrapper = wc . getRemoteBusinessWrapper ( wrapperId ) ; // At this point , all BeanIds are known to have the serialized
// byte array cached , so put Stateful and Entity BeanIds in the
// BeanId Cache . BeanIds for homes , stateless , and messagedriven
// are singletons and already cached on EJSHome . d154342.1
BeanId beanId = wrapper . beanId ; // d464515
if ( ! beanId . _isHome && beanId . pkey != null ) // d464515
{ beanIdCache . add ( beanId ) ; // d464515
} } } // If this is a Component Wrapper Key , then it already is the
// serialized beanId , so just use it to find the Common / Factory in
// the Wrapper Cache , then get the one remote wrapper . d419704
else { ByteArray wrapperKey = new ByteArray ( key ) ; wc = ( EJSWrapperCommon ) wrapperCache . findAndFault ( wrapperKey ) ; // f111627
if ( wc != null ) { wrapper = wc . getRemoteObjectWrapper ( ) ; // d112375 d440604
// At this point , all BeanIds are known to have the serialized
// byte array cached , so put Stateful and Entity BeanIds in the
// BeanId Cache . BeanIds for homes , stateless , and messagedriven
// are singletons and already cached on EJSHome . d154342.1
BeanId beanId = wrapper . beanId ; // d464515
if ( ! beanId . _isHome && beanId . pkey != null ) // d464515
{ beanIdCache . add ( beanId ) ; // d464515
} } } } catch ( FaultException ex ) { FFDCFilter . processException ( ex , CLASS_NAME + ".keyToObject" , "501" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "Unable to fault in wrapper" , ex ) ; throw new RemoteException ( ex . getMessage ( ) , ex ) ; // d356676.1
} if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keyToObject" , wrapper ) ; return wrapper ;
|
public class InterceptedSubclassFactory { /** * Creates the given method on the proxy class where the implementation
* forwards the call directly to the method handler .
* the generated bytecode is equivalent to :
* return ( RetType ) methodHandler . invoke ( this , param1 , param2 ) ;
* @ param methodInfo any JLR method
* @ param delegateToSuper
* @ return the method byte code */
protected void createInterceptorBody ( ClassMethod method , MethodInformation methodInfo , boolean delegateToSuper , ClassMethod staticConstructor ) { } }
|
invokeMethodHandler ( method , methodInfo , true , DEFAULT_METHOD_RESOLVER , delegateToSuper , staticConstructor ) ;
|
public class Application { /** * < p > Get a value by evaluating an expression . < / p >
* < p > Call { @ link # getExpressionFactory } then call { @ link
* ExpressionFactory # createValueExpression } passing the argument
* < code > expression < / code > and < code > expectedType < / code > . Call
* { @ link FacesContext # getELContext } and pass it to { @ link
* ValueExpression # getValue } , returning the result . < / p >
* < p > An implementation is provided that throws
* < code > UnsupportedOperationException < / code > so that users that decorate
* the < code > Application < / code > continue to work . */
public < T > T evaluateExpressionGet ( FacesContext context , String expression , Class < ? extends T > expectedType ) throws ELException { } }
|
if ( defaultApplication != null ) { return defaultApplication . evaluateExpressionGet ( context , expression , expectedType ) ; } throw new UnsupportedOperationException ( ) ;
|
public class Tools { /** * Clamp values .
* @ param x Value .
* @ param range Range .
* @ return Value . */
public static double Clamp ( double x , DoubleRange range ) { } }
|
return Clamp ( x , range . getMin ( ) , range . getMax ( ) ) ;
|
public class Properties { /** * Returns the value to which the specified property key is mapped , or
* < code > null < / code > if this properties contains no mapping for the property key .
* @ param property
* the property key whose associated value is to be returned
* @ return the value to which the specified property key is mapped , or
* < code > null < / code > if this properties contains no mapping for the property key */
@ SuppressWarnings ( "unchecked" ) public < T > T get ( PropertyKey < T > property ) { } }
|
return ( T ) properties . get ( property . getName ( ) ) ;
|
public class VFSRepository { /** * For testing purpose of new VFS providers ( eg . Confluence , . . . )
* @ param urlScheme a { @ link java . lang . String } object .
* @ param provider a { @ link org . apache . commons . vfs . provider . FileProvider } object .
* @ throws org . apache . commons . vfs . FileSystemException if any . */
public void addProvider ( String urlScheme , FileProvider provider ) throws FileSystemException { } }
|
( ( DefaultFileSystemManager ) fileSystemManager ) . addProvider ( urlScheme , provider ) ;
|
public class InternalTimerServiceImpl { /** * Starts the local { @ link InternalTimerServiceImpl } by :
* < ol >
* < li > Setting the { @ code keySerialized } and { @ code namespaceSerializer } for the timers it will contain . < / li >
* < li > Setting the { @ code triggerTarget } which contains the action to be performed when a timer fires . < / li >
* < li > Re - registering timers that were retrieved after recovering from a node failure , if any . < / li >
* < / ol >
* This method can be called multiple times , as long as it is called with the same serializers . */
public void startTimerService ( TypeSerializer < K > keySerializer , TypeSerializer < N > namespaceSerializer , Triggerable < K , N > triggerTarget ) { } }
|
if ( ! isInitialized ) { if ( keySerializer == null || namespaceSerializer == null ) { throw new IllegalArgumentException ( "The TimersService serializers cannot be null." ) ; } if ( this . keySerializer != null || this . namespaceSerializer != null || this . triggerTarget != null ) { throw new IllegalStateException ( "The TimerService has already been initialized." ) ; } // the following is the case where we restore
if ( restoredTimersSnapshot != null ) { TypeSerializerSchemaCompatibility < K > keySerializerCompatibility = restoredTimersSnapshot . getKeySerializerSnapshot ( ) . resolveSchemaCompatibility ( keySerializer ) ; if ( keySerializerCompatibility . isIncompatible ( ) || keySerializerCompatibility . isCompatibleAfterMigration ( ) ) { throw new IllegalStateException ( "Tried to initialize restored TimerService with new key serializer that requires migration or is incompatible." ) ; } TypeSerializerSchemaCompatibility < N > namespaceSerializerCompatibility = restoredTimersSnapshot . getNamespaceSerializerSnapshot ( ) . resolveSchemaCompatibility ( namespaceSerializer ) ; if ( namespaceSerializerCompatibility . isIncompatible ( ) || namespaceSerializerCompatibility . isCompatibleAfterMigration ( ) ) { throw new IllegalStateException ( "Tried to initialize restored TimerService with new namespace serializer that requires migration or is incompatible." ) ; } this . keySerializer = keySerializerCompatibility . isCompatibleAsIs ( ) ? keySerializer : keySerializerCompatibility . getReconfiguredSerializer ( ) ; this . namespaceSerializer = namespaceSerializerCompatibility . isCompatibleAsIs ( ) ? namespaceSerializer : namespaceSerializerCompatibility . getReconfiguredSerializer ( ) ; } else { this . keySerializer = keySerializer ; this . namespaceSerializer = namespaceSerializer ; } this . keyDeserializer = null ; this . namespaceDeserializer = null ; this . triggerTarget = Preconditions . checkNotNull ( triggerTarget ) ; // re - register the restored timers ( if any )
final InternalTimer < K , N > headTimer = processingTimeTimersQueue . peek ( ) ; if ( headTimer != null ) { nextTimer = processingTimeService . registerTimer ( headTimer . getTimestamp ( ) , this ) ; } this . isInitialized = true ; } else { if ( ! ( this . keySerializer . equals ( keySerializer ) && this . namespaceSerializer . equals ( namespaceSerializer ) ) ) { throw new IllegalArgumentException ( "Already initialized Timer Service " + "tried to be initialized with different key and namespace serializers." ) ; } }
|
public class SerializationUtils { /** * Read a JSON string and parse to { @ link JsonNode } instance , with a custom class loader .
* @ param source
* @ param classLoader
* @ return
* @ since 0.6.2 */
public static JsonNode readJson ( Reader source , ClassLoader classLoader ) { } }
|
ClassLoader oldClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( classLoader != null ) { Thread . currentThread ( ) . setContextClassLoader ( classLoader ) ; } try { if ( source == null ) { return NullNode . instance ; } ObjectMapper mapper = poolMapper . borrowObject ( ) ; if ( mapper != null ) { try { return mapper . readTree ( source ) ; } finally { poolMapper . returnObject ( mapper ) ; } } throw new SerializationException ( "No ObjectMapper instance avaialble!" ) ; } catch ( Exception e ) { throw e instanceof SerializationException ? ( SerializationException ) e : new SerializationException ( e ) ; } finally { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; }
|
public class AmazonConnectClient { /** * Updates the security profiles assigned to the user .
* @ param updateUserSecurityProfilesRequest
* @ return Result of the UpdateUserSecurityProfiles operation returned by the service .
* @ throws InvalidRequestException
* The request is not valid .
* @ throws InvalidParameterException
* One or more of the parameters provided to the operation are not valid .
* @ throws ResourceNotFoundException
* The specified resource was not found .
* @ throws ThrottlingException
* The throttling limit has been exceeded .
* @ throws InternalServiceException
* Request processing failed due to an error or failure with the service .
* @ sample AmazonConnect . UpdateUserSecurityProfiles
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / connect - 2017-08-08 / UpdateUserSecurityProfiles "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateUserSecurityProfilesResult updateUserSecurityProfiles ( UpdateUserSecurityProfilesRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeUpdateUserSecurityProfiles ( request ) ;
|
public class RSAUtils { /** * 获取公钥
* @ param keyMap 密钥对
* @ return
* @ throws Exception */
public static String getPublicKey ( Map < String , Object > keyMap ) throws Exception { } }
|
Key key = ( Key ) keyMap . get ( PUBLIC_KEY ) ; return String . valueOf ( Base64Utils . encode ( key . getEncoded ( ) ) ) ;
|
public class RequestHttpBase { /** * Returns the value of an already set output header .
* @ param name name of the header to get . */
public String headerOut ( String name ) { } }
|
ArrayList < String > keys = _headerKeysOut ; int headerSize = keys . size ( ) ; for ( int i = 0 ; i < headerSize ; i ++ ) { String oldKey = keys . get ( i ) ; if ( oldKey . equalsIgnoreCase ( name ) ) { return ( String ) _headerValuesOut . get ( i ) ; } } /* if ( name . equalsIgnoreCase ( " content - type " ) ) {
throw new UnsupportedOperationException ( ) ;
/ / return request ( ) . getContentType ( ) ; */
if ( name . equalsIgnoreCase ( "content-length" ) ) { return _contentLengthOut >= 0 ? String . valueOf ( _contentLengthOut ) : null ; } if ( name . equalsIgnoreCase ( "content-type" ) ) { return _contentTypeOut ; } return null ;
|
public class FTPClient { /** * Throws ServerException if GFD . 47 GETPUT is not supported or
* cannot be used . */
protected void checkGETPUTSupport ( ) throws ServerException , IOException { } }
|
if ( ! isFeatureSupported ( FeatureList . GETPUT ) ) { throw new ServerException ( ServerException . UNSUPPORTED_FEATURE ) ; } if ( controlChannel . isIPv6 ( ) ) { throw new ServerException ( ServerException . UNSUPPORTED_FEATURE , "Cannot use GridFTP2 with IP 6" ) ; }
|
public class HttpClientResourceAdaptor { /** * ( non - Javadoc )
* @ see
* javax . slee . resource . ResourceAdaptor # setResourceAdaptorContext ( javax . slee
* . resource . ResourceAdaptorContext ) */
public void setResourceAdaptorContext ( ResourceAdaptorContext arg0 ) { } }
|
resourceAdaptorContext = arg0 ; tracer = resourceAdaptorContext . getTracer ( HttpClientResourceAdaptor . class . getSimpleName ( ) ) ; try { fireableEventType = resourceAdaptorContext . getEventLookupFacility ( ) . getFireableEventType ( new EventTypeID ( "net.java.client.slee.resource.http.event.ResponseEvent" , "net.java.client.slee" , "4.0" ) ) ; } catch ( Throwable e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } sbbInterface = new HttpClientResourceAdaptorSbbInterfaceImpl ( this ) ;
|
public class AbstractDirectoryInfo { /** * Try to locate a directory in the file system .
* @ param directory the directory to locate
* @ return true if the directory was found , false otherwise */
protected final boolean tryFS ( String directory ) { } }
|
String path = directory ; File file = new File ( path ) ; if ( this . testDirectory ( file ) == true ) { // found in file system
try { this . url = file . toURI ( ) . toURL ( ) ; this . file = file ; this . fullDirectoryName = FilenameUtils . getPath ( file . getAbsolutePath ( ) ) ; this . setRootPath = directory ; return true ; } catch ( MalformedURLException e ) { this . errors . addError ( "init() - malformed URL for file with name " + this . file . getAbsolutePath ( ) + " and message: " + e . getMessage ( ) ) ; } } return false ;
|
public class Primitives { /** * Write value to byte array
* @ param value
* @ param array
* @ param offset
* @ see java . nio . ByteBuffer # putFloat ( float ) */
public static final void writeFloat ( float value , byte [ ] array , int offset ) { } }
|
writeInt ( Float . floatToRawIntBits ( value ) , array , offset ) ;
|
public class FTPFileSystem { /** * Convenience method , so that we don ' t open a new connection when using this
* method from within another method . Otherwise every API invocation incurs
* the overhead of opening / closing a TCP connection . */
private FileStatus getFileStatus ( FTPClient client , Path file ) throws IOException { } }
|
FileStatus fileStat = null ; Path workDir = new Path ( client . printWorkingDirectory ( ) ) ; Path absolute = makeAbsolute ( workDir , file ) ; Path parentPath = absolute . getParent ( ) ; if ( parentPath == null ) { // root dir
long length = - 1 ; // Length of root dir on server not known
boolean isDir = true ; int blockReplication = 1 ; long blockSize = DEFAULT_BLOCK_SIZE ; // Block Size not known .
long modTime = - 1 ; // Modification time of root dir not known .
Path root = new Path ( "/" ) ; return new FileStatus ( length , isDir , blockReplication , blockSize , modTime , root . makeQualified ( this ) ) ; } String pathName = parentPath . toUri ( ) . getPath ( ) ; FTPFile [ ] ftpFiles = client . listFiles ( pathName ) ; if ( ftpFiles != null ) { for ( FTPFile ftpFile : ftpFiles ) { if ( ftpFile . getName ( ) . equals ( file . getName ( ) ) ) { // file found in dir
fileStat = getFileStatus ( ftpFile , parentPath ) ; break ; } } if ( fileStat == null ) { throw new FileNotFoundException ( "File " + file + " does not exist." ) ; } } else { throw new FileNotFoundException ( "File " + file + " does not exist." ) ; } return fileStat ;
|
public class CryptoUtils { /** * Calculates the SHA1 hash of the string .
* @ param text
* @ return sha1 hash of the string */
public static String getHashSHA1 ( String text ) { } }
|
byte [ ] bytes = text . getBytes ( StandardCharsets . ISO_8859_1 ) ; return getHashSHA1 ( bytes ) ;
|
public class SM2Engine { /** * 下一个K值
* @ return K值 */
private BigInteger nextK ( ) { } }
|
final int qBitLength = this . ecParams . getN ( ) . bitLength ( ) ; BigInteger k ; do { k = new BigInteger ( qBitLength , this . random ) ; } while ( k . equals ( ECConstants . ZERO ) || k . compareTo ( this . ecParams . getN ( ) ) >= 0 ) ; return k ;
|
public class Utils { /** * http : / / stackoverflow . com / questions / 8981029 / simple - way - to - do - dynamic - but - square - layout */
public static int getSquaredMeasureSpec ( final ViewGroup viewGroup , int widthMeasureSpec , int heightMeasureSpec ) { } }
|
int widthMode = View . MeasureSpec . getMode ( widthMeasureSpec ) ; int widthSize = View . MeasureSpec . getSize ( widthMeasureSpec ) ; int heightMode = View . MeasureSpec . getMode ( heightMeasureSpec ) ; int heightSize = View . MeasureSpec . getSize ( heightMeasureSpec ) ; int size ; if ( widthMode == View . MeasureSpec . EXACTLY && widthSize > 0 ) { size = widthSize ; } else if ( heightMode == View . MeasureSpec . EXACTLY && heightSize > 0 ) { size = heightSize ; } else { size = widthSize < heightSize ? widthSize : heightSize ; } return View . MeasureSpec . makeMeasureSpec ( size , View . MeasureSpec . EXACTLY ) ;
|
public class JarVerifier { /** * called to let us know we have processed all the
* META - INF entries , and if we re - read one of them , don ' t
* re - process it . Also gets rid of any data structures
* we needed when parsing META - INF entries . */
void doneWithMeta ( ) { } }
|
parsingMeta = false ; anyToVerify = ! sigFileSigners . isEmpty ( ) ; baos = null ; sigFileData = null ; pendingBlocks = null ; signerCache = null ; manDig = null ; // MANIFEST . MF is always treated as signed and verified ,
// move its signers from sigFileSigners to verifiedSigners .
if ( sigFileSigners . containsKey ( JarFile . MANIFEST_NAME ) ) { verifiedSigners . put ( JarFile . MANIFEST_NAME , sigFileSigners . remove ( JarFile . MANIFEST_NAME ) ) ; }
|
public class Converter { /** * Transforms different objects ( BigDecimal , Integer ) to Double .
* @ param value
* The object to transform
* @ return
* The double value */
public static Double asDouble ( Object value ) { } }
|
double doubleValue ; switch ( value . getClass ( ) . getCanonicalName ( ) ) { case "java.math.BigDecimal" : doubleValue = ( ( BigDecimal ) value ) . doubleValue ( ) ; break ; case "java.lang.Integer" : doubleValue = ( ( Integer ) value ) . doubleValue ( ) ; break ; default : doubleValue = ( Double ) value ; break ; } return doubleValue ;
|
public class BlockMapOutputBuffer { /** * return the value of ProcResourceValues for later use */
protected ProcResourceValues sortReduceParts ( ) { } }
|
long sortStartMilli = System . currentTimeMillis ( ) ; ProcResourceValues sortStartProcVals = task . getCurrentProcResourceValues ( ) ; long sortStart = task . jmxThreadInfoTracker . getTaskCPUTime ( "MAIN_TASK" ) ; // sort
for ( int i = 0 ; i < reducePartitions . length ; i ++ ) { reducePartitions [ i ] . groupOrSort ( ) ; } long sortEndMilli = System . currentTimeMillis ( ) ; ProcResourceValues sortEndProcVals = task . getCurrentProcResourceValues ( ) ; long sortEnd = task . jmxThreadInfoTracker . getTaskCPUTime ( "MAIN_TASK" ) ; mapSpillSortCounter . incCountersPerSort ( sortStartProcVals , sortEndProcVals , sortEndMilli - sortStartMilli ) ; mapSpillSortCounter . incJVMCPUPerSort ( sortStart , sortEnd ) ; return sortEndProcVals ;
|
public class SearchExpression { /** * A list of filter objects .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setFilters ( java . util . Collection ) } or { @ link # withFilters ( java . util . Collection ) } if you want to override
* the existing values .
* @ param filters
* A list of filter objects .
* @ return Returns a reference to this object so that method calls can be chained together . */
public SearchExpression withFilters ( Filter ... filters ) { } }
|
if ( this . filters == null ) { setFilters ( new java . util . ArrayList < Filter > ( filters . length ) ) ; } for ( Filter ele : filters ) { this . filters . add ( ele ) ; } return this ;
|
public class BasicChecker { /** * Initializes the internal state of the checker from parameters
* specified in the constructor . */
@ Override public void init ( boolean forward ) throws CertPathValidatorException { } }
|
if ( ! forward ) { prevPubKey = trustedPubKey ; if ( PKIX . isDSAPublicKeyWithoutParams ( prevPubKey ) ) { // If TrustAnchor is a DSA public key and it has no params , it
// cannot be used to verify the signature of the first cert ,
// so throw exception
throw new CertPathValidatorException ( "Key parameters missing" ) ; } prevSubject = caName ; } else { throw new CertPathValidatorException ( "forward checking not supported" ) ; }
|
public class SpecStringParser { /** * TODO Unit Test this */
public static String fixLeadingBracketSugar ( String dotNotaton ) { } }
|
if ( dotNotaton == null || dotNotaton . length ( ) == 0 ) { return "" ; } char prev = dotNotaton . charAt ( 0 ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( prev ) ; for ( int index = 1 ; index < dotNotaton . length ( ) ; index ++ ) { char curr = dotNotaton . charAt ( index ) ; if ( curr == '[' && prev != '\\' ) { if ( prev == '@' || prev == '.' ) { // no need to add an extra ' . '
} else { sb . append ( '.' ) ; } } sb . append ( curr ) ; prev = curr ; } return sb . toString ( ) ;
|
public class Configuration { /** * Write a UID file
* @ param uidFile The UID file to write
* @ param uid The UID to write to the file */
private void writeUid ( File uidFile , String uid ) { } }
|
BufferedWriter bw = null ; try { bw = new BufferedWriter ( new FileWriter ( uidFile ) ) ; bw . write ( uid ) ; } catch ( IOException ioe ) { } finally { if ( bw != null ) { try { bw . close ( ) ; } catch ( IOException ioe ) { } } }
|
public class MethodInterceptor { /** * { @ inheritDoc } */
public Object processInvocation ( final InterceptorContext context ) throws Exception { } }
|
try { Method method = this . method ; if ( withContext ) { if ( changeMethod ) { final Method oldMethod = context . getMethod ( ) ; context . setMethod ( method ) ; try { return method . invoke ( interceptorInstance , context . getInvocationContext ( ) ) ; } finally { context . setMethod ( oldMethod ) ; } } else { return method . invoke ( interceptorInstance , context . getInvocationContext ( ) ) ; } } else { method . invoke ( interceptorInstance , null ) ; return context . proceed ( ) ; } } catch ( IllegalAccessException e ) { final IllegalAccessError n = new IllegalAccessError ( e . getMessage ( ) ) ; n . setStackTrace ( e . getStackTrace ( ) ) ; throw n ; } catch ( InvocationTargetException e ) { throw Interceptors . rethrow ( e . getCause ( ) ) ; }
|
public class ExecutionManager { /** * Cancel request and workers . */
@ SuppressWarnings ( "deprecation" ) private void cancelRequestAndWorkers ( ) { } }
|
for ( ActorRef worker : workers . values ( ) ) { if ( worker != null && ! worker . isTerminated ( ) ) { worker . tell ( OperationWorkerMsgType . CANCEL , getSelf ( ) ) ; } } logger . info ( "ExecutionManager sending cancelPendingRequest at time: " + PcDateUtils . getNowDateTimeStr ( ) ) ;
|
public class Version { /** * Factory method to construct an instance of { @ link Version } initialized with major , minor
* and maintenance version numbers along with the version qualifier ( e . g . RELEASE ) .
* @ param major major version number .
* @ param minor minor version number .
* @ param maintenance maintenance version number .
* @ param qualifier version { @ link Qualifier } such as M # ( Milestone ) , RC # ( Release Candidate ) or RELEASE .
* @ return a new instance of { @ link Version } initialized with the major , minor and maintenance version numbers
* along with the version qualifier .
* @ throws IllegalArgumentException if { @ code major } , { @ code minor } or { @ code maintenance } version numbers
* are less than { @ literal 0 } .
* @ see org . cp . elements . lang . Version . Qualifier
* @ see org . cp . elements . lang . Version
* @ see # from ( int , int , int , Qualifier , int ) */
public static Version from ( int major , int minor , int maintenance , Qualifier qualifier ) { } }
|
return from ( major , minor , maintenance , qualifier , 0 ) ;
|
public class ApiOvhTelephony { /** * Alter this object properties
* REST : PUT / telephony / { billingAccount } / ovhPabx / { serviceName } / menu / { menuId } / entry / { entryId }
* @ param body [ required ] New object properties
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ]
* @ param menuId [ required ]
* @ param entryId [ required ] */
public void billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_PUT ( String billingAccount , String serviceName , Long menuId , Long entryId , OvhOvhPabxMenuEntry body ) throws IOException { } }
|
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , menuId , entryId ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ;
|
public class BeanUtils { /** * 获得输入对象列表的镜象实例列表 , 要求参数类必需包含一个无参的public构造函数
* @ param sourceList
* @ return
* @ author ying
* @ since 1.0.0 */
@ SuppressWarnings ( { } }
|
"rawtypes" , "unchecked" } ) public static List getCloneList ( List sourceList ) { if ( null == sourceList ) { return null ; } List targetList = new ArrayList ( ) ; for ( int i = 0 ; i < sourceList . size ( ) ; i ++ ) { Object target = null ; Object source = sourceList . get ( i ) ; try { Constructor con = source . getClass ( ) . getConstructor ( ) ; target = con . newInstance ( ) ; PropertyUtils . copyProperties ( target , source ) ; } catch ( Exception e ) { logger . error ( "clone object exception object class:" + source . getClass ( ) , e ) ; } targetList . add ( target ) ; } return targetList ;
|
public class EvaluatorStatusManager { /** * Transition to the new state of the evaluator , if possible .
* @ param toState New state of the evaluator .
* @ throws IllegalStateException if state transition is not valid . */
private void setState ( final EvaluatorState toState ) { } }
|
while ( true ) { final EvaluatorState fromState = this . state . get ( ) ; if ( fromState == toState ) { break ; } if ( ! fromState . isLegalTransition ( toState ) ) { LOG . log ( Level . WARNING , "Illegal state transition: {0} -> {1}" , new Object [ ] { fromState , toState } ) ; throw new IllegalStateException ( "Illegal state transition: " + fromState + " -> " + toState ) ; } if ( this . state . compareAndSet ( fromState , toState ) ) { break ; } }
|
public class XmlWriter { /** * Write an attribute with a value , if value is null nothing is written .
* @ throws IllegalStateException if the is no element is open */
public void writeAttribute ( String name , Object value ) { } }
|
if ( ! _isElementOpen ) throw new IllegalStateException ( "no open element" ) ; if ( value == null ) return ; _isElementOpen = false ; try { _strategy . writeAttribute ( this , name , value ) ; } finally { _isElementOpen = true ; }
|
public class ZipEntryUtil { /** * Create new Zip entry and fill it with associated with file meta - info
* @ param name Zip entry name
* @ param file source File
* @ return newly created Zip entry */
static ZipEntry fromFile ( String name , File file ) { } }
|
ZipEntry zipEntry = new ZipEntry ( name ) ; if ( ! file . isDirectory ( ) ) { zipEntry . setSize ( file . length ( ) ) ; } zipEntry . setTime ( file . lastModified ( ) ) ; ZTFilePermissions permissions = ZTFilePermissionsUtil . getDefaultStategy ( ) . getPermissions ( file ) ; if ( permissions != null ) { ZipEntryUtil . setZTFilePermissions ( zipEntry , permissions ) ; } return zipEntry ;
|
public class Timeout { /** * Creates a new Timeout instance . */
public static Timeout create ( final TimeoutId id , final String sagaId , final String name , final Date expiredAt , final Object data ) { } }
|
Timeout timeout = new Timeout ( ) ; timeout . id = id ; timeout . sagaId = sagaId ; timeout . expiredAt = expiredAt ; timeout . name = name ; timeout . data = data ; return timeout ;
|
public class SessionAffinityManager { /** * setTheSipApplicationSessionCookie */
public void setSIPCookie ( ServletRequest request , ServletResponse response , String sipCookieString ) { } }
|
// LIBERTY Cannot reach IExtendedResponse from here .
// overridden in SessionAffinityManagerImpl
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . logp ( Level . FINE , methodClassName , methodNames [ SET_SIP_COOKIE ] , "" ) ; }
|
public class Xsd2CobolTypesModelBuilder { /** * For java . lang types , strips the package which is not needed in generated
* java classes .
* @ param javaType the proposed java class
* @ return the java type name shortened if needed */
private static String getShortTypeName ( Class < ? > javaType ) { } }
|
String javaTypeName = javaType . getName ( ) ; if ( javaTypeName . startsWith ( "java.lang." ) ) { return javaTypeName . substring ( "java.lang." . length ( ) ) ; } else { return javaTypeName ; }
|
public class CodepointHelper { /** * Removes leading and trailing bidi controls from the string
* @ param sStr
* Source string
* @ return the modified string */
@ Nullable public static String stripBidi ( @ Nullable final String sStr ) { } }
|
if ( sStr == null || sStr . length ( ) <= 1 ) return sStr ; String ret = sStr ; if ( isBidi ( ret . charAt ( 0 ) ) ) ret = ret . substring ( 1 ) ; if ( isBidi ( ret . charAt ( ret . length ( ) - 1 ) ) ) ret = ret . substring ( 0 , ret . length ( ) - 1 ) ; return ret ;
|
public class DefaultFontMapper { /** * Looks for a BaseFont parameter associated with a name .
* @ param name the name
* @ return the BaseFont parameter or < CODE > null < / CODE > if not found . */
public BaseFontParameters getBaseFontParameters ( String name ) { } }
|
String alias = ( String ) aliases . get ( name ) ; if ( alias == null ) return ( BaseFontParameters ) mapper . get ( name ) ; BaseFontParameters p = ( BaseFontParameters ) mapper . get ( alias ) ; if ( p == null ) return ( BaseFontParameters ) mapper . get ( name ) ; else return p ;
|
public class Terminal { /** * Like print , but prints out a whole slew of objects on the same line .
* @ param messages objects you want to print on the same line . */
public static void puts ( Object ... messages ) { } }
|
for ( Object message : messages ) { IO . print ( message ) ; if ( ! ( message instanceof Terminal . Escape ) ) IO . print ( ' ' ) ; } IO . println ( ) ;
|
public class Plot { /** * Generates the Gnuplot script and data files .
* @ param basepath The base path to use . A number of new files will be
* created and their names will all start with this string .
* @ return The number of data points sent to Gnuplot . This can be less
* than the number of data points involved in the query due to things like
* aggregation or downsampling .
* @ throws IOException if there was an error while writing one of the files . */
public int dumpToFiles ( final String basepath ) throws IOException { } }
|
int npoints = 0 ; final int nseries = datapoints . size ( ) ; final String datafiles [ ] = nseries > 0 ? new String [ nseries ] : null ; FileSystem . checkDirectory ( new File ( basepath ) . getParent ( ) , Const . MUST_BE_WRITEABLE , Const . CREATE_IF_NEEDED ) ; for ( int i = 0 ; i < nseries ; i ++ ) { datafiles [ i ] = basepath + "_" + i + ".dat" ; final PrintWriter datafile = new PrintWriter ( datafiles [ i ] ) ; try { for ( final DataPoint d : datapoints . get ( i ) ) { final long ts = d . timestamp ( ) / 1000 ; if ( d . isInteger ( ) ) { datafile . print ( ts + utc_offset ) ; datafile . print ( ' ' ) ; datafile . print ( d . longValue ( ) ) ; } else { final double value = d . doubleValue ( ) ; if ( Double . isInfinite ( value ) ) { // Infinity is invalid .
throw new IllegalStateException ( "Infinity found in" + " datapoints #" + i + ": " + value + " d=" + d ) ; } else if ( Double . isNaN ( value ) ) { // NaNs should be skipped .
continue ; } datafile . print ( ts + utc_offset ) ; datafile . print ( ' ' ) ; datafile . print ( value ) ; } datafile . print ( '\n' ) ; if ( ts >= ( start_time & UNSIGNED ) && ts <= ( end_time & UNSIGNED ) ) { npoints ++ ; } } } finally { datafile . close ( ) ; } } if ( npoints == 0 ) { // Gnuplot doesn ' t like empty graphs when xrange and yrange aren ' t
// entirely defined , because it can ' t decide on good ranges with no
// data . We always set the xrange , but the yrange is supplied by the
// user . Let ' s make sure it defines a min and a max .
params . put ( "yrange" , "[0:10]" ) ; // Doesn ' t matter what values we use .
} writeGnuplotScript ( basepath , datafiles ) ; return npoints ;
|
public class WebsocketFinalizer { /** * UriConfiguration methods */
@ Override public WebsocketSender uri ( String uri ) { } }
|
return new WebsocketFinalizer ( cachedConfiguration . bootstrap ( b -> HttpClientConfiguration . uri ( b , uri ) ) ) ;
|
public class StaticTypeCheckingSupport { /** * Filter methods according to visibility
* @ param methodNodeList method nodes to filter
* @ param enclosingClassNode the enclosing class
* @ return filtered method nodes
* @ since 3.0.0 */
public static List < MethodNode > filterMethodsByVisibility ( List < MethodNode > methodNodeList , ClassNode enclosingClassNode ) { } }
|
if ( ! asBoolean ( methodNodeList ) ) { return StaticTypeCheckingVisitor . EMPTY_METHODNODE_LIST ; } List < MethodNode > result = new LinkedList < > ( ) ; boolean isEnclosingInnerClass = enclosingClassNode instanceof InnerClassNode ; List < ClassNode > outerClasses = enclosingClassNode . getOuterClasses ( ) ; outer : for ( MethodNode methodNode : methodNodeList ) { if ( methodNode instanceof ExtensionMethodNode ) { result . add ( methodNode ) ; continue ; } ClassNode declaringClass = methodNode . getDeclaringClass ( ) ; if ( isEnclosingInnerClass ) { for ( ClassNode outerClass : outerClasses ) { if ( outerClass . isDerivedFrom ( declaringClass ) ) { if ( outerClass . equals ( declaringClass ) ) { result . add ( methodNode ) ; continue outer ; } else { if ( methodNode . isPublic ( ) || methodNode . isProtected ( ) ) { result . add ( methodNode ) ; continue outer ; } } } } } if ( declaringClass instanceof InnerClassNode ) { if ( declaringClass . getOuterClasses ( ) . contains ( enclosingClassNode ) ) { result . add ( methodNode ) ; continue ; } } if ( methodNode . isPrivate ( ) && ! enclosingClassNode . equals ( declaringClass ) ) { continue ; } if ( methodNode . isProtected ( ) && ! enclosingClassNode . isDerivedFrom ( declaringClass ) && ! samePackageName ( enclosingClassNode , declaringClass ) ) { continue ; } if ( methodNode . isPackageScope ( ) && ! samePackageName ( enclosingClassNode , declaringClass ) ) { continue ; } result . add ( methodNode ) ; } return result ;
|
public class PKAbstractSigningUtil { /** * ( non - Javadoc )
* @ see de . brendamour . jpasskit . signing . IPKSigningUtil # signManifestFile ( byte [ ] , de . brendamour . jpasskit . signing . PKSigningInformation ) */
@ Override public byte [ ] signManifestFile ( byte [ ] manifestJSON , PKSigningInformation signingInformation ) throws PKSigningException { } }
|
Assert . notNull ( manifestJSON , "Manifest JSON is mandatory" ) ; CMSProcessableByteArray content = new CMSProcessableByteArray ( manifestJSON ) ; return signManifestUsingContent ( signingInformation , content ) ;
|
public class InputLogEventMarshaller { /** * Marshall the given parameter object . */
public void marshall ( InputLogEvent inputLogEvent , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( inputLogEvent == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( inputLogEvent . getTimestamp ( ) , TIMESTAMP_BINDING ) ; protocolMarshaller . marshall ( inputLogEvent . getMessage ( ) , MESSAGE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class OVSImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setOVERCHAR ( Integer newOVERCHAR ) { } }
|
Integer oldOVERCHAR = overchar ; overchar = newOVERCHAR ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . OVS__OVERCHAR , oldOVERCHAR , overchar ) ) ;
|
public class JmsJcaSessionImpl { /** * Gets the managed connection , this will reassociate itself with a managed
* connection if we don ' t have one and the connection manager is a
* < code > LazyAssociatableConnectionManager < / code > .
* @ return the managed connection
* @ throws IllegalStateException
* if we don ' t have a managed connection and the connection
* manager doesn ' t support lazy enlistment */
JmsJcaManagedConnection getManagedConnection ( ) throws IllegalStateException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getManagedConnection" ) ; } if ( _managedConnection == null ) { final ConnectionManager connectionManager = _connection . getConnectionManager ( ) ; if ( connectionManager == null ) { throw new IllegalStateException ( NLS . getFormattedMessage ( ( "EXCEPTION_RECEIVED_CWSJR1126" ) , new Object [ ] { "getManagedConnection" } , null ) ) ; } if ( connectionManager instanceof LazyAssociatableConnectionManager ) { try { final ManagedConnectionFactory managedConnectionFactory = _connection . getConnectionFactory ( ) . getManagedConnectionFactory ( ) ; ( ( LazyAssociatableConnectionManager ) connectionManager ) . associateConnection ( this , managedConnectionFactory , _requestInfo ) ; } catch ( final ResourceException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "getManagedConnection" , "1:673:1.47" , this ) ; SibTr . exception ( this , TRACE , exception ) ; throw new IllegalStateException ( NLS . getFormattedMessage ( ( "EXCEPTION_RECEIVED_CWSJR1121" ) , new Object [ ] { "getManagedConnection" , exception } , null ) , exception ) ; } } else { throw new IllegalStateException ( NLS . getFormattedMessage ( ( "EXCEPTION_RECEIVED_CWSJR1122" ) , new Object [ ] { "getManagedConnection" , connectionManager . getClass ( ) . getName ( ) , LazyAssociatableConnectionManager . class . getName ( ) } , null ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "getManagedConnection" , _managedConnection ) ; } return _managedConnection ;
|
public class DataSet { /** * This method changes the back - end store used to hold and represent data
* points . Changing this may be beneficial for expert users who know how
* their data will be accessed , or need to make modifications for more
* efficient storage . < br >
* If the currently data store is not empty , it ' s contents will be copied to
* the new store . < br >
* If the provided data store is not empty , and error will occur .
* @ param store the new method for stroing data points */
public void setDataStore ( DataStore store ) { } }
|
if ( store . size ( ) > 0 ) throw new RuntimeException ( "A non-empty data store was provided to an already existing dataset object." ) ; store . setCategoricalDataInfo ( this . datapoints . getCategoricalDataInfo ( ) ) ; store . setNumNumeric ( numNumerVals ) ; if ( this . datapoints . size ( ) > 0 ) { for ( int i = 0 ; i < this . datapoints . size ( ) ; i ++ ) store . addDataPoint ( this . getDataPoint ( i ) ) ; } this . datapoints = store ;
|
public class AwsIamAccessKeyDetailsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AwsIamAccessKeyDetails awsIamAccessKeyDetails , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( awsIamAccessKeyDetails == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( awsIamAccessKeyDetails . getUserName ( ) , USERNAME_BINDING ) ; protocolMarshaller . marshall ( awsIamAccessKeyDetails . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( awsIamAccessKeyDetails . getCreatedAt ( ) , CREATEDAT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class SystemPropertiesUtil { /** * 合并系统变量 ( - D ) , 环境变量 和默认值 , 以系统变量优先 */
public static Double getDouble ( String propertyName , String envName , Double defaultValue ) { } }
|
checkEnvName ( envName ) ; Double propertyValue = NumberUtil . toDoubleObject ( System . getProperty ( propertyName ) , null ) ; if ( propertyValue != null ) { return propertyValue ; } else { propertyValue = NumberUtil . toDoubleObject ( System . getenv ( envName ) , null ) ; return propertyValue != null ? propertyValue : defaultValue ; }
|
public class DockerClient { /** * Remove an image , deleting any tags it might have . */
public void removeImage ( String imageId ) throws DockerException { } }
|
Preconditions . checkState ( ! StringUtils . isEmpty ( imageId ) , "Image ID can't be empty" ) ; try { WebResource webResource = client . resource ( restEndpointUrl + "/images/" + imageId ) . queryParam ( "force" , "true" ) ; LOGGER . trace ( "DELETE: {}" , webResource ) ; webResource . delete ( ) ; } catch ( UniformInterfaceException exception ) { if ( exception . getResponse ( ) . getStatus ( ) == 204 ) { // no error
LOGGER . trace ( "Successfully removed image " + imageId ) ; } else if ( exception . getResponse ( ) . getStatus ( ) == 404 ) { LOGGER . warn ( "{} no such image" , imageId ) ; } else if ( exception . getResponse ( ) . getStatus ( ) == 409 ) { throw new DockerException ( "Conflict" ) ; } else if ( exception . getResponse ( ) . getStatus ( ) == 500 ) { throw new DockerException ( "Server error." , exception ) ; } else { throw new DockerException ( exception ) ; } }
|
public class ASTHelpers { /** * Find the root assignable expression of a chain of field accesses . If there is no root ( i . e , a
* bare method call or a static method call ) , return null .
* < p > Examples :
* < pre > { @ code
* a . trim ( ) . intern ( ) = = > a
* a . b . trim ( ) . intern ( ) = = > a . b
* this . intValue . foo ( ) = = > this . intValue
* this . foo ( ) = = > this
* intern ( ) = = > null
* String . format ( ) = = > null
* java . lang . String . format ( ) = = > null
* } < / pre > */
@ Nullable public static ExpressionTree getRootAssignable ( MethodInvocationTree methodInvocationTree ) { } }
|
if ( ! ( methodInvocationTree instanceof JCMethodInvocation ) ) { throw new IllegalArgumentException ( "Expected type to be JCMethodInvocation, but was " + methodInvocationTree . getClass ( ) ) ; } // Check for bare method call , e . g . intern ( ) .
if ( ( ( JCMethodInvocation ) methodInvocationTree ) . getMethodSelect ( ) instanceof JCIdent ) { return null ; } // Unwrap the field accesses until you get to an identifier .
ExpressionTree expr = methodInvocationTree ; while ( expr instanceof JCMethodInvocation ) { expr = ( ( JCMethodInvocation ) expr ) . getMethodSelect ( ) ; if ( expr instanceof JCFieldAccess ) { expr = ( ( JCFieldAccess ) expr ) . getExpression ( ) ; } } // We only want assignable identifiers .
Symbol sym = getSymbol ( expr ) ; if ( sym instanceof VarSymbol ) { return expr ; } return null ;
|
public class UpdatePatchBaselineRequest { /** * Information about the patches to use to update the instances , including target operating systems and source
* repositories . Applies to Linux instances only .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSources ( java . util . Collection ) } or { @ link # withSources ( java . util . Collection ) } if you want to override
* the existing values .
* @ param sources
* Information about the patches to use to update the instances , including target operating systems and
* source repositories . Applies to Linux instances only .
* @ return Returns a reference to this object so that method calls can be chained together . */
public UpdatePatchBaselineRequest withSources ( PatchSource ... sources ) { } }
|
if ( this . sources == null ) { setSources ( new com . amazonaws . internal . SdkInternalList < PatchSource > ( sources . length ) ) ; } for ( PatchSource ele : sources ) { this . sources . add ( ele ) ; } return this ;
|
public class ByteBufUtil { /** * Encode a { @ link CharSequence } in < a href = " http : / / en . wikipedia . org / wiki / UTF - 8 " > UTF - 8 < / a > and write
* it to a { @ link ByteBuf } .
* It behaves like { @ link # reserveAndWriteUtf8 ( ByteBuf , CharSequence , int ) } with { @ code reserveBytes }
* computed by { @ link # utf8MaxBytes ( CharSequence ) } . < br >
* This method returns the actual number of bytes written . */
public static int writeUtf8 ( ByteBuf buf , CharSequence seq ) { } }
|
return reserveAndWriteUtf8 ( buf , seq , utf8MaxBytes ( seq ) ) ;
|
public class RowMapperWide { /** * Returns the Lucene { @ link Query } to get the { @ link Document } s satisfying the specified partition key and { @ link
* RangeTombstone } .
* @ param partitionKey A partition key .
* @ param rangeTombstone A { @ link RangeTombstone } .
* @ return The Lucene { @ link Query } to get the { @ link Document } s satisfying the specified partition key and { @ link
* RangeTombstone } . */
public Query query ( DecoratedKey partitionKey , RangeTombstone rangeTombstone ) { } }
|
BooleanQuery query = new BooleanQuery ( ) ; query . add ( partitionKeyMapper . query ( partitionKey ) , MUST ) ; query . add ( clusteringKeyMapper . query ( rangeTombstone . min , rangeTombstone . max ) , MUST ) ; return query ;
|
public class IsBetweenLowerBoundInclusive { /** * Creates a matcher for { @ code T } s that matches when the < code > compareTo ( ) < / code > method returns a value between
* < code > from < / code > and < code > to < / code > , both included .
* < p > For example :
* < pre > assertThat ( 10 , betweenLowerBoundInclusive ( 10 , 11 ) ) < / pre >
* will return true . while :
* < pre > assertThat ( 11 , betweenLowerBoundInclusive ( 10 , 11 ) ) < / pre >
* will return false . */
public static < T extends Comparable < T > > Matcher < T > betweenLowerBoundInclusive ( final T from , final T to ) { } }
|
return new IsBetweenLowerBoundInclusive ( from , to ) ;
|
public class CommandLine { /** * Sets whether the parser should ignore case when converting arguments to { @ code enum } values . The default is { @ code false } .
* When set to true , for example , for an option of type < a href = " https : / / docs . oracle . com / javase / 8 / docs / api / java / time / DayOfWeek . html " > java . time . DayOfWeek < / a > ,
* values { @ code MonDaY } , { @ code monday } and { @ code MONDAY } are all recognized if { @ code true } .
* < p > The specified setting will be registered with this { @ code CommandLine } and the full hierarchy of its
* subcommands and nested sub - subcommands < em > at the moment this method is called < / em > . Subcommands added
* later will have the default setting . To ensure a setting is applied to all
* subcommands , call the setter last , after adding subcommands . < / p >
* @ param newValue the new setting
* @ return this { @ code CommandLine } object , to allow method chaining
* @ since 3.4 */
public CommandLine setCaseInsensitiveEnumValuesAllowed ( boolean newValue ) { } }
|
getCommandSpec ( ) . parser ( ) . caseInsensitiveEnumValuesAllowed ( newValue ) ; for ( CommandLine command : getCommandSpec ( ) . subcommands ( ) . values ( ) ) { command . setCaseInsensitiveEnumValuesAllowed ( newValue ) ; } return this ;
|
public class HistoricalSecrets { /** * / * package */
static Secret decrypt ( String data , CryptoConfidentialKey key ) throws IOException , GeneralSecurityException { } }
|
byte [ ] in ; try { in = Base64 . getDecoder ( ) . decode ( data . getBytes ( StandardCharsets . UTF_8 ) ) ; } catch ( IllegalArgumentException ex ) { throw new IOException ( "Could not decode secret" , ex ) ; } Secret s = tryDecrypt ( key . decrypt ( ) , in ) ; if ( s != null ) return s ; // try our historical key for backward compatibility
Cipher cipher = Secret . getCipher ( "AES" ) ; cipher . init ( Cipher . DECRYPT_MODE , getLegacyKey ( ) ) ; return tryDecrypt ( cipher , in ) ;
|
public class Regex { /** * Finds next match and returns the matched string
* @ param in
* @ param size
* @ return Matched string
* @ throws IOException
* @ throws SyntaxErrorException */
public String find ( PushbackReader in , int size ) throws IOException , SyntaxErrorException { } }
|
if ( acceptEmpty ) { throw new IllegalArgumentException ( "using find for '" + expression + "' that accepts empty string" ) ; } InputReader reader = Input . getInstance ( in , size ) ; int rc = find ( reader ) ; reader . release ( ) ; if ( rc == 1 ) { return reader . getString ( ) ; } else { throw new SyntaxErrorException ( "string matching '" + expression + "' not found" ) ; }
|
public class ClustersInner { /** * Lists all the HDInsight clusters under the subscription .
* @ 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 & lt ; ClusterInner & gt ; object */
public Observable < Page < ClusterInner > > listNextAsync ( final String nextPageLink ) { } }
|
return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ClusterInner > > , Page < ClusterInner > > ( ) { @ Override public Page < ClusterInner > call ( ServiceResponse < Page < ClusterInner > > response ) { return response . body ( ) ; } } ) ;
|
public class UserEntryScreen { /** * Add all the screen listeners . */
public void addListeners ( ) { } }
|
String strMessage = "Create new user account" ; String strTerms = this . getProperty ( "terms" ) ; // Terms resource EY
if ( strTerms == null ) strTerms = "terms" ; if ( this . getTask ( ) != null ) if ( this . getTask ( ) . getApplication ( ) != null ) { BaseApplication application = ( BaseApplication ) this . getTask ( ) . getApplication ( ) ; strMessage = application . getResources ( ResourceConstants . ERROR_RESOURCE , true ) . getString ( strMessage ) ; strTerms = application . getResources ( ResourceConstants . DEFAULT_RESOURCE , true ) . getString ( strTerms ) ; } this . getScreenRecord ( ) . getField ( UserScreenRecord . STATUS_LINE ) . setString ( strMessage ) ; this . getScreenRecord ( ) . getField ( UserScreenRecord . TERMS ) . setString ( strTerms ) ; // x this . readCurrentUser ( ) ;
super . addListeners ( ) ; FieldListener listener = this . getMainRecord ( ) . getField ( UserInfo . USER_NAME ) . getListener ( MainFieldHandler . class ) ; if ( listener != null ) this . getMainRecord ( ) . getField ( UserInfo . USER_NAME ) . removeListener ( listener , true ) ; // Don ' t read current accounts
this . getMainRecord ( ) . addListener ( new UserPasswordHandler ( false ) ) ; this . addAutoLoginHandler ( ) ;
|
public class PathParamSerializers { /** * Create a PathParamSerializer for List parameters . */
public static < Param > PathParamSerializer < List < Param > > list ( String name , Function < PSequence < String > , Param > deserialize , Function < Param , PSequence < String > > serialize ) { } }
|
return new NamedPathParamSerializer < List < Param > > ( "List(" + name + ")" ) { @ Override public PSequence < String > serialize ( List < Param > parameter ) { List < String > serializedParams = serializeCollection ( parameter , serialize ) . collect ( Collectors . toList ( ) ) ; return TreePVector . from ( serializedParams ) ; } @ Override public List < Param > deserialize ( PSequence < String > parameters ) { return deserializeCollection ( parameters , deserialize ) . collect ( Collectors . toList ( ) ) ; } } ;
|
public class ShowImages { /** * Shows a set of images in a grid pattern .
* @ param numColumns How many columns are in the grid
* @ param title Number of the window
* @ param images List of images to show
* @ return Display panel */
public static ImageGridPanel showGrid ( int numColumns , String title , BufferedImage ... images ) { } }
|
JFrame frame = new JFrame ( title ) ; int numRows = images . length / numColumns + images . length % numColumns ; ImageGridPanel panel = new ImageGridPanel ( numRows , numColumns , images ) ; frame . add ( panel , BorderLayout . CENTER ) ; frame . pack ( ) ; frame . setVisible ( true ) ; return panel ;
|
public class ParserBase { /** * Returns < code > true < / code > if the supplied < code > file < / code > is a valid zip and contains at least one entry of each of the supplied < code > fileTypes < / code > .
* @ param file The zip file to check
* @ param fileTypes The types of files to look for
* @ return < code > true < / code > if file types found */
public static boolean doesZipContainFileTypes ( File file , String ... fileTypes ) { } }
|
// It must be a zip file with an XML file at it ' s root and a properties file in it
if ( ! file . getName ( ) . endsWith ( ".zip" ) ) { return false ; } ZipFile zip = null ; try { zip = new ZipFile ( file ) ; boolean [ ] foundFileTypes = new boolean [ fileTypes . length ] ; boolean foundAll = false ; Enumeration < ? extends ZipEntry > entries = zip . entries ( ) ; while ( entries . hasMoreElements ( ) && ! foundAll ) { foundAll = true ; ZipEntry entry = entries . nextElement ( ) ; String name = entry . getName ( ) ; for ( int i = 0 ; i < fileTypes . length ; i ++ ) { if ( ! foundFileTypes [ i ] ) { foundFileTypes [ i ] = name . endsWith ( fileTypes [ i ] ) ; if ( foundAll ) { foundAll = foundFileTypes [ i ] ; } } } } return foundAll ; } catch ( IOException e ) { return false ; } finally { if ( zip != null ) { try { zip . close ( ) ; } catch ( IOException e ) { return false ; } } }
|
public class FlashImpl { /** * Convert the Object to a Boolean .
* @ param value
* @ return */
private Boolean _convertToBoolean ( Object value ) { } }
|
Boolean booleanValue ; if ( value instanceof Boolean ) { booleanValue = ( Boolean ) value ; } else { booleanValue = Boolean . parseBoolean ( value . toString ( ) ) ; } return booleanValue ;
|
public class AbstractMethod { /** * Utility method for obtaining an appropriate { @ link AuthMethod } for this call .
* @ param acceptableAuthMethods an array of classes , representing authentication methods that are acceptable for
* this endpoint
* @ return An AuthMethod created from one of the provided acceptableAuthMethods .
* @ throws NexmoClientException If no AuthMethod is available from the provided array of acceptableAuthMethods . */
protected AuthMethod getAuthMethod ( Class [ ] acceptableAuthMethods ) throws NexmoClientException { } }
|
if ( acceptable == null ) { this . acceptable = new HashSet < > ( ) ; Collections . addAll ( acceptable , acceptableAuthMethods ) ; } return this . httpWrapper . getAuthCollection ( ) . getAcceptableAuthMethod ( acceptable ) ;
|
public class Record { /** * Get the table for this record .
* This is the same as getFieldTable , but casts the class up .
* @ return The table for this record . */
public BaseTable getTable ( ) { } }
|
BaseTable table = ( BaseTable ) super . getTable ( ) ; if ( table == null ) // It ' s possible that m _ table was set in an overriding init method .
{ DatabaseOwner databaseOwner = null ; if ( this . getRecordOwner ( ) != null ) databaseOwner = this . getRecordOwner ( ) . getDatabaseOwner ( ) ; if ( databaseOwner != null ) { BaseDatabase database = ( BaseDatabase ) databaseOwner . getDatabase ( this . getDatabaseName ( ) , this . getDatabaseType ( ) , null ) ; m_table = database . makeTable ( this ) ; } } return ( BaseTable ) super . getTable ( ) ;
|
public class AddOn { /** * Calculates the requirements to run this add - on , in the current ZAP and Java versions and with the given
* { @ code availableAddOns } .
* If the add - on depends on other add - ons , those add - ons are also checked if are also runnable .
* < strong > Note : < / strong > All the given { @ code availableAddOns } are expected to be loadable in the currently running ZAP
* version , that is , the method { @ code AddOn . canLoadInCurrentVersion ( ) } , returns { @ code true } .
* @ param availableAddOns the other add - ons available
* @ return a requirements to run the add - on , and if not runnable the reason why it ' s not .
* @ since 2.4.0
* @ see # canLoadInCurrentVersion ( )
* @ see # canRunInCurrentJavaVersion ( )
* @ see AddOnRunRequirements */
public AddOnRunRequirements calculateRunRequirements ( Collection < AddOn > availableAddOns ) { } }
|
AddOnRunRequirements requirements = new AddOnRunRequirements ( this ) ; calculateRunRequirementsImpl ( availableAddOns , requirements , null , this ) ; if ( requirements . isRunnable ( ) ) { checkExtensionsWithDeps ( availableAddOns , requirements , this ) ; } return requirements ;
|
public class ObfuscatUtil { /** * Compute the the hash value for the String .
* @ param passwd
* the password String
* @ return
* the Hash digest byte .
* @ throws NoSuchAlgorithmException
* the NoSuchAlgorithmException . */
public static byte [ ] computeHash ( String passwd ) throws NoSuchAlgorithmException { } }
|
java . security . MessageDigest md = java . security . MessageDigest . getInstance ( "SHA-1" ) ; md . reset ( ) ; md . update ( passwd . getBytes ( ) ) ; return md . digest ( ) ;
|
public class JobEndNotifier { /** * simple synchronous way */
public static void localRunnerNotification ( JobConf conf , JobStatus status ) { } }
|
JobEndStatusInfo notification = createNotification ( conf , status ) ; if ( notification != null ) { while ( notification . configureForRetry ( ) ) { try { int code = httpNotification ( notification . getUri ( ) ) ; if ( code != 200 ) { throw new IOException ( "Invalid response status code: " + code ) ; } else { break ; } } catch ( IOException ioex ) { LOG . error ( "Notification error [" + notification . getUri ( ) + "]" , ioex ) ; } catch ( Exception ex ) { LOG . error ( "Notification error [" + notification . getUri ( ) + "]" , ex ) ; } try { synchronized ( Thread . currentThread ( ) ) { Thread . currentThread ( ) . sleep ( notification . getRetryInterval ( ) ) ; } } catch ( InterruptedException iex ) { LOG . error ( "Notification retry error [" + notification + "]" , iex ) ; } } }
|
public class ScheduleExpressionParser { /** * Parses a single value at the current position in the parse string .
* Whitespace before the value is not skipped . A " single value " is defined
* per the spec and includes :
* < ul >
* < li > Non - negative integers within the attribute ' s range . The return
* value will be that value literally .
* < li > Names corresponding to integers . For example , " Mon " for dayOfWeek
* week or " Jan " for month . The return value will be the corresponding
* literal value . For example , 0 for " Mon " and 1 for " Jan " .
* < li > For dayOfMonth , the word " Last " . The return value will be { @ link ENCODED _ NTH _ LAST _ DAY _ OF _ MONTH } .
* < li > For dayOfMonth , negative integers in the range [ - 7 , - 1 ] . The
* return value will be encoded relative to { @ link ENCODED _ NTH _ LAST _ DAY _ OF _ MONTH } .
* < li > For dayOfMonth , a sequence of two words representing the nth day of
* week in a month . For example , " 1st Sun " or " Last Sat " . The return
* value will be encoded as specified by { @ link ENCODED _ NTH _ DAY _ OF _ WEEK _ IN _ MONTH } .
* < li > The wild card character " * " . The return value will be { @ link ENCODED _ WILD _ CARD } .
* < / ul >
* @ throws ScheduleExpressionParserException if the expression contains an
* invalid attribute value */
private int readSingleValue ( ) { } }
|
if ( ivPos < ivString . length ( ) && ivString . charAt ( ivPos ) == '*' ) { ivPos ++ ; return ENCODED_WILD_CARD ; } int begin = scanToken ( ) ; String [ ] namedValues = ivAttr . getNamedValues ( ) ; int result = namedValues == null ? - 1 : findNamedValue ( begin , namedValues , ivAttr . getMin ( ) ) ; if ( result == - 1 ) { try { result = Integer . valueOf ( ivString . substring ( begin , ivPos ) ) ; } catch ( NumberFormatException ex ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "parse failed" , ex ) ; error ( ScheduleExpressionParserException . Error . VALUE ) ; // F7437591 . codRev , F743-506
} if ( ivAttr == Attribute . DAY_OF_MONTH && result >= - 7 && result <= - 1 ) { result = ENCODED_NTH_LAST_DAY_OF_MONTH + - result ; } else if ( result < ivAttr . getMin ( ) || result > ivAttr . getMax ( ) ) { error ( ScheduleExpressionParserException . Error . VALUE_RANGE ) ; // F743-506
} } // The named values for dayOfMonth are " 1st " , " 2nd " , etc , and " Last " .
// Next , we need to search for a day of the week .
else if ( ivAttr == Attribute . DAY_OF_MONTH ) { // findNamedValue will have added ivAttr . getMin , which we don ' t want .
int weekOfMonth = result - ivAttr . getMin ( ) ; // Since " Last " might not be followed by a day of the week , we need to
// peek at the next atom . Primitively implement this by saving and
// restoring the position in the parse string .
skipWhitespace ( ) ; int savedPos = ivPos ; int dayOfWeek = findNamedValue ( scanToken ( ) , DAYS_OF_WEEK , 0 ) ; if ( dayOfWeek == - 1 ) { if ( weekOfMonth != LAST_WEEK_OF_MONTH ) { error ( ScheduleExpressionParserException . Error . MISSING_DAY_OF_WEEK ) ; // F743-506
} // We parsed " Last x " hoping that x would be a day of the week , but
// it wasn ' t . Restore the position within the parse string .
ivPos = savedPos ; result = ENCODED_NTH_LAST_DAY_OF_MONTH ; } else { result = ENCODED_NTH_DAY_OF_WEEK_IN_MONTH + ( weekOfMonth * 7 ) + dayOfWeek ; } } return result ;
|
public class PdfOutline { /** * Returns the PDF representation of this < CODE > PdfOutline < / CODE > .
* @ param writer the encryption information
* @ param os
* @ throws IOException */
public void toPdf ( PdfWriter writer , OutputStream os ) throws IOException { } }
|
if ( color != null && ! color . equals ( Color . black ) ) { put ( PdfName . C , new PdfArray ( new float [ ] { color . getRed ( ) / 255f , color . getGreen ( ) / 255f , color . getBlue ( ) / 255f } ) ) ; } int flag = 0 ; if ( ( style & Font . BOLD ) != 0 ) flag |= 2 ; if ( ( style & Font . ITALIC ) != 0 ) flag |= 1 ; if ( flag != 0 ) put ( PdfName . F , new PdfNumber ( flag ) ) ; if ( parent != null ) { put ( PdfName . PARENT , parent . indirectReference ( ) ) ; } if ( destination != null && destination . hasPage ( ) ) { put ( PdfName . DEST , destination ) ; } if ( action != null ) put ( PdfName . A , action ) ; if ( count != 0 ) { put ( PdfName . COUNT , new PdfNumber ( count ) ) ; } super . toPdf ( writer , os ) ;
|
public class MicroMetaDao { /** * 锟斤拷荼锟斤拷锟斤拷询锟斤拷录锟斤拷 */
public int queryObjCountByCondition ( String tableName , String condition ) { } }
|
/* JdbcTemplate jdbcTemplate = ( JdbcTemplate ) MicroDbHolder
. getDbSource ( dbName ) ; */
// String tableName = changeTableNameCase ( otableName ) ;
JdbcTemplate jdbcTemplate = getMicroJdbcTemplate ( ) ; String sql = "" ; sql = "select count(1) from " + tableName + " where " + condition ; logger . debug ( sql ) ; Integer total = jdbcTemplate . queryForObject ( sql , Integer . class ) ; return total ;
|
public class BaseMultifactorAuthenticationProviderBypass { /** * Evaluate attribute rules for bypass .
* @ param attrName the attr name
* @ param attrValue the attr value
* @ param attributes the attributes
* @ param matchIfNoValueProvided the force match on value
* @ return true a matching attribute name / value is found */
protected static boolean locateMatchingAttributeValue ( final String attrName , final String attrValue , final Map < String , List < Object > > attributes , final boolean matchIfNoValueProvided ) { } }
|
LOGGER . debug ( "Locating matching attribute [{}] with value [{}] amongst the attribute collection [{}]" , attrName , attrValue , attributes ) ; if ( StringUtils . isBlank ( attrName ) ) { LOGGER . debug ( "Failed to match since attribute name is undefined" ) ; return false ; } val names = attributes . entrySet ( ) . stream ( ) . filter ( e -> { LOGGER . debug ( "Attempting to match [{}] against [{}]" , attrName , e . getKey ( ) ) ; return e . getKey ( ) . matches ( attrName ) ; } ) . collect ( Collectors . toSet ( ) ) ; LOGGER . debug ( "Found [{}] attributes relevant for multifactor authentication bypass" , names . size ( ) ) ; if ( names . isEmpty ( ) ) { return false ; } if ( StringUtils . isBlank ( attrValue ) ) { LOGGER . debug ( "No attribute value to match is provided; Match result is set to [{}]" , matchIfNoValueProvided ) ; return matchIfNoValueProvided ; } val values = names . stream ( ) . filter ( e -> { val valuesCol = CollectionUtils . toCollection ( e . getValue ( ) ) ; LOGGER . debug ( "Matching attribute [{}] with values [{}] against [{}]" , e . getKey ( ) , valuesCol , attrValue ) ; return valuesCol . stream ( ) . anyMatch ( v -> v . toString ( ) . matches ( attrValue ) ) ; } ) . collect ( Collectors . toSet ( ) ) ; LOGGER . debug ( "Matching attribute values remaining are [{}]" , values ) ; return ! values . isEmpty ( ) ;
|
public class ObjectMetadata { /** * Gets the Content - Length HTTP header indicating the size of the
* associated object in bytes .
* This field is required when uploading objects to S3 , but the AWS S3 Java
* client will automatically set it when working directly with files . When
* uploading directly from a stream , set this field if
* possible . Otherwise the client must buffer the entire stream in
* order to calculate the content length before sending the data to
* Amazon S3.
* For more information on the Content - Length HTTP header , see < a
* href = " http : / / www . w3 . org / Protocols / rfc2616 / rfc2616 - sec14 . html # sec14.13 " >
* http : / / www . w3 . org / Protocols / rfc2616 / rfc2616 - sec14 . html # sec14.13 < / a >
* @ return The Content - Length HTTP header indicating the size of the
* associated object in bytes . Returns < code > null < / code >
* if it hasn ' t been set yet .
* @ see ObjectMetadata # setContentLength ( long ) */
public long getContentLength ( ) { } }
|
Long contentLength = ( Long ) metadata . get ( Headers . CONTENT_LENGTH ) ; if ( contentLength == null ) return 0 ; return contentLength . longValue ( ) ;
|
public class PhiAccrualFailureDetector { /** * Compute phi for the specified node id .
* @ return phi value */
public double phi ( ) { } }
|
long latestHeartbeat = history . latestHeartbeatTime ( ) ; DescriptiveStatistics samples = history . samples ( ) ; if ( samples . getN ( ) < minSamples ) { return 0.0 ; } return computePhi ( samples , latestHeartbeat , System . currentTimeMillis ( ) ) ;
|
public class Quicksort { /** * Sort the list in ascending order using this algorithm .
* @ param < E > the type of elements in this list .
* @ param list the list that we want to sort */
public static < E extends Comparable < E > > void sort ( List < E > list ) { } }
|
Quicksort . sort ( list , 0 , list . size ( ) - 1 , false ) ;
|
public class SiteTracker { /** * An array per up host , there will be no entry for this host */
public long [ ] [ ] getRemoteSites ( ) { } }
|
int localhost = VoltDB . instance ( ) . getHostMessenger ( ) . getHostId ( ) ; long [ ] [ ] retval = new long [ m_allHostsImmutable . size ( ) - 1 ] [ ] ; int i = 0 ; for ( int host : m_allHostsImmutable ) { if ( host != localhost ) { retval [ i ++ ] = longListToArray ( m_hostsToSitesImmutable . get ( host ) ) ; } } return retval ;
|
public class JDBCUtilities { /** * Return true if table tableName contains field fieldName .
* @ param connection Connection
* @ param tableName Table name
* @ param fieldName Field name
* @ return True if the table contains the field
* @ throws SQLException */
public static boolean hasField ( Connection connection , String tableName , String fieldName ) throws SQLException { } }
|
final Statement statement = connection . createStatement ( ) ; try { final ResultSet resultSet = statement . executeQuery ( "SELECT * FROM " + TableLocation . parse ( tableName ) + " LIMIT 0;" ) ; try { return hasField ( resultSet . getMetaData ( ) , fieldName ) ; } finally { resultSet . close ( ) ; } } catch ( SQLException ex ) { return false ; } finally { statement . close ( ) ; }
|
public class OptimizationPlan { /** * Adds rules for converting { @ code source } to { @ code dest } .
* A rule for every combination of flipped / unflipped commutative operations added .
* @ param source source pattern
* @ param dest destination pattern */
@ SuppressWarnings ( "ObjectAllocationInLoop" ) public void add ( NodeBase source , NodeBase dest ) { } }
|
// amount of commutative nodes
int n = 0 ; for ( NodeBase node : source . getDescendants ( ) ) { if ( node instanceof CommutativeOperator ) { n ++ ; } } for ( int i = 0 ; i < 1 << n ; i ++ ) { Root root = new Root ( source . getClone ( ) ) ; int j = 0 ; for ( NodeBase node : root . getDescendants ( ) ) { if ( node instanceof CommutativeOperator ) { if ( ( i & 1 << j ) != 0 ) { ( ( CommutativeOperator ) node ) . flipChildren ( ) ; } j ++ ; } } rules . add ( new OptimizationRule ( root . getChild ( ) , dest ) ) ; }
|
public class CpnlElFunctions { /** * Replaces all ' href ' attribute values found in the text value by the resolver mapped value .
* @ param request the text ( rich text ) value
* @ param value the text ( rich text ) value
* @ return the transformed text value */
public static String map ( SlingHttpServletRequest request , String value ) { } }
|
StringBuilder result = new StringBuilder ( ) ; Matcher matcher = HREF_PATTERN . matcher ( value ) ; int len = value . length ( ) ; int pos = 0 ; while ( matcher . find ( pos ) ) { String unmapped = matcher . group ( 3 ) ; String mapped = url ( request , unmapped ) ; result . append ( value , pos , matcher . start ( ) ) ; result . append ( matcher . group ( 1 ) ) ; result . append ( mapped ) ; result . append ( matcher . group ( 4 ) ) ; pos = matcher . end ( ) ; } if ( pos >= 0 && pos < len ) { result . append ( value , pos , len ) ; } return result . toString ( ) ;
|
public class CmsJspTagDisplay { /** * Sets the items . < p >
* @ param displayFormatters the items to set */
public void setDisplayFormatters ( Object displayFormatters ) { } }
|
if ( displayFormatters instanceof List ) { for ( Object formatterItem : ( ( List < ? > ) displayFormatters ) ) { if ( formatterItem instanceof CmsJspContentAccessValueWrapper ) { addFormatter ( ( CmsJspContentAccessValueWrapper ) formatterItem ) ; } } } else if ( displayFormatters instanceof CmsJspContentAccessValueWrapper ) { addFormatter ( ( CmsJspContentAccessValueWrapper ) displayFormatters ) ; } else if ( displayFormatters instanceof String ) { String [ ] temp = ( ( String ) displayFormatters ) . split ( CmsXmlDisplayFormatterValue . SEPARATOR ) ; if ( temp . length == 2 ) { addDisplayFormatter ( temp [ 0 ] , temp [ 1 ] ) ; } }
|
public class ServerDnsAliasesInner { /** * Gets a server DNS alias .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server that the alias is pointing to .
* @ param dnsAliasName The name of the server DNS alias .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ServerDnsAliasInner object if successful . */
public ServerDnsAliasInner get ( String resourceGroupName , String serverName , String dnsAliasName ) { } }
|
return getWithServiceResponseAsync ( resourceGroupName , serverName , dnsAliasName ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class RenderUtils { /** * Render a generic object , returning the corresponding HTML string . Works for null objects ,
* RDF { @ code Value } s , { @ code Record } s , { @ code BindingSet } s and { @ code Iterable } s of the
* former .
* @ param object
* the object to render .
* @ return the rendered HTML string */
public static String render ( final Object object ) { } }
|
try { final StringBuilder builder = new StringBuilder ( ) ; render ( object , builder ) ; return builder . toString ( ) ; } catch ( final IOException ex ) { throw new Error ( ex ) ; // should not happen
}
|
public class CmsVfsBundleManager { /** * Adds a resource bundle based on a properties file in the VFS . < p >
* @ param bundleResource the properties file */
private void addPropertyBundle ( CmsResource bundleResource ) { } }
|
NameAndLocale nameAndLocale = getNameAndLocale ( bundleResource ) ; Locale locale = nameAndLocale . getLocale ( ) ; String baseName = nameAndLocale . getName ( ) ; m_bundleBaseNames . add ( baseName ) ; LOG . info ( String . format ( "Adding property VFS bundle (path=%s, name=%s, locale=%s)" , bundleResource . getRootPath ( ) , baseName , "" + locale ) ) ; Locale paramLocale = locale != null ? locale : CmsLocaleManager . getDefaultLocale ( ) ; CmsVfsBundleParameters params = new CmsVfsBundleParameters ( nameAndLocale . getName ( ) , bundleResource . getRootPath ( ) , paramLocale , locale == null , CmsVfsResourceBundle . TYPE_PROPERTIES ) ; CmsVfsResourceBundle bundle = new CmsVfsResourceBundle ( params ) ; addBundle ( baseName , locale , bundle ) ;
|
public class CmsResourceTreeContainer { /** * Fills the properties of a tree item . < p >
* @ param cms the CMS context
* @ param resourceItem the empty item
* @ param resource the resource for which the tree item is being created
* @ param parentId the parent id */
protected void fillProperties ( CmsObject cms , Item resourceItem , CmsResource resource , CmsUUID parentId ) { } }
|
resourceItem . getItemProperty ( PROPERTY_RESOURCE ) . setValue ( resource ) ; // use the root path as name in case of the root item
String name = getName ( cms , resource , parentId ) ; if ( resource . isFolder ( ) && ! name . endsWith ( "/" ) ) { name += "/" ; } CmsResourceUtil resUtil = new CmsResourceUtil ( cms , resource ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_RESOURCE_NAME ) . setValue ( name ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_STATE ) . setValue ( resource . getState ( ) ) ; resourceItem . getItemProperty ( PROPERTY_INSIDE_PROJECT ) . setValue ( Boolean . valueOf ( resUtil . isInsideProject ( ) ) ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_IS_FOLDER ) . setValue ( Boolean . valueOf ( resource . isFolder ( ) ) ) ; try { CmsObject rootCms = OpenCms . initCmsObject ( cms ) ; rootCms . getRequestContext ( ) . setSiteRoot ( "" ) ; CmsJspNavBuilder builder = new CmsJspNavBuilder ( rootCms ) ; CmsJspNavElement nav = builder . getNavigationForResource ( resource . getRootPath ( ) , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) ; boolean inNavigation = nav . isInNavigation ( ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_IN_NAVIGATION ) . setValue ( Boolean . valueOf ( inNavigation ) ) ; if ( inNavigation ) { resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_NAVIGATION_POSITION ) . setValue ( Float . valueOf ( nav . getNavPosition ( ) ) ) ; } String navText = null ; if ( nav . getProperties ( ) . containsKey ( CmsPropertyDefinition . PROPERTY_NAVTEXT ) ) { navText = nav . getProperties ( ) . get ( CmsPropertyDefinition . PROPERTY_NAVTEXT ) ; } else if ( nav . getProperties ( ) . containsKey ( CmsPropertyDefinition . PROPERTY_TITLE ) ) { navText = nav . getProperties ( ) . get ( CmsPropertyDefinition . PROPERTY_TITLE ) ; } resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_NAVIGATION_TEXT ) . setValue ( navText ) ; String folderCaption ; folderCaption = CmsResourceIcon . getTreeCaptionHTML ( name , resUtil , null , false ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_TREE_CAPTION ) . setValue ( folderCaption ) ; if ( inNavigation ) { if ( navText == null ) { navText = name ; } String sitemapCaption = CmsResourceIcon . getTreeCaptionHTML ( navText , resUtil , null , false ) ; resourceItem . getItemProperty ( PROPERTY_SITEMAP_CAPTION ) . setValue ( sitemapCaption ) ; } } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; }
|
public class ArrayMath { /** * Computes 2 - norm of vector
* @ param a A vector of double
* @ return Euclidean norm of a */
public static double norm ( double [ ] a ) { } }
|
double squaredSum = 0 ; for ( double anA : a ) { squaredSum += anA * anA ; } return Math . sqrt ( squaredSum ) ;
|
public class Exceptions { /** * Throws the given exception and sneaks it through any compiler checks . This
* allows to throw checked exceptions without the need to declare it .
* Clients should use the following idiom to trick static analysis and dead code checks :
* < pre >
* throw sneakyThrow ( new CheckedException ( " Catch me if you can ; - ) " ) ) .
* < / pre >
* This method is heavily inspired by project
* < a href = " https : / / github . com / rzwitserloot / lombok / blob / master / src / core / lombok / Lombok . java " > Lombok < / a > .
* @ param t the throwable that should be sneaked through compiler checks . May not be < code > null < / code > .
* @ return never returns anything since { @ code t } is always thrown .
* @ throws NullPointerException if { @ code t } is < code > null < / code > . */
public static RuntimeException sneakyThrow ( Throwable t ) { } }
|
if ( t == null ) throw new NullPointerException ( "t" ) ; Exceptions . < RuntimeException > sneakyThrow0 ( t ) ; return null ;
|
public class BasicBondGenerator { /** * Determine the ring set for this atom container .
* @ param atomContainer the atom container to find rings in .
* @ return the rings of the molecule */
protected IRingSet getRingSet ( IAtomContainer atomContainer ) { } }
|
IRingSet ringSet = atomContainer . getBuilder ( ) . newInstance ( IRingSet . class ) ; try { IAtomContainerSet molecules = ConnectivityChecker . partitionIntoMolecules ( atomContainer ) ; for ( IAtomContainer mol : molecules . atomContainers ( ) ) { ringSet . add ( Cycles . sssr ( mol ) . toRingSet ( ) ) ; } return ringSet ; } catch ( Exception exception ) { logger . warn ( "Could not partition molecule: " + exception . getMessage ( ) ) ; logger . debug ( exception ) ; return ringSet ; }
|
public class ParameterizedTypeReference { /** * / * @ Nullable */
private LightweightTypeReference getSuperTypeByName ( String typeName , boolean interfaceType ) { } }
|
JvmTypeReference superType = getSuperTypeByName ( typeName , interfaceType , type , new RecursionGuard < JvmType > ( ) ) ; if ( superType != null ) { JvmType rawType = superType . getType ( ) ; if ( isRawType ( ) ) { return createRawTypeReference ( rawType ) ; } if ( superType . eClass ( ) == TypesPackage . Literals . JVM_PARAMETERIZED_TYPE_REFERENCE ) { if ( ( ( JvmParameterizedTypeReference ) superType ) . getArguments ( ) . isEmpty ( ) ) { return getOwner ( ) . newParameterizedTypeReference ( rawType ) ; } } LightweightTypeReference unresolved = getOwner ( ) . toLightweightTypeReference ( rawType ) ; TypeParameterSubstitutor < ? > substitutor = createSubstitutor ( ) ; LightweightTypeReference result = substitutor . substitute ( unresolved ) ; return result ; } return null ;
|
public class XmlErrorHandler { /** * Adds a validation error based on a < code > SAXParseException < / code > .
* @ param severity
* the severity of the error
* @ param spex
* the < code > SAXParseException < / code > raised while validating the
* XML source */
private void addError ( short severity , SAXParseException spex ) { } }
|
if ( spex . getLineNumber ( ) > 0 ) { buf . append ( "Line " + spex . getLineNumber ( ) + " - " ) ; } buf . append ( spex . getMessage ( ) + "\n" ) ; ValidationError error = new ValidationError ( severity , buf . toString ( ) ) ; errors . add ( error ) ; buf . setLength ( 0 ) ;
|
public class ELTools { /** * Returns a list of String denoting every primitively typed property of a certain bean .
* @ param p _ expression
* The EL expression describing the bean . The EL expression is passed without the leading " # { " and the
* trailing brace " } " .
* @ param p _ recursive
* if true , the list also contains properties of nested beans .
* @ return a list of strings consisting of EL expressions without the leading " # { " and the trailing brace " } " . */
public static List < String > getEveryProperty ( String p_expression , boolean p_recursive ) { } }
|
synchronized ( propertyLists ) { if ( propertyLists . containsKey ( p_expression ) ) { return propertyLists . get ( p_expression ) ; } } Object container = evalAsObject ( "#{" + p_expression + "}" ) ; Class < ? extends Object > c = container == null ? null : container . getClass ( ) ; List < String > propertyNames = new ArrayList < String > ( ) ; if ( isPrimitive ( c ) ) { propertyNames . add ( p_expression ) ; } else { try { @ SuppressWarnings ( "unchecked" ) Map < String , Object > description = BeanUtilsBean2 . getInstance ( ) . describe ( container ) ; for ( String o : description . keySet ( ) ) { Object object = description . get ( o ) ; if ( object == null ) { // might be an array
} else if ( o . equals ( "class" ) ) { continue ; } else if ( isPrimitive ( object . getClass ( ) ) ) { propertyNames . add ( o ) ; } else if ( p_recursive ) { List < String > nested = getEveryProperty ( p_expression + "." + o , p_recursive ) ; for ( String n : nested ) { propertyNames . add ( o + "." + n ) ; } } } synchronized ( propertyLists ) { propertyLists . put ( p_expression , propertyNames ) ; } } catch ( IllegalAccessException e ) { // todo replace by a logger
LOGGER . log ( Level . SEVERE , "Couldn\"t read property list of " + p_expression , e ) ; e . printStackTrace ( ) ; } catch ( InvocationTargetException e ) { // todo replace by a logger
LOGGER . log ( Level . SEVERE , "Couldn\"t read property list of " + p_expression , e ) ; e . printStackTrace ( ) ; } catch ( NoSuchMethodException e ) { // todo replace by a logger
LOGGER . log ( Level . SEVERE , "Couldn\"t read property list of " + p_expression , e ) ; } } return propertyNames ;
|
public class Pointer { /** * Creates a new Pointer to the given buffer . < br / >
* < br / >
* Note that this method takes into account the array offset and position
* of the given buffer , in contrast to the { @ link # to ( Buffer ) } method .
* @ param buffer The buffer
* @ return The new pointer
* @ throws IllegalArgumentException If the given buffer
* is null or is neither direct nor has a backing array */
public static Pointer toBuffer ( Buffer buffer ) { } }
|
if ( buffer == null || ( ! buffer . isDirect ( ) && ! buffer . hasArray ( ) ) ) { throw new IllegalArgumentException ( "Buffer may not be null and must have an array or be direct" ) ; } if ( buffer instanceof ByteBuffer ) { return computePointer ( ( ByteBuffer ) buffer ) ; } if ( buffer instanceof ShortBuffer ) { return computePointer ( ( ShortBuffer ) buffer ) ; } if ( buffer instanceof IntBuffer ) { return computePointer ( ( IntBuffer ) buffer ) ; } if ( buffer instanceof LongBuffer ) { return computePointer ( ( LongBuffer ) buffer ) ; } if ( buffer instanceof FloatBuffer ) { return computePointer ( ( FloatBuffer ) buffer ) ; } if ( buffer instanceof DoubleBuffer ) { return computePointer ( ( DoubleBuffer ) buffer ) ; } throw new IllegalArgumentException ( "Unknown buffer type: " + buffer ) ;
|
public class BigDecimalUtil { /** * Returns a value rounded - up to p digits after decimal .
* If p is negative , then the number is rounded to
* places to the left of the decimal point . eg .
* 10.23 rounded to - 1 will give : 20 . If p is zero ,
* the returned value is rounded to the nearest integral
* value .
* < p > If n is negative , the resulting value is obtained
* as the round - up value of absolute value of n multiplied
* by the sign value of n ( @ see MathX . sign ( double d ) ) .
* Thus , - 0.2 rounded - up to p = 0 will give - 1 not 0.
* < p > If n is NaN , returned value is NaN .
* @ param n
* @ param p
* @ return */
public static BigDecimal roundUp ( final BigDecimal n , final int p ) { } }
|
if ( n == null ) { return null ; } final int scale = n . scale ( ) ; return BigDecimalUtil . setScale ( BigDecimal . valueOf ( roundUp ( n . doubleValue ( ) , p ) ) , scale ) ;
|
public class NamedEventManager { /** * Retrieves the short name for an event class , according to spec rules .
* @ param cls the class to find the short name for .
* @ return a String containing the short name for the given class . */
private String getFixedName ( Class < ? extends ComponentSystemEvent > cls ) { } }
|
StringBuilder result = new StringBuilder ( ) ; String className ; // Get the unqualified class name .
className = cls . getSimpleName ( ) ; // Strip the trailing " event " off the class name if present .
if ( className . toLowerCase ( ) . endsWith ( "event" ) ) { className = className . substring ( 0 , result . length ( ) - 5 ) ; } // Prepend the package name .
if ( cls . getPackage ( ) != null ) { result . append ( cls . getPackage ( ) . getName ( ) ) ; result . append ( '.' ) ; } result . append ( className ) ; return result . toString ( ) ;
|
public class BranchUniversalObject { /** * Method to report user actions happened on this BUO . Use this method to report the user actions for analytics purpose .
* @ param action A { @ link String } with value of user action name . See { @ link BranchEvent } for Branch defined user events .
* @ param metadata A HashMap containing any additional metadata need to add to this user event
* NOTE : please consider using { @ link # userCompletedAction ( BRANCH _ STANDARD _ EVENT , HashMap ) } instead */
public void userCompletedAction ( String action , HashMap < String , String > metadata ) { } }
|
JSONObject actionCompletedPayload = new JSONObject ( ) ; try { JSONArray canonicalIDList = new JSONArray ( ) ; canonicalIDList . put ( canonicalIdentifier_ ) ; actionCompletedPayload . put ( canonicalIdentifier_ , convertToJson ( ) ) ; if ( metadata != null ) { for ( String key : metadata . keySet ( ) ) { actionCompletedPayload . put ( key , metadata . get ( key ) ) ; } } if ( Branch . getInstance ( ) != null ) { Branch . getInstance ( ) . userCompletedAction ( action , actionCompletedPayload ) ; } } catch ( JSONException ignore ) { }
|
public class UriBuilder { /** * Returns whether the href is a JAX - RS template .
* @ param href the href to check
* @ return true if the href is templated , false otherwise */
static boolean jaxTemplate ( String href ) { } }
|
Matcher m = JAX_RS_TEMPLATE . matcher ( href ) ; return m . matches ( ) ;
|
public class DatabaseInformationMain { /** * One time initialisation of instance attributes
* at construction time . < p > */
protected final void init ( ) { } }
|
ns = new DINameSpace ( database ) ; pi = new DIProcedureInfo ( ns ) ; // flag the Session - dependent cached tables
Table t ; for ( int i = 0 ; i < sysTables . length ; i ++ ) { t = sysTables [ i ] = generateTable ( i ) ; if ( t != null ) { t . setDataReadOnly ( true ) ; } } GranteeManager gm = database . getGranteeManager ( ) ; Right right = new Right ( ) ; right . set ( GrantConstants . SELECT , null ) ; for ( int i = 0 ; i < sysTableHsqlNames . length ; i ++ ) { if ( sysTables [ i ] != null ) { gm . grantSystemToPublic ( sysTables [ i ] , right ) ; } } right = Right . fullRights ; gm . grantSystemToPublic ( SqlInvariants . YES_OR_NO , right ) ; gm . grantSystemToPublic ( SqlInvariants . TIME_STAMP , right ) ; gm . grantSystemToPublic ( SqlInvariants . CARDINAL_NUMBER , right ) ; gm . grantSystemToPublic ( SqlInvariants . CHARACTER_DATA , right ) ; gm . grantSystemToPublic ( SqlInvariants . SQL_CHARACTER , right ) ; gm . grantSystemToPublic ( SqlInvariants . SQL_IDENTIFIER_CHARSET , right ) ; gm . grantSystemToPublic ( SqlInvariants . SQL_IDENTIFIER , right ) ; gm . grantSystemToPublic ( SqlInvariants . SQL_TEXT , right ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.