signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class ScanResultObject { /** * Load the class named returned by { @ link # getClassInfo ( ) } , or if that returns null , the class named by
* { @ link # getClassName ( ) } . Returns a { @ code Class < ? > } reference for the class , cast to the requested superclass
* or interface type .
* @ param < T >
* the superclass or interface type
* @ param superclassOrInterfaceType
* The type to cast the resulting class reference to .
* @ return The { @ code Class < ? > } reference for the referenced class , or null if the class could not be loaded ( or
* casting failed ) and ignoreExceptions is true .
* @ throws IllegalArgumentException
* if the class could not be loaded or cast , and ignoreExceptions was false . */
< T > Class < T > loadClass ( final Class < T > superclassOrInterfaceType ) { } }
|
return loadClass ( superclassOrInterfaceType , /* ignoreExceptions = */
false ) ;
|
public class Deployment { /** * Use { @ link # getFilesMap ( ) } instead . */
@ java . lang . Deprecated public java . util . Map < java . lang . String , com . google . appengine . v1 . FileInfo > getFiles ( ) { } }
|
return getFilesMap ( ) ;
|
public class UriUtil { /** * Return a URI for the given resource ID .
* The returned URI consists of a { @ link # LOCAL _ RESOURCE _ SCHEME } scheme and
* the resource ID as path .
* @ param resourceId the resource ID to use
* @ return the URI */
public static Uri getUriForResourceId ( int resourceId ) { } }
|
return new Uri . Builder ( ) . scheme ( LOCAL_RESOURCE_SCHEME ) . path ( String . valueOf ( resourceId ) ) . build ( ) ;
|
public class UnitVectorProperty3dfx { /** * Change the coordinates of the vector .
* @ param x x coordinate of the vector .
* @ param y y coordinate of the vector .
* @ param z z coordinate of the vector . */
public void set ( double x , double y , double z ) { } }
|
assert Vector3D . isUnitVector ( x , y , z ) : AssertMessages . normalizedParameters ( 0 , 1 , 2 ) ; if ( ( x != getX ( ) || y != getY ( ) || z != getZ ( ) ) && ! isBound ( ) ) { final Vector3dfx v = super . get ( ) ; v . set ( x , y , z ) ; fireValueChangedEvent ( ) ; }
|
public class PGPRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setYmOset ( Integer newYmOset ) { } }
|
Integer oldYmOset = ymOset ; ymOset = newYmOset ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . PGPRG__YM_OSET , oldYmOset , ymOset ) ) ;
|
public class LdapTemplate { /** * { @ inheritDoc } */
@ Override public boolean authenticate ( Name base , String filter , String password , final AuthenticatedLdapEntryContextCallback callback ) { } }
|
return authenticate ( base , filter , password , callback , new NullAuthenticationErrorCallback ( ) ) ;
|
public class AssetRendition { /** * Read dimension for original rendition from asset metadata .
* @ param rendition Rendition
* @ return Dimension or null */
private static @ Nullable Dimension getDimensionFromOriginal ( @ NotNull Rendition rendition ) { } }
|
Asset asset = rendition . getAsset ( ) ; // asset may have stored dimension in different property names
long width = getAssetMetadataValueAsLong ( asset , TIFF_IMAGEWIDTH , EXIF_PIXELXDIMENSION ) ; long height = getAssetMetadataValueAsLong ( asset , TIFF_IMAGELENGTH , EXIF_PIXELYDIMENSION ) ; return toDimension ( width , height ) ;
|
public class BestMatchBy { /** * Returns ' best ' result from by .
* If there is no result : returns null ,
* if there is just one that is best ,
* otherwise the ' bestFunction ' is applied to all results to determine best .
* @ param by by to use to find elements .
* @ param context context to search in .
* @ param < T > type of element expected .
* @ return ' best ' element , will be < code > null < / code > if no elements were found . */
public static < T extends WebElement > T findElement ( By by , SearchContext context ) { } }
|
WebElement element = null ; List < WebElement > elements = context . findElements ( by ) ; if ( elements . size ( ) == 1 ) { element = elements . get ( 0 ) ; } else if ( elements . size ( ) > 1 ) { element = BEST_FUNCTION . apply ( context , elements ) ; } return ( T ) element ;
|
public class Criteria { /** * Explicitly wrap { @ link Criteria } inside not operation .
* @ since 1.4
* @ return */
public Criteria notOperator ( ) { } }
|
Crotch c = new Crotch ( ) ; c . setNegating ( true ) ; c . add ( this ) ; return c ;
|
public class XSLTAttributeDef { /** * Process an attribute string of type T _ SIMPLEPATTERNLIST into
* a vector of XPath match patterns .
* @ param handler non - null reference to current StylesheetHandler that is constructing the Templates .
* @ param uri The Namespace URI , or an empty string .
* @ param name The local name ( without prefix ) , or empty string if not namespace processing .
* @ param rawName The qualified name ( with prefix ) .
* @ param value A whitespace delimited list of simple match patterns .
* @ return A Vector of XPath objects .
* @ throws org . xml . sax . SAXException that wraps a
* { @ link javax . xml . transform . TransformerException } if one of the match pattern
* strings contains a syntax error . */
Vector processSIMPLEPATTERNLIST ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { } }
|
try { StringTokenizer tokenizer = new StringTokenizer ( value , " \t\n\r\f" ) ; int nPatterns = tokenizer . countTokens ( ) ; Vector patterns = new Vector ( nPatterns ) ; for ( int i = 0 ; i < nPatterns ; i ++ ) { XPath pattern = handler . createMatchPatternXPath ( tokenizer . nextToken ( ) , owner ) ; patterns . addElement ( pattern ) ; } return patterns ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; }
|
public class CmsEditor { /** * Returns the editor action for a " cancel " button . < p >
* This overwrites the cancel method of the CmsDialog class . < p >
* Always use this value , do not write anything directly in the html page . < p >
* @ return the default action for a " cancel " button */
public String buttonActionCancel ( ) { } }
|
String target = null ; if ( Boolean . valueOf ( getParamDirectedit ( ) ) . booleanValue ( ) ) { // editor is in direct edit mode
if ( CmsStringUtil . isNotEmpty ( getParamBacklink ( ) ) ) { // set link to the specified back link target
target = getParamBacklink ( ) ; } else { // set link to the edited resource
target = getParamResource ( ) ; } } else { // in workplace mode , show explorer view
target = CmsVaadinUtils . getWorkplaceLink ( ) ; } return "onclick=\"top.location.href='" + getJsp ( ) . link ( target ) + "';\"" ;
|
public class SibRaManagedConnection { /** * Associates an existing connection handle with this managed connection .
* The connection handle may still be associated with another managed
* connection or may be dissociated .
* @ param connection
* the connection handle
* @ throws ResourceAdapterInternalException
* if the connection does not belong to this resource adapter */
public void associateConnection ( final Object connection ) throws ResourceAdapterInternalException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "associateConnection" , connection ) ; } if ( connection instanceof SibRaConnection ) { final SibRaConnection sibRaConnection = ( SibRaConnection ) connection ; // Dissociate it from its old managed connection
final SibRaManagedConnection oldManagedConnection = sibRaConnection . getManagedConnection ( ) ; if ( oldManagedConnection != null ) { oldManagedConnection . _connections . remove ( connection ) ; } // Associate it with this managed connection
sibRaConnection . setManagedConnection ( this ) ; _connections . add ( sibRaConnection ) ; } else { final ResourceAdapterInternalException exception = new ResourceAdapterInternalException ( NLS . getFormattedMessage ( "UNRECOGNISED_CONNECTION_CWSIV0403" , new Object [ ] { connection , SibRaConnection . class } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw exception ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "associateConnection" ) ; }
|
public class FastStr { /** * Wrapper of { @ link String # replaceFirst ( String , String ) } but return FastStr inance
* @ param regex the regular expression specifies the place to be replaced
* @ param replacement the string to replace the found part
* @ return a FastStr that has the first found part replaced */
@ Override public FastStr replaceFirst ( String regex , String replacement ) { } }
|
return unsafeOf ( Pattern . compile ( regex ) . matcher ( this ) . replaceFirst ( replacement ) ) ;
|
public class TableExportAction { /** * Gets a { @ code List } of ( visible ) column names for the given table .
* Called when exporting the column names .
* @ return the { @ code List } of column names , never { @ code null } . */
protected List < String > getColumnNames ( ) { } }
|
List < String > columnNamesList = new ArrayList < > ( ) ; for ( int col = 0 ; col < getTable ( ) . getColumnCount ( ) ; col ++ ) { columnNamesList . add ( getTable ( ) . getColumnModel ( ) . getColumn ( col ) . getHeaderValue ( ) . toString ( ) ) ; } return columnNamesList ;
|
public class FilelistenerReadTrx { /** * { @ inheritDoc } */
@ Override public boolean fileExists ( String pRelativePath ) { } }
|
String paths [ ] = this . getFilePaths ( ) ; for ( String s : paths ) { if ( s . equals ( pRelativePath ) ) { return true ; } } return false ;
|
public class CmsTextBox { /** * Checks if the given key code represents a functional key . < p >
* @ param keyCode the key code to check
* @ return < code > true < / code > if the given key code represents a functional key */
protected boolean isNavigationKey ( int keyCode ) { } }
|
for ( int i = 0 ; i < NAVIGATION_CODES . length ; i ++ ) { if ( NAVIGATION_CODES [ i ] == keyCode ) { return true ; } } return false ;
|
public class StringBlock { /** * ( Comment taken from platform ResourceTypes . cpp )
* Strings in UTF - 16 format have length indicated by a length encoded in the
* stored data . It is either 1 or 2 characters of length data . This allows a
* maximum length of 0x7FFFFF ( 2147483647 bytes ) , but if you ' re storing that
* much data in a string , you ' re abusing them .
* If the high bit is set , then there are two characters or 4 bytes of length
* data encoded . In that case , drop the high bit of the first character and
* add it together with the next character . */
private static int decodeLengthUtf16 ( ByteBuffer buffer ) { } }
|
int length = buffer . get ( ) ; if ( ( length & 0x80 ) != 0 ) { length = ( ( length & 0x7F ) << 8 ) | buffer . get ( ) ; } return length ;
|
public class PgBinaryWriter { /** * Writes primitive boolean to the output stream
* @ param value value to write */
public void writeBoolean ( boolean value ) { } }
|
try { buffer . writeInt ( 1 ) ; if ( value ) { buffer . writeByte ( 1 ) ; } else { buffer . writeByte ( 0 ) ; } } catch ( Exception e ) { throw new BinaryWriteFailedException ( e ) ; }
|
public class StatisticalMoments { /** * Get the skewness using sample variance .
* @ return Skewness */
public double getSampleSkewness ( ) { } }
|
if ( ! ( m2 > 0 ) || ! ( n > 2 ) ) { throw new ArithmeticException ( "Skewness not defined when variance is 0 or weight <= 2.0!" ) ; } return ( m3 * n / ( n - 1 ) / ( n - 2 ) ) / FastMath . pow ( getSampleVariance ( ) , 1.5 ) ;
|
public class DatabaseThreatDetectionPoliciesInner { /** * Gets a database ' s threat detection policy .
* @ 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 .
* @ param databaseName The name of the database for which database Threat Detection policy is defined .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the DatabaseSecurityAlertPolicyInner object */
public Observable < DatabaseSecurityAlertPolicyInner > getAsync ( String resourceGroupName , String serverName , String databaseName ) { } }
|
return getWithServiceResponseAsync ( resourceGroupName , serverName , databaseName ) . map ( new Func1 < ServiceResponse < DatabaseSecurityAlertPolicyInner > , DatabaseSecurityAlertPolicyInner > ( ) { @ Override public DatabaseSecurityAlertPolicyInner call ( ServiceResponse < DatabaseSecurityAlertPolicyInner > response ) { return response . body ( ) ; } } ) ;
|
public class SharedResourcesBrokerImpl { /** * Get a { @ link org . apache . gobblin . broker . iface . ConfigView } for the input scope , key , and factory . */
public < K extends SharedResourceKey > KeyedScopedConfigViewImpl < S , K > getConfigView ( S scope , K key , String factoryName ) { } }
|
Config config = ConfigFactory . empty ( ) ; for ( ScopedConfig < S > scopedConfig : this . scopedConfigs ) { if ( scopedConfig . getScopeType ( ) . equals ( scopedConfig . getScopeType ( ) . rootScope ( ) ) ) { config = ConfigUtils . getConfigOrEmpty ( scopedConfig . getConfig ( ) , factoryName ) . withFallback ( config ) ; } else if ( scope != null && SharedResourcesBrokerUtils . isScopeTypeAncestor ( scope , scopedConfig . getScopeType ( ) ) ) { Config tmpConfig = ConfigUtils . getConfigOrEmpty ( scopedConfig . getConfig ( ) , factoryName ) ; tmpConfig = ConfigUtils . getConfigOrEmpty ( tmpConfig , scope . name ( ) ) ; config = tmpConfig . atKey ( scope . name ( ) ) . withFallback ( config ) ; } } return new KeyedScopedConfigViewImpl < > ( scope , key , factoryName , config ) ;
|
public class JsonUtil { /** * Gets json .
* @ param kernelDims the kernel dims
* @ return the json */
@ javax . annotation . Nonnull public static JsonArray getJson ( @ javax . annotation . Nonnull final int [ ] kernelDims ) { } }
|
@ javax . annotation . Nonnull final JsonArray array = new JsonArray ( ) ; for ( final int k : kernelDims ) { array . add ( new JsonPrimitive ( k ) ) ; } return array ;
|
public class AmazonEC2Client { /** * Describes the specified key pairs or all of your key pairs .
* For more information about key pairs , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / UserGuide / ec2 - key - pairs . html " > Key Pairs < / a > in the < i > Amazon
* Elastic Compute Cloud User Guide < / i > .
* @ param describeKeyPairsRequest
* @ return Result of the DescribeKeyPairs operation returned by the service .
* @ sample AmazonEC2 . DescribeKeyPairs
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeKeyPairs " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public DescribeKeyPairsResult describeKeyPairs ( DescribeKeyPairsRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeDescribeKeyPairs ( request ) ;
|
public class AssertUtils { /** * Assert that a Map has entries ; that is , it must not be < code > null < / code >
* and must have at least one entry .
* < pre class = " code " >
* Assert . notEmpty ( map , & quot ; Map must have entries & quot ; ) ;
* < / pre >
* @ param map the map to check
* @ param message the exception message to use if the assertion fails
* @ throws IllegalArgumentException if the map is < code > null < / code > or has no entries */
public static void notEmpty ( Map < ? , ? > map , String message ) { } }
|
if ( map == null || map . isEmpty ( ) ) { throw new IllegalArgumentException ( message ) ; }
|
public class IfcPhysicalComplexQuantityImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcPhysicalQuantity > getHasQuantities ( ) { } }
|
return ( EList < IfcPhysicalQuantity > ) eGet ( Ifc4Package . Literals . IFC_PHYSICAL_COMPLEX_QUANTITY__HAS_QUANTITIES , true ) ;
|
public class ArrayListIterate { /** * Iterates over the section of the list covered by the specified indexes . The indexes are both inclusive . If the
* from is less than the to , the list is iterated in forward order . If the from is greater than the to , then the
* list is iterated in the reverse order . The index passed into the ObjectIntProcedure is the actual index of the
* range .
* < pre > e . g .
* ArrayList < People > people = new ArrayList < People > ( FastList . newListWith ( ted , mary , bob , sally ) ) ;
* ArrayListIterate . forEachWithIndex ( people , 0 , 1 , new ObjectIntProcedure < Person > ( )
* public void value ( Person person , int index )
* LOGGER . info ( person . getName ( ) + " at index : " + index ) ;
* < / pre >
* This code would output ted and mary ' s names . */
public static < T > void forEachWithIndex ( ArrayList < T > list , int from , int to , ObjectIntProcedure < ? super T > objectIntProcedure ) { } }
|
ListIterate . rangeCheck ( from , to , list . size ( ) ) ; if ( ArrayListIterate . isOptimizableArrayList ( list , to - from + 1 ) ) { T [ ] elements = ArrayListIterate . getInternalArray ( list ) ; InternalArrayIterate . forEachWithIndexWithoutChecks ( elements , from , to , objectIntProcedure ) ; } else { RandomAccessListIterate . forEachWithIndex ( list , from , to , objectIntProcedure ) ; }
|
public class OperationsApi { /** * Get used skills .
* Get all [ CfgSkill ] ( https : / / docs . genesys . com / Documentation / PSDK / latest / ConfigLayerRef / CfgSkill ) that are linked to existing [ CfgPerson ] ( https : / / docs . genesys . com / Documentation / PSDK / latest / ConfigLayerRef / CfgPerson ) objects .
* @ param callback The callback function called when the skills are returned asynchronously . Callback takes one parameter : Map & lt ; String , Object & lt ; results .
* @ throws ProvisioningApiException if the call is unsuccessful . */
public void getUsedSkillsAsync ( AsyncCallback callback ) throws ProvisioningApiException { } }
|
String aioId = UUID . randomUUID ( ) . toString ( ) ; asyncCallbacks . put ( aioId , callback ) ; try { ApiAsyncSuccessResponse resp = operationsApi . getUsedSkillsAsync ( aioId ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 1 ) ) { throw new ProvisioningApiException ( "Error getting used skills. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error getting used skills" , e ) ; }
|
public class NetUtils { /** * 添加Cookie
* @ param response { @ link HttpServletResponse }
* @ param name Cookie名
* @ param value Cookie值
* @ return { @ link Boolean }
* @ since 1.0.8 */
public static boolean addCookie ( HttpServletResponse response , String name , String value ) { } }
|
return addCookie ( new Cookie ( name , value ) , response ) ;
|
public class Telefonnummer { /** * Liefert die Nummer der Ortsvermittlungsstelle , d . h . die Telefonnummer
* ohne Vorwahl und Laenderkennzahl .
* @ return z . B . " 32168" */
public Telefonnummer getRufnummer ( ) { } }
|
String inlandsnummer = RegExUtils . replaceAll ( this . getInlandsnummer ( ) . toString ( ) , "[ /]+" , " " ) ; return new Telefonnummer ( StringUtils . substringAfter ( inlandsnummer , " " ) . replaceAll ( " " , "" ) ) ;
|
public class AgentPoolsInner { /** * Creates or updates an agent pool .
* Creates or updates an agent pool in the specified managed cluster .
* @ param resourceGroupName The name of the resource group .
* @ param managedClusterName The name of the managed cluster resource .
* @ param agentPoolName The name of the agent pool .
* @ param parameters Parameters supplied to the Create or Update an agent pool operation .
* @ 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 AgentPoolInner object if successful . */
public AgentPoolInner beginCreateOrUpdate ( String resourceGroupName , String managedClusterName , String agentPoolName , AgentPoolInner parameters ) { } }
|
return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , managedClusterName , agentPoolName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
|
public class TemplateExecution { /** * Import the passed classNamer ' s type present in the passed packageNamer ' s package name . */
public void require ( Namer packageNamer , Namer classNamer ) { } }
|
requireFirstTime ( packageNamer . getPackageName ( ) + "." + classNamer . getType ( ) ) ;
|
public class CollectionLiterals { /** * Creates an empty mutable { @ link HashMap } instance .
* @ return a new { @ link HashMap }
* @ since 2.13 */
@ Pure public static < K , V > HashMap < K , V > newHashMap ( ) { } }
|
return new HashMap < K , V > ( ) ;
|
public class CmsXmlContentDefinition { /** * Generates an XML schema for the content definition . < p >
* @ return the generated XML schema */
public Document getSchema ( ) { } }
|
Document result ; if ( m_schemaDocument == null ) { result = DocumentHelper . createDocument ( ) ; Element root = result . addElement ( XSD_NODE_SCHEMA ) ; root . addAttribute ( XSD_ATTRIBUTE_ELEMENT_FORM_DEFAULT , XSD_ATTRIBUTE_VALUE_QUALIFIED ) ; Element include = root . addElement ( XSD_NODE_INCLUDE ) ; include . addAttribute ( XSD_ATTRIBUTE_SCHEMA_LOCATION , XSD_INCLUDE_OPENCMS ) ; if ( m_includes . size ( ) > 0 ) { Iterator < CmsXmlContentDefinition > i = m_includes . iterator ( ) ; while ( i . hasNext ( ) ) { CmsXmlContentDefinition definition = i . next ( ) ; root . addElement ( XSD_NODE_INCLUDE ) . addAttribute ( XSD_ATTRIBUTE_SCHEMA_LOCATION , definition . m_schemaLocation ) ; } } String outerTypeName = createTypeName ( getOuterName ( ) ) ; String innerTypeName = createTypeName ( getInnerName ( ) ) ; Element content = root . addElement ( XSD_NODE_ELEMENT ) ; content . addAttribute ( XSD_ATTRIBUTE_NAME , getOuterName ( ) ) ; content . addAttribute ( XSD_ATTRIBUTE_TYPE , outerTypeName ) ; Element list = root . addElement ( XSD_NODE_COMPLEXTYPE ) ; list . addAttribute ( XSD_ATTRIBUTE_NAME , outerTypeName ) ; Element listSequence = list . addElement ( XSD_NODE_SEQUENCE ) ; Element listElement = listSequence . addElement ( XSD_NODE_ELEMENT ) ; listElement . addAttribute ( XSD_ATTRIBUTE_NAME , getInnerName ( ) ) ; listElement . addAttribute ( XSD_ATTRIBUTE_TYPE , innerTypeName ) ; listElement . addAttribute ( XSD_ATTRIBUTE_MIN_OCCURS , XSD_ATTRIBUTE_VALUE_ZERO ) ; listElement . addAttribute ( XSD_ATTRIBUTE_MAX_OCCURS , XSD_ATTRIBUTE_VALUE_UNBOUNDED ) ; Element main = root . addElement ( XSD_NODE_COMPLEXTYPE ) ; main . addAttribute ( XSD_ATTRIBUTE_NAME , innerTypeName ) ; Element mainSequence ; if ( m_sequenceType == SequenceType . SEQUENCE ) { mainSequence = main . addElement ( XSD_NODE_SEQUENCE ) ; } else { mainSequence = main . addElement ( XSD_NODE_CHOICE ) ; if ( getChoiceMaxOccurs ( ) > 1 ) { mainSequence . addAttribute ( XSD_ATTRIBUTE_MAX_OCCURS , String . valueOf ( getChoiceMaxOccurs ( ) ) ) ; } else { mainSequence . addAttribute ( XSD_ATTRIBUTE_MIN_OCCURS , XSD_ATTRIBUTE_VALUE_ZERO ) ; mainSequence . addAttribute ( XSD_ATTRIBUTE_MAX_OCCURS , XSD_ATTRIBUTE_VALUE_ONE ) ; } } Iterator < I_CmsXmlSchemaType > i = m_typeSequence . iterator ( ) ; while ( i . hasNext ( ) ) { I_CmsXmlSchemaType schemaType = i . next ( ) ; schemaType . appendXmlSchema ( mainSequence ) ; } Element language = main . addElement ( XSD_NODE_ATTRIBUTE ) ; language . addAttribute ( XSD_ATTRIBUTE_NAME , XSD_ATTRIBUTE_VALUE_LANGUAGE ) ; language . addAttribute ( XSD_ATTRIBUTE_TYPE , CmsXmlLocaleValue . TYPE_NAME ) ; language . addAttribute ( XSD_ATTRIBUTE_USE , XSD_ATTRIBUTE_VALUE_OPTIONAL ) ; } else { result = ( Document ) m_schemaDocument . clone ( ) ; } return result ;
|
public class ResourceHandler { void handlePut ( HttpRequest request , HttpResponse response , String pathInContext , Resource resource ) throws IOException { } }
|
if ( log . isDebugEnabled ( ) ) log . debug ( "PUT " + pathInContext + " in " + resource ) ; boolean exists = resource != null && resource . exists ( ) ; if ( exists && ! passConditionalHeaders ( request , response , resource ) ) return ; if ( pathInContext . endsWith ( "/" ) ) { if ( ! exists ) { if ( ! resource . getFile ( ) . mkdirs ( ) ) response . sendError ( HttpResponse . __403_Forbidden , "Directories could not be created" ) ; else { request . setHandled ( true ) ; response . setStatus ( HttpResponse . __201_Created ) ; response . commit ( ) ; } } else { request . setHandled ( true ) ; response . setStatus ( HttpResponse . __200_OK ) ; response . commit ( ) ; } } else { try { int toRead = request . getContentLength ( ) ; InputStream in = request . getInputStream ( ) ; OutputStream out = resource . getOutputStream ( ) ; if ( toRead >= 0 ) IO . copy ( in , out , toRead ) ; else IO . copy ( in , out ) ; out . close ( ) ; request . setHandled ( true ) ; response . setStatus ( exists ? HttpResponse . __200_OK : HttpResponse . __201_Created ) ; response . commit ( ) ; } catch ( Exception ex ) { log . warn ( LogSupport . EXCEPTION , ex ) ; response . sendError ( HttpResponse . __403_Forbidden , ex . getMessage ( ) ) ; } }
|
public class AbstractPrimitiveService { /** * Configures the given operation on the given executor .
* @ param operationId the operation identifier
* @ param method the operation method
* @ param executor the service executor */
private void configure ( OperationId operationId , Method method , ServiceExecutor executor ) { } }
|
if ( method . getReturnType ( ) == Void . TYPE ) { if ( method . getParameterTypes ( ) . length == 0 ) { executor . register ( operationId , ( ) -> { try { method . invoke ( this ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { throw new PrimitiveException . ServiceException ( e ) ; } } ) ; } else { executor . register ( operationId , args -> { try { method . invoke ( this , ( Object [ ] ) args . value ( ) ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { throw new PrimitiveException . ServiceException ( e ) ; } } ) ; } } else { if ( method . getParameterTypes ( ) . length == 0 ) { executor . register ( operationId , ( ) -> { try { return method . invoke ( this ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { throw new PrimitiveException . ServiceException ( e ) ; } } ) ; } else { executor . register ( operationId , args -> { try { return method . invoke ( this , ( Object [ ] ) args . value ( ) ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { throw new PrimitiveException . ServiceException ( e ) ; } } ) ; } }
|
public class RssGenerator { /** * Helper method to create an instance of SitemapGenerator
* @ param baseUrl Base URL
* @ param root If Base URL is root ( for example http : / / www . javavids . com or if
* it ' s some path like http : / / www . javalibs . com / blog )
* @ return Instance of RssGenerator */
public static RssGenerator of ( String baseUrl , boolean root ) { } }
|
return new RssGenerator ( baseUrl , root , null , null ) ;
|
public class PathParser { /** * Update the target ' s data to match the source .
* Before calling this , make sure canMorph ( target , source ) is true .
* @ param target The target path represented in an array of PathDataNode
* @ param source The source path represented in an array of PathDataNode */
public static void updateNodes ( PathDataNode [ ] target , PathDataNode [ ] source ) { } }
|
for ( int i = 0 ; i < source . length ; i ++ ) { target [ i ] . mType = source [ i ] . mType ; for ( int j = 0 ; j < source [ i ] . mParams . length ; j ++ ) { target [ i ] . mParams [ j ] = source [ i ] . mParams [ j ] ; } }
|
public class ResultUtil { /** * Given a list of String , do a case insensitive search for target string
* Used by resultsetMetadata to search for target column name
* @ param source source string list
* @ param target target string to match
* @ return index in the source string list that matches the target string
* index starts from zero */
public static int listSearchCaseInsensitive ( List < String > source , String target ) { } }
|
for ( int i = 0 ; i < source . size ( ) ; i ++ ) { if ( target . equalsIgnoreCase ( source . get ( i ) ) ) { return i ; } } return - 1 ;
|
public class LWJGL3TypeConversions { /** * Convert stencil functions to GL constants .
* @ param function The function .
* @ return The resulting GL constant . */
public static int stencilFunctionToGL ( final JCGLStencilFunction function ) { } }
|
switch ( function ) { case STENCIL_ALWAYS : return GL11 . GL_ALWAYS ; case STENCIL_EQUAL : return GL11 . GL_EQUAL ; case STENCIL_GREATER_THAN : return GL11 . GL_GREATER ; case STENCIL_GREATER_THAN_OR_EQUAL : return GL11 . GL_GEQUAL ; case STENCIL_LESS_THAN : return GL11 . GL_LESS ; case STENCIL_LESS_THAN_OR_EQUAL : return GL11 . GL_LEQUAL ; case STENCIL_NEVER : return GL11 . GL_NEVER ; case STENCIL_NOT_EQUAL : return GL11 . GL_NOTEQUAL ; } throw new UnreachableCodeException ( ) ;
|
public class BindContentProviderBuilder { /** * Generate on shutdown .
* @ param dataSourceNameClazz
* the data source name clazz */
private void generateOnShutdown ( String dataSourceNameClazz ) { } }
|
MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "shutdown" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( Void . TYPE ) ; methodBuilder . addJavadoc ( "<p>Close database.</p>\n" ) ; methodBuilder . addJavadoc ( "\n" ) ; methodBuilder . addJavadoc ( "@see android.content.ContentProvider#shutdown()\n" ) ; methodBuilder . addStatement ( "super.shutdown()" ) ; methodBuilder . addStatement ( "dataSource.close()" ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ;
|
public class KEYBase { /** * Converts the DNSKEY / KEY Record to a String */
String rrToString ( ) { } }
|
StringBuffer sb = new StringBuffer ( ) ; sb . append ( flags ) ; sb . append ( " " ) ; sb . append ( proto ) ; sb . append ( " " ) ; sb . append ( alg ) ; if ( key != null ) { if ( Options . check ( "multiline" ) ) { sb . append ( " (\n" ) ; sb . append ( base64 . formatString ( key , 64 , "\t" , true ) ) ; sb . append ( " ; key_tag = " ) ; sb . append ( getFootprint ( ) ) ; } else { sb . append ( " " ) ; sb . append ( base64 . toString ( key ) ) ; } } return sb . toString ( ) ;
|
public class Property_Builder { /** * Returns a newly - created { @ link org . inferred . freebuilder . processor . property . Property } based on
* the contents of this { @ code Builder } .
* @ throws IllegalStateException if any field has not been set */
public org . inferred . freebuilder . processor . property . Property build ( ) { } }
|
Preconditions . checkState ( _unsetProperties . isEmpty ( ) , "Not set: %s" , _unsetProperties ) ; return new Value ( this ) ;
|
public class DeployerProxy { /** * Creates a proxied HTTP GET request to Apache Brooklyn to retrieve Sensors from a particular Entity
* @ param brooklynId of the desired application to fetch . This ID may differ from SeaClouds Application ID
* @ param brooklynEntityId of the desired entity . This Entity ID should be children of brooklynId
* @ return List < SensorSummary > with the entity sensors */
public List < SensorSummary > getEntitySensors ( String brooklynId , String brooklynEntityId ) throws IOException { } }
|
Invocation invocation = getJerseyClient ( ) . target ( getEndpoint ( ) + "/v1/applications/" + brooklynId + "/entities/" + brooklynEntityId + "/sensors" ) . request ( ) . buildGet ( ) ; return invocation . invoke ( ) . readEntity ( new GenericType < List < SensorSummary > > ( ) { } ) ;
|
public class ZipUtils { /** * Zips the contents of the specified { @ link File directory } .
* @ param directory { @ link File } referring to the file system path / location containing the contents to zip .
* @ return a { @ link File ZIP file } containing the compressed contents of the specified { @ link File directory } .
* @ throws IllegalArgumentException if { @ link File directory } is not a valid directory .
* @ throws IllegalStateException if the { @ link File ZIP file } could not be created / initialized .
* @ throws IOException if the contents of the specified { @ link File directory } could not be zipped .
* @ throws SystemException if a file system entry could not be added to the { @ link File ZIP file } .
* @ see # zip ( File , File , ZipOutputStream )
* @ see java . io . File */
public static File zip ( File directory ) throws IOException { } }
|
Assert . isTrue ( FileUtils . isDirectory ( directory ) , "[%s] is not a valid directory" , directory ) ; File zip = new File ( directory . getParent ( ) , directory . getName ( ) . concat ( ZIP_FILE_EXTENSION ) ) ; Assert . state ( zip . createNewFile ( ) , "Failed to create new ZIP file [%s]" , zip ) ; try ( ZipOutputStream outputStream = new ZipOutputStream ( new FileOutputStream ( zip , false ) ) ) { zip ( directory , directory , outputStream ) ; outputStream . finish ( ) ; } return zip ;
|
public class CmsOrgUnitOverviewDialog { /** * Creates the dialog HTML for all defined widgets of the named dialog ( page ) . < p >
* This overwrites the method from the super class to create a layout variation for the widgets . < p >
* @ param dialog the dialog ( page ) to get the HTML for
* @ return the dialog HTML for all defined widgets of the named dialog ( page ) */
@ Override protected String createDialogHtml ( String dialog ) { } }
|
StringBuffer result = new StringBuffer ( 1024 ) ; result . append ( createWidgetTableStart ( ) ) ; // show error header once if there were validation errors
result . append ( createWidgetErrorHeader ( ) ) ; if ( dialog . equals ( PAGES [ 0 ] ) ) { // create the widgets for the first dialog page
result . append ( dialogBlockStart ( key ( Messages . GUI_ORGUNIT_EDITOR_LABEL_IDENTIFICATION_BLOCK_0 ) ) ) ; result . append ( createWidgetTableStart ( ) ) ; result . append ( createDialogRowsHtml ( 0 , 2 ) ) ; result . append ( createWidgetTableEnd ( ) ) ; result . append ( dialogBlockEnd ( ) ) ; } result . append ( createWidgetTableEnd ( ) ) ; return result . toString ( ) ;
|
public class Log4JLogger { /** * Log an error to the Log4j Logger with < code > DEBUG < / code > priority . */
public void debug ( Object message , Throwable t ) { } }
|
if ( IS12 ) { getLogger ( ) . log ( FQCN , Level . DEBUG , message , t ) ; } else { getLogger ( ) . log ( FQCN , Level . DEBUG , message , t ) ; }
|
public class ToolDescriptor { /** * Default value for { @ link ToolInstallation # getProperties ( ) } used in the form binding .
* @ since 1.305 */
public DescribableList < ToolProperty < ? > , ToolPropertyDescriptor > getDefaultProperties ( ) throws IOException { } }
|
DescribableList < ToolProperty < ? > , ToolPropertyDescriptor > r = new DescribableList < > ( NOOP ) ; List < ? extends ToolInstaller > installers = getDefaultInstallers ( ) ; if ( ! installers . isEmpty ( ) ) r . add ( new InstallSourceProperty ( installers ) ) ; return r ;
|
public class Comparer { /** * Returns the result of ( delegate = = target1 ) | | ( delegate = = target2 ) | | . . . | | ( delegate = = targetN )
* @ param targets
* @ return */
public boolean any ( Object ... targets ) { } }
|
if ( null == targets ) { return null == this . delegate ; } for ( Object target : targets ) { if ( null == target ) { if ( null == this . delegate ) { return true ; } continue ; } if ( target == this . delegate ) { return true ; } } return false ;
|
public class StreamProcessor { /** * Consumes up to 4 bytes and returns them as int ( taking into account endianess ) .
* Throws exception if specified number of bytes cannot be consumed .
* @ param is the input stream to read bytes from
* @ param numBytes the number of bytes to read
* @ param isLittleEndian whether the bytes should be interpreted in little or big endian format
* @ return packed int read from input stream and constructed according to endianness */
public static int readPackedInt ( InputStream is , int numBytes , boolean isLittleEndian ) throws IOException { } }
|
int value = 0 ; for ( int i = 0 ; i < numBytes ; i ++ ) { int b = is . read ( ) ; if ( b == - 1 ) { throw new IOException ( "no more bytes" ) ; } if ( isLittleEndian ) { value |= ( b & 0xFF ) << ( i * 8 ) ; } else { value = ( value << 8 ) | ( b & 0xFF ) ; } } return value ;
|
public class BuildWithDetails { /** * Stream build console output log as text using BuildConsoleStreamListener
* Method can be used to asynchronously obtain logs for running build .
* @ param listener interface used to asynchronously obtain logs
* @ param poolingInterval interval ( seconds ) used to pool jenkins for logs
* @ param poolingTimeout pooling timeout ( seconds ) used to break pooling in case build stuck
* @ throws InterruptedException in case of an error .
* @ throws IOException in case of an error . */
public void streamConsoleOutput ( final BuildConsoleStreamListener listener , final int poolingInterval , final int poolingTimeout , boolean crumbFlag ) throws InterruptedException , IOException { } }
|
// Calculate start and timeout
final long startTime = System . currentTimeMillis ( ) ; final long timeoutTime = startTime + ( poolingTimeout * 1000 ) ; int bufferOffset = 0 ; while ( true ) { Thread . sleep ( poolingInterval * 1000 ) ; ConsoleLog consoleLog = null ; consoleLog = getConsoleOutputText ( bufferOffset , crumbFlag ) ; String logString = consoleLog . getConsoleLog ( ) ; if ( logString != null && ! logString . isEmpty ( ) ) { listener . onData ( logString ) ; } if ( consoleLog . getHasMoreData ( ) ) { bufferOffset = consoleLog . getCurrentBufferSize ( ) ; } else { listener . finished ( ) ; break ; } long currentTime = System . currentTimeMillis ( ) ; if ( currentTime > timeoutTime ) { LOGGER . warn ( "Pooling for build {0} for {2} timeout! Check if job stuck in jenkins" , BuildWithDetails . this . getDisplayName ( ) , BuildWithDetails . this . getNumber ( ) ) ; break ; } }
|
public class BatchGetObjectInformationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchGetObjectInformation batchGetObjectInformation , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( batchGetObjectInformation == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchGetObjectInformation . getObjectReference ( ) , OBJECTREFERENCE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class MetadataReferenceDao { /** * Query by the metadata ids
* @ param fileId
* file id
* @ return metadata references
* @ throws SQLException
* upon failure */
public List < MetadataReference > queryByMetadata ( long fileId ) throws SQLException { } }
|
QueryBuilder < MetadataReference , Void > qb = queryBuilder ( ) ; qb . where ( ) . eq ( MetadataReference . COLUMN_FILE_ID , fileId ) ; List < MetadataReference > metadataReferences = qb . query ( ) ; return metadataReferences ;
|
public class AuthenticationFilter { /** * Cleans the path by removing the servlet paths and URL parameters .
* @ param path a non - null path
* @ return a non - null path */
static String cleanPath ( String path ) { } }
|
return path . replaceFirst ( "^" + ServletRegistrationComponent . REST_CONTEXT + "/" , "/" ) . replaceFirst ( "^" + ServletRegistrationComponent . WEBSOCKET_CONTEXT + "/" , "/" ) . replaceFirst ( "\\?.*" , "" ) ;
|
public class Right { /** * supports column level GRANT */
String getTableRightsSQL ( Table table ) { } }
|
StringBuffer sb = new StringBuffer ( ) ; if ( isFull ) { return Tokens . T_ALL ; } if ( isFullSelect ) { sb . append ( Tokens . T_SELECT ) ; sb . append ( ',' ) ; } else if ( selectColumnSet != null ) { sb . append ( Tokens . T_SELECT ) ; getColumnList ( table , selectColumnSet , sb ) ; sb . append ( ',' ) ; } if ( isFullInsert ) { sb . append ( Tokens . T_INSERT ) ; sb . append ( ',' ) ; } else if ( insertColumnSet != null ) { sb . append ( Tokens . T_INSERT ) ; getColumnList ( table , insertColumnSet , sb ) ; sb . append ( ',' ) ; } if ( isFullUpdate ) { sb . append ( Tokens . T_UPDATE ) ; sb . append ( ',' ) ; } else if ( updateColumnSet != null ) { sb . append ( Tokens . T_UPDATE ) ; getColumnList ( table , updateColumnSet , sb ) ; sb . append ( ',' ) ; } if ( isFullDelete ) { sb . append ( Tokens . T_DELETE ) ; sb . append ( ',' ) ; } if ( isFullReferences ) { sb . append ( Tokens . T_REFERENCES ) ; sb . append ( ',' ) ; } else if ( referencesColumnSet != null ) { sb . append ( Tokens . T_REFERENCES ) ; sb . append ( ',' ) ; } if ( isFullTrigger ) { sb . append ( Tokens . T_TRIGGER ) ; sb . append ( ',' ) ; } else if ( triggerColumnSet != null ) { sb . append ( Tokens . T_TRIGGER ) ; sb . append ( ',' ) ; } return sb . toString ( ) . substring ( 0 , sb . length ( ) - 1 ) ;
|
public class HttpHandler { /** * Creates an HTTP request based on the message context .
* @ param msgContext the Axis message context
* @ return a new { @ link HttpRequest } with content and headers populated */
private HttpRequest createHttpRequest ( MessageContext msgContext ) throws SOAPException , IOException { } }
|
Message requestMessage = Preconditions . checkNotNull ( msgContext . getRequestMessage ( ) , "Null request message on message context" ) ; // Construct the output stream .
String contentType = requestMessage . getContentType ( msgContext . getSOAPConstants ( ) ) ; ByteArrayOutputStream bos = new ByteArrayOutputStream ( BUFFER_SIZE ) ; if ( msgContext . isPropertyTrue ( HTTPConstants . MC_GZIP_REQUEST ) ) { logger . debug ( "Compressing request" ) ; try ( GZIPOutputStream gzipOs = new GZIPOutputStream ( bos , BUFFER_SIZE ) ) { requestMessage . writeTo ( gzipOs ) ; } } else { logger . debug ( "Not compressing request" ) ; requestMessage . writeTo ( bos ) ; } HttpRequest httpRequest = requestFactory . buildPostRequest ( new GenericUrl ( msgContext . getStrProp ( MessageContext . TRANS_URL ) ) , new ByteArrayContent ( contentType , bos . toByteArray ( ) ) ) ; int timeoutMillis = msgContext . getTimeout ( ) ; if ( timeoutMillis >= 0 ) { logger . debug ( "Setting read and connect timeout to {} millis" , timeoutMillis ) ; // These are not the same , but MessageContext has only one definition of timeout .
httpRequest . setReadTimeout ( timeoutMillis ) ; httpRequest . setConnectTimeout ( timeoutMillis ) ; } // Copy the request headers from the message context to the post request .
setHttpRequestHeaders ( msgContext , httpRequest ) ; return httpRequest ;
|
public class CoreOAuthConsumerSupport { /** * Internal use of configuring the URL for protected access , the resource details already having been loaded .
* @ param url The URL .
* @ param requestToken The request token .
* @ param details The details .
* @ param httpMethod The http method .
* @ param additionalParameters Any additional request parameters .
* @ return The configured URL . */
protected URL configureURLForProtectedAccess ( URL url , OAuthConsumerToken requestToken , ProtectedResourceDetails details , String httpMethod , Map < String , String > additionalParameters ) { } }
|
String file ; if ( ! "POST" . equalsIgnoreCase ( httpMethod ) && ! "PUT" . equalsIgnoreCase ( httpMethod ) && ! details . isAcceptsAuthorizationHeader ( ) ) { StringBuilder fileb = new StringBuilder ( url . getPath ( ) ) ; String queryString = getOAuthQueryString ( details , requestToken , url , httpMethod , additionalParameters ) ; fileb . append ( '?' ) . append ( queryString ) ; file = fileb . toString ( ) ; } else { file = url . getFile ( ) ; } try { if ( "http" . equalsIgnoreCase ( url . getProtocol ( ) ) ) { URLStreamHandler streamHandler = getStreamHandlerFactory ( ) . getHttpStreamHandler ( details , requestToken , this , httpMethod , additionalParameters ) ; return new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , file , streamHandler ) ; } else if ( "https" . equalsIgnoreCase ( url . getProtocol ( ) ) ) { URLStreamHandler streamHandler = getStreamHandlerFactory ( ) . getHttpsStreamHandler ( details , requestToken , this , httpMethod , additionalParameters ) ; return new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , file , streamHandler ) ; } else { throw new OAuthRequestFailedException ( "Unsupported OAuth protocol: " + url . getProtocol ( ) ) ; } } catch ( MalformedURLException e ) { throw new IllegalStateException ( e ) ; }
|
public class ParaClient { /** * Invoke a POST request to the Para API .
* @ param resourcePath the subpath after ' / v1 / ' , should not start with ' / '
* @ param entity request body
* @ return a { @ link Response } object */
public Response invokePost ( String resourcePath , Entity < ? > entity ) { } }
|
logger . debug ( "POST {}, entity: {}" , getFullPath ( resourcePath ) , entity ) ; return invokeSignedRequest ( getApiClient ( ) , accessKey , key ( true ) , POST , getEndpoint ( ) , getFullPath ( resourcePath ) , null , null , entity ) ;
|
public class MalisisSlot { /** * Sets the item stack size .
* @ param stackSize the stack size
* @ return the amount of items that were added to the slot . */
public int setItemStackSize ( int stackSize ) { } }
|
if ( itemStack . isEmpty ( ) ) return 0 ; int start = itemStack . getCount ( ) ; itemStack . setCount ( Math . min ( stackSize , Math . min ( itemStack . getMaxStackSize ( ) , getSlotStackLimit ( ) ) ) ) ; return itemStack . getCount ( ) - start ;
|
public class MRJobLauncher { /** * Add local non - jar files the job depends on to DistributedCache . */
@ SuppressWarnings ( "deprecation" ) private void addLocalFiles ( Path jobFileDir , String jobFileList , Configuration conf ) throws IOException { } }
|
DistributedCache . createSymlink ( conf ) ; for ( String jobFile : SPLITTER . split ( jobFileList ) ) { Path srcJobFile = new Path ( jobFile ) ; // DistributedCache requires absolute path , so we need to use makeQualified .
Path destJobFile = new Path ( this . fs . makeQualified ( jobFileDir ) , srcJobFile . getName ( ) ) ; // Copy the file from local file system to HDFS
this . fs . copyFromLocalFile ( srcJobFile , destJobFile ) ; // Create a URI that is in the form path # symlink
URI destFileUri = URI . create ( destJobFile . toUri ( ) . getPath ( ) + "#" + destJobFile . getName ( ) ) ; LOG . info ( String . format ( "Adding %s to DistributedCache" , destFileUri ) ) ; // Finally add the file to DistributedCache with a symlink named after the file name
DistributedCache . addCacheFile ( destFileUri , conf ) ; }
|
public class RemoveAdGroup { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ param adGroupId the ID of the ad group to remove .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session , long adGroupId ) throws RemoteException { } }
|
// Get the AdGroupService .
AdGroupServiceInterface adGroupService = adWordsServices . get ( session , AdGroupServiceInterface . class ) ; // Create ad group with REMOVED status .
AdGroup adGroup = new AdGroup ( ) ; adGroup . setId ( adGroupId ) ; adGroup . setStatus ( AdGroupStatus . REMOVED ) ; // Create operations .
AdGroupOperation operation = new AdGroupOperation ( ) ; operation . setOperand ( adGroup ) ; operation . setOperator ( Operator . SET ) ; AdGroupOperation [ ] operations = new AdGroupOperation [ ] { operation } ; // Remove ad group .
AdGroupReturnValue result = adGroupService . mutate ( operations ) ; // Display ad groups .
for ( AdGroup adGroupResult : result . getValue ( ) ) { System . out . printf ( "Ad group with name '%s' and ID %d was removed.%n" , adGroupResult . getName ( ) , adGroupResult . getId ( ) ) ; }
|
public class PixelMarkerOverlay { /** * Sets the argument as the only point marked by this overlay .
* @ param p the point to mark ; if { @ code null } , then no points will be selected */
public void setPoint ( Point p ) { } }
|
points . clear ( ) ; if ( p != null ) { points . add ( new Point ( p ) ) ; } repaint ( ) ;
|
public class CmsStringUtil { /** * Substitutes searchString in content with replaceItem . < p >
* @ param content the content which is scanned
* @ param searchString the String which is searched in content
* @ param replaceItem the new String which replaces searchString
* @ param occurences must be a " g " if all occurrences of searchString shall be replaced
* @ return String the substituted String */
public static String substitutePerl ( String content , String searchString , String replaceItem , String occurences ) { } }
|
String translationRule = "s#" + searchString + "#" + replaceItem + "#" + occurences ; Perl5Util perlUtil = new Perl5Util ( ) ; try { return perlUtil . substitute ( translationRule , content ) ; } catch ( MalformedPerl5PatternException e ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_MALFORMED_TRANSLATION_RULE_1 , translationRule ) , e ) ; } } return content ;
|
public class AT_Context { /** * Sets the left and right frame margin .
* @ param frameLeft margin
* @ param frameRight margin
* @ return this to allow chaining */
public AT_Context setFrameLeftRightMargin ( int frameLeft , int frameRight ) { } }
|
if ( frameRight > - 1 && frameLeft > - 1 ) { this . frameLeftMargin = frameLeft ; this . frameRightMargin = frameRight ; } return this ;
|
public class FormLayoutFormBuilder { /** * Set a panel with the provided layout layout .
* @ param layout JGoodies FormLayout
* @ param panel JPanel on which the builder will place the components . */
public void setLayout ( FormLayout layout , JPanel panel ) { } }
|
this . panel = panel ; this . layout = layout ; panel . setLayout ( layout ) ; cc = new CellConstraints ( ) ; row = - 1 ;
|
public class FixtureFactory { /** * Creates new instance of fixture .
* @ param clazz class to instantiate .
* @ param < T > type to create .
* @ return instance of clazz ( subclass , actually ) that will have # aroundSlimInvoke ( ) invoked on each method call . */
public < T extends InteractionAwareFixture > T create ( Class < T > clazz ) { } }
|
return create ( clazz , null , null ) ;
|
public class Atomix { /** * Starts the Atomix instance .
* The returned future will be completed once this instance completes startup . Note that in order to complete startup ,
* all partitions must be able to form . For Raft partitions , that requires that a majority of the nodes in each
* partition be started concurrently .
* @ return a future to be completed once the instance has completed startup */
@ Override public synchronized CompletableFuture < Void > start ( ) { } }
|
if ( closeFuture != null ) { return Futures . exceptionalFuture ( new IllegalStateException ( "Atomix instance " + ( closeFuture . isDone ( ) ? "shutdown" : "shutting down" ) ) ) ; } LOGGER . info ( BUILD ) ; return super . start ( ) . thenRun ( ( ) -> { if ( enableShutdownHook ) { if ( shutdownHook == null ) { shutdownHook = new Thread ( ( ) -> super . stop ( ) . join ( ) ) ; Runtime . getRuntime ( ) . addShutdownHook ( shutdownHook ) ; } } } ) ;
|
public class EmulatedFields { /** * Finds and returns the double value of a given field named { @ code name }
* in the receiver . If the field has not been assigned any value yet , the
* default value { @ code defaultValue } is returned instead .
* @ param name
* the name of the field to find .
* @ param defaultValue
* return value in case the field has not been assigned to yet .
* @ return the value of the given field if it has been assigned , the default
* value otherwise .
* @ throws IllegalArgumentException
* if the corresponding field can not be found . */
public double get ( String name , double defaultValue ) throws IllegalArgumentException { } }
|
ObjectSlot slot = findMandatorySlot ( name , double . class ) ; return slot . defaulted ? defaultValue : ( ( Double ) slot . fieldValue ) . doubleValue ( ) ;
|
public class SynchronizedUniqueIDGeneratorFactory { /** * Get the synchronized ID generator instance .
* @ param synchronizedGeneratorIdentity An instance of { @ link SynchronizedGeneratorIdentity } to ( re ) use for
* acquiring the generator ID .
* @ param mode Generator mode .
* @ return An instance of this class .
* @ throws IOException Thrown when something went wrong trying to find the cluster ID or trying to claim a
* generator ID . */
public static synchronized IDGenerator generatorFor ( SynchronizedGeneratorIdentity synchronizedGeneratorIdentity , Mode mode ) throws IOException { } }
|
String instanceKey = synchronizedGeneratorIdentity . getZNode ( ) ; if ( ! instances . containsKey ( instanceKey ) ) { logger . debug ( "Creating new instance." ) ; instances . putIfAbsent ( instanceKey , new BaseUniqueIDGenerator ( synchronizedGeneratorIdentity , mode ) ) ; } return instances . get ( instanceKey ) ;
|
public class CmsResultFacets { /** * Filters the available folder facets . < p >
* @ param folderFacets the folder facets
* @ return the filtered facets */
private Collection < Count > filterFolderFacets ( Collection < Count > folderFacets ) { } }
|
String siteRoot = A_CmsUI . getCmsObject ( ) . getRequestContext ( ) . getSiteRoot ( ) ; if ( ! siteRoot . endsWith ( "/" ) ) { siteRoot += "/" ; } Collection < Count > result = new ArrayList < Count > ( ) ; for ( Count value : folderFacets ) { if ( value . getName ( ) . startsWith ( siteRoot ) && ( value . getName ( ) . length ( ) > siteRoot . length ( ) ) ) { if ( m_selectedFolders . isEmpty ( ) ) { result . add ( value ) ; } else { for ( String folder : m_selectedFolders ) { if ( value . getName ( ) . startsWith ( folder ) ) { result . add ( value ) ; break ; } } } } } return result ;
|
public class Request { /** * Starts a new Request configured to upload a photo to the user ' s default photo album . The photo
* will be read from the specified stream .
* This should only be called from the UI thread .
* This method is deprecated . Prefer to call Request . newUploadPhotoRequest ( . . . ) . executeAsync ( ) ;
* @ param session the Session to use , or null ; if non - null , the session must be in an opened state
* @ param file the file containing the photo to upload
* @ param callback a callback that will be called when the request is completed to handle success or error conditions
* @ return a RequestAsyncTask that is executing the request */
@ Deprecated public static RequestAsyncTask executeUploadPhotoRequestAsync ( Session session , File file , Callback callback ) throws FileNotFoundException { } }
|
return newUploadPhotoRequest ( session , file , callback ) . executeAsync ( ) ;
|
public class ClassicLayoutManager { /** * Layout columns in groups by reading the corresponding report options .
* @ throws LayoutException */
protected void layoutGroups ( ) { } }
|
log . debug ( "Starting groups layout..." ) ; for ( DJGroup columnsGroup : getReport ( ) . getColumnsGroups ( ) ) { JRDesignGroup jgroup = getJRGroupFromDJGroup ( columnsGroup ) ; jgroup . setStartNewPage ( columnsGroup . isStartInNewPage ( ) ) ; jgroup . setStartNewColumn ( columnsGroup . isStartInNewColumn ( ) ) ; jgroup . setReprintHeaderOnEachPage ( columnsGroup . isReprintHeaderOnEachPage ( ) ) ; jgroup . setResetPageNumber ( columnsGroup . isResetPageNumber ( ) ) ; JRDesignSection headerSection = ( JRDesignSection ) jgroup . getGroupHeaderSection ( ) ; JRDesignSection footerSection = ( JRDesignSection ) jgroup . getGroupFooterSection ( ) ; JRDesignBand header = LayoutUtils . getBandFromSection ( headerSection ) ; JRDesignBand footer = LayoutUtils . getBandFromSection ( footerSection ) ; // double check to prevent NPE
if ( header == null ) { header = new JRDesignBand ( ) ; headerSection . addBand ( header ) ; } if ( footer == null ) { footer = new JRDesignBand ( ) ; footerSection . addBand ( footer ) ; } header . setHeight ( columnsGroup . getHeaderHeight ( ) ) ; footer . setHeight ( columnsGroup . getFooterHeight ( ) ) ; header . setSplitType ( LayoutUtils . getSplitTypeFromBoolean ( columnsGroup . isAllowHeaderSplit ( ) ) ) ; footer . setSplitType ( LayoutUtils . getSplitTypeFromBoolean ( columnsGroup . isAllowFooterSplit ( ) ) ) ; if ( columnsGroup . getLayout ( ) . isPrintHeaders ( ) ) { boolean found = false ; boolean skipPreviousGroupHeaders = false ; int groupIdx = getReport ( ) . getColumnsGroups ( ) . indexOf ( columnsGroup ) ; if ( groupIdx > 0 ) { DJGroup prevG = getReport ( ) . getColumnsGroups ( ) . get ( groupIdx - 1 ) ; if ( ! ( prevG . getColumnToGroupBy ( ) instanceof GlobalGroupColumn ) ) skipPreviousGroupHeaders = ! prevG . getLayout ( ) . isShowValueForEachRow ( ) ; } for ( Object o : getVisibleColumns ( ) ) { AbstractColumn col = ( AbstractColumn ) o ; // If in a nested group , header for column prior to this groups column
// depends on configuration
if ( col . equals ( columnsGroup . getColumnToGroupBy ( ) ) ) { found = true ; } if ( ! found && skipPreviousGroupHeaders ) { continue ; } JRDesignTextField designTextField = createColumnNameTextField ( columnsGroup , col ) ; designTextField . setPositionType ( PositionTypeEnum . FLOAT ) ; // XXX changed to see what happens ( must come from the column position property )
designTextField . setStretchType ( StretchTypeEnum . NO_STRETCH ) ; // XXX changed to see what happens ( must come from the column property )
header . addElement ( designTextField ) ; } } DJGroupLabel label = columnsGroup . getFooterLabel ( ) ; if ( label != null ) { List < DJGroupVariable > footerVariables = columnsGroup . getFooterVariables ( ) ; PropertyColumn col = columnsGroup . getColumnToGroupBy ( ) ; int x = 0 , y = 0 ; // max width
int width = getDesign ( ) . getPageWidth ( ) - getDesign ( ) . getLeftMargin ( ) - getDesign ( ) . getRightMargin ( ) ; int height = label . getHeight ( ) ; int yOffset = 0 ; if ( label . getLabelPosition ( ) == LabelPosition . LEFT ) { DJGroupVariable lmvar = findLeftMostColumn ( footerVariables ) ; x = col . getPosX ( ) ; // label starts in the column - to - group - by x position
y = findYOffsetForGroupLabel ( footer ) ; if ( lmvar != null ) { AbstractColumn lmColumn = lmvar . getColumnToApplyOperation ( ) ; width = lmColumn . getPosX ( ) - x ; } else width -= x ; height = getFooterVariableHeight ( columnsGroup ) ; } else if ( label . getLabelPosition ( ) == LabelPosition . RIGHT ) { DJGroupVariable rmvar = findRightMostColumn ( footerVariables ) ; if ( rmvar != null ) { AbstractColumn rmColumn = rmvar . getColumnToApplyOperation ( ) ; x = rmColumn . getPosX ( ) + rmColumn . getWidth ( ) ; } else x = col . getPosX ( ) ; // label starts in the column - to - group - by x position
y = findYOffsetForGroupLabel ( footer ) ; width -= x ; height = getFooterVariableHeight ( columnsGroup ) ; } else if ( label . getLabelPosition ( ) == LabelPosition . TOP ) { x = col . getPosX ( ) ; // label starts in the column - to - group - by x position
width -= x ; yOffset = height ; } else if ( label . getLabelPosition ( ) == LabelPosition . BOTTOM ) { x = col . getPosX ( ) ; // label starts in the column - to - group - by x position
y = getFooterVariableHeight ( columnsGroup ) ; width -= x ; } layoutGroupFooterLabels ( columnsGroup , jgroup , x , y , width , height ) ; layoutGroupVariables ( columnsGroup , jgroup , yOffset ) ; } else { layoutGroupVariables ( columnsGroup , jgroup , 0 ) ; } layoutGroupSubreports ( columnsGroup , jgroup ) ; layoutGroupCrosstabs ( columnsGroup , jgroup ) ; }
|
public class AlluxioURI { /** * Returns true if the current AlluxioURI is an ancestor of another AlluxioURI .
* otherwise , return false .
* @ param alluxioURI potential children to check
* @ return true the current alluxioURI is an ancestor of the AlluxioURI */
public boolean isAncestorOf ( AlluxioURI alluxioURI ) throws InvalidPathException { } }
|
// To be an ancestor of another URI , authority and scheme must match
if ( ! Objects . equals ( getAuthority ( ) , alluxioURI . getAuthority ( ) ) ) { return false ; } if ( ! Objects . equals ( getScheme ( ) , alluxioURI . getScheme ( ) ) ) { return false ; } return PathUtils . hasPrefix ( PathUtils . normalizePath ( alluxioURI . getPath ( ) , SEPARATOR ) , PathUtils . normalizePath ( getPath ( ) , SEPARATOR ) ) ;
|
public class FileSystem { /** * Normalize the given string contains a Windows & reg ; native long filename
* and replies a Java - standard version .
* < p > Long filenames ( LFN ) , spelled " long file names " by Microsoft Corporation ,
* are Microsoft ' s way of implementing filenames longer than the 8.3,
* or short - filename , naming scheme used in Microsoft DOS in their modern
* FAT and NTFS filesystems . Because these filenames can be longer than the
* 8.3 filename , they can be more descriptive . Another advantage of this
* scheme is that it allows for use of * nix files ending in ( e . g . . jpeg ,
* . tiff , . html , and . xhtml ) rather than specialized shortened names
* ( e . g . . jpg , . tif , . htm , . xht ) .
* < p > The long filename system allows a maximum length of 255 UTF - 16 characters ,
* including spaces and non - alphanumeric characters ; excluding the following
* characters , which have special meaning within the command interpreter or
* the operating system kernel : < code > \ < / code > < code > / < / code > < code > : < / code >
* < code > * < / code > < code > ? < / code > < code > " < / code > < code > & lt ; < / code >
* < code > & gt ; < / code > < code > | < / code >
* @ param filename the filename to test .
* @ return the normalized path or < code > null < / code > if not a windows native path .
* @ see # isWindowsNativeFilename ( String ) */
@ Pure public static File normalizeWindowsNativeFilename ( String filename ) { } }
|
final String fn = extractLocalPath ( filename ) ; if ( fn != null && fn . length ( ) > 0 ) { final Pattern pattern = Pattern . compile ( WINDOW_NATIVE_FILENAME_PATTERN ) ; final Matcher matcher = pattern . matcher ( fn ) ; if ( matcher . find ( ) ) { return new File ( fn . replace ( WINDOWS_SEPARATOR_CHAR , File . separatorChar ) ) ; } } return null ;
|
public class PaymentProtocol { /** * Parse transactions from payment message .
* @ param params network parameters ( needed for transaction deserialization )
* @ param paymentMessage payment message to parse
* @ return list of transactions */
public static List < Transaction > parseTransactionsFromPaymentMessage ( NetworkParameters params , Protos . Payment paymentMessage ) { } }
|
final List < Transaction > transactions = new ArrayList < > ( paymentMessage . getTransactionsCount ( ) ) ; for ( final ByteString transaction : paymentMessage . getTransactionsList ( ) ) transactions . add ( params . getDefaultSerializer ( ) . makeTransaction ( transaction . toByteArray ( ) ) ) ; return transactions ;
|
public class AsynchronousRequest { /** * For more info on Character Skills API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / characters # Skills " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param API API key
* @ param name character name
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws GuildWars2Exception invalid API key | empty character name
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see CharacterSkills character skills info */
public void getCharacterSkills ( String API , String name , Callback < CharacterSkills > callback ) throws GuildWars2Exception , NullPointerException { } }
|
isParamValid ( new ParamChecker ( ParamType . API , API ) , new ParamChecker ( ParamType . CHAR , name ) ) ; gw2API . getCharacterSkills ( name , API ) . enqueue ( callback ) ;
|
public class RDBMSQuery { /** * Gets the column list .
* @ param m
* the m
* @ param results
* the results
* @ return the column list */
List < String > getColumnList ( EntityMetadata m , String [ ] results , EmbeddableType compoundKey ) { } }
|
List < String > columns = new ArrayList < String > ( ) ; if ( results != null && results . length > 0 ) { MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; EntityType entity = metaModel . entity ( m . getEntityClazz ( ) ) ; for ( int i = 1 ; i < results . length ; i ++ ) { if ( results [ i ] != null ) { Attribute attribute = entity . getAttribute ( results [ i ] ) ; if ( attribute == null ) { throw new QueryHandlerException ( "column type is null for: " + results ) ; } else if ( m . getIdAttribute ( ) . equals ( attribute ) && compoundKey != null ) { Field [ ] fields = m . getIdAttribute ( ) . getBindableJavaType ( ) . getDeclaredFields ( ) ; for ( Field field : fields ) { if ( ! ReflectUtils . isTransientOrStatic ( field ) ) { Attribute compositeColumn = compoundKey . getAttribute ( field . getName ( ) ) ; columns . add ( ( ( AbstractAttribute ) compositeColumn ) . getJPAColumnName ( ) ) ; } } } else { columns . add ( ( ( AbstractAttribute ) attribute ) . getJPAColumnName ( ) ) ; } } } return columns ; } if ( log . isInfoEnabled ( ) ) { log . info ( "No record found, returning null." ) ; } return null ;
|
public class GetCelebrityRecognitionResult { /** * Array of celebrities recognized in the video .
* @ param celebrities
* Array of celebrities recognized in the video . */
public void setCelebrities ( java . util . Collection < CelebrityRecognition > celebrities ) { } }
|
if ( celebrities == null ) { this . celebrities = null ; return ; } this . celebrities = new java . util . ArrayList < CelebrityRecognition > ( celebrities ) ;
|
public class DefaultErrorHandler { /** * Find the sibling { @ link HelpBlock } .
* @ param widget the { @ link Widget } to search .
* @ return the found { @ link HelpBlock } of null if not found . */
private HelpBlock findHelpBlock ( Widget widget ) { } }
|
if ( widget instanceof HelpBlock ) { return ( HelpBlock ) widget ; } // Try and find the HelpBlock in the children of the given widget .
if ( widget instanceof HasWidgets ) { for ( Widget w : ( HasWidgets ) widget ) { if ( w instanceof HelpBlock ) { return ( HelpBlock ) w ; } } } if ( ! ( widget instanceof HasValidationState ) ) { // Try and find the HelpBlock in the parent of widget .
return findHelpBlock ( widget . getParent ( ) ) ; } return null ;
|
public class Specification { /** * < p > marshallize . < / p >
* @ return a { @ link java . util . Vector } object . */
public Vector < Object > marshallize ( ) { } }
|
Vector < Object > parameters = super . marshallize ( ) ; Vector < Object > suts = XmlRpcDataMarshaller . toXmlRpcSystemUnderTestsParameters ( targetedSystemUnderTests ) ; parameters . add ( SPECIFICATION_SUTS_IDX , suts ) ; if ( isNotBlank ( dialectClass ) ) { parameters . add ( SPECIFICATION_DIALECT_IDX , dialectClass ) ; } return parameters ;
|
public class PoolManager { /** * Put the mcw in the hash map
* @ param mc
* @ param mcw */
public void putMcToMCWMap ( ManagedConnection mc , MCWrapper mcw ) { } }
|
mcToMCWMapWrite . lock ( ) ; try { mcToMCWMap . put ( mc , mcw ) ; } finally { mcToMCWMapWrite . unlock ( ) ; }
|
public class FileSystem { /** * Reply the basename of the specified file without the last extension .
* @ param filename is the name to parse .
* @ return the basename of the specified file without the last extension .
* @ see # shortBasename ( URL )
* @ see # largeBasename ( URL )
* @ see # dirname ( URL )
* @ see # extension ( URL ) */
@ Pure public static String basename ( URL filename ) { } }
|
if ( filename == null ) { return null ; } final String largeBasename = filename . getPath ( ) ; assert ! isWindowsNativeFilename ( largeBasename ) ; int end = largeBasename . length ( ) ; int idx ; do { end -- ; idx = largeBasename . lastIndexOf ( URL_PATH_SEPARATOR_CHAR , end ) ; } while ( idx >= 0 && end >= 0 && idx >= end ) ; String basename ; if ( idx < 0 ) { if ( end < largeBasename . length ( ) - 1 ) { basename = largeBasename . substring ( 0 , end + 1 ) ; } else { basename = largeBasename ; } } else { basename = largeBasename . substring ( idx + 1 , end + 1 ) ; } idx = basename . lastIndexOf ( getFileExtensionCharacter ( ) ) ; if ( idx >= 0 ) { basename = basename . substring ( 0 , idx ) ; } return decodeHTMLEntities ( basename ) ;
|
public class CommandLineInterface { /** * Using all language profiles from the given directory . */
private LanguageDetector makeDetector ( ) throws IOException { } }
|
double alpha = getParamDouble ( "alpha" , DEFAULT_ALPHA ) ; String profileDirectory = requireParamString ( "directory" ) + "/" ; Optional < Long > seed = Optional . fromNullable ( getParamLongOrNull ( "seed" ) ) ; List < LanguageProfile > languageProfiles = new LanguageProfileReader ( ) . readAll ( new File ( profileDirectory ) ) ; return LanguageDetectorBuilder . create ( NgramExtractors . standard ( ) ) . alpha ( alpha ) . seed ( seed ) . shortTextAlgorithm ( 50 ) . withProfiles ( languageProfiles ) . build ( ) ;
|
public class ArrayList { /** * Appends all of the elements in the specified collection to the end of
* this list , in the order that they are returned by the
* specified collection ' s Iterator . The behavior of this operation is
* undefined if the specified collection is modified while the operation
* is in progress . ( This implies that the behavior of this call is
* undefined if the specified collection is this list , and this
* list is nonempty . )
* @ param c collection containing elements to be added to this list
* @ return < tt > true < / tt > if this list changed as a result of the call
* @ throws NullPointerException if the specified collection is null */
public boolean addAll ( Collection < ? extends E > c ) { } }
|
Object [ ] a = c . toArray ( ) ; int numNew = a . length ; ensureCapacityInternal ( size + numNew ) ; // Increments modCount
System . arraycopy ( a , 0 , elementData , size , numNew ) ; size += numNew ; return numNew != 0 ;
|
public class Fetch { /** * Updates this fetch , adding a single field . If the field is a reference , the reference will be
* fetched with the Fetch that is provided .
* @ param field the name of the field to fetch
* @ param fetch the fetch to use for this field , if the field is a reference
* @ return this Fetch , updated */
public Fetch field ( String field , Fetch fetch ) { } }
|
attrFetchMap . put ( field , fetch ) ; return this ;
|
public class ConnectionUtility { /** * Destroy all the data sources created before .
* If any exception occurred , it will be logged but never propagated . */
public static void destroyDataSources ( ) { } }
|
synchronized ( dataSourcesStructureLock ) { for ( Map . Entry < String , DataSource > dsEntry : dataSources . entrySet ( ) ) { String dsName = dsEntry . getKey ( ) ; DataSource ds = dsEntry . getValue ( ) ; for ( Map . Entry < String , DataSourceProvider > dspEntry : dataSourceProviders . entrySet ( ) ) { // try them one by one
String dspName = dspEntry . getKey ( ) ; DataSourceProvider dsp = dspEntry . getValue ( ) ; try { if ( dsp . destroyDataSource ( ds ) ) { break ; } } catch ( NoClassDefFoundError e ) { // ignore
} catch ( Throwable e ) { log . error ( "Error when destroying data source '" + dsName + "' using provider '" + dspName + "'" , e ) ; } } } dataSources . clear ( ) ; }
|
public class WDataTable { /** * Indicates whether the table supports sorting .
* @ return true if the table and model both support sorting , false otherwise . */
public boolean isSortable ( ) { } }
|
// First check global override which turns sorting off
if ( getSortMode ( ) == SortMode . NONE ) { return false ; } // Otherwise , the table is sortable if at least one column is sortable .
TableDataModel dataModel = getDataModel ( ) ; final int columnCount = getColumnCount ( ) ; for ( int i = 0 ; i < columnCount ; i ++ ) { if ( dataModel . isSortable ( i ) ) { return true ; } } return false ;
|
public class JpaLocalTxnInterceptor { /** * Returns True if rollback DID NOT HAPPEN ( i . e . if commit should continue ) .
* @ param transactional The metadata annotaiton of the method
* @ param e The exception to test for rollback
* @ param txn A JPA Transaction to issue rollbacks on */
private boolean rollbackIfNecessary ( Transactional transactional , Exception e , EntityTransaction txn ) { } }
|
boolean commit = true ; // check rollback clauses
for ( Class < ? extends Exception > rollBackOn : transactional . rollbackOn ( ) ) { // if one matched , try to perform a rollback
if ( rollBackOn . isInstance ( e ) ) { commit = false ; // check ignore clauses ( supercedes rollback clause )
for ( Class < ? extends Exception > exceptOn : transactional . ignore ( ) ) { // An exception to the rollback clause was found , DON ' T rollback
// ( i . e . commit and throw anyway )
if ( exceptOn . isInstance ( e ) ) { commit = true ; break ; } } // rollback only if nothing matched the ignore check
if ( ! commit ) { txn . rollback ( ) ; } // otherwise continue to commit
break ; } } return commit ;
|
public class CollectSerIteratorFactory { /** * Creates an iterator wrapper for a value retrieved from a parent iterator .
* Allows the parent iterator to define the child iterator using generic type information .
* This handles cases such as a { @ code List } as the value in a { @ code Map } .
* @ param value the possible collection - like object , not null
* @ param parent the parent iterator , not null
* @ return the iterator , null if not a collection - like type */
@ Override public SerIterator createChild ( final Object value , final SerIterator parent ) { } }
|
Class < ? > declaredType = parent . valueType ( ) ; List < Class < ? > > childGenericTypes = parent . valueTypeTypes ( ) ; if ( value instanceof Grid ) { if ( childGenericTypes . size ( ) == 1 ) { return grid ( ( Grid < ? > ) value , declaredType , childGenericTypes . get ( 0 ) , EMPTY_VALUE_TYPES ) ; } return grid ( ( Grid < ? > ) value , Object . class , Object . class , EMPTY_VALUE_TYPES ) ; } return super . createChild ( value , parent ) ;
|
public class MicroBeanMapUtil { /** * @ param beanObj
* @ param fieldName
* @ param value */
public static void setBeanProperty ( Object beanObj , String fieldName , Object value ) throws Exception { } }
|
Class cls = beanObj . getClass ( ) ; Field field = cls . getDeclaredField ( fieldName ) ; Class fieldCls = field . getType ( ) ; field . setAccessible ( true ) ; Object fieldObj = str2Obj ( fieldCls , value ) ; field . set ( beanObj , fieldObj ) ;
|
public class BingVideosImpl { /** * The Video Trending Search API lets you search on Bing and get back a list of videos that are trending based on search requests made by others . The videos are broken out into different categories . For example , Top Music Videos . For a list of markets that support trending videos , see [ Trending Videos ] ( https : / / docs . microsoft . com / azure / cognitive - services / bing - video - search / trending - videos ) .
* @ param trendingOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TrendingVideos object */
public Observable < ServiceResponse < TrendingVideos > > trendingWithServiceResponseAsync ( TrendingOptionalParameter trendingOptionalParameter ) { } }
|
final String acceptLanguage = trendingOptionalParameter != null ? trendingOptionalParameter . acceptLanguage ( ) : null ; final String userAgent = trendingOptionalParameter != null ? trendingOptionalParameter . userAgent ( ) : this . client . userAgent ( ) ; final String clientId = trendingOptionalParameter != null ? trendingOptionalParameter . clientId ( ) : null ; final String clientIp = trendingOptionalParameter != null ? trendingOptionalParameter . clientIp ( ) : null ; final String location = trendingOptionalParameter != null ? trendingOptionalParameter . location ( ) : null ; final String countryCode = trendingOptionalParameter != null ? trendingOptionalParameter . countryCode ( ) : null ; final String market = trendingOptionalParameter != null ? trendingOptionalParameter . market ( ) : null ; final SafeSearch safeSearch = trendingOptionalParameter != null ? trendingOptionalParameter . safeSearch ( ) : null ; final String setLang = trendingOptionalParameter != null ? trendingOptionalParameter . setLang ( ) : null ; final Boolean textDecorations = trendingOptionalParameter != null ? trendingOptionalParameter . textDecorations ( ) : null ; final TextFormat textFormat = trendingOptionalParameter != null ? trendingOptionalParameter . textFormat ( ) : null ; return trendingWithServiceResponseAsync ( acceptLanguage , userAgent , clientId , clientIp , location , countryCode , market , safeSearch , setLang , textDecorations , textFormat ) ;
|
public class ResponseHandler { /** * Helper method which schedules the given { @ link CouchbaseRequest } with a delay for further retry .
* @ param request the request to retry . */
private void scheduleForRetry ( final CouchbaseRequest request , final boolean isNotMyVbucket ) { } }
|
CoreEnvironment env = environment ; long delayTime ; TimeUnit delayUnit ; if ( request . retryDelay ( ) != null ) { Delay delay = request . retryDelay ( ) ; if ( request . retryCount ( ) == 0 ) { delayTime = request . retryAfter ( ) ; request . incrementRetryCount ( ) ; } else { delayTime = delay . calculate ( request . incrementRetryCount ( ) ) ; } delayUnit = delay . unit ( ) ; if ( request . maxRetryDuration ( ) != 0 && ( ( System . currentTimeMillis ( ) ) + delayTime ) > request . maxRetryDuration ( ) ) { request . observable ( ) . onError ( new RequestCancelledException ( "Could not dispatch request, cancelling " + "instead of retrying as the maximum retry duration specified by Server has been exceeded" ) ) ; return ; } } else { Delay delay = env . retryDelay ( ) ; if ( isNotMyVbucket ) { boolean hasFastForward = bucketHasFastForwardMap ( request . bucket ( ) , configurationProvider . config ( ) ) ; delayTime = request . incrementRetryCount ( ) == 0 && hasFastForward ? 0 : nmvbRetryDelay ; delayUnit = TimeUnit . MILLISECONDS ; } else { delayTime = delay . calculate ( request . incrementRetryCount ( ) ) ; delayUnit = delay . unit ( ) ; } } if ( traceLoggingEnabled ) { LOGGER . trace ( "Retrying {} with a delay of {} {}" , request , delayTime , delayUnit ) ; } final Scheduler . Worker worker = env . scheduler ( ) . createWorker ( ) ; worker . schedule ( new Action0 ( ) { @ Override public void call ( ) { try { cluster . send ( request ) ; } finally { worker . unsubscribe ( ) ; } } } , delayTime , delayUnit ) ;
|
public class snmp_user { /** * < pre >
* Use this operation to add SNMP User .
* < / pre > */
public static snmp_user add ( nitro_service client , snmp_user resource ) throws Exception { } }
|
resource . validate ( "add" ) ; return ( ( snmp_user [ ] ) resource . perform_operation ( client , "add" ) ) [ 0 ] ;
|
public class RepairPriorityQueue { /** * Gets an element in the queue given its key .
* @ param key the key to look for .
* @ return the element which corresponds to the key or null . */
public RepairDigramRecord get ( String key ) { } }
|
RepairQueueNode el = this . elements . get ( key ) ; if ( null != el ) { return el . payload ; } return null ;
|
public class PostInitializeProcessor { /** * { @ inheritDoc } */
@ Override public void afterSingletonsInstantiated ( ) { } }
|
final long startTimestamp = System . currentTimeMillis ( ) ; this . initializeAnnotations ( ) ; this . processInitialization ( ) ; int methodCount = this . postInitializingMethods . values ( ) . stream ( ) . mapToInt ( List :: size ) . sum ( ) ; log . info ( "Launched {} method(s) in {}ms" , methodCount , System . currentTimeMillis ( ) - startTimestamp ) ;
|
public class RgbaColor { /** * Takes two adjustments and applies the one that conforms to the
* range . If the first modification moves the value out of range
* [ 0-100 ] , the second modification will be applied < b > and clipped
* if necessary < / b > .
* @ param index
* The index in HSL
* @ param first
* The first modification that will be applied and
* bounds checked
* @ param second
* If 0 , the first is always applied */
private RgbaColor adjustSL ( int index , float first , float second ) { } }
|
float [ ] HSL = convertToHsl ( ) ; float firstvalue = HSL [ index ] + first ; // check if it ' s in bounds
if ( slCheck ( firstvalue ) == firstvalue ) { // it is , keep this transform
HSL [ index ] = firstvalue ; } else if ( second == 0 ) { // just take the first one because there is no second , but
// bounds check it .
HSL [ index ] = slCheck ( firstvalue ) ; } else { // always take the second if the first exceeds bounds
HSL [ index ] = slCheck ( HSL [ index ] + second ) ; } return RgbaColor . fromHsl ( HSL ) ;
|
public class LocalSubscriptionControl { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . ControlAdapter # registerControlAdapterAsMBean ( ) */
public void registerControlAdapterAsMBean ( ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerControlAdapterAsMBean" ) ; if ( isRegistered ( ) ) { // Don ' t register a 2nd time .
} else { super . registerControlAdapterAsMBean ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerControlAdapterAsMBean" ) ;
|
public class Axis { /** * Add a label to the axis at given location . */
public Axis addLabel ( String label , double location ) { } }
|
if ( labels == null ) { labels = new HashMap < > ( ) ; } labels . put ( label , location ) ; setSlice ( ) ; initGridLines ( ) ; initGridLabels ( ) ; return this ;
|
public class DefaultRewriteContentHandler { /** * Converts the RTE externalized form of media reference to internal form .
* @ param ref Externalize media reference
* @ return Internal media reference */
private String unexternalizeImageRef ( String ref ) { } }
|
String unexternalizedRef = ref ; if ( StringUtils . isNotEmpty ( unexternalizedRef ) ) { // decode if required
unexternalizedRef = decodeIfEncoded ( unexternalizedRef ) ; // TODO : implementation has to be aligned with MediaSource implementations !
// remove default servlet extension that is needed for inline images in RTE
unexternalizedRef = StringUtils . removeEnd ( unexternalizedRef , "/" + JcrConstants . JCR_CONTENT + ".default" ) ; unexternalizedRef = StringUtils . removeEnd ( unexternalizedRef , "/_jcr_content.default" ) ; } return unexternalizedRef ;
|
public class WorkflowJPA { /** * / * ( non - Javadoc )
* @ see nz . co . senanque . workflow . WorkflowDAO # findProcessInstance ( java . lang . Long ) */
@ Transactional public ProcessInstance findProcessInstance ( Long id ) { } }
|
log . debug ( "findProcessInstance {}" , id ) ; ProcessInstance ret = null ; try { ret = m_entityManager . find ( ProcessInstance . class , id , LockModeType . PESSIMISTIC_WRITE ) ; if ( ret == null ) { throw new WorkflowException ( "Could not find process instance id=" + id ) ; } ret . getAudits ( ) . size ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw e ; } return ret ;
|
public class VisibilityAlgorithm { /** * Compute isovist polygon
* @ param position View coordinate
* @ param addEnvelope If true add circle bounding box . This function does not work properly if the view point is not
* enclosed by segments
* @ return Visibility polygon */
public Polygon getIsoVist ( Coordinate position , boolean addEnvelope ) { } }
|
// Add bounding circle
List < SegmentString > bounded = new ArrayList < > ( originalSegments . size ( ) + numPoints ) ; // Compute envelope
Envelope env = new Envelope ( ) ; for ( SegmentString segment : originalSegments ) { env . expandToInclude ( segment . getCoordinate ( 0 ) ) ; env . expandToInclude ( segment . getCoordinate ( 1 ) ) ; } if ( addEnvelope ) { // Add bounding geom in envelope
env . expandToInclude ( new Coordinate ( position . x - maxDistance , position . y - maxDistance ) ) ; env . expandToInclude ( new Coordinate ( position . x + maxDistance , position . y + position . x ) ) ; GeometricShapeFactory geometricShapeFactory = new GeometricShapeFactory ( ) ; geometricShapeFactory . setCentre ( new Coordinate ( position . x - env . getMinX ( ) , position . y - env . getMinY ( ) ) ) ; geometricShapeFactory . setWidth ( maxDistance * 2 ) ; geometricShapeFactory . setHeight ( maxDistance * 2 ) ; geometricShapeFactory . setNumPoints ( numPoints ) ; addPolygon ( bounded , geometricShapeFactory . createEllipse ( ) ) ; for ( SegmentString segment : originalSegments ) { final Coordinate a = segment . getCoordinate ( 0 ) ; final Coordinate b = segment . getCoordinate ( 1 ) ; addSegment ( bounded , new Coordinate ( a . x - env . getMinX ( ) , a . y - env . getMinY ( ) ) , new Coordinate ( b . x - env . getMinX ( ) , b . y - env . getMinY ( ) ) ) ; } // Intersection with bounding circle
bounded = fixSegments ( bounded ) ; } else { for ( SegmentString segment : originalSegments ) { final Coordinate a = segment . getCoordinate ( 0 ) ; final Coordinate b = segment . getCoordinate ( 1 ) ; addSegment ( bounded , new Coordinate ( a . x - env . getMinX ( ) , a . y - env . getMinY ( ) ) , new Coordinate ( b . x - env . getMinX ( ) , b . y - env . getMinY ( ) ) ) ; } } position = new Coordinate ( position . x - env . getMinX ( ) , position . y - env . getMinY ( ) ) ; List < Vertex > sorted = new ArrayList < > ( bounded . size ( ) * 2 ) ; for ( int idSegment = 0 ; idSegment < bounded . size ( ) ; idSegment ++ ) { SegmentString segment = bounded . get ( idSegment ) ; // Convert segment to angle relative to viewPoint
for ( int j = 0 ; j < 2 ; ++ j ) { final Coordinate pt = segment . getCoordinate ( j ) ; sorted . add ( new Vertex ( idSegment , j , angle ( pt , position ) ) ) ; } } Collections . sort ( sorted ) ; List < Integer > map = new ArrayList < > ( bounded . size ( ) ) ; for ( int i = 0 ; i < bounded . size ( ) ; i ++ ) { map . add ( - 1 ) ; } List < Integer > heap = new ArrayList < > ( bounded . size ( ) ) ; Coordinate start = new Coordinate ( position . x + 1 , position . y ) ; // Init heap and map lists
for ( int i = 0 ; i < bounded . size ( ) ; i ++ ) { SegmentString seg = bounded . get ( i ) ; double a1 = angle ( seg . getCoordinate ( 0 ) , position ) ; double a2 = angle ( seg . getCoordinate ( 1 ) , position ) ; boolean active = false ; if ( a1 > - Math . PI && a1 <= 0 && a2 <= Math . PI && a2 >= 0 && a2 - a1 > Math . PI ) { active = true ; } if ( a2 > - Math . PI && a2 <= 0 && a1 <= Math . PI && a1 >= 0 && a1 - a2 > Math . PI ) { active = true ; } if ( active ) { insert ( i , heap , position , bounded , start , map ) ; } } List < Coordinate > polygon = new ArrayList < > ( ) ; // Iterate over vertices using the anticlockwise order
for ( int i = 0 ; i < sorted . size ( ) ; ) { boolean extend = false ; // Use existing vertex
boolean shorten = false ; // Compute intersection with two vertices
int orig = i ; Coordinate vertex = bounded . get ( sorted . get ( i ) . idSegment ) . getCoordinate ( sorted . get ( i ) . vertexIndex ) ; int oldSegment = heap . get ( 0 ) ; do { if ( map . get ( sorted . get ( i ) . idSegment ) != - 1 ) { if ( sorted . get ( i ) . idSegment == oldSegment ) { extend = true ; vertex = bounded . get ( sorted . get ( i ) . idSegment ) . getCoordinate ( sorted . get ( i ) . vertexIndex ) ; } remove ( map . get ( sorted . get ( i ) . idSegment ) , heap , position , bounded , vertex , map ) ; } else { insert ( sorted . get ( i ) . idSegment , heap , position , bounded , vertex , map ) ; if ( heap . get ( 0 ) != oldSegment ) { shorten = true ; } } i ++ ; if ( i == sorted . size ( ) ) { break ; } } while ( sorted . get ( i ) . angle < sorted . get ( orig ) . angle + epsilon ) ; if ( extend ) { polygon . add ( new Coordinate ( vertex . x + env . getMinX ( ) , vertex . y + env . getMinY ( ) ) ) ; Coordinate cur = intersectLines ( bounded . get ( heap . get ( 0 ) ) , position , vertex ) ; if ( cur != null && ! cur . equals2D ( vertex , epsilon ) ) { polygon . add ( new Coordinate ( cur . x + env . getMinX ( ) , cur . y + env . getMinY ( ) ) ) ; } } else if ( shorten ) { final Coordinate i1 = intersectLines ( bounded . get ( oldSegment ) , position , vertex ) ; final Coordinate i2 = intersectLines ( bounded . get ( heap . get ( 0 ) ) , position , vertex ) ; polygon . add ( new Coordinate ( i1 . x + env . getMinX ( ) , i1 . y + env . getMinY ( ) ) ) ; polygon . add ( new Coordinate ( i2 . x + env . getMinX ( ) , i2 . y + env . getMinY ( ) ) ) ; } } // Finish polygon
polygon . add ( polygon . get ( 0 ) ) ; GeometryFactory geometryFactory = new GeometryFactory ( ) ; return geometryFactory . createPolygon ( polygon . toArray ( new Coordinate [ 0 ] ) ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.