signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Utils { /** * Unregister the mbean with the given name , if there is one registered
* @ param name The mbean name to unregister
* @ see # registerMBean ( Object , String ) */
private static void unregisterMBean ( String name ) { } } | MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; try { synchronized ( mbs ) { ObjectName objName = new ObjectName ( name ) ; if ( mbs . isRegistered ( objName ) ) { mbs . unregisterMBean ( objName ) ; } } } catch ( Exception e ) { e . printStackTrace ( ) ; } |
public class PageFlowManagedObject { /** * Initialize the given field with an instance . Mainly useful for the error handling . */
protected void initializeField ( Field field , Object instance ) { } } | if ( instance != null ) { if ( _log . isTraceEnabled ( ) ) { _log . trace ( "Initializing field " + field . getName ( ) + " in " + getDisplayName ( ) + " with " + instance ) ; } try { field . set ( this , instance ) ; } catch ( IllegalArgumentException e ) { _log . error ( "Could not set field " + field . getName ( ) + " on " + getDisplayName ( ) + "; instance is of type " + instance . getClass ( ) . getName ( ) + ", field type is " + field . getType ( ) . getName ( ) ) ; } catch ( IllegalAccessException e ) { _log . error ( "Error initializing field " + field . getName ( ) + " in " + getDisplayName ( ) , e ) ; } } |
public class ns_doc_image { /** * < pre >
* Use this operation to delete NetScaler Documentation file .
* < / pre > */
public static ns_doc_image delete ( nitro_service client , ns_doc_image resource ) throws Exception { } } | resource . validate ( "delete" ) ; return ( ( ns_doc_image [ ] ) resource . delete_resource ( client ) ) [ 0 ] ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcBuildingElementProxyType ( ) { } } | if ( ifcBuildingElementProxyTypeEClass == null ) { ifcBuildingElementProxyTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 62 ) ; } return ifcBuildingElementProxyTypeEClass ; |
public class HprofFieldObjectValue { /** * ~ Methods - - - - - */
public long getInstanceId ( ) { } } | HprofByteBuffer dumpBuffer = classDump . getHprofBuffer ( ) ; return dumpBuffer . getID ( fileOffset + classDump . classDumpSegment . fieldValueOffset ) ; |
public class WebSiteManagementClientImpl { /** * Updates source control token .
* Updates source control token .
* @ param sourceControlType Type of source control
* @ param requestMessage Source control token information
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < SourceControlInner > updateSourceControlAsync ( String sourceControlType , SourceControlInner requestMessage , final ServiceCallback < SourceControlInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateSourceControlWithServiceResponseAsync ( sourceControlType , requestMessage ) , serviceCallback ) ; |
public class CmsContainerConfiguration { /** * Generates an empty configuration object . < p >
* @ return an empty configuration object */
public static CmsContainerConfiguration emptyConfiguration ( ) { } } | return new CmsContainerConfiguration ( null , new HashMap < String , Boolean > ( ) , new HashMap < String , CmsContainerElementBean > ( ) ) ; |
public class FeatureWebSecurityCollaboratorImpl { /** * { @ inheritDoc } */
@ Override public String getFeatureAuthzRoleHeaderValue ( ) { } } | String name = null ; WebAppConfig wac = getWebAppConfig ( ) ; if ( wac != null && wac instanceof WebAppConfiguration ) { Dictionary < String , String > headers = ( ( WebAppConfiguration ) wac ) . getBundleHeaders ( ) ; if ( headers != null ) name = headers . get ( "IBM-Authorization-Roles" ) ; } return name ; |
public class BICO { /** * Inserts a new point into the ClusteringFeature tree .
* @ param x
* the point */
protected void bicoUpdate ( double [ ] x ) { } } | assert ( ! this . bufferPhase && this . numDimensions == x . length ) ; // Starts with the global root node as the current root node
ClusteringTreeNode r = this . root ; int i = 1 ; while ( true ) { ClusteringTreeNode y = r . nearestChild ( x ) ; // Checks if the point can not be added to the current level
if ( r . hasNoChildren ( ) || y == null || Metric . distanceSquared ( x , y . getCenter ( ) ) > calcRSquared ( i ) ) { // Creates a new node for the point and adds it to the current
// root node
r . addChild ( new ClusteringTreeNode ( x , new ClusteringFeature ( x , calcR ( i ) ) ) ) ; this . rootCount ++ ; break ; } else { // Checks if the point can be added to the nearest node without
// exceeding the global threshold
if ( y . getClusteringFeature ( ) . calcKMeansCosts ( y . getCenter ( ) , x ) <= this . T ) { // Adds the point to the ClusteringFeature
y . getClusteringFeature ( ) . add ( 1 , x , Metric . distanceSquared ( x ) ) ; break ; } else { // Navigates one level down in the tree
r = y ; i ++ ; } } } // Checks if the number of nodes in the tree exceeds the maximum number
if ( this . rootCount > this . maxNumClusterFeatures ) { rebuild ( ) ; } |
public class ObfuscatedData { /** * Parse string containing obfuscated data .
* @ param obfuscatedString obfuscated string to parse
* @ return parsed data */
public static ObfuscatedData fromString ( String obfuscatedString ) { } } | String [ ] parts = obfuscatedString . split ( "\\$" ) ; if ( parts . length != 5 ) { throw new IllegalArgumentException ( "Invalid obfuscated data" ) ; } if ( ! parts [ 1 ] . equals ( SIGNATURE ) ) { throw new IllegalArgumentException ( "Invalid obfuscated data" ) ; } return new ObfuscatedData ( Integer . parseInt ( parts [ 2 ] ) , Base64 . decode ( parts [ 3 ] ) , Base64 . decode ( parts [ 4 ] ) ) ; |
public class Axis { /** * Set the slices of axis . */
private void setSlice ( ) { } } | // slicing initialisation
if ( labels == null ) { double min = base . getPrecisionUnit ( ) [ index ] * Math . ceil ( base . getLowerBounds ( ) [ index ] / base . getPrecisionUnit ( ) [ index ] ) ; double max = base . getPrecisionUnit ( ) [ index ] * Math . floor ( base . getUpperBounds ( ) [ index ] / base . getPrecisionUnit ( ) [ index ] ) ; linearSlices = ( int ) Math . ceil ( Math . round ( ( max - min ) / base . getPrecisionUnit ( ) [ index ] , 1 ) ) ; if ( linearSlices <= 0 ) { linearSlices = 1 ; } if ( linearSlices < 3 ) { linearSlices *= 2 ; } linesSlicing = new double [ linearSlices + 3 ] ; labelsSlicing = new double [ linearSlices + 3 ] ; double pitch = ( max - min ) / linearSlices ; for ( int i = 1 ; i <= linearSlices + 1 ; i ++ ) { // lines and labels slicing are the same
linesSlicing [ i ] = min + ( i - 1 ) * pitch ; labelsSlicing [ i ] = min + ( i - 1 ) * pitch ; } linesSlicing [ 0 ] = base . getLowerBounds ( ) [ index ] ; labelsSlicing [ 0 ] = base . getLowerBounds ( ) [ index ] ; linesSlicing [ linearSlices + 2 ] = base . getUpperBounds ( ) [ index ] ; labelsSlicing [ linearSlices + 2 ] = base . getUpperBounds ( ) [ index ] ; } else { linesSlicing = new double [ labels . size ( ) + 2 ] ; labelsSlicing = new double [ labels . size ( ) ] ; gridLabelStrings = new String [ labels . size ( ) ] ; linesSlicing [ 0 ] = base . getLowerBounds ( ) [ index ] ; int i = 1 ; for ( String string : labels . keySet ( ) ) { linesSlicing [ i ] = labels . get ( string ) ; labelsSlicing [ i - 1 ] = labels . get ( string ) ; gridLabelStrings [ i - 1 ] = string ; i ++ ; } linesSlicing [ i ] = base . getUpperBounds ( ) [ index ] ; Arrays . sort ( linesSlicing ) ; QuickSort . sort ( labelsSlicing , gridLabelStrings ) ; } |
public class SequencesUtils { /** * Returns a set of possible alphabets for a given string .
* < p > Looks for alphabets registered in { @ link com . milaboratory . core . sequence . Alphabets } . < / p >
* @ param string target string ( sequence )
* @ return set of possible alphabets for a given string */
public static Set < Alphabet < ? > > possibleAlphabets ( String string ) { } } | HashSet < Alphabet < ? > > alphabets = new HashSet < > ( ) ; for ( Alphabet alphabet : Alphabets . getAll ( ) ) { if ( belongsToAlphabet ( alphabet , string ) ) alphabets . add ( alphabet ) ; } return alphabets ; |
public class IntStreamEx { /** * Returns a new { @ code IntStreamEx } which is a concatenation of this stream
* and the stream containing supplied values
* This is a < a href = " package - summary . html # StreamOps " > quasi - intermediate
* operation < / a > .
* @ param values the values to append to the stream
* @ return the new stream */
public IntStreamEx append ( int ... values ) { } } | if ( values . length == 0 ) return this ; return new IntStreamEx ( IntStream . concat ( stream ( ) , IntStream . of ( values ) ) , context ) ; |
public class ClassUtils { /** * < p > newInstance . < / p >
* @ param clazz a { @ link java . lang . Class } object .
* @ param args a { @ link java . lang . Object } object .
* @ param < T > a T object .
* @ return a T object . */
public static < T > T newInstance ( Class clazz , Object ... args ) { } } | if ( clazz == null ) return null ; Class [ ] argsClass = getArgsClasses ( args ) ; try { Constructor < T > constructor = clazz . < T > getConstructor ( argsClass ) ; return constructor . newInstance ( args ) ; } catch ( InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e ) { throw new IllegalStateException ( e . getMessage ( ) , e ) ; } |
public class Batch { /** * Tries to add ( write ) event to the batch , returns true , if successful . If fails , no subsequent attempts to add event
* to this batch will succeed , the next batch should be taken . */
boolean tryAddEvent ( byte [ ] event ) { } } | while ( true ) { long state = getState ( ) ; if ( isSealed ( state ) ) { return false ; } int bufferWatermark = bufferWatermark ( state ) ; if ( bufferWatermark == 0 ) { if ( tryAddFirstEvent ( event ) ) { return true ; } } else if ( newBufferWatermark ( bufferWatermark , event ) <= emitter . maxBufferWatermark ) { if ( tryAddNonFirstEvent ( state , event ) ) { return true ; } } else { seal ( ) ; return false ; } } |
public class DiskClient { /** * Sets the access control policy on the specified resource . Replaces any existing policy .
* < p > Sample code :
* < pre > < code >
* try ( DiskClient diskClient = DiskClient . create ( ) ) {
* ProjectZoneDiskResourceName resource = ProjectZoneDiskResourceName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ RESOURCE ] " ) ;
* ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest . newBuilder ( ) . build ( ) ;
* Policy response = diskClient . setIamPolicyDisk ( resource , zoneSetPolicyRequestResource ) ;
* < / code > < / pre >
* @ param resource Name or id of the resource for this request .
* @ param zoneSetPolicyRequestResource
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Policy setIamPolicyDisk ( ProjectZoneDiskResourceName resource , ZoneSetPolicyRequest zoneSetPolicyRequestResource ) { } } | SetIamPolicyDiskHttpRequest request = SetIamPolicyDiskHttpRequest . newBuilder ( ) . setResource ( resource == null ? null : resource . toString ( ) ) . setZoneSetPolicyRequestResource ( zoneSetPolicyRequestResource ) . build ( ) ; return setIamPolicyDisk ( request ) ; |
public class HarrisFast { /** * 高斯平滑
* @ param x
* @ param y
* @ param sigma
* @ return */
private double gaussian ( double x , double y , double sigma ) { } } | double sigma2 = sigma * sigma ; double t = ( x * x + y * y ) / ( 2 * sigma2 ) ; double u = 1.0 / ( 2 * Math . PI * sigma2 ) ; double e = u * Math . exp ( - t ) ; return e ; |
public class PoolingDataSourceBean { /** * Set the { @ link XADataSource } directly , instead of calling
* { @ link # setClassName ( String ) } .
* @ param dataSource the data source to use */
public void setDataSource ( XADataSource dataSource ) { } } | this . dataSource = dataSource ; setClassName ( DirectXADataSource . class . getName ( ) ) ; setDriverProperties ( new Properties ( ) ) ; |
public class JSLProperties { /** * Gets the value of the propertyList property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* This is why there is not a < CODE > set < / CODE > method for the propertyList property .
* For example , to add a new item , do as follows :
* < pre >
* getPropertyList ( ) . add ( newItem ) ;
* < / pre >
* Objects of the following type ( s ) are allowed in the list
* { @ link Property } */
@ Generated ( value = "com.ibm.jtc.jax.tools.xjc.Driver" , date = "2014-06-11T05:49:00-04:00" , comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-" ) public List < Property > getPropertyList ( ) { } } | if ( propertyList == null ) { propertyList = new ArrayList < Property > ( ) ; } return this . propertyList ; |
public class ImageUtils { /** * Returns a * copy * of a subimage of image . This avoids the performance problems associated with BufferedImage . getSubimage .
* @ param image the image
* @ param x the x position
* @ param y the y position
* @ param w the width
* @ param h the height
* @ return the subimage */
public static BufferedImage getSubimage ( BufferedImage image , int x , int y , int w , int h ) { } } | BufferedImage newImage = new BufferedImage ( w , h , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D g = newImage . createGraphics ( ) ; g . drawRenderedImage ( image , AffineTransform . getTranslateInstance ( - x , - y ) ) ; g . dispose ( ) ; return newImage ; |
public class NShortSegment { /** * 二元语言模型分词
* @ param sSentence 待分词的句子
* @ param nKind 需要几个结果
* @ param wordNetOptimum
* @ param wordNetAll
* @ return 一系列粗分结果 */
public List < List < Vertex > > biSegment ( char [ ] sSentence , int nKind , WordNet wordNetOptimum , WordNet wordNetAll ) { } } | List < List < Vertex > > coarseResult = new LinkedList < List < Vertex > > ( ) ; // / / / / / 生成词网 / / / / /
generateWordNet ( wordNetAll ) ; // logger . trace ( " 词网大小 : " + wordNetAll . size ( ) ) ;
// logger . trace ( " 打印词网 : \ n " + wordNetAll ) ;
// / / / / / 生成词图 / / / / /
Graph graph = generateBiGraph ( wordNetAll ) ; // logger . trace ( graph . toString ( ) ) ;
if ( HanLP . Config . DEBUG ) { System . out . printf ( "打印词图:%s\n" , graph . printByTo ( ) ) ; } // / / / / / N - 最短路径 / / / / /
NShortPath nShortPath = new NShortPath ( graph , nKind ) ; List < int [ ] > spResult = nShortPath . getNPaths ( nKind * 2 ) ; if ( spResult . size ( ) == 0 ) { throw new RuntimeException ( nKind + "-最短路径求解失败,请检查上面的词网是否存在负圈或悬孤节点" ) ; } // logger . trace ( nKind + " - 最短路径 " ) ;
// for ( int [ ] path : spResult )
// logger . trace ( Graph . parseResult ( graph . parsePath ( path ) ) ) ;
// / / / / / 日期 、 数字合并策略
for ( int [ ] path : spResult ) { List < Vertex > vertexes = graph . parsePath ( path ) ; generateWord ( vertexes , wordNetOptimum ) ; coarseResult . add ( vertexes ) ; } return coarseResult ; |
public class BaseXMLBuilder { /** * Return the result of evaluating an XPath query on the builder ' s DOM
* using the given namespace . Returns null if the query finds nothing ,
* or finds a node that does not match the type specified by returnType .
* @ param xpath
* an XPath expression
* @ param type
* the type the XPath is expected to resolve to , e . g :
* { @ link XPathConstants # NODE } , { @ link XPathConstants # NODESET } ,
* { @ link XPathConstants # STRING } .
* @ param nsContext
* a mapping of prefixes to namespace URIs that allows the XPath expression
* to use namespaces , or null for a non - namespaced document .
* @ return
* a builder node representing the first Element that matches the
* XPath expression .
* @ throws XPathExpressionException
* If the XPath is invalid , or if does not resolve to at least one
* { @ link Node # ELEMENT _ NODE } . */
public Object xpathQuery ( String xpath , QName type , NamespaceContext nsContext ) throws XPathExpressionException { } } | XPathFactory xpathFactory = XPathFactory . newInstance ( ) ; XPath xPath = xpathFactory . newXPath ( ) ; if ( nsContext != null ) { xPath . setNamespaceContext ( nsContext ) ; } XPathExpression xpathExp = xPath . compile ( xpath ) ; try { return xpathExp . evaluate ( this . xmlNode , type ) ; } catch ( IllegalArgumentException e ) { // Thrown if item found does not match expected type
return null ; } |
public class CommerceAddressRestrictionLocalServiceBaseImpl { /** * Returns the number of rows matching the dynamic query .
* @ param dynamicQuery the dynamic query
* @ param projection the projection to apply to the query
* @ return the number of rows matching the dynamic query */
@ Override public long dynamicQueryCount ( DynamicQuery dynamicQuery , Projection projection ) { } } | return commerceAddressRestrictionPersistence . countWithDynamicQuery ( dynamicQuery , projection ) ; |
public class DatastoreHelper { /** * Makes an ancestor filter . */
public static Filter . Builder makeAncestorFilter ( Key ancestor ) { } } | return makeFilter ( DatastoreHelper . KEY_PROPERTY_NAME , PropertyFilter . Operator . HAS_ANCESTOR , makeValue ( ancestor ) ) ; |
public class ContentNegotiationFilter { /** * private String getAcceptedFormats ( HttpServletRequest pRequest ) {
* String accept = pRequest . getHeader ( HTTP _ HEADER _ ACCEPT ) ;
* Check if User - Agent is in list of known agents
* if ( mKnownAgentPatterns ! = null ) {
* String agent = pRequest . getHeader ( HTTP _ HEADER _ USER _ AGENT ) ;
* for ( int i = 0 ; i < mKnownAgentPatterns . length ; i + + ) {
* Pattern pattern = mKnownAgentPatterns [ i ] ;
* if ( pattern . matcher ( agent ) . matches ( ) ) {
* Merge known with real accpet , in case plugins add extra capabilities
* accept = mergeAccept ( mKnownAgentAccpets [ i ] , accept ) ;
* System . out . println ( " - - > User - Agent : " + agent + " accepts : " + accept ) ;
* return accept ;
* System . out . println ( " No agent match , defaulting to Accept header : " + accept ) ;
* return accept ;
* private String mergeAccept ( String pKnown , String pAccept ) {
* TODO : Make sure there are no duplicates . . .
* return pKnown + " , " + pAccept ; */
protected RenderedImage doFilter ( BufferedImage pImage , ServletRequest pRequest , ImageServletResponse pResponse ) throws IOException { } } | if ( pRequest instanceof HttpServletRequest ) { HttpServletRequest request = ( HttpServletRequest ) pRequest ; Map < String , Float > formatQuality = getFormatQualityMapping ( ) ; // TODO : Consider adding original format , and use as fallback in worst case ?
// TODO : Original format should have some boost , to avoid unneccesary convertsion ?
// Update source quality settings from image properties
adjustQualityFromImage ( formatQuality , pImage ) ; // System . out . println ( " Source quality mapping : " + formatQuality ) ;
adjustQualityFromAccept ( formatQuality , request ) ; // System . out . println ( " Final media scores : " + formatQuality ) ;
// Find the formats with the highest quality factor , and use the first ( predictable )
String acceptable = findBestFormat ( formatQuality ) ; // System . out . println ( " Acceptable : " + acceptable ) ;
// Send HTTP 406 Not Acceptable
if ( acceptable == null ) { if ( pResponse instanceof HttpServletResponse ) { ( ( HttpServletResponse ) pResponse ) . sendError ( HttpURLConnection . HTTP_NOT_ACCEPTABLE ) ; } return null ; } else { // TODO : Only if the format was changed !
// Let other filters / caches / proxies know we changed the image
} // Set format
pResponse . setOutputContentType ( acceptable ) ; // System . out . println ( " Set format : " + acceptable ) ;
} return pImage ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getFNDFtDsFlags ( ) { } } | if ( fndFtDsFlagsEEnum == null ) { fndFtDsFlagsEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 36 ) ; } return fndFtDsFlagsEEnum ; |
public class Components { /** * Returns the name of the object ' s class together with an id ( see
* { @ link # objectId ( Object ) } ) . May be used to implement { @ code toString ( ) }
* with identifiable objects . If the log level is " finer " , the full
* class name will be used for the returned value , else the simple name .
* @ param object
* the object
* @ return the object ' s name */
public static String objectName ( Object object ) { } } | if ( object == null ) { return "<null>" ; } StringBuilder builder = new StringBuilder ( ) ; builder . append ( Components . className ( object . getClass ( ) ) ) . append ( '#' ) . append ( objectId ( object ) ) ; return builder . toString ( ) ; |
public class DistributedExceptionInfo { /** * Retrieve the text message for this exception . The default message ( which may be null )
* will be returned
* in any of the following situations :
* < ul >
* < li > No resource bundle name exists
* < li > No resource key exists
* < li > The resource bundle could not be found
* < li > The key was not found in the resource bundle
* < / ul >
* @ return java . lang . String message for this exception */
public java . lang . String getMessage ( ) { } } | if ( resourceBundleName != null && resourceKey != null ) { String retrievedMessage = null ; String internalMessage = null ; String defaultEnglishMessage = null ; ResourceBundle bundle = null ; // retrieve the resource bundle
try { bundle = ResourceBundle . getBundle ( resourceBundleName ) ; } catch ( MissingResourceException e ) { String key = null ; if ( message == null ) { key = "missingResourceBundleNoDft" ; defaultEnglishMessage = "There was an error retrieving resource bundle {0}. \nThere is no default message." ; } else { key = "missingResourceBundleWithDft" ; defaultEnglishMessage = "There was an error retrieving resource bundle {0}. \nThe default exception message is: {2}." ; } internalMessage = getErrorMsg ( DIST_EX_RESOURCE_BUNDLE_NAME , key , defaultEnglishMessage ) ; } // if the resource bundle was successfully retrieved , get the specific message based
// on the resource key
if ( bundle != null ) { try { retrievedMessage = bundle . getString ( resourceKey ) ; } catch ( MissingResourceException e ) { String key = null ; if ( message == null ) { key = "missingResourceKeyNoDft" ; defaultEnglishMessage = "There was an error retrieving resource key {1} in resource bundle {0}. \nThere is no default message." ; } else { key = "missingResourceKeyWithDft" ; defaultEnglishMessage = "There was an error retrieving resource key {1} in resource bundle {0}. \nThe default exception message is: {2}." ; } internalMessage = getErrorMsg ( DIST_EX_RESOURCE_BUNDLE_NAME , key , defaultEnglishMessage ) ; } } String formattedMessage = null ; // format the message
if ( retrievedMessage != null ) { if ( formatArguments != null ) { formattedMessage = MessageFormat . format ( retrievedMessage , formatArguments ) ; } else { formattedMessage = retrievedMessage ; } } else if ( internalMessage != null ) { Object intFormatArguments [ ] = { resourceBundleName , resourceKey , message } ; formattedMessage = MessageFormat . format ( internalMessage , intFormatArguments ) ; } else { // shouldn ' t happen
return message ; // which could be null
} return formattedMessage ; } else { // resource information does not exist , so return the default message , if provided
return message ; } |
public class LogicFile { /** * Add this field in the Record ' s field sequence . */
public BaseField setupField ( int iFieldSeq ) { } } | BaseField field = null ; // if ( iFieldSeq = = 0)
// field = new CounterField ( this , ID , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 1)
// field = new RecordChangedField ( this , LAST _ CHANGED , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 2)
// field = new BooleanField ( this , DELETED , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ;
// field . setHidden ( true ) ;
if ( iFieldSeq == 3 ) field = new IntegerField ( this , SEQUENCE , Constants . DEFAULT_FIELD_LENGTH , null , new Integer ( 1000 ) ) ; if ( iFieldSeq == 4 ) { field = new StringField ( this , METHOD_NAME , 40 , null , null ) ; field . setNullable ( false ) ; } if ( iFieldSeq == 5 ) field = new MemoField ( this , LOGIC_DESCRIPTION , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 6 ) field = new StringField ( this , METHOD_RETURNS , 255 , null , null ) ; if ( iFieldSeq == 7 ) field = new StringField ( this , METHOD_INTERFACE , 255 , null , null ) ; if ( iFieldSeq == 8 ) field = new StringField ( this , METHOD_CLASS_NAME , 40 , null , null ) ; if ( iFieldSeq == 9 ) field = new MemoField ( this , LOGIC_SOURCE , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 10 ) field = new StringField ( this , LOGIC_THROWS , 255 , null , null ) ; if ( iFieldSeq == 11 ) field = new StringField ( this , PROTECTION , 60 , null , null ) ; if ( iFieldSeq == 12 ) field = new StringField ( this , COPY_FROM , 40 , null , null ) ; if ( iFieldSeq == 13 ) { field = new IncludeScopeField ( this , INCLUDE_SCOPE , Constants . DEFAULT_FIELD_LENGTH , null , new Integer ( 0x004 ) ) ; field . addListener ( new InitOnceFieldHandler ( null ) ) ; } if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ; |
public class SQLExpressions { /** * Get a group _ concat ( expr , separator ) expression
* @ param expr expression to be aggregated
* @ param separator separator string
* @ return group _ concat ( expr , separator ) */
public static StringExpression groupConcat ( Expression < String > expr , String separator ) { } } | return Expressions . stringOperation ( SQLOps . GROUP_CONCAT2 , expr , Expressions . constant ( separator ) ) ; |
public class TextRetinaApiImpl { /** * { @ inheritDoc } */
@ Override public List < Text > getSlices ( String text , Boolean includeFingerprint ) throws ApiException { } } | return getSlices ( text , null , includeFingerprint ) ; |
public class ParameterValueImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case BpsimPackage . PARAMETER_VALUE__INSTANCE : return getInstance ( ) ; case BpsimPackage . PARAMETER_VALUE__RESULT : return getResult ( ) ; case BpsimPackage . PARAMETER_VALUE__VALID_FOR : return getValidFor ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class AbstractJaxRsWebEndpoint { /** * Calculate the base URL based on the HttpServletRequest instance
* @ param request
* @ return */
protected String getBaseURL ( HttpServletRequest request ) { } } | // if ( forcedBaseAddress ! = null ) {
// return forcedBaseAddress ;
String reqPrefix = request . getRequestURL ( ) . toString ( ) ; String pathInfo = request . getPathInfo ( ) == null ? "" : request . getPathInfo ( ) ; // fix for CXF - 898
if ( ! "/" . equals ( pathInfo ) || reqPrefix . endsWith ( "/" ) ) { StringBuilder sb = new StringBuilder ( ) ; // request . getScheme ( ) , request . getLocalName ( ) and request . getLocalPort ( )
// should be marginally cheaper - provided request . getLocalName ( ) does
// return the actual name used in request URI as opposed to localhost
// consistently across the Servlet stacks
URI uri = URI . create ( reqPrefix ) ; sb . append ( uri . getScheme ( ) ) . append ( "://" ) . append ( uri . getRawAuthority ( ) ) ; // No servletPath will be appended , as in Liberty , each endpoint will be served by one servlet instance
sb . append ( request . getContextPath ( ) ) ; reqPrefix = sb . toString ( ) ; } return reqPrefix ; |
public class MultiMap { /** * Remove the given number of values for a given key . May return less values then requested .
* @ param key the key to remove from .
* @ param num the number of values to remove .
* @ return a list of the removed values .
* @ since 4.4.0 */
public List < V > remove ( K key , int num ) { } } | List < V > values = map . get ( key ) ; if ( values == null ) { return Collections . emptyList ( ) ; } final int resultSize = values . size ( ) > num ? num : values . size ( ) ; final List < V > result = new ArrayList < > ( resultSize ) ; for ( int i = 0 ; i < resultSize ; i ++ ) { result . add ( values . get ( 0 ) ) ; } if ( values . isEmpty ( ) ) { map . remove ( key ) ; } return result ; |
public class XssMatchTupleMarshaller { /** * Marshall the given parameter object . */
public void marshall ( XssMatchTuple xssMatchTuple , ProtocolMarshaller protocolMarshaller ) { } } | if ( xssMatchTuple == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( xssMatchTuple . getFieldToMatch ( ) , FIELDTOMATCH_BINDING ) ; protocolMarshaller . marshall ( xssMatchTuple . getTextTransformation ( ) , TEXTTRANSFORMATION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DataLoader { /** * Creates new DataLoader with the specified batch loader function and with the provided options
* where the batch loader function returns a list of
* { @ link org . dataloader . Try } objects .
* @ param batchLoadFunction the batch load function to use that uses { @ link org . dataloader . Try } objects
* @ param options the options to use
* @ param < K > the key type
* @ param < V > the value type
* @ return a new DataLoader
* @ see # newDataLoaderWithTry ( BatchLoader ) */
public static < K , V > DataLoader < K , V > newDataLoaderWithTry ( BatchLoaderWithContext < K , Try < V > > batchLoadFunction , DataLoaderOptions options ) { } } | return new DataLoader < > ( batchLoadFunction , options ) ; |
public class AntClassLoader { /** * Cleans up any resources held by this classloader . Any open archive
* files are closed . */
public synchronized void cleanup ( ) { } } | for ( Enumeration e = jarFiles . elements ( ) ; e . hasMoreElements ( ) ; ) { JarFile jarFile = ( JarFile ) e . nextElement ( ) ; try { jarFile . close ( ) ; } catch ( IOException ioe ) { // ignore
} } jarFiles = new Hashtable ( ) ; if ( project != null ) { project . removeBuildListener ( this ) ; } project = null ; |
public class JmxEndpointConfiguration { /** * Gets the value of the serverUrl property .
* @ return the serverUrl */
public String getServerUrl ( ) { } } | if ( StringUtils . hasText ( this . serverUrl ) ) { return serverUrl ; } else { return "service:jmx:" + protocol + ":///jndi/" + protocol + "://" + host + ":" + port + ( binding != null ? "/" + binding : "" ) ; } |
public class Scanner { /** * text token */
protected Token nextText ( ) throws ScanException { } } | builder . setLength ( 0 ) ; int i = position ; int l = input . length ( ) ; boolean escaped = false ; while ( i < l ) { char c = input . charAt ( i ) ; switch ( c ) { case '\\' : if ( escaped ) { builder . append ( '\\' ) ; } else { escaped = true ; } break ; case '#' : case '$' : if ( i + 1 < l && input . charAt ( i + 1 ) == '{' ) { if ( escaped ) { builder . append ( c ) ; } else { return token ( Symbol . TEXT , builder . toString ( ) , i - position ) ; } } else { if ( escaped ) { builder . append ( '\\' ) ; } builder . append ( c ) ; } escaped = false ; break ; default : if ( escaped ) { builder . append ( '\\' ) ; } builder . append ( c ) ; escaped = false ; } i ++ ; } if ( escaped ) { builder . append ( '\\' ) ; } return token ( Symbol . TEXT , builder . toString ( ) , i - position ) ; |
public class CPOptionValueLocalServiceWrapper { /** * Adds the cp option value to the database . Also notifies the appropriate model listeners .
* @ param cpOptionValue the cp option value
* @ return the cp option value that was added */
@ Override public com . liferay . commerce . product . model . CPOptionValue addCPOptionValue ( com . liferay . commerce . product . model . CPOptionValue cpOptionValue ) { } } | return _cpOptionValueLocalService . addCPOptionValue ( cpOptionValue ) ; |
public class ToyData { /** * Generate n samples from each class . */
public double [ ] [ ] sample ( int n ) { } } | double [ ] [ ] samples = new double [ 2 * n ] [ ] ; MultivariateGaussianDistribution [ ] gauss = new MultivariateGaussianDistribution [ k ] ; for ( int i = 0 ; i < k ; i ++ ) { gauss [ i ] = new MultivariateGaussianDistribution ( m [ i ] , v ) ; } for ( int i = 0 ; i < n ; i ++ ) { samples [ i ] = gauss [ Math . random ( prob ) ] . rand ( ) ; } for ( int i = 0 ; i < k ; i ++ ) { gauss [ i ] = new MultivariateGaussianDistribution ( m [ k + i ] , v ) ; } for ( int i = 0 ; i < n ; i ++ ) { samples [ n + i ] = gauss [ Math . random ( prob ) ] . rand ( ) ; } return samples ; |
public class ProcessResponse { /** * syntactic sugar */
public ProcessResponseNotesComponent addNotes ( ) { } } | ProcessResponseNotesComponent t = new ProcessResponseNotesComponent ( ) ; if ( this . notes == null ) this . notes = new ArrayList < ProcessResponseNotesComponent > ( ) ; this . notes . add ( t ) ; return t ; |
public class CompositeFastList { /** * Override in subclasses where it can be optimized . */
@ Override protected void defaultSort ( Comparator < ? super E > comparator ) { } } | FastList < E > list = comparator == null ? ( FastList < E > ) this . toSortedList ( ) : ( FastList < E > ) this . toSortedList ( comparator ) ; this . lists . clear ( ) ; this . lists . add ( list ) ; |
public class LegacySpy { /** * Executes the { @ link Sniffer . Executable # execute ( ) } method on provided argument and verifies the expectations
* @ throws SniffyAssertionError if wrong number of queries was executed
* @ since 2.0 */
@ Deprecated public C execute ( Sniffer . Executable executable ) throws SniffyAssertionError { } } | return execute ( ( io . sniffy . Executable ) executable ) ; |
public class JsonParseUtil { /** * Parses the current token as a single - precision floating point value .
* @ param parser
* @ return { @ link Float }
* @ throws IOException
* @ throws JsonFormatException
* @ author vvakame */
public static Float parserFloat ( JsonPullParser parser ) throws IOException , JsonFormatException { } } | State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_DOUBLE ) { return ( float ) parser . getValueDouble ( ) ; } else { throw new IllegalStateException ( "unexpected state. expected=VALUE_DOUBLE, but get=" + eventType . toString ( ) ) ; } |
public class AnnotationHandler { /** * Helper method for { @ link # parse ( StaplerRequest , Annotation , Class , String ) } to convert to the right type
* from String . */
protected final Object convert ( Class targetType , String value ) { } } | Converter converter = Stapler . lookupConverter ( targetType ) ; if ( converter == null ) throw new IllegalArgumentException ( "Unable to convert to " + targetType ) ; return converter . convert ( targetType , value ) ; |
public class AstBinOp { /** * Ops do not make sense on categoricals , except EQ / NE ; flip such ops to NAs */
private ValFrame cleanCategorical ( Frame oldfr , Frame newfr ) { } } | final boolean categoricalOK = categoricalOK ( ) ; final Vec oldvecs [ ] = oldfr . vecs ( ) ; final Vec newvecs [ ] = newfr . vecs ( ) ; Futures fs = new Futures ( ) ; for ( int i = 0 ; i < oldvecs . length ; i ++ ) if ( ( oldvecs [ i ] . isCategorical ( ) && ! categoricalOK ) ) { // categorical are OK ( op is EQ / NE )
Vec cv = newvecs [ i ] . makeCon ( Double . NaN ) ; newfr . replace ( i , cv ) . remove ( fs ) ; } fs . blockForPending ( ) ; return new ValFrame ( newfr ) ; |
public class Scanner { /** * Tries to read more input . May block . */
private void readInput ( ) { } } | if ( buf . limit ( ) == buf . capacity ( ) ) makeSpace ( ) ; // Prepare to receive data
int p = buf . position ( ) ; buf . position ( buf . limit ( ) ) ; buf . limit ( buf . capacity ( ) ) ; int n = 0 ; try { n = source . read ( buf ) ; } catch ( IOException ioe ) { lastException = ioe ; n = - 1 ; } if ( n == - 1 ) { sourceClosed = true ; needInput = false ; } if ( n > 0 ) needInput = false ; // Restore current position and limit for reading
buf . limit ( buf . position ( ) ) ; buf . position ( p ) ; // Android - changed : The matcher implementation eagerly calls toString ( ) so we ' ll have
// to update its input whenever the buffer limit , position etc . changes .
matcher . reset ( buf ) ; |
public class HiveRegProps { /** * Create a { @ link State } object that contains Hive table properties . These properties are obtained from
* { @ link # HIVE _ TABLE _ PARTITION _ PROPS } , which is a list of comma - separated properties . Each property is in the form
* of ' [ key ] = [ value ] ' . */
private State createHiveProps ( String propKey ) { } } | State state = new State ( ) ; if ( ! contains ( propKey ) ) { return state ; } for ( String propValue : getPropAsList ( propKey ) ) { List < String > tokens = SPLITTER . splitToList ( propValue ) ; Preconditions . checkState ( tokens . size ( ) == 2 , propValue + " is not a valid Hive table/partition property" ) ; state . setProp ( tokens . get ( 0 ) , tokens . get ( 1 ) ) ; } return state ; |
public class channel { /** * Use this API to fetch filtered set of channel resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static channel [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | channel obj = new channel ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; channel [ ] response = ( channel [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class DoubleStream { /** * Returns { @ code DoubleStream } with elements that does not satisfy the given predicate .
* < p > This is an intermediate operation .
* @ param predicate the predicate used to filter elements
* @ return the new stream */
@ NotNull public DoubleStream filterNot ( @ NotNull final DoublePredicate predicate ) { } } | return filter ( DoublePredicate . Util . negate ( predicate ) ) ; |
public class DocumentLine { /** * getter for block - gets
* @ generated
* @ return value of the feature */
public int getBlock ( ) { } } | if ( DocumentLine_Type . featOkTst && ( ( DocumentLine_Type ) jcasType ) . casFeat_block == null ) jcasType . jcas . throwFeatMissing ( "block" , "ch.epfl.bbp.uima.types.DocumentLine" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( DocumentLine_Type ) jcasType ) . casFeatCode_block ) ; |
public class ConversionWrapper { /** * Extracts the direction , creates the reverse if necessary . */
public void init ( ) { } } | if ( conv . getConversionDirection ( ) == ConversionDirectionType . REVERSIBLE && this . reverse == null ) { reverse = new ConversionWrapper ( conv , ( GraphL3 ) graph ) ; this . direction = LEFT_TO_RIGHT ; reverse . direction = RIGHT_TO_LEFT ; reverse . reverse = this ; } else if ( conv . getConversionDirection ( ) == ConversionDirectionType . RIGHT_TO_LEFT ) { this . direction = RIGHT_TO_LEFT ; } else { this . direction = LEFT_TO_RIGHT ; } |
public class CmsVfsSitemapService { /** * Creates a new resource info to a given model page resource . < p >
* @ param cms the current CMS context
* @ param modelResource the model page resource
* @ param locale the locale used for retrieving descriptions / titles
* @ return the new resource info
* @ throws CmsException if something goes wrong */
private CmsNewResourceInfo createNewResourceInfo ( CmsObject cms , CmsResource modelResource , Locale locale ) throws CmsException { } } | // if model page got overwritten by another resource , reread from site path
if ( ! cms . existsResource ( modelResource . getStructureId ( ) , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) ) { modelResource = cms . readResource ( cms . getSitePath ( modelResource ) , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) ; } int typeId = modelResource . getTypeId ( ) ; String name = OpenCms . getResourceManager ( ) . getResourceType ( typeId ) . getTypeName ( ) ; String title = cms . readPropertyObject ( modelResource , CmsPropertyDefinition . PROPERTY_TITLE , false , locale ) . getValue ( ) ; String description = cms . readPropertyObject ( modelResource , CmsPropertyDefinition . PROPERTY_DESCRIPTION , false , locale ) . getValue ( ) ; boolean editable = false ; try { CmsResource freshModelResource = cms . readResource ( modelResource . getStructureId ( ) , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) ; editable = cms . hasPermissions ( freshModelResource , CmsPermissionSet . ACCESS_WRITE , false , CmsResourceFilter . DEFAULT ) ; } catch ( CmsException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } CmsNewResourceInfo info = new CmsNewResourceInfo ( typeId , name , title , description , modelResource . getStructureId ( ) , editable , description ) ; info . setBigIconClasses ( CmsIconUtil . getIconClasses ( name , null , false ) ) ; Float navpos = null ; try { CmsProperty navposProp = cms . readPropertyObject ( modelResource , CmsPropertyDefinition . PROPERTY_NAVPOS , true ) ; String navposStr = navposProp . getValue ( ) ; if ( navposStr != null ) { try { navpos = Float . valueOf ( navposStr ) ; } catch ( NumberFormatException e ) { // noop
} } } catch ( CmsException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } info . setNavPos ( navpos ) ; info . setDate ( CmsDateUtil . getDate ( new Date ( modelResource . getDateLastModified ( ) ) , DateFormat . LONG , getWorkplaceLocale ( ) ) ) ; info . setVfsPath ( modelResource . getRootPath ( ) ) ; return info ; |
public class StubPersonAttributeDao { /** * / * ( non - Javadoc )
* @ see org . jasig . services . persondir . IPersonAttributeDao # getPerson ( java . lang . String ) */
@ Override public IPersonAttributes getPerson ( final String uid , final IPersonAttributeDaoFilter filter ) { } } | if ( ! this . isEnabled ( ) ) { return null ; } if ( uid == null ) { throw new IllegalArgumentException ( "Illegal to invoke getPerson(String) with a null argument." ) ; } return this . backingPerson ; |
public class MPDUtility { /** * This method maps the currency symbol position from the
* representation used in the MPP file to the representation
* used by MPX .
* @ param value MPP symbol position
* @ return MPX symbol position */
public static CurrencySymbolPosition getSymbolPosition ( int value ) { } } | CurrencySymbolPosition result ; switch ( value ) { case 1 : { result = CurrencySymbolPosition . AFTER ; break ; } case 2 : { result = CurrencySymbolPosition . BEFORE_WITH_SPACE ; break ; } case 3 : { result = CurrencySymbolPosition . AFTER_WITH_SPACE ; break ; } case 0 : default : { result = CurrencySymbolPosition . BEFORE ; break ; } } return ( result ) ; |
public class CollaboratorUtils { /** * Returns a java . security . Principal object containing the name of the current authenticated user .
* If the user has not been authenticated , the method returns null .
* Look at the Subject on the thread only .
* We will extract , security name from WSCredential and the set of Principals , our WSPrincipal type . If a property has been set , then
* the realm is prepended to the security name .
* @ param useRealm whether to prepend the security name with the realm name
* @ param realm the realm name to prefix the security name with
* @ param web call by the webRequest
* @ param isJaspiEnabled TODO
* @ return a java . security . Principal containing the name of the user making this request ; null if the user has not been authenticated */
public Principal getCallerPrincipal ( boolean useRealm , String realm , boolean web , boolean isJaspiEnabled ) { } } | Subject subject = subjectManager . getCallerSubject ( ) ; if ( subject == null ) { return null ; } SubjectHelper subjectHelper = new SubjectHelper ( ) ; if ( subjectHelper . isUnauthenticated ( subject ) && web ) { return null ; } if ( isJaspiEnabled ) { Principal principal = getPrincipalFromWSCredential ( subjectHelper , subject ) ; if ( principal != null ) { return principal ; } } String securityName = getSecurityNameFromWSCredential ( subjectHelper , subject ) ; if ( securityName == null ) { return null ; } Principal jsonWebToken = MpJwtHelper . getJsonWebTokenPricipal ( subject ) ; if ( jsonWebToken != null ) { return jsonWebToken ; } Set < WSPrincipal > principals = subject . getPrincipals ( WSPrincipal . class ) ; if ( principals . size ( ) > 1 ) { multiplePrincipalsError ( principals ) ; } WSPrincipal wsPrincipal = null ; if ( ! principals . isEmpty ( ) ) { String principalName = createPrincipalName ( useRealm , realm , securityName ) ; wsPrincipal = principals . iterator ( ) . next ( ) ; wsPrincipal = new WSPrincipal ( principalName , wsPrincipal . getAccessId ( ) , wsPrincipal . getAuthenticationMethod ( ) ) ; } return wsPrincipal ; |
public class GradientDef { /** * < pre >
* The gradient function ' s name .
* < / pre >
* < code > optional string gradient _ func = 2 ; < / code > */
public java . lang . String getGradientFunc ( ) { } } | java . lang . Object ref = gradientFunc_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; gradientFunc_ = s ; return s ; } |
public class DatabaseVulnerabilityAssessmentScansInner { /** * Lists the vulnerability assessment scans of a database .
* ServiceResponse < PageImpl < VulnerabilityAssessmentScanRecordInner > > * @ 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 .
* ServiceResponse < PageImpl < VulnerabilityAssessmentScanRecordInner > > * @ param serverName The name of the server .
* ServiceResponse < PageImpl < VulnerabilityAssessmentScanRecordInner > > * @ param databaseName The name of the database .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; VulnerabilityAssessmentScanRecordInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < VulnerabilityAssessmentScanRecordInner > > > listByDatabaseSinglePageAsync ( final String resourceGroupName , final String serverName , final String databaseName ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverName == null ) { throw new IllegalArgumentException ( "Parameter serverName is required and cannot be null." ) ; } if ( databaseName == null ) { throw new IllegalArgumentException ( "Parameter databaseName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } final String vulnerabilityAssessmentName = "default" ; return service . listByDatabase ( resourceGroupName , serverName , databaseName , vulnerabilityAssessmentName , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < VulnerabilityAssessmentScanRecordInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < VulnerabilityAssessmentScanRecordInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < VulnerabilityAssessmentScanRecordInner > > result = listByDatabaseDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < VulnerabilityAssessmentScanRecordInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class GenJsCodeVisitor { /** * Example :
* < pre >
* { switch $ boo }
* { case 0}
* { case 1 , 2}
* { default }
* { / switch }
* < / pre >
* might generate
* < pre >
* switch ( opt _ data . boo ) {
* case 0:
* break ;
* case 1:
* case 2:
* break ;
* default :
* < / pre > */
@ Override protected void visitSwitchNode ( SwitchNode node ) { } } | Expression switchOn = coerceTypeForSwitchComparison ( node . getExpr ( ) ) ; SwitchBuilder switchBuilder = switchValue ( switchOn ) ; for ( SoyNode child : node . getChildren ( ) ) { if ( child instanceof SwitchCaseNode ) { SwitchCaseNode scn = ( SwitchCaseNode ) child ; ImmutableList . Builder < Expression > caseChunks = ImmutableList . builder ( ) ; for ( ExprNode caseExpr : scn . getExprList ( ) ) { Expression caseChunk = translateExpr ( caseExpr ) ; caseChunks . add ( caseChunk ) ; } Statement body = visitChildrenReturningCodeChunk ( scn ) ; switchBuilder . addCase ( caseChunks . build ( ) , body ) ; } else if ( child instanceof SwitchDefaultNode ) { Statement body = visitChildrenReturningCodeChunk ( ( SwitchDefaultNode ) child ) ; switchBuilder . setDefault ( body ) ; } else { throw new AssertionError ( ) ; } } jsCodeBuilder . append ( switchBuilder . build ( ) ) ; |
public class HiveSessionImpl { /** * extract the real user from the given token string */
private String getUserFromToken ( HiveAuthFactory authFactory , String tokenStr ) throws HiveSQLException { } } | return authFactory . getUserFromToken ( tokenStr ) ; |
public class Utils { /** * returns values for a key in the following order :
* 1 . First checks environment variables
* 2 . Falls back to system properties
* @ param name
* @ param defaultValue
* @ return */
public static String getEnv ( String name , String defaultValue ) { } } | Map < String , String > env = System . getenv ( ) ; // try to get value from environment variables
if ( env . get ( name ) != null ) { return env . get ( name ) ; } // fall back to system properties
return System . getProperty ( name , defaultValue ) ; |
public class UserOption { /** * Returns true if this option accepts the specified value
* @ param value the value to test
* @ return true if the option accepts the value , false otherwise */
public boolean acceptsValue ( String value ) { } } | if ( value == null ) { return false ; } else if ( hasValues ( ) ) { return getValuesList ( ) . contains ( value ) ; } else { return true ; } |
public class NodeSupport { /** * Gets the value of " framework . server . name " property
* @ return Returns value of framework . server . name property */
@ Override public String getFrameworkNodeName ( ) { } } | String name = getLookup ( ) . getProperty ( "framework.server.name" ) ; if ( null != name ) { return name . trim ( ) ; } else { return name ; } |
public class SARLLabelProvider { /** * Replies the image for the given element .
* < p > This function is a Xtext dispatch function for { @ link # imageDescriptor ( Object ) } .
* @ param element the element .
* @ return the image descriptor .
* @ see # imageDescriptor ( Object ) */
protected ImageDescriptor imageDescriptor ( SarlConstructor element ) { } } | if ( element . isStatic ( ) ) { return this . images . forStaticConstructor ( ) ; } return this . images . forConstructor ( element . getVisibility ( ) , this . adornments . get ( this . jvmModelAssociations . getInferredConstructor ( element ) ) ) ; |
public class Element { /** * Check that the element ' s children are limited to allowed element types . */
void assertContentModel ( Collection < Class < ? extends Element > > permittedChildren ) throws InvalidInputException { } } | for ( Element child : this . getChildren ( ) ) { if ( ! permittedChildren . contains ( child . getClass ( ) ) ) { // Permit whitespace
if ( child instanceof TextNode && StringUtils . isBlank ( ( ( TextNode ) child ) . getText ( ) ) ) { continue ; } throw new InvalidInputException ( "Element \"" + child . getMessageMLTag ( ) + "\" is not allowed in \"" + this . getMessageMLTag ( ) + "\"" ) ; } } |
public class TarUtils { /** * @ param fileList
* @ return
* @ throws IOException
* @ throws CompressorException */
public static String tarFiles ( String dir , String fileNamePrefix , List < File > fileList ) throws IOException , CompressorException { } } | OsUtil . makeDirs ( dir ) ; // 时间
String curTime = DateUtils . format ( new Date ( ) , DataFormatConstants . COMMON_TIME_FORMAT ) ; // 文件名
String outputFilePath = fileNamePrefix + "_" + curTime + ".tar.gz" ; File outputFile = new File ( dir , outputFilePath ) ; FileOutputStream out = null ; out = new FileOutputStream ( outputFile ) ; // 进行打包
TarArchiveOutputStream os = new TarArchiveOutputStream ( out ) ; for ( File file : fileList ) { os . putArchiveEntry ( new TarArchiveEntry ( file , file . getName ( ) ) ) ; IOUtils . copy ( new FileInputStream ( file ) , os ) ; os . closeArchiveEntry ( ) ; } if ( os != null ) { try { os . flush ( ) ; os . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return outputFile . getAbsolutePath ( ) ; |
public class CSVStream { /** * Writes objects from the given { @ link Stream } to the given { @ link Writer } in
* CSV format , converting them to a { @ link List } of String ' s using the given
* { @ link BiFunction } .
* @ param writer
* The Writer that will receive the CSV file .
* @ param objects
* The Stream of objects to be written
* @ param headers
* The headers to use for the resulting CSV file .
* @ param objectConverter
* The function to convert an individual object to a line in the
* resulting CSV file , represented as a List of String ' s .
* @ param < T >
* The type of the objects to be converted .
* @ throws IOException
* If an error occurred accessing the output stream .
* @ throws CSVStreamException
* If an error occurred converting or serialising the objects . */
public static < T > void write ( final Writer writer , final Stream < T > objects , final List < String > headers , final BiFunction < List < String > , T , List < String > > objectConverter ) throws IOException , CSVStreamException { } } | write ( writer , objects , buildSchema ( headers ) , objectConverter ) ; |
public class FrameworkProjectConfig { /** * Create and generate file with the given properties if not null
* @ param name
* @ param propertyFile
* @ param properties
* @ param filesystemFramework
* @ return */
public static FrameworkProjectConfig create ( final String name , final File propertyFile , final Properties properties , final IFilesystemFramework filesystemFramework ) { } } | if ( ! propertyFile . exists ( ) ) { generateProjectPropertiesFile ( name , propertyFile , false , properties , true ) ; } return create ( name , propertyFile , filesystemFramework ) ; |
public class App { /** * Check if the permissions map contains " OWN " keyword , which restricts access to objects to their creators .
* @ param user user in context
* @ param object some object
* @ return true if app contains permission for this resource and it is marked with " OWN " */
public boolean permissionsContainOwnKeyword ( User user , ParaObject object ) { } } | if ( user == null || object == null ) { return false ; } String resourcePath1 = object . getType ( ) ; String resourcePath2 = object . getObjectURI ( ) . substring ( 1 ) ; // remove first ' / '
String resourcePath3 = object . getPlural ( ) ; return hasOwnKeyword ( App . ALLOW_ALL , resourcePath1 ) || hasOwnKeyword ( App . ALLOW_ALL , resourcePath2 ) || hasOwnKeyword ( App . ALLOW_ALL , resourcePath3 ) || hasOwnKeyword ( user . getId ( ) , resourcePath1 ) || hasOwnKeyword ( user . getId ( ) , resourcePath2 ) || hasOwnKeyword ( user . getId ( ) , resourcePath3 ) ; |
public class Setup { /** * This method is used to set the Moip API environment where the requests will be sent .
* The only Moip environments that are possible request are { @ code SANDBOX } or { @ code PRODUCTION } .
* @ param environment
* { @ code String } the Moip API environment .
* @ return { @ code Setup } */
public Setup setEnvironment ( final Environment environment ) { } } | switch ( environment ) { case SANDBOX : this . environment = SANDBOX_URL ; break ; case PRODUCTION : this . environment = PRODUCTION_URL ; break ; case CONNECT_SANDBOX : this . environment = CONNECT_SANDBOX_URL ; break ; case CONNECT_PRODUCTION : this . environment = CONNECT_PRODUCTION_URL ; break ; default : this . environment = "" ; } return this ; |
public class Dcs_sqr { /** * Symbolic QR or LU ordering and analysis .
* @ param order
* ordering method to use ( 0 to 3)
* @ param A
* column - compressed matrix
* @ param qr
* analyze for QR if true or LU if false
* @ return symbolic analysis for QR or LU , null on error */
public static Dcss cs_sqr ( int order , Dcs A , boolean qr ) { } } | int n , k , post [ ] ; Dcss S ; boolean ok = true ; if ( ! Dcs_util . CS_CSC ( A ) ) return ( null ) ; /* check inputs */
n = A . n ; S = new Dcss ( ) ; /* allocate result S */
S . q = Dcs_amd . cs_amd ( order , A ) ; /* fill - reducing ordering */
if ( order > 0 && S . q == null ) return ( null ) ; if ( qr ) /* QR symbolic analysis */
{ Dcs C = order > 0 ? Dcs_permute . cs_permute ( A , null , S . q , false ) : A ; S . parent = Dcs_etree . cs_etree ( C , true ) ; /* etree of C ' * C , where C = A ( : , q ) */
post = Dcs_post . cs_post ( S . parent , n ) ; S . cp = Dcs_counts . cs_counts ( C , S . parent , post , true ) ; /* col counts chol ( C ' * C ) */
ok = C != null && S . parent != null && S . cp != null && cs_vcount ( C , S ) ; if ( ok ) for ( S . unz = 0 , k = 0 ; k < n ; k ++ ) S . unz += S . cp [ k ] ; ok = ok && S . lnz >= 0 && S . unz >= 0 ; /* int overflow guard */
} else { S . unz = 4 * ( A . p [ n ] ) + n ; /* for LU factorization only , */
S . lnz = S . unz ; /* guess nnz ( L ) and nnz ( U ) */
} return ( ok ? S : null ) ; /* return result S */ |
public class CassDAOImpl { /** * Given a DATA object , extract the individual elements from the Data into an Object Array for the
* execute element . */
public Result < DATA > create ( TRANS trans , DATA data ) { } } | if ( createPS == null ) { Result . err ( Result . ERR_NotImplemented , "Create is disabled for %s" , getClass ( ) . getSimpleName ( ) ) ; } if ( async ) /* ResultSetFuture */
{ Result < ResultSetFuture > rs = createPS . execAsync ( trans , C_TEXT , data ) ; if ( rs . notOK ( ) ) { return Result . err ( rs ) ; } } else { Result < ResultSet > rs = createPS . exec ( trans , C_TEXT , data ) ; if ( rs . notOK ( ) ) { return Result . err ( rs ) ; } } wasModified ( trans , CRUD . create , data ) ; return Result . ok ( data ) ; |
public class DOTranslationUtility { /** * Parse and read the object state value from raw text .
* Reads a text representation of object state , and returns a " state code "
* abbreviation corresponding to that state . Null or empty values are interpreted
* as " Active " .
* XXX : It might clearer to nix state codes altogether and just use the full value
* @ param rawValue Raw string to parse . May be null
* @ return String containing the state code ( A , D , or I )
* @ throws ParseException thrown when state value cannot be determined */
public static String readStateAttribute ( String rawValue ) throws ParseException { } } | if ( MODEL . DELETED . looselyMatches ( rawValue , true ) ) { return "D" ; } else if ( MODEL . INACTIVE . looselyMatches ( rawValue , true ) ) { return "I" ; } else if ( MODEL . ACTIVE . looselyMatches ( rawValue , true ) || rawValue == null || rawValue . isEmpty ( ) ) { return "A" ; } else { throw new ParseException ( "Could not interpret state value of '" + rawValue + "'" , 0 ) ; } |
public class Ray { /** * Gets the distance to the plane at z .
* @ param z the z plane
* @ return the distance */
public double intersectZ ( double z ) { } } | if ( direction . z == 0 ) return Double . NaN ; return ( z - origin . z ) / direction . z ; |
public class SentenceSet2VectorSet { /** * Returns a command - line help .
* return a command - line help . */
private static String getHelp ( ) { } } | StringBuffer sb = new StringBuffer ( ) ; // SRE
sb . append ( "\njSRE: Simple Relation Extraction V1.10\t 30.08.06\n" ) ; sb . append ( "developed by Claudio Giuliano (giuliano@itc.it)\n\n" ) ; // License
sb . append ( "Copyright 2005 FBK-irst (http://www.fbk.eu)\n" ) ; sb . append ( "\n" ) ; sb . append ( "Licensed under the Apache License, Version 2.0 (the \"License\");\n" ) ; sb . append ( "you may not use this file except in compliance with the License.\n" ) ; sb . append ( "You may obtain a copy of the License at\n" ) ; sb . append ( "\n" ) ; sb . append ( " http://www.apache.org/licenses/LICENSE-2.0\n" ) ; sb . append ( "\n" ) ; sb . append ( "Unless required by applicable law or agreed to in writing, software\n" ) ; sb . append ( "distributed under the License is distributed on an \"AS IS\" BASIS,\n" ) ; sb . append ( "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" ) ; sb . append ( "See the License for the specific language governing permissions and\n" ) ; sb . append ( "limitations under the License.\n\n" ) ; // Usage
sb . append ( "Usage: java org.itc.irst.tcc.sre.SentenceSet2VectorSet [options] example-file model-file output-file\n\n" ) ; // Arguments
sb . append ( "Arguments:\n" ) ; sb . append ( "\ttest-file\t-> file with test data (SRE format)\n" ) ; sb . append ( "\tmodel-file\t-> file from which to load the learned model\n" ) ; sb . append ( "\toutput-file\t-> file in which to store resulting output\n" ) ; sb . append ( "Options:\n" ) ; sb . append ( "\t-h\t\t-> this help\n" ) ; return sb . toString ( ) ; |
public class DoTask { /** * Checks if the Java version is recent enough to run MOA .
* @ return true if the Java version is recent . */
public static boolean isJavaVersionOK ( ) { } } | boolean isJavaVersionOK = true ; String versionStr = System . getProperty ( "java.version" ) ; String [ ] parts ; double version ; if ( versionStr . contains ( "." ) ) { parts = versionStr . split ( "\\." ) ; } else { parts = new String [ ] { versionStr } ; } if ( parts . length == 1 ) { try { version = Double . parseDouble ( parts [ 0 ] ) ; } catch ( Exception e ) { System . err . println ( "Unparsable Java version: " + versionStr ) ; return false ; } } else { try { version = Double . parseDouble ( parts [ 0 ] ) + Double . parseDouble ( parts [ 1 ] ) / 10 ; } catch ( Exception e ) { System . err . println ( "Unparsable Java version: " + versionStr ) ; return false ; } } if ( version < 1.8 ) { isJavaVersionOK = false ; System . err . println ( ) ; System . err . println ( Globals . getWorkbenchInfoString ( ) ) ; System . err . println ( ) ; System . err . print ( "Java 8 or higher is required to run MOA. " ) ; System . err . println ( "Java version " + versionStr + " found" ) ; } return isJavaVersionOK ; |
public class S3Location { /** * A list of grants that control access to the staged results .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAccessControlList ( java . util . Collection ) } or { @ link # withAccessControlList ( java . util . Collection ) } if
* you want to override the existing values .
* @ param accessControlList
* A list of grants that control access to the staged results .
* @ return Returns a reference to this object so that method calls can be chained together . */
public S3Location withAccessControlList ( Grant ... accessControlList ) { } } | if ( this . accessControlList == null ) { setAccessControlList ( new java . util . ArrayList < Grant > ( accessControlList . length ) ) ; } for ( Grant ele : accessControlList ) { this . accessControlList . add ( ele ) ; } return this ; |
public class Grid { /** * Replies the bounds covered by a cell at the specified location .
* @ param row the row index .
* @ param column the column index .
* @ return the bounds . */
@ Pure public Rectangle2d getCellBounds ( int row , int column ) { } } | final double cellWidth = getCellWidth ( ) ; final double cellHeight = getCellHeight ( ) ; final double x = this . bounds . getMinX ( ) + cellWidth * column ; final double y = this . bounds . getMinY ( ) + cellHeight * row ; return new Rectangle2d ( x , y , cellWidth , cellHeight ) ; |
public class Choice5 { /** * { @ inheritDoc } */
@ Override public Choice4 < A , B , C , D > converge ( Function < ? super E , ? extends CoProduct4 < A , B , C , D , ? > > convergenceFn ) { } } | return match ( Choice4 :: a , Choice4 :: b , Choice4 :: c , Choice4 :: d , convergenceFn . andThen ( cp4 -> cp4 . match ( Choice4 :: a , Choice4 :: b , Choice4 :: c , Choice4 :: d ) ) ) ; |
public class LockManagerRemoteImpl { public void releaseLocks ( Object key ) { } } | LockInfo info = new LockInfo ( key , null , METHOD_RELEASE_LOCKS ) ; try { byte [ ] requestBarr = serialize ( info ) ; performRequest ( requestBarr ) ; } catch ( Throwable t ) { throw new LockRuntimeException ( "Cannot release locks using owner key '" + key + "'" , t ) ; } |
public class DrizzleResultSet { /** * Retrieves the value of the designated column in the current row of this < code > ResultSet < / code > object as a
* < code > java . sql . Timestamp < / code > object in the Java programming language .
* @ param columnLabel the label for the column specified with the SQL AS clause . If the SQL AS clause was not
* specified , then the label is the name of the column
* @ return the column value ; if the value is SQL < code > NULL < / code > , the value returned is < code > null < / code >
* @ throws java . sql . SQLException if the columnLabel is not valid ; if a database access error occurs or this method
* is called on a closed result set */
public Timestamp getTimestamp ( final String columnLabel ) throws SQLException { } } | try { return getValueObject ( columnLabel ) . getTimestamp ( ) ; } catch ( ParseException e ) { throw SQLExceptionMapper . getSQLException ( "Could not parse column as timestamp, was: \"" + getValueObject ( columnLabel ) . getString ( ) + "\"" , e ) ; } |
public class PrimitiveTransformation { /** * < code > . google . privacy . dlp . v2 . CryptoDeterministicConfig crypto _ deterministic _ config = 12 ; < / code > */
public com . google . privacy . dlp . v2 . CryptoDeterministicConfigOrBuilder getCryptoDeterministicConfigOrBuilder ( ) { } } | if ( transformationCase_ == 12 ) { return ( com . google . privacy . dlp . v2 . CryptoDeterministicConfig ) transformation_ ; } return com . google . privacy . dlp . v2 . CryptoDeterministicConfig . getDefaultInstance ( ) ; |
public class FileSystemGroupStore { /** * Returns an < code > Iterator < / code > over the < code > Collection < / code > of < code > IEntities < / code >
* that are members of this < code > IEntityGroup < / code > .
* @ return java . util . Iterator
* @ param group org . apereo . portal . groups . IEntityGroup */
@ Override public java . util . Iterator findEntitiesForGroup ( IEntityGroup group ) throws GroupsException { } } | if ( log . isDebugEnabled ( ) ) log . debug ( DEBUG_CLASS_NAME + ".findEntitiesForGroup(): retrieving entities for group " + group ) ; Collection entities = null ; File f = getFile ( group ) ; if ( f . isDirectory ( ) ) { entities = Collections . EMPTY_LIST ; } else { entities = getEntitiesFromFile ( f ) ; } return entities . iterator ( ) ; |
public class AspectranWebService { /** * Find the standalone ActivityContext for this web aspectran service .
* @ param servlet the servlet
* @ return the ActivityContext for this web aspectran service */
public static ActivityContext getActivityContext ( HttpServlet servlet ) { } } | ServletContext servletContext = servlet . getServletContext ( ) ; String attrName = STANDALONE_WEB_SERVICE_ATTRIBUTE_PREFIX + servlet . getServletName ( ) ; ActivityContext activityContext = getActivityContext ( servletContext , attrName ) ; if ( activityContext != null ) { return activityContext ; } else { return getActivityContext ( servletContext ) ; } |
public class IoUtil { /** * Write the entire contents of the supplied string to the given stream . This method always flushes and closes the stream when
* finished .
* @ param input1 the first stream
* @ param input2 the second stream
* @ return true if the streams contain the same content , or false otherwise
* @ throws IOException
* @ throws IllegalArgumentException if the stream is null */
public static boolean isSame ( InputStream input1 , InputStream input2 ) throws IOException { } } | CheckArg . isNotNull ( input1 , "input1" ) ; CheckArg . isNotNull ( input2 , "input2" ) ; boolean error = false ; try { byte [ ] buffer1 = new byte [ 1024 ] ; byte [ ] buffer2 = new byte [ 1024 ] ; try { int numRead1 = 0 ; int numRead2 = 0 ; while ( true ) { numRead1 = input1 . read ( buffer1 ) ; numRead2 = input2 . read ( buffer2 ) ; if ( numRead1 > - 1 ) { if ( numRead2 != numRead1 ) return false ; // Otherwise same number of bytes read
if ( ! Arrays . equals ( buffer1 , buffer2 ) ) return false ; // Otherwise same bytes read , so continue . . .
} else { // Nothing more in stream 1 . . .
return numRead2 < 0 ; } } } finally { input1 . close ( ) ; } } catch ( IOException e ) { error = true ; // this error should be thrown , even if there is an error closing stream 2
throw e ; } catch ( RuntimeException e ) { error = true ; // this error should be thrown , even if there is an error closing stream 2
throw e ; } finally { try { input2 . close ( ) ; } catch ( IOException e ) { if ( ! error ) throw e ; } } |
public class LdapUtils { /** * Execute modify operation boolean .
* @ param currentDn the current dn
* @ param connectionFactory the connection factory
* @ param entry the entry
* @ return true / false */
public static boolean executeModifyOperation ( final String currentDn , final ConnectionFactory connectionFactory , final LdapEntry entry ) { } } | final Map < String , Set < String > > attributes = entry . getAttributes ( ) . stream ( ) . collect ( Collectors . toMap ( LdapAttribute :: getName , ldapAttribute -> new HashSet < > ( ldapAttribute . getStringValues ( ) ) ) ) ; return executeModifyOperation ( currentDn , connectionFactory , attributes ) ; |
public class ListAssessmentRunAgentsResult { /** * A list of ARNs that specifies the agents returned by the action .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAssessmentRunAgents ( java . util . Collection ) } or { @ link # withAssessmentRunAgents ( java . util . Collection ) }
* if you want to override the existing values .
* @ param assessmentRunAgents
* A list of ARNs that specifies the agents returned by the action .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListAssessmentRunAgentsResult withAssessmentRunAgents ( AssessmentRunAgent ... assessmentRunAgents ) { } } | if ( this . assessmentRunAgents == null ) { setAssessmentRunAgents ( new java . util . ArrayList < AssessmentRunAgent > ( assessmentRunAgents . length ) ) ; } for ( AssessmentRunAgent ele : assessmentRunAgents ) { this . assessmentRunAgents . add ( ele ) ; } return this ; |
public class LocalQueueConnection { /** * ( non - Javadoc )
* @ see javax . jms . QueueConnection # createQueueSession ( boolean , int ) */
@ Override public synchronized QueueSession createQueueSession ( boolean transacted , int acknowledgeMode ) throws JMSException { } } | checkNotClosed ( ) ; LocalQueueSession session = new LocalQueueSession ( idProvider . createID ( ) , this , engine , transacted , acknowledgeMode ) ; registerSession ( session ) ; return session ; |
public class BsScheduledJobCA { public void filter ( String name , EsAbstractConditionQuery . OperatorCall < BsScheduledJobCQ > queryLambda , ConditionOptionCall < FilterAggregationBuilder > opLambda , OperatorCall < BsScheduledJobCA > aggsLambda ) { } } | ScheduledJobCQ cq = new ScheduledJobCQ ( ) ; if ( queryLambda != null ) { queryLambda . callback ( cq ) ; } FilterAggregationBuilder builder = regFilterA ( name , cq . getQuery ( ) ) ; if ( opLambda != null ) { opLambda . callback ( builder ) ; } if ( aggsLambda != null ) { ScheduledJobCA ca = new ScheduledJobCA ( ) ; aggsLambda . callback ( ca ) ; ca . getAggregationBuilderList ( ) . forEach ( builder :: subAggregation ) ; } |
public class ASTHelpers { /** * Returns whether { @ code anno } corresponds to a type annotation , or { @ code null } if it could not
* be determined . */
@ Nullable public static AnnotationType getAnnotationType ( AnnotationTree anno , @ Nullable Symbol target , VisitorState state ) { } } | if ( target == null ) { return null ; } Symbol annoSymbol = getSymbol ( anno ) ; if ( annoSymbol == null ) { return null ; } Compound compound = target . attribute ( annoSymbol ) ; if ( compound == null ) { for ( TypeCompound typeCompound : target . getRawTypeAttributes ( ) ) { if ( typeCompound . type . tsym . equals ( annoSymbol ) ) { compound = typeCompound ; break ; } } } if ( compound == null ) { return null ; } return TypeAnnotations . instance ( state . context ) . annotationTargetType ( compound , target ) ; |
public class JORARepository { /** * Updates the specified field in the supplied object ( which must
* correspond to the supplied table ) .
* @ return the number of rows modified by the update . */
protected < T > int updateField ( final Table < T > table , final T object , String field ) throws PersistenceException { } } | final FieldMask mask = table . getFieldMask ( ) ; mask . setModified ( field ) ; return executeUpdate ( new Operation < Integer > ( ) { public Integer invoke ( Connection conn , DatabaseLiaison liaison ) throws SQLException , PersistenceException { return table . update ( conn , object , mask ) ; } } ) ; |
public class TenantService { /** * Provides the complete collection of tenants in the system in the default order
* ( alphabetically by name ) . */
public List < ITenant > getTenantsList ( ) { } } | List < ITenant > rslt = new ArrayList < ITenant > ( tenantDao . getAllTenants ( ) ) ; Collections . sort ( rslt ) ; return rslt ; |
public class MetadataUtils { /** * Gets the enclosing document name .
* @ param m
* the m
* @ param criteria
* Input criteria
* @ param viaColumnName
* true if < code > criteria < / code > is column Name , false if
* < code > criteria < / code > is column field name
* @ return the enclosing document name */
public static String getEnclosingEmbeddedFieldName ( EntityMetadata m , String criteria , boolean viaColumnName , final KunderaMetadata kunderaMetadata ) { } } | String enclosingEmbeddedFieldName = null ; StringTokenizer strToken = new StringTokenizer ( criteria , "." ) ; String embeddableAttributeName = null ; String embeddedFieldName = null ; String nestedEmbeddedFieldName = null ; if ( strToken . countTokens ( ) > 0 ) { embeddableAttributeName = strToken . nextToken ( ) ; } if ( strToken . countTokens ( ) > 0 ) { embeddedFieldName = strToken . nextToken ( ) ; } if ( strToken . countTokens ( ) > 0 ) { nestedEmbeddedFieldName = strToken . nextToken ( ) ; } Metamodel metaModel = kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; EntityType entity = metaModel . entity ( m . getEntityClazz ( ) ) ; try { Attribute attribute = entity . getAttribute ( embeddableAttributeName ) ; if ( ( ( MetamodelImpl ) metaModel ) . isEmbeddable ( ( ( AbstractAttribute ) attribute ) . getBindableJavaType ( ) ) ) { EmbeddableType embeddable = metaModel . embeddable ( ( ( AbstractAttribute ) attribute ) . getBindableJavaType ( ) ) ; Iterator < Attribute > attributeIter = embeddable . getAttributes ( ) . iterator ( ) ; while ( attributeIter . hasNext ( ) ) { AbstractAttribute attrib = ( AbstractAttribute ) attributeIter . next ( ) ; if ( viaColumnName && attrib . getName ( ) . equals ( embeddedFieldName ) ) { if ( nestedEmbeddedFieldName != null && ( ( MetamodelImpl ) metaModel ) . isEmbeddable ( ( ( AbstractAttribute ) attrib ) . getBindableJavaType ( ) ) ) { EmbeddableType nestedEmbeddable = metaModel . embeddable ( ( ( AbstractAttribute ) attrib ) . getBindableJavaType ( ) ) ; Iterator < Attribute > iter = embeddable . getAttributes ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { AbstractAttribute nestedAttribute = ( AbstractAttribute ) iter . next ( ) ; if ( viaColumnName && nestedAttribute . getName ( ) . equals ( embeddedFieldName ) ) { return nestedAttribute . getName ( ) ; } if ( ! viaColumnName && nestedAttribute . getJPAColumnName ( ) . equals ( embeddedFieldName ) ) { return nestedAttribute . getName ( ) ; } } } else if ( nestedEmbeddedFieldName != null && ! ( ( MetamodelImpl ) metaModel ) . isEmbeddable ( ( ( AbstractAttribute ) attrib ) . getBindableJavaType ( ) ) ) { return null ; } else { return attribute . getName ( ) ; } } if ( ! viaColumnName && attrib . getJPAColumnName ( ) . equals ( embeddedFieldName ) ) { return attribute . getName ( ) ; } } } } catch ( IllegalArgumentException iax ) { return null ; } return enclosingEmbeddedFieldName ; |
public class A_CmsTextExtractor { /** * Parses the given input stream with the provided parser and returns the result as a map of content items . < p >
* @ param in the input stream for the content to parse
* @ param parser the parser to use
* @ return the result of the parsing as a map of content items
* @ throws Exception in case something goes wrong */
@ SuppressWarnings ( "deprecation" ) protected CmsExtractionResult extractText ( InputStream in , Parser parser ) throws Exception { } } | LinkedHashMap < String , String > contentItems = new LinkedHashMap < String , String > ( ) ; StringWriter writer = new StringWriter ( ) ; BodyContentHandler handler = new BodyContentHandler ( writer ) ; Metadata meta = new Metadata ( ) ; ParseContext context = new ParseContext ( ) ; parser . parse ( in , handler , meta , context ) ; in . close ( ) ; String result = writer . toString ( ) ; // add the main document text
StringBuffer content = new StringBuffer ( result ) ; if ( CmsStringUtil . isNotEmpty ( result ) ) { contentItems . put ( I_CmsExtractionResult . ITEM_RAW , result ) ; } // appends all known document meta data as content items
combineContentItem ( meta . get ( DublinCore . TITLE ) , I_CmsExtractionResult . ITEM_TITLE , content , contentItems ) ; combineContentItem ( meta . get ( MSOffice . KEYWORDS ) , I_CmsExtractionResult . ITEM_KEYWORDS , content , contentItems ) ; String subject = meta . get ( I_CmsExtractionResult . ITEM_SUBJECT ) ; if ( StringUtils . isBlank ( subject ) ) { subject = meta . get ( DublinCore . SUBJECT ) ; } combineContentItem ( subject , I_CmsExtractionResult . ITEM_SUBJECT , content , contentItems ) ; combineContentItem ( meta . get ( MSOffice . AUTHOR ) , I_CmsExtractionResult . ITEM_AUTHOR , content , contentItems ) ; String creator = meta . get ( "xmp:CreatorTool" ) ; if ( StringUtils . isBlank ( creator ) ) { creator = meta . get ( DublinCore . CREATOR ) ; } if ( StringUtils . isBlank ( creator ) ) { creator = meta . get ( I_CmsExtractionResult . ITEM_CREATOR ) ; } combineContentItem ( creator , I_CmsExtractionResult . ITEM_CREATOR , content , contentItems ) ; combineContentItem ( meta . get ( MSOffice . CATEGORY ) , I_CmsExtractionResult . ITEM_CATEGORY , content , contentItems ) ; combineContentItem ( meta . get ( MSOffice . COMMENTS ) , I_CmsExtractionResult . ITEM_COMMENTS , content , contentItems ) ; String company = meta . get ( OfficeOpenXMLExtended . COMPANY ) ; if ( StringUtils . isBlank ( company ) ) { company = meta . get ( MSOffice . COMPANY ) ; } combineContentItem ( company , I_CmsExtractionResult . ITEM_COMPANY , content , contentItems ) ; combineContentItem ( meta . get ( MSOffice . MANAGER ) , I_CmsExtractionResult . ITEM_MANAGER , content , contentItems ) ; // this constant seems to be missing from TIKA
combineContentItem ( meta . get ( I_CmsExtractionResult . ITEM_PRODUCER ) , I_CmsExtractionResult . ITEM_PRODUCER , content , contentItems ) ; // return the final result
return new CmsExtractionResult ( content . toString ( ) , contentItems ) ; |
public class Translate { /** * Translate { @ link Edge } IDs using the given { @ link TranslateFunction } .
* @ param edges input edges
* @ param translator implements conversion from { @ code OLD } to { @ code NEW }
* @ param < OLD > old edge ID type
* @ param < NEW > new edge ID type
* @ param < EV > edge value type
* @ return translated edges */
public static < OLD , NEW , EV > DataSet < Edge < NEW , EV > > translateEdgeIds ( DataSet < Edge < OLD , EV > > edges , TranslateFunction < OLD , NEW > translator ) { } } | return translateEdgeIds ( edges , translator , PARALLELISM_DEFAULT ) ; |
public class SessionRuntimeException { /** * Converts a Throwable to a SessionRuntimeException . If the Throwable is a
* SessionRuntimeException , it will be passed through unmodified ; otherwise , it will be wrapped
* in a new SessionRuntimeException .
* @ param cause the Throwable to convert
* @ return a SessionRuntimeException */
public static SessionRuntimeException fromThrowable ( Throwable cause ) { } } | return ( cause instanceof SessionRuntimeException ) ? ( SessionRuntimeException ) cause : new SessionRuntimeException ( cause ) ; |
public class Formula { /** * Sets an entry in the predicate cache of this formula
* @ param key the cache key
* @ param value the cache value */
public void setPredicateCacheEntry ( final CacheEntry key , final boolean value ) { } } | this . predicateCache . put ( key , Tristate . fromBool ( value ) ) ; |
public class CreateAuthorizerResult { /** * For REQUEST authorizer , this is not defined .
* @ param providerArns
* For REQUEST authorizer , this is not defined . */
public void setProviderArns ( java . util . Collection < String > providerArns ) { } } | if ( providerArns == null ) { this . providerArns = null ; return ; } this . providerArns = new java . util . ArrayList < String > ( providerArns ) ; |
public class InjectionRecommender2 { /** * Provide the recommendations for the given module .
* @ param superModule the super module to extract definitions from .
* @ param currentModuleAccess the accessor to the the current module ' s definition . */
protected void recommend ( Class < ? > superModule , GuiceModuleAccess currentModuleAccess ) { } } | LOG . info ( MessageFormat . format ( "Building injection configuration from {0}" , // $ NON - NLS - 1 $
superModule . getName ( ) ) ) ; final Set < BindingElement > superBindings = new LinkedHashSet < > ( ) ; fillFrom ( superBindings , superModule . getSuperclass ( ) ) ; fillFrom ( superBindings , superModule ) ; final Set < Binding > currentBindings = currentModuleAccess . getBindings ( ) ; recommendFrom ( superModule . getName ( ) , superBindings , currentBindings ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.