signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CommonMBeanConnection { /** * Get the MBeanServerConnection for the target controller host and port .
* @ param controllerHost
* @ param controllerPort
* @ param environment
* @ return
* @ throws MalformedURLException
* @ throws IOException */
private JMXConnector getMBeanServerConnection ( String controllerHost , int controllerPort , HashMap < String , Object > environment ) throws MalformedURLException , IOException { } } | JMXServiceURL serviceURL = new JMXServiceURL ( "REST" , controllerHost , controllerPort , "/IBMJMXConnectorREST" ) ; return new ClientProvider ( ) . newJMXConnector ( serviceURL , environment ) ; |
public class Request { /** * Hostname getter , if user has defined a specific hostname through
* java system properties then it will be used . Otherwise the default
* hostname ( https : / / code . google . com ) will be returned .
* @ return Hostname to use for performing request . */
public static String getHostname ( ) { } } | final String hostname = System . getProperty ( HOSTNAME_PROPERTY ) ; // TODO : Ensure hostname format is valid .
return ( hostname == null ? DEFAULT_HOSTNAME : hostname ) ; |
public class Verjson { /** * Serializes the given object to a String */
public String write ( T obj ) throws JsonProcessingException { } } | Date ts = includeTimestamp ? Date . from ( now ( ) ) : null ; MetaWrapper wrapper = new MetaWrapper ( getHighestSourceVersion ( ) , getNamespace ( ) , obj , ts ) ; return mapper . writeValueAsString ( wrapper ) ; |
public class PGStream { /** * Copy data from an input stream to the connection .
* @ param inStream the stream to read data from
* @ param remaining the number of bytes to copy
* @ throws IOException if a data I / O error occurs */
public void sendStream ( InputStream inStream , int remaining ) throws IOException { } } | int expectedLength = remaining ; if ( streamBuffer == null ) { streamBuffer = new byte [ 8192 ] ; } while ( remaining > 0 ) { int count = ( remaining > streamBuffer . length ? streamBuffer . length : remaining ) ; int readCount ; try { readCount = inStream . read ( streamBuffer , 0 , count ) ; if ( readCount < 0 ) { throw new EOFException ( GT . tr ( "Premature end of input stream, expected {0} bytes, but only read {1}." , expectedLength , expectedLength - remaining ) ) ; } } catch ( IOException ioe ) { while ( remaining > 0 ) { send ( streamBuffer , count ) ; remaining -= count ; count = ( remaining > streamBuffer . length ? streamBuffer . length : remaining ) ; } throw new PGBindException ( ioe ) ; } send ( streamBuffer , readCount ) ; remaining -= readCount ; } |
public class Transporter { /** * - - - IS NODE ONLINE ? - - - */
public boolean isOnline ( String nodeID ) { } } | if ( this . nodeID . equals ( nodeID ) ) { return true ; } NodeDescriptor node = nodes . get ( nodeID ) ; if ( node == null ) { return false ; } node . readLock . lock ( ) ; try { return node . offlineSince == 0 && node . seq > 0 ; } finally { node . readLock . unlock ( ) ; } |
public class ClasspathElementDir { /** * Recursively scan a directory for file path patterns matching the scan spec .
* @ param dir
* the directory
* @ param log
* the log */
private void scanDirRecursively ( final File dir , final LogNode log ) { } } | if ( skipClasspathElement ) { return ; } // See if this canonical path has been scanned before , so that recursive scanning doesn ' t get stuck in an
// infinite loop due to symlinks
String canonicalPath ; try { canonicalPath = dir . getCanonicalPath ( ) ; if ( ! scannedCanonicalPaths . add ( canonicalPath ) ) { if ( log != null ) { log . log ( "Reached symlink cycle, stopping recursion: " + dir ) ; } return ; } } catch ( final IOException | SecurityException e ) { if ( log != null ) { log . log ( "Could not canonicalize path: " + dir , e ) ; } return ; } final String dirPath = dir . getPath ( ) ; final String dirRelativePath = ignorePrefixLen > dirPath . length ( ) ? "/" : dirPath . substring ( ignorePrefixLen ) . replace ( File . separatorChar , '/' ) + "/" ; if ( nestedClasspathRootPrefixes != null && nestedClasspathRootPrefixes . contains ( dirRelativePath ) ) { if ( log != null ) { log . log ( "Reached nested classpath root, stopping recursion to avoid duplicate scanning: " + dirRelativePath ) ; } return ; } // Whitelist / blacklist classpath elements based on dir resource paths
checkResourcePathWhiteBlackList ( dirRelativePath , log ) ; if ( skipClasspathElement ) { return ; } final ScanSpecPathMatch parentMatchStatus = scanSpec . dirWhitelistMatchStatus ( dirRelativePath ) ; if ( parentMatchStatus == ScanSpecPathMatch . HAS_BLACKLISTED_PATH_PREFIX ) { // Reached a non - whitelisted or blacklisted path - - stop the recursive scan
if ( log != null ) { log . log ( "Reached blacklisted directory, stopping recursive scan: " + dirRelativePath ) ; } return ; } if ( parentMatchStatus == ScanSpecPathMatch . NOT_WITHIN_WHITELISTED_PATH ) { // Reached a non - whitelisted and non - blacklisted path - - stop the recursive scan
return ; } final File [ ] filesInDir = dir . listFiles ( ) ; if ( filesInDir == null ) { if ( log != null ) { log . log ( "Invalid directory " + dir ) ; } return ; } Arrays . sort ( filesInDir ) ; final LogNode subLog = log == null ? null // Log dirs after files ( addWhitelistedResources ( ) precedes log entry with " 0 : " )
: log . log ( "1:" + canonicalPath , "Scanning directory: " + dir + ( dir . getPath ( ) . equals ( canonicalPath ) ? "" : " ; canonical path: " + canonicalPath ) ) ; // Only scan files in directory if directory is not only an ancestor of a whitelisted path
if ( parentMatchStatus != ScanSpecPathMatch . ANCESTOR_OF_WHITELISTED_PATH ) { // Do preorder traversal ( files in dir , then subdirs ) , to reduce filesystem cache misses
for ( final File fileInDir : filesInDir ) { // Process files in dir before recursing
if ( fileInDir . isFile ( ) ) { final String fileInDirRelativePath = dirRelativePath . isEmpty ( ) || "/" . equals ( dirRelativePath ) ? fileInDir . getName ( ) : dirRelativePath + fileInDir . getName ( ) ; // Whitelist / blacklist classpath elements based on file resource paths
checkResourcePathWhiteBlackList ( fileInDirRelativePath , subLog ) ; if ( skipClasspathElement ) { return ; } // If relative path is whitelisted
if ( parentMatchStatus == ScanSpecPathMatch . HAS_WHITELISTED_PATH_PREFIX || parentMatchStatus == ScanSpecPathMatch . AT_WHITELISTED_PATH || ( parentMatchStatus == ScanSpecPathMatch . AT_WHITELISTED_CLASS_PACKAGE && scanSpec . classfileIsSpecificallyWhitelisted ( fileInDirRelativePath ) ) ) { // Resource is whitelisted
final Resource resource = newResource ( fileInDirRelativePath , fileInDir ) ; addWhitelistedResource ( resource , parentMatchStatus , subLog ) ; // Save last modified time
fileToLastModified . put ( fileInDir , fileInDir . lastModified ( ) ) ; } else { if ( subLog != null ) { subLog . log ( "Skipping non-whitelisted file: " + fileInDirRelativePath ) ; } } } } } else if ( scanSpec . enableClassInfo && dirRelativePath . equals ( "/" ) ) { // Always check for module descriptor in package root , even if package root isn ' t in whitelist
for ( final File fileInDir : filesInDir ) { if ( fileInDir . getName ( ) . equals ( "module-info.class" ) && fileInDir . isFile ( ) ) { final Resource resource = newResource ( "module-info.class" , fileInDir ) ; addWhitelistedResource ( resource , parentMatchStatus , subLog ) ; fileToLastModified . put ( fileInDir , fileInDir . lastModified ( ) ) ; } } } // Recurse into subdirectories
for ( final File fileInDir : filesInDir ) { if ( fileInDir . isDirectory ( ) ) { scanDirRecursively ( fileInDir , subLog ) ; // If a blacklisted classpath element resource path was found , it will set skipClasspathElement
if ( skipClasspathElement ) { if ( subLog != null ) { subLog . addElapsedTime ( ) ; } return ; } } } if ( subLog != null ) { subLog . addElapsedTime ( ) ; } // Save the last modified time of the directory
fileToLastModified . put ( dir , dir . lastModified ( ) ) ; |
public class Job { /** * Set the { @ link OutputFormat } for the job .
* @ param cls the < code > OutputFormat < / code > to use
* @ throws IllegalStateException if the job is submitted */
public void setOutputFormatClass ( Class < ? extends OutputFormat > cls ) throws IllegalStateException { } } | ensureState ( JobState . DEFINE ) ; conf . setClass ( OUTPUT_FORMAT_CLASS_ATTR , cls , OutputFormat . class ) ; |
public class CSRFServiceImpl { /** * Compares to token .
* @ param a the first token
* @ param b the second token
* @ return { @ code true } if the token are equal , { @ code false } otherwise */
@ Override public boolean compareTokens ( String a , String b ) { } } | if ( isSignedToken ( ) ) { return crypto . compareSignedTokens ( a , b ) ; } else { return crypto . constantTimeEquals ( a , b ) ; } |
public class JSONObject { /** * Get the value object associated with a key .
* @ param key
* A key string .
* @ return The object associated with the key .
* @ throws JSONException
* if the key is not found . */
public Object get ( String key ) throws JSONException { } } | Object o = opt ( key ) ; if ( o == null ) { throw new JSONException ( "JSONObject[" + quote ( key ) + "] not found." ) ; } return o ; |
public class X509CRLEntryImpl { /** * Utility method to convert an arbitrary instance of X509CRLEntry
* to a X509CRLEntryImpl . Does a cast if possible , otherwise reparses
* the encoding . */
public static X509CRLEntryImpl toImpl ( X509CRLEntry entry ) throws CRLException { } } | if ( entry instanceof X509CRLEntryImpl ) { return ( X509CRLEntryImpl ) entry ; } else { return new X509CRLEntryImpl ( entry . getEncoded ( ) ) ; } |
public class Camera { /** * Check horizontal limit on move .
* @ param extrp The extrapolation value .
* @ param vx The horizontal movement . */
private void checkHorizontalLimit ( double extrp , double vx ) { } } | // Inside interval
if ( mover . getX ( ) >= limitLeft && mover . getX ( ) <= limitRight && limitLeft != Integer . MIN_VALUE && limitRight != Integer . MAX_VALUE ) { offset . moveLocation ( extrp , vx , 0 ) ; // Block offset on its limits
if ( offset . getX ( ) < - intervalHorizontal ) { offset . teleportX ( - intervalHorizontal ) ; } else if ( offset . getX ( ) > intervalHorizontal ) { offset . teleportX ( intervalHorizontal ) ; } } // Outside interval
if ( ( int ) offset . getX ( ) == - intervalHorizontal || ( int ) offset . getX ( ) == intervalHorizontal ) { mover . moveLocationX ( extrp , vx ) ; } applyHorizontalLimit ( ) ; |
public class JsScopeUiDatePickerOnChangeEvent { /** * Creates a default { @ link JsScopeUiDatePickerOnChangeEvent } to execute the given
* statement .
* @ param javascriptCode
* the JavaScript statement to execute with the scope .
* @ return the created { @ link JsScopeUiDatePickerDateTextEvent } . */
public static JsScopeUiDatePickerOnChangeEvent quickScope ( final CharSequence javascriptCode ) { } } | return new JsScopeUiDatePickerOnChangeEvent ( ) { private static final long serialVersionUID = 1L ; @ Override protected void execute ( JsScopeContext scopeContext ) { scopeContext . append ( javascriptCode ) ; } } ; |
public class CollectionPrefetcher { /** * Build the multiple queries for one relationship because of limitation of IN ( . . . )
* @ param owners Collection containing all objects of the ONE side */
protected Query [ ] buildPrefetchQueries ( Collection owners , Collection children ) { } } | ClassDescriptor cld = getOwnerClassDescriptor ( ) ; Class topLevelClass = getBroker ( ) . getTopLevelClass ( cld . getClassOfObject ( ) ) ; BrokerHelper helper = getBroker ( ) . serviceBrokerHelper ( ) ; Collection queries = new ArrayList ( owners . size ( ) ) ; Collection idsSubset = new HashSet ( owners . size ( ) ) ; Object [ ] fkValues ; Object owner ; Identity id ; Iterator iter = owners . iterator ( ) ; while ( iter . hasNext ( ) ) { owner = iter . next ( ) ; fkValues = helper . extractValueArray ( helper . getKeyValues ( cld , owner ) ) ; id = getBroker ( ) . serviceIdentity ( ) . buildIdentity ( null , topLevelClass , fkValues ) ; idsSubset . add ( id ) ; if ( idsSubset . size ( ) == pkLimit ) { queries . add ( buildPrefetchQuery ( idsSubset ) ) ; idsSubset . clear ( ) ; } } if ( idsSubset . size ( ) > 0 ) { queries . add ( buildPrefetchQuery ( idsSubset ) ) ; } return ( Query [ ] ) queries . toArray ( new Query [ queries . size ( ) ] ) ; |
public class SharedSymbolTable { /** * Collects the necessary symbols from { @ code priorSymtab } and
* { @ code symbols } , and load them into the passed - in { @ code symbolsList } and
* { @ code symbolsMap } . */
private static void prepSymbolsListAndMap ( SymbolTable priorSymtab , Iterator < String > symbols , List < String > symbolsList , Map < String , Integer > symbolsMap ) { } } | int sid = 1 ; // Collect from passed - in priorSymtab
if ( priorSymtab != null ) { Iterator < String > priorSymbols = priorSymtab . iterateDeclaredSymbolNames ( ) ; while ( priorSymbols . hasNext ( ) ) { String text = priorSymbols . next ( ) ; if ( text != null ) { assert text . length ( ) > 0 ; putToMapIfNotThere ( symbolsMap , text , sid ) ; } // NB : Null entries must be added in the sid sequence
// to retain compat . with the prior version .
symbolsList . add ( text ) ; sid ++ ; } } // Collect from passed - in symbols
while ( symbols . hasNext ( ) ) { String text = symbols . next ( ) ; // TODO amzn / ion - java / issues / 12 What about empty symbols ?
if ( symbolsMap . get ( text ) == null ) { putToMapIfNotThere ( symbolsMap , text , sid ) ; symbolsList . add ( text ) ; sid ++ ; } } |
public class I18nChooseableSpecifics { /** * < p > Setter for lang . < / p >
* @ param pLang reference */
@ Override public final void setLang ( final Languages pLang ) { } } | this . lang = pLang ; if ( this . itsId == null ) { this . itsId = new IdI18nChooseableSpecifics ( ) ; } this . itsId . setLang ( this . lang ) ; |
public class ContentSpecBuilder { /** * Builds a book into a zip file for the passed Content Specification .
* @ param contentSpec The content specification that is to be built . It should have already been validated , if not errors may occur .
* @ param requester The user who requested the book to be built .
* @ param builderOptions The set of options what are to be when building the book .
* @ param zanataDetails The Zanata details to be used when editor links are turned on .
* @ param buildType
* @ return A byte array that is the zip file
* @ throws BuildProcessingException Any unexpected errors that occur during building .
* @ throws BuilderCreationException Any error that occurs while trying to setup / create the builder */
public byte [ ] buildTranslatedBook ( final ContentSpec contentSpec , final String requester , final DocBookBuildingOptions builderOptions , final ZanataDetails zanataDetails , final BuildType buildType ) throws BuilderCreationException , BuildProcessingException { } } | return buildTranslatedBook ( contentSpec , requester , builderOptions , new HashMap < String , byte [ ] > ( ) , zanataDetails , buildType ) ; |
public class ChildrenOrderAnalyzer { /** * Check the order of one child against the previous dated child .
* @ param child the child
* @ param prevChild the previous child
* @ return the current child if dated */
private Person analyzeChild ( final Person child , final Person prevChild ) { } } | Person retChild = prevChild ; if ( retChild == null ) { return child ; } final LocalDate birthDate = getNearBirthEventDate ( child ) ; if ( birthDate == null ) { return retChild ; } final LocalDate prevDate = getNearBirthEventDate ( prevChild ) ; if ( prevDate == null ) { return child ; } if ( birthDate . isBefore ( prevDate ) ) { final String message = String . format ( CHILD_ORDER_FORMAT , child . getName ( ) . getString ( ) , birthDate , prevChild . getName ( ) . getString ( ) , prevDate ) ; getResult ( ) . addMismatch ( message ) ; } retChild = child ; return retChild ; |
public class ColumnPrefixDistributedRowLock { /** * Release the lock by releasing this and any other stale lock columns */
@ Override public void release ( ) throws Exception { } } | if ( ! locksToDelete . isEmpty ( ) || lockColumn != null ) { MutationBatch m = keyspace . prepareMutationBatch ( ) . setConsistencyLevel ( consistencyLevel ) ; fillReleaseMutation ( m , false ) ; m . execute ( ) ; } |
public class Emoji { /** * Method to replace String . join , since it was only introduced in java8
* @ param array the array to be concatenated
* @ return concatenated String */
private String stringJoin ( String [ ] array , int count ) { } } | String joined = "" ; for ( int i = 0 ; i < count ; i ++ ) joined += array [ i ] ; return joined ; |
public class Variable { /** * Get a hedged member .
* @ param hedgeName is the hedge name
* @ param memberName is the member name
* @ return the member */
public Member getMember ( String hedgeName , String memberName ) { } } | String fullName = hedgeName + "$" + memberName ; return getMember ( fullName ) ; |
public class MapBuilder { /** * Puts the given { @ link KEY key } and { @ link VALUE value } into the { @ link Map } being built
* by this { @ link MapBuilder builder } .
* @ param key { @ link KEY key } to put .
* @ param value { @ link VALUE value } to put mapped to the given { @ link KEY key } .
* @ return this { @ link MapBuilder } .
* @ see java . util . Map # put ( Object , Object ) */
public MapBuilder < KEY , VALUE > put ( KEY key , VALUE value ) { } } | getMap ( ) . put ( key , value ) ; return this ; |
public class OpentracingService { /** * Check the configuration for filters of a particular type .
* @ param filters The resulting list of filters .
* @ param map Configuration properties .
* @ param configAdmin Service to get child configurations .
* @ param childNames The name of the configuration element to check for .
* @ param impl The filter class to instantiate if an element is found . */
private static void processFilters ( List < SpanFilter > filters , String pattern , String childNames , Class < ? extends SpanFilter > impl ) { } } | final String methodName = "processFilters" ; try { SpanFilterType type = SpanFilterType . INCOMING ; boolean ignoreCase = false ; boolean regex = true ; SpanFilter filter = ( SpanFilter ) Class . forName ( impl . getName ( ) ) . getConstructor ( String . class , SpanFilterType . class , boolean . class , boolean . class ) . newInstance ( pattern , type , ignoreCase , regex ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "filter " + filter ) ; } filters . add ( filter ) ; } catch ( ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e ) { throw new IllegalStateException ( e ) ; } |
public class JpaStylesheetUserPreferencesDao { /** * Add the needed fetches to a critera query */
protected void addFetches ( final Root < StylesheetUserPreferencesImpl > descriptorRoot ) { } } | descriptorRoot . fetch ( StylesheetUserPreferencesImpl_ . layoutAttributes , JoinType . LEFT ) ; descriptorRoot . fetch ( StylesheetUserPreferencesImpl_ . outputProperties , JoinType . LEFT ) ; descriptorRoot . fetch ( StylesheetUserPreferencesImpl_ . parameters , JoinType . LEFT ) ; |
public class RowAction { /** * Rollback actions for a session including and after the given timestamp */
synchronized void rollback ( Session session , long timestamp ) { } } | RowActionBase action = this ; do { if ( action . session == session && action . commitTimestamp == 0 ) { if ( action . actionTimestamp >= timestamp || action . actionTimestamp == 0 ) { action . commitTimestamp = session . actionTimestamp ; action . rolledback = true ; action . prepared = false ; } } action = action . next ; } while ( action != null ) ; |
public class MathActivityMarshaller { /** * Marshall the given parameter object . */
public void marshall ( MathActivity mathActivity , ProtocolMarshaller protocolMarshaller ) { } } | if ( mathActivity == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( mathActivity . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( mathActivity . getAttribute ( ) , ATTRIBUTE_BINDING ) ; protocolMarshaller . marshall ( mathActivity . getMath ( ) , MATH_BINDING ) ; protocolMarshaller . marshall ( mathActivity . getNext ( ) , NEXT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SVGMorph { /** * Update the morph time index by the amount specified
* @ param delta The amount to update the morph by */
public void updateMorphTime ( float delta ) { } } | for ( int i = 0 ; i < figures . size ( ) ; i ++ ) { Figure figure = ( Figure ) figures . get ( i ) ; MorphShape shape = ( MorphShape ) figure . getShape ( ) ; shape . updateMorphTime ( delta ) ; } |
public class XML { /** * See ECMA 357 , 11_2_2_1 , Semantics , 3 _ f . */
@ Override public Scriptable getExtraMethodSource ( Context cx ) { } } | if ( hasSimpleContent ( ) ) { String src = toString ( ) ; return ScriptRuntime . toObjectOrNull ( cx , src ) ; } return null ; |
public class MiriamLink { /** * Retrieves the resource by id ( for example : " MIR : 00100008 " ( bind ) ) .
* @ param resourceId - resource identifier ( similar to , but not a data type identifier ! )
* @ return MIRIAM Resource bean */
public static Resource getResource ( String resourceId ) { } } | for ( Datatype datatype : miriam . getDatatype ( ) ) { for ( Resource resource : getResources ( datatype ) ) { if ( resource . getId ( ) . equalsIgnoreCase ( resourceId ) ) return resource ; } } throw new IllegalArgumentException ( "Resource not found : " + resourceId ) ; |
public class MimeUtil { /** * Parse the magic . mime file */
private static void parse ( final Reader r ) throws IOException { } } | final BufferedReader br = new BufferedReader ( r ) ; String line ; final ArrayList < String > sequence = new ArrayList < String > ( ) ; line = br . readLine ( ) ; while ( true ) { if ( line == null ) { break ; } line = line . trim ( ) ; if ( line . length ( ) == 0 || line . charAt ( 0 ) == '#' ) { line = br . readLine ( ) ; continue ; } sequence . add ( line ) ; // read the following lines until a line does not begin with ' > ' or
// EOF
while ( true ) { line = br . readLine ( ) ; if ( line == null ) { addEntry ( sequence ) ; sequence . clear ( ) ; break ; } line = line . trim ( ) ; if ( line . length ( ) == 0 || line . charAt ( 0 ) == '#' ) { continue ; } if ( line . charAt ( 0 ) != '>' ) { addEntry ( sequence ) ; sequence . clear ( ) ; break ; } sequence . add ( line ) ; } } if ( ! sequence . isEmpty ( ) ) { addEntry ( sequence ) ; } |
public class AbstractCommonService { /** * 添加一条空记录
* @ return */
@ Override public String save ( Object pData ) { } } | String id = GUID . newGUID ( ) ; if ( pData instanceof TemplateModel ) { TemplateModel entity = ( TemplateModel ) pData ; entity . setId ( id ) ; entity . setRev ( System . currentTimeMillis ( ) ) ; } else if ( pData instanceof CommonModel ) { CommonModel entity = ( CommonModel ) pData ; entity . setId ( id ) ; } mDao . insert ( pData ) ; return id ; |
public class CircuitBreakerStatus { /** * Copy the current immutable object by setting a value for the { @ link AbstractCircuitBreakerStatus # getFailedThroughputOneMinute ( ) failedThroughputOneMinute } attribute .
* @ param value A new value for failedThroughputOneMinute
* @ return A modified copy of the { @ code this } object */
public final CircuitBreakerStatus withFailedThroughputOneMinute ( double value ) { } } | double newValue = value ; return new CircuitBreakerStatus ( this . id , this . timestamp , this . state , this . totalSuccessCount , this . totalFailureCount , this . latencyMicros , this . throughputOneMinute , newValue ) ; |
public class BaseStreamWriter { /** * StAX2 , other accessors , mutators */
@ Override public XMLStreamLocation2 getLocation ( ) { } } | return new WstxInputLocation ( null , // no parent
null , ( String ) null , // pub / sys ids not yet known
mWriter . getAbsOffset ( ) , mWriter . getRow ( ) , mWriter . getColumn ( ) ) ; |
public class A_CmsTreeTabDataPreloader { /** * Creates the beans for the loaded resources , and returns the root bean . < p >
* @ return the root bean
* @ throws CmsException if something goes wrong */
private T createBeans ( ) throws CmsException { } } | // create the beans for the resources
Map < CmsResource , T > beans = new HashMap < CmsResource , T > ( ) ; for ( CmsResource resource : m_knownResources ) { T bean = createEntry ( m_cms , resource ) ; if ( bean != null ) { beans . put ( resource , bean ) ; } } // attach beans for child resources to the beans for their parents
for ( Map . Entry < CmsResource , T > entry : beans . entrySet ( ) ) { CmsResource key = entry . getKey ( ) ; T bean = entry . getValue ( ) ; for ( CmsResource child : m_childMap . get ( key ) ) { T childEntry = beans . get ( child ) ; if ( childEntry != null ) { bean . addChild ( childEntry ) ; } } } return beans . get ( m_rootResource ) ; |
public class AbstractApplication { /** * Initialize the properties of the scene .
* 800x600 with transparent background and a Region as Parent Node
* @ return the scene built
* @ throws CoreException if build fails */
protected final Scene buildScene ( ) throws CoreException { } } | final Scene scene = new Scene ( buildRootPane ( ) , StageParameters . APPLICATION_SCENE_WIDTH . get ( ) , StageParameters . APPLICATION_SCENE_HEIGHT . get ( ) , JRebirthColors . SCENE_BG_COLOR . get ( ) ) ; return scene ; |
public class HashUtil { /** * A function that calculates the index ( e . g . to be used in an array / list ) for a given hash . The returned value will always
* be equal or larger than 0 and will always be smaller than ' length ' .
* The reason this function exists is to deal correctly with negative and especially the Integer . MIN _ VALUE ; since that can ' t
* be used safely with a Math . abs function .
* @ param length the length of the array / list
* @ return the mod of the hash
* @ throws IllegalArgumentException if mod smaller than 1. */
public static int hashToIndex ( int hash , int length ) { } } | checkPositive ( length , "length must be larger than 0" ) ; if ( hash == Integer . MIN_VALUE ) { return 0 ; } return abs ( hash ) % length ; |
public class XPathEvaluator { /** * { @ inheritDoc } */
@ Override public XPathSelector call ( ) throws Exception { } } | final Processor proc = new Processor ( false ) ; final Configuration config = proc . getUnderlyingConfiguration ( ) ; final NodeInfo doc = new DocumentWrapper ( mSession , config ) ; final XPathCompiler xpath = proc . newXPathCompiler ( ) ; final DocumentBuilder builder = proc . newDocumentBuilder ( ) ; XPathSelector selector = null ; try { final XdmItem booksDoc = builder . build ( doc ) ; selector = xpath . compile ( mExpression ) . load ( ) ; selector . setContextItem ( booksDoc ) ; } catch ( final SaxonApiException e ) { LOGGER . error ( "Saxon Exception: " + e . getMessage ( ) , e ) ; throw e ; } return selector ; |
public class JumboCyclicVertexSearch { /** * { @ inheritDoc } */
@ Override public int [ ] [ ] fused ( ) { } } | List < int [ ] > fused = new ArrayList < int [ ] > ( cycles . size ( ) ) ; for ( int i = 0 ; i < cycles . size ( ) ; i ++ ) { if ( this . fused . get ( i ) ) fused . add ( toArray ( cycles . get ( i ) ) ) ; } return fused . toArray ( new int [ fused . size ( ) ] [ ] ) ; |
public class AddOn { /** * Tells whether or not the given file name matches the name of a ZAP add - on .
* The file name must have the format " { @ code < id > - < status > - < version > . zap } " . The { @ code id } is a string , the { @ code status }
* must be a value from { @ link Status } and the { @ code version } must be an integer .
* @ param fileName the name of the file to check
* @ return { @ code true } if the given file name is the name of an add - on , { @ code false } otherwise .
* @ deprecated ( 2.6.0 ) Use { @ link # isAddOnFileName ( String ) } instead , the checks done in this method are more
* strict than it needs to .
* @ see # isAddOnFileName ( String ) */
@ Deprecated public static boolean isAddOn ( String fileName ) { } } | if ( ! isAddOnFileName ( fileName ) ) { return false ; } if ( fileName . substring ( 0 , fileName . indexOf ( "." ) ) . split ( "-" ) . length < 3 ) { return false ; } String [ ] strArray = fileName . substring ( 0 , fileName . indexOf ( "." ) ) . split ( "-" ) ; try { Status . valueOf ( strArray [ 1 ] ) ; Integer . parseInt ( strArray [ 2 ] ) ; } catch ( Exception e ) { return false ; } return true ; |
public class CommercePriceEntryPersistenceImpl { /** * Returns the commerce price entries before and after the current commerce price entry in the ordered set where uuid = & # 63 ; .
* @ param commercePriceEntryId the primary key of the current commerce price entry
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next commerce price entry
* @ throws NoSuchPriceEntryException if a commerce price entry with the primary key could not be found */
@ Override public CommercePriceEntry [ ] findByUuid_PrevAndNext ( long commercePriceEntryId , String uuid , OrderByComparator < CommercePriceEntry > orderByComparator ) throws NoSuchPriceEntryException { } } | CommercePriceEntry commercePriceEntry = findByPrimaryKey ( commercePriceEntryId ) ; Session session = null ; try { session = openSession ( ) ; CommercePriceEntry [ ] array = new CommercePriceEntryImpl [ 3 ] ; array [ 0 ] = getByUuid_PrevAndNext ( session , commercePriceEntry , uuid , orderByComparator , true ) ; array [ 1 ] = commercePriceEntry ; array [ 2 ] = getByUuid_PrevAndNext ( session , commercePriceEntry , uuid , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; } |
public class ConnectionImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . MPCoreConnection # setWaitTimeInMessage ( boolean ) */
@ Override public void setSetWaitTimeInMessage ( boolean setWaitTime ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setSetWaitTimeInMessage" , Boolean . valueOf ( setWaitTime ) ) ; _setWaitTimeInMessage = setWaitTime ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setSetWaitTimeInMessage" ) ; |
public class PropertiesUtils { /** * Set pipe device properties in db
* @ param deviceName
* @ param pipeName
* @ param properties
* @ throws DevFailed */
public static void setDevicePipePropertiesInDB ( final String deviceName , final String pipeName , final Map < String , String [ ] > properties ) throws DevFailed { } } | LOGGER . debug ( "update pipe {} device properties {} in DB " , pipeName , properties . keySet ( ) ) ; DatabaseFactory . getDatabase ( ) . setDevicePipeProperties ( deviceName , pipeName , properties ) ; |
public class SimulatorProtocolImpl { /** * sends the message to the AUT . */
protected void sendMessage ( String xml ) { } } | byte [ ] bytes = null ; try { bytes = xml . getBytes ( "UTF-8" ) ; writeBytes ( bytes ) ; } catch ( SocketException se ) { // when we get a socket exception , let ' s try to re - establish
stop ( ) ; start ( ) ; try { writeBytes ( bytes ) ; } catch ( IOException e ) { throw new WebDriverException ( e ) ; } } catch ( IOException e ) { throw new WebDriverException ( e ) ; } |
public class MatcherApplicationStrategy { /** * Applies the given { @ link ArgumentMatcherAction } to all arguments and
* corresponding matchers
* @ param action
* must not be < code > null < / code >
* @ return
* < ul >
* < li > < code > true < / code > if the given < b > action < / b > returned
* < code > true < / code > for all arguments and matchers passed to it .
* < li > < code > false < / code > if the given < b > action < / b > returned
* < code > false < / code > for one of the passed arguments and matchers
* < li > < code > false < / code > if the given matchers don ' t fit to the given invocation
* because too many or to few matchers are available .
* < / ul > */
public boolean forEachMatcherAndArgument ( ArgumentMatcherAction action ) { } } | if ( matchingType == ERROR_UNSUPPORTED_NUMBER_OF_MATCHERS ) return false ; Object [ ] arguments = invocation . getArguments ( ) ; for ( int i = 0 ; i < arguments . length ; i ++ ) { ArgumentMatcher < ? > matcher = matchers . get ( i ) ; Object argument = arguments [ i ] ; if ( ! action . apply ( matcher , argument ) ) { return false ; } } return true ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getFontDescriptorSpecification ( ) { } } | if ( fontDescriptorSpecificationEClass == null ) { fontDescriptorSpecificationEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 378 ) ; } return fontDescriptorSpecificationEClass ; |
public class TaskEntity { /** * Tracks a property change . Therefore the original and new value are stored in a map .
* It tracks multiple changes and if a property finally is changed back to the original
* value , then the change is removed .
* @ param propertyName
* @ param orgValue
* @ param newValue */
protected void propertyChanged ( String propertyName , Object orgValue , Object newValue ) { } } | if ( propertyChanges . containsKey ( propertyName ) ) { // update an existing change to save the original value
Object oldOrgValue = propertyChanges . get ( propertyName ) . getOrgValue ( ) ; if ( ( oldOrgValue == null && newValue == null ) // change back to null
|| ( oldOrgValue != null && oldOrgValue . equals ( newValue ) ) ) { // remove this change
propertyChanges . remove ( propertyName ) ; } else { propertyChanges . get ( propertyName ) . setNewValue ( newValue ) ; } } else { // save this change
if ( ( orgValue == null && newValue != null ) // null to value
|| ( orgValue != null && newValue == null ) // value to null
|| ( orgValue != null && ! orgValue . equals ( newValue ) ) ) // value change
propertyChanges . put ( propertyName , new PropertyChange ( propertyName , orgValue , newValue ) ) ; } |
public class JMMap { /** * New changed key map map .
* @ param < K > the type parameter
* @ param < V > the type parameter
* @ param < NK > the type parameter
* @ param map the map
* @ param changingKeyFunction the changing key function
* @ return the map */
public static < K , V , NK > Map < NK , V > newChangedKeyMap ( Map < K , V > map , Function < K , NK > changingKeyFunction ) { } } | return buildEntryStream ( map ) . collect ( toMap ( entry -> changingKeyFunction . apply ( entry . getKey ( ) ) , Entry :: getValue ) ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Boolean } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "includeAllowableActions" , scope = GetAllVersions . class ) public JAXBElement < Boolean > createGetAllVersionsIncludeAllowableActions ( Boolean value ) { } } | return new JAXBElement < Boolean > ( _GetObjectOfLatestVersionIncludeAllowableActions_QNAME , Boolean . class , GetAllVersions . class , value ) ; |
public class Moneys { /** * Determine if an instance of { @ code Money } is valid .
* @ param value an instance of { @ code Money }
* @ throws java . lang . IllegalArgumentException if money is invalid */
public static void checkValid ( Money value ) { } } | String currencyCode = value . getCurrencyCode ( ) ; if ( currencyCode == null || currencyCode . length ( ) != 3 ) { throw new IllegalArgumentException ( MSG_3_LETTERS_LONG ) ; } long units = value . getUnits ( ) ; int nanos = value . getNanos ( ) ; if ( ( units > 0 && nanos < 0 ) || ( units < 0 && nanos > 0 ) ) { throw new IllegalArgumentException ( MSG_UNITS_NANOS_MISMATCH ) ; } if ( Math . abs ( nanos ) > MAX_NANOS ) { throw new IllegalArgumentException ( MSG_NANOS_OOB ) ; } |
public class TransformerRegistry { /** * Get the sub registry for the servers .
* @ param range the version range
* @ return the sub registry */
public TransformersSubRegistration getServerRegistration ( final ModelVersionRange range ) { } } | final PathAddress address = PathAddress . EMPTY_ADDRESS . append ( HOST , SERVER ) ; return new TransformersSubRegistrationImpl ( range , domain , address ) ; |
public class Swagger2MarkupConfigBuilder { /** * Set the page break locations
* @ param locations List of locations to create new pages
* @ return this builder */
public Swagger2MarkupConfigBuilder withPageBreaks ( List < PageBreakLocations > locations ) { } } | Validate . notNull ( locations , "%s must not be null" , "locations" ) ; config . pageBreakLocations = locations ; return this ; |
public class BeanRepository { /** * Returns a new created Object with the given { @ code creator } . This equates to a { @ code prototype } Bean . It is
* not required to configure a { @ code prototype } Bean in the BeanRepository before . This Method can be used
* to pass Parameters to the Constructor of an Object . Use this Method if the { @ code prototype } Bean has
* < b > no < / b > Dependencies to other Beans . The Method { @ link PostConstructible # onPostConstruct ( BeanRepository ) }
* is executed for every Call of this Method .
* @ param creator The Code to create the new Object
* @ param < T > The Type of the Bean
* @ see BeanAccessor
* @ see PostConstructible
* @ return a new created Object */
public < T > T getPrototypeBean ( final Supplier < T > creator ) { } } | final PrototypeProvider provider = new PrototypeProvider ( name , repository -> creator . get ( ) ) ; return provider . getBean ( this , dryRun ) ; |
public class GSPCOLImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . GSPCOL__RES1 : setRES1 ( RES1_EDEFAULT ) ; return ; case AfplibPackage . GSPCOL__COLSPCE : setCOLSPCE ( COLSPCE_EDEFAULT ) ; return ; case AfplibPackage . GSPCOL__RES2 : setRES2 ( RES2_EDEFAULT ) ; return ; case AfplibPackage . GSPCOL__COLSIZE1 : setCOLSIZE1 ( COLSIZE1_EDEFAULT ) ; return ; case AfplibPackage . GSPCOL__COLSIZE2 : setCOLSIZE2 ( COLSIZE2_EDEFAULT ) ; return ; case AfplibPackage . GSPCOL__COLSIZE3 : setCOLSIZE3 ( COLSIZE3_EDEFAULT ) ; return ; case AfplibPackage . GSPCOL__COLSIZE4 : setCOLSIZE4 ( COLSIZE4_EDEFAULT ) ; return ; case AfplibPackage . GSPCOL__COLVALUE : setCOLVALUE ( COLVALUE_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class VectorVectorMult_DDRM { /** * Adds to A & isin ; & real ; < sup > m & times ; n < / sup > the results of an outer product multiplication
* of the two vectors . This is also known as a rank 1 update . < br >
* < br >
* A = A + & gamma ; x * y < sup > T < / sup >
* where x & isin ; & real ; < sup > m < / sup > and y & isin ; & real ; < sup > n < / sup > are vectors .
* Which is equivalent to : A < sub > ij < / sub > = A < sub > ij < / sub > + & gamma ; x < sub > i < / sub > * y < sub > j < / sub >
* These functions are often used inside of highly optimized code and therefor sanity checks are
* kept to a minimum . It is not recommended that any of these functions be used directly .
* @ param gamma A multiplication factor for the outer product .
* @ param x A vector with m elements . Not modified .
* @ param y A vector with n elements . Not modified .
* @ param A A Matrix with m by n elements . Modified . */
public static void addOuterProd ( double gamma , DMatrixD1 x , DMatrixD1 y , DMatrix1Row A ) { } } | int m = A . numRows ; int n = A . numCols ; int index = 0 ; if ( gamma == 1.0 ) { for ( int i = 0 ; i < m ; i ++ ) { double xdat = x . get ( i ) ; for ( int j = 0 ; j < n ; j ++ ) { A . plus ( index ++ , xdat * y . get ( j ) ) ; } } } else { for ( int i = 0 ; i < m ; i ++ ) { double xdat = x . get ( i ) ; for ( int j = 0 ; j < n ; j ++ ) { A . plus ( index ++ , gamma * xdat * y . get ( j ) ) ; } } } |
public class XMonitoredInputStream { /** * / * ( non - Javadoc )
* @ see java . io . InputStream # read ( byte [ ] ) */
@ Override public int read ( byte [ ] b ) throws IOException { } } | int result = stream . read ( b ) ; update ( result ) ; return result ; |
public class WrapperManager { /** * F86406 */
public void introspect ( IntrospectionWriter writer ) { } } | writer . begin ( "WrapperManager" ) ; beanIdCache . introspect ( writer ) ; ( ( Cache ) wrapperCache ) . introspect ( writer ) ; writer . end ( ) ; |
public class CacheListUtil { /** * 指定获取范围 ( 返回的类型是raw string , 所以不推荐使用 ) */
@ SuppressWarnings ( "all" ) public static Single < List < String > > getRange ( CacheConfigBean cacheConfigBean , String cacheKey , int startIndex , int endIndex ) { } } | return SingleRxXian . call ( CacheService . CACHE_SERVICE , "cacheListRange" , new JSONObject ( ) { { put ( "cacheConfig" , cacheConfigBean ) ; put ( "key" , cacheKey ) ; put ( "startIndex" , startIndex ) ; put ( "endIndex" , endIndex ) ; } } ) . map ( unitResponse -> { if ( unitResponse . getData ( ) != null ) return unitResponse . dataToTypedList ( String . class ) ; else return null ; } ) ; |
public class PolicyIndexInvocationHandler { /** * { @ inheritDoc } */
@ Override public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { } } | // get the method parameters and " type "
ManagementMethodInvocation managementMethod = new ManagementMethodInvocation ( method , args ) ; // if it ' s not a method that requires policy cache modifications , quit
if ( managementMethod . action . equals ( ManagementMethodInvocation . Action . NA ) ) return invokeTarget ( target , method , args ) ; Object returnValue = null ; // holds the state of the Fedora policy object before and after the API method is invoked
PolicyObject policyBefore = null ; PolicyObject policyAfter = null ; // validation note :
// validation is carried out as part of the API methods
// policy index update occurs after the management method has been invoked
// therefore if a validation error occurs the object will not have changed ,
// and the resulting exception means the policy index won ' t be updated ( and therefore remain in sync )
switch ( managementMethod . target ) { case DIGITALOBJECT : // API methods operating on the object
switch ( managementMethod . component ) { case STATE : // object state change
// if the requested object state is null , then there ' s no state change - no change to policy index
if ( managementMethod . parameters . objectState != null && managementMethod . parameters . objectState . length ( ) > 0 ) { // get the " before " object and determine if it was indexed in the cache
policyBefore = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , null , null , null ) ; boolean indexedBefore = policyBefore . isPolicyActive ( ) ; returnValue = invokeTarget ( target , method , args ) ; // get the object after the state change and determine if it should be indexed
policyAfter = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , managementMethod . parameters . objectState , null , null ) ; // if the indexing status has changed , make appropriate changes to the policy cache / index
if ( indexedBefore != policyAfter . isPolicyActive ( ) ) { if ( policyAfter . isPolicyActive ( ) ) { addPolicy ( managementMethod . parameters . pid , policyAfter . getDsContent ( ) ) ; } else { deletePolicy ( managementMethod . parameters . pid ) ; } } } break ; case CONTENT : // object ingest or purge
switch ( managementMethod . action ) { case CREATE : // ingest
// do the API call
returnValue = invokeTarget ( target , method , args ) ; // get the ingested policy - note ingested object PID is the return value
policyAfter = new PolicyObject ( m_DOManager , managementMethod . parameters . context , ( String ) returnValue , null , null , null ) ; // add to the cache if required
if ( policyAfter . isPolicyActive ( ) ) { addPolicy ( ( String ) returnValue , policyAfter . getDsContent ( ) ) ; } break ; case DELETE : // purge
// get the policy object that existed prior to ingest and see if it was indexed
policyBefore = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , null , null , null ) ; boolean wasIndexed = policyBefore . isPolicyActive ( ) ; // do the API call
returnValue = invokeTarget ( target , method , args ) ; // if the policy was indexed , delete it from the cache / index
if ( wasIndexed ) deletePolicy ( managementMethod . parameters . pid ) ; break ; default : } break ; default : } break ; case DATASTREAM : // operations on datastreams
// note , DS ID can be null - server - assigned ID
if ( managementMethod . parameters . dsID != null && managementMethod . parameters . dsID . equals ( FedoraPolicyStore . FESL_POLICY_DATASTREAM ) ) { switch ( managementMethod . component ) { case STATE : // datastream state change
// get the object prior to the API call and see if it was indexed / cached
policyBefore = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , null , managementMethod . parameters . dsID , null ) ; boolean wasIndexed = policyBefore . isPolicyActive ( ) ; // do the API call
returnValue = invokeTarget ( target , method , args ) ; // the object after the call
policyAfter = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , null , managementMethod . parameters . dsID , managementMethod . parameters . dsState ) ; // if indexing status has changed , update the cache / index
if ( wasIndexed != policyAfter . isPolicyActive ( ) ) { if ( policyAfter . isPolicyActive ( ) ) { addPolicy ( managementMethod . parameters . pid , policyAfter . getDsContent ( ) ) ; } else { deletePolicy ( managementMethod . parameters . pid ) ; } } break ; case CONTENT : // datastream add , modify , purge
switch ( managementMethod . action ) { case CREATE : // do the API call
returnValue = invokeTarget ( target , method , args ) ; // get the policy object after the method call
policyAfter = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , null , managementMethod . parameters . dsID , managementMethod . parameters . dsState ) ; if ( policyAfter . isPolicyActive ( ) ) addPolicy ( managementMethod . parameters . pid , policyAfter . getDsContent ( ) ) ; break ; case DELETE : // get the policy object before the call and see if it was indexed
policyBefore = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , null , managementMethod . parameters . dsID , managementMethod . parameters . dsState ) ; wasIndexed = policyBefore . isPolicyActive ( ) ; // invoke the method
returnValue = invokeTarget ( target , method , args ) ; policyAfter = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , null , managementMethod . parameters . dsID , null ) ; if ( wasIndexed ) { // if policy is still active after , only a version was purged and the policy has changed . Update
if ( policyAfter . isPolicyActive ( ) ) { updatePolicy ( managementMethod . parameters . pid , policyAfter . getDsContent ( ) ) ; // policy is not active after , then it was deleted and needs to be removed from index .
} else { deletePolicy ( managementMethod . parameters . pid ) ; } } break ; case UPDATE : // do the API call , get the policy object after the call
returnValue = invokeTarget ( target , method , args ) ; policyAfter = new PolicyObject ( m_DOManager , managementMethod . parameters . context , managementMethod . parameters . pid , null , managementMethod . parameters . dsID , null ) ; if ( policyAfter . isPolicyActive ( ) ) updatePolicy ( managementMethod . parameters . pid , policyAfter . getDsContent ( ) ) ; break ; default : } break ; default : } } break ; default : } // if API call not made as part of the above ( ie no action was required on policy cache ) , do it now
if ( returnValue == null ) returnValue = invokeTarget ( target , method , args ) ; return returnValue ; |
public class SimpleDateFormat { /** * Private method lazily instantiate the TimeZoneFormat field
* @ param bForceUpdate when true , check if tzFormat is synchronized with
* the current numberFormat and update its digits if necessary . When false ,
* this check is skipped . */
private synchronized void initializeTimeZoneFormat ( boolean bForceUpdate ) { } } | if ( bForceUpdate || tzFormat == null ) { tzFormat = TimeZoneFormat . getInstance ( locale ) ; String digits = null ; if ( numberFormat instanceof DecimalFormat ) { DecimalFormatSymbols decsym = ( ( DecimalFormat ) numberFormat ) . getDecimalFormatSymbols ( ) ; digits = new String ( decsym . getDigits ( ) ) ; } else if ( numberFormat instanceof DateNumberFormat ) { digits = new String ( ( ( DateNumberFormat ) numberFormat ) . getDigits ( ) ) ; } if ( digits != null ) { if ( ! tzFormat . getGMTOffsetDigits ( ) . equals ( digits ) ) { if ( tzFormat . isFrozen ( ) ) { tzFormat = tzFormat . cloneAsThawed ( ) ; } tzFormat . setGMTOffsetDigits ( digits ) ; } } } |
public class ManagerConfiguration { /** * Sets the callback property .
* @ param callback callback object
* @ param property name of the property
* @ param value value of the property */
private void setProperty ( Callback callback , String property , String value ) { } } | try { if ( value != null ) { SimonBeanUtils . getInstance ( ) . setProperty ( callback , property , value ) ; } else { callback . getClass ( ) . getMethod ( setterName ( property ) ) . invoke ( callback ) ; } } catch ( NoSuchMethodException | InvocationTargetException | IllegalAccessException e ) { throw new SimonException ( e ) ; } |
public class Transformers { /** * Transform .
* @ param from the from
* @ return the ticket */
@ Transformer ( from = "{urn:switchyard-quickstart-demo:helpdesk:1.0}openTicket" ) public Ticket transform ( Element from ) { } } | Ticket ticket = new Ticket ( ) ; ticket . setId ( getElementValue ( from , "id" ) ) ; return ticket ; |
public class ZonedDateTime { /** * Returns a copy of this date - time with the specified amount added .
* This returns a { @ code ZonedDateTime } , based on this one , with the amount
* in terms of the unit added . If it is not possible to add the amount , because the
* unit is not supported or for some other reason , an exception is thrown .
* If the field is a { @ link ChronoUnit } then the addition is implemented here .
* The zone is not part of the calculation and will be unchanged in the result .
* The calculation for date and time units differ .
* Date units operate on the local time - line .
* The period is first added to the local date - time , then converted back
* to a zoned date - time using the zone ID .
* The conversion uses { @ link # ofLocal ( LocalDateTime , ZoneId , ZoneOffset ) }
* with the offset before the addition .
* Time units operate on the instant time - line .
* The period is first added to the local date - time , then converted back to
* a zoned date - time using the zone ID .
* The conversion uses { @ link # ofInstant ( LocalDateTime , ZoneOffset , ZoneId ) }
* with the offset before the addition .
* If the field is not a { @ code ChronoUnit } , then the result of this method
* is obtained by invoking { @ code TemporalUnit . addTo ( Temporal , long ) }
* passing { @ code this } as the argument . In this case , the unit determines
* whether and how to perform the addition .
* This instance is immutable and unaffected by this method call .
* @ param amountToAdd the amount of the unit to add to the result , may be negative
* @ param unit the unit of the amount to add , not null
* @ return a { @ code ZonedDateTime } based on this date - time with the specified amount added , not null
* @ throws DateTimeException if the addition cannot be made
* @ throws UnsupportedTemporalTypeException if the unit is not supported
* @ throws ArithmeticException if numeric overflow occurs */
@ Override public ZonedDateTime plus ( long amountToAdd , TemporalUnit unit ) { } } | if ( unit instanceof ChronoUnit ) { if ( unit . isDateBased ( ) ) { return resolveLocal ( dateTime . plus ( amountToAdd , unit ) ) ; } else { return resolveInstant ( dateTime . plus ( amountToAdd , unit ) ) ; } } return unit . addTo ( this , amountToAdd ) ; |
public class CreateFileContext { /** * Merges and embeds the given { @ link CreateFilePOptions } with the corresponding master options .
* @ param optionsBuilder Builder for proto { @ link CreateFilePOptions } to embed
* @ return the instance of { @ link CreateFileContext } with default values for master */
public static CreateFileContext mergeFrom ( CreateFilePOptions . Builder optionsBuilder ) { } } | CreateFilePOptions masterOptions = FileSystemOptions . createFileDefaults ( ServerConfiguration . global ( ) ) ; CreateFilePOptions . Builder mergedOptionsBuilder = masterOptions . toBuilder ( ) . mergeFrom ( optionsBuilder . build ( ) ) ; return new CreateFileContext ( mergedOptionsBuilder ) ; |
public class VerifierFactory { /** * parses a schema at the specified location and returns a Verifier object
* that validates documents by using that schema .
* Some of XML parsers accepts filenames as well as URLs , while others
* reject them . Therefore , to parse a file as a schema , you should use
* a File object .
* @ param uri URI of a schema file */
public Verifier newVerifier ( String uri ) throws VerifierConfigurationException , SAXException , IOException { } } | return compileSchema ( uri ) . newVerifier ( ) ; |
public class ExceptionFactory { /** * Creates an exception from an plan name .
* @ param planName the plan name
* @ param version the version
* @ return the exception */
public static final PlanVersionAlreadyExistsException planVersionAlreadyExistsException ( String planName , String version ) { } } | return new PlanVersionAlreadyExistsException ( Messages . i18n . format ( "PlanVersionAlreadyExists" , planName , version ) ) ; // $ NON - NLS - 1 $ |
public class Quaternion { /** * Returns true if the L - infinite distance between this tuple
* and tuple t1 is less than or equal to the epsilon parameter ,
* otherwise returns false . The L - infinite
* distance is equal to MAX [ abs ( x1 - x2 ) , abs ( y1 - y2 ) ] .
* @ param t1 the tuple to be compared to this tuple
* @ param epsilon the threshold value
* @ return true or false */
@ Pure public boolean epsilonEquals ( Quaternion t1 , double epsilon ) { } } | double diff ; diff = this . x - t1 . getX ( ) ; if ( Double . isNaN ( diff ) ) return false ; if ( ( diff < 0 ? - diff : diff ) > epsilon ) return false ; diff = this . y - t1 . getY ( ) ; if ( Double . isNaN ( diff ) ) return false ; if ( ( diff < 0 ? - diff : diff ) > epsilon ) return false ; diff = this . z - t1 . getZ ( ) ; if ( Double . isNaN ( diff ) ) return false ; if ( ( diff < 0 ? - diff : diff ) > epsilon ) return false ; diff = this . w - t1 . getW ( ) ; if ( Double . isNaN ( diff ) ) return false ; if ( ( diff < 0 ? - diff : diff ) > epsilon ) return false ; return true ; |
public class EntityUtils { /** * 清除实体类中引用的无效 ( 外键 ) 属性 . < br >
* < pre >
* hibernate在保存对象是检查对象是否引用了未持久化的对象 , 如果引用则保存出错 .
* 实体类 ( Entity ) 是否已经持久化通过检查其id是否为有效值来判断的 .
* 对于实体类中包含的
* & lt ; code & gt ;
* Component
* & lt ; / code & gt ;
* 则递归处理
* 因为集合为空仍有其含义 , 这里对集合不做随意处理 . 如
* / / evict collection
* if ( value instanceof Collection ) {
* if ( ( ( Collection ) value ) . isEmpty ( ) )
* map . put ( attr , null ) ;
* < / pre >
* @ see ValidEntityPredicate
* @ param entity */
public static void evictEmptyProperty ( Object entity ) { } } | if ( null == entity ) { return ; } boolean isEntity = false ; if ( entity instanceof Entity ) { isEntity = true ; } BeanMap map = new BeanMap ( entity ) ; List < String > attList = new ArrayList < String > ( ) ; for ( Object o : map . keySet ( ) ) { attList . add ( ( String ) o ) ; } attList . remove ( "class" ) ; for ( String attr : attList ) { if ( ! PropertyUtils . isWriteable ( entity , attr ) ) { continue ; } Object value = map . get ( attr ) ; if ( null == value ) { continue ; } else { // evict invalid entity key
if ( isEntity && attr . equals ( "id" ) ) { if ( ! ValidEntityKeyPredicate . Instance . apply ( value ) ) { map . put ( attr , null ) ; } } // evict invalid entity
if ( value instanceof Entity && ! ValidEntityPredicate . Instance . apply ( value ) ) { map . put ( attr , null ) ; } else if ( value instanceof Component ) { // evict component recursively
evictEmptyProperty ( value ) ; } } } |
public class ServiceDirectoryFuture { /** * Fail the Future .
* @ param ex
* the ServiceException of the Directory Request .
* @ return
* true for success . */
public synchronized boolean fail ( ServiceException ex ) { } } | if ( completed ) { return false ; } this . completed = true ; this . ex = ex ; notifyAll ( ) ; return true ; |
public class SqlTableSession { /** * / * ( non - Javadoc )
* @ see org . parosproxy . paros . db . paros . TableSession # insert ( long , java . lang . String ) */
@ Override public synchronized void insert ( long sessionId , String sessionName ) throws DatabaseException { } } | SqlPreparedStatementWrapper psInsert = null ; try { psInsert = DbSQL . getSingleton ( ) . getPreparedStatement ( "session.ps.insert" ) ; psInsert . getPs ( ) . setLong ( 1 , sessionId ) ; psInsert . getPs ( ) . setString ( 2 , sessionName ) ; psInsert . getPs ( ) . executeUpdate ( ) ; } catch ( SQLException e ) { throw new DatabaseException ( e ) ; } finally { DbSQL . getSingleton ( ) . releasePreparedStatement ( psInsert ) ; } |
public class AbstractJsonArray { /** * Removes a value from the receiver ' s collection
* @ param value the value to remove */
public void remove ( V value ) { } } | int index = values . indexOf ( value ) ; values . remove ( value ) ; if ( value instanceof JsonEntity ) { ( ( JsonEntity ) value ) . removePropertyChangeListener ( propListener ) ; } firePropertyChange ( "#" + index , value , null ) ; |
public class Generator { /** * Adds a section to the given media query section - creates if necessary */
private void addResultSection ( String mediaQueryPath , Section section ) { } } | Section qry = mediaQueries . get ( mediaQueryPath ) ; if ( qry == null ) { qry = new Section ( ) ; qry . getSelectors ( ) . add ( Collections . singletonList ( mediaQueryPath ) ) ; mediaQueries . put ( mediaQueryPath , qry ) ; } qry . addSubSection ( section ) ; |
public class PluginUtils { /** * Reads a plugin spec file and returns a { @ link PluginSpec } .
* @ param pluginSpec the plugin spec
* @ throws IOException when an unhandled exception occurs
* @ return plugin ' s specification */
public static PluginSpec readPluginSpecFile ( URL pluginSpec ) throws IOException { } } | return ( PluginSpec ) mapper . reader ( PluginSpec . class ) . readValue ( pluginSpec ) ; |
public class EditText { /** * Gets the number of times the marquee animation is repeated . Only meaningful if the
* TextView has marquee enabled .
* @ return the number of times the marquee animation is repeated . - 1 if the animation
* repeats indefinitely
* @ see # setMarqueeRepeatLimit ( int )
* @ attr ref android . R . styleable # TextView _ marqueeRepeatLimit */
@ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public int getMarqueeRepeatLimit ( ) { } } | if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) return mInputView . getMarqueeRepeatLimit ( ) ; return - 1 ; |
public class RDBMDistributedLayoutStore { /** * Replaces the layout Document stored on a fragment definition with a new version . This is
* called when a fragment owner updates their layout . */
private void updateCachedLayout ( Document layout , IUserProfile profile , FragmentDefinition fragment ) { } } | final Locale locale = profile . getLocaleManager ( ) . getLocales ( ) . get ( 0 ) ; // need to make a copy that we can fragmentize
layout = ( Document ) layout . cloneNode ( true ) ; // Fix later to handle multiple profiles
final Element root = layout . getDocumentElement ( ) ; final UserView userView = this . fragmentUtils . getUserView ( fragment , locale ) ; if ( userView == null ) { throw new IllegalStateException ( "No UserView found for fragment: " + fragment . getName ( ) ) ; } root . setAttribute ( Constants . ATT_ID , Constants . FRAGMENT_ID_USER_PREFIX + userView . getUserId ( ) + Constants . FRAGMENT_ID_LAYOUT_PREFIX + "1" ) ; try { this . fragmentActivator . clearChacheForOwner ( fragment . getOwnerId ( ) ) ; this . fragmentUtils . getUserView ( fragment , locale ) ; } catch ( final Exception e ) { logger . error ( "An exception occurred attempting to update a layout." , e ) ; } |
public class Curve25519 { /** * Generating private key . Source : https : / / cr . yp . to / ecdh . html
* @ param randomBytes random bytes ( 32 + bytes )
* @ return generated private key */
public static byte [ ] keyGenPrivate ( byte [ ] randomBytes ) throws NoSuchAlgorithmException , DigestException { } } | if ( randomBytes . length < 32 ) { throw new RuntimeException ( "Random bytes too small" ) ; } // Hashing Random Bytes instead of using random bytes directly
// Just in case as reference ed255519 implementation do same
MessageDigest digest = MessageDigest . getInstance ( "SHA-256" ) ; digest . digest ( randomBytes , 0 , randomBytes . length ) ; byte [ ] privateKey = digest . digest ( ) ; // Performing bit ' s flipping
privateKey [ 0 ] &= 248 ; privateKey [ 31 ] &= 127 ; privateKey [ 31 ] |= 64 ; return privateKey ; |
public class RecoveryInterceptor { /** * Finds a fallback method for the given context .
* @ param context The context
* @ return The fallback method if it is present */
public Optional < ? extends MethodExecutionHandle < ? , Object > > findFallbackMethod ( MethodInvocationContext < Object , Object > context ) { } } | Class < ? > declaringType = context . getDeclaringType ( ) ; Optional < ? extends MethodExecutionHandle < ? , Object > > result = beanContext . findExecutionHandle ( declaringType , Qualifiers . byStereotype ( Fallback . class ) , context . getMethodName ( ) , context . getArgumentTypes ( ) ) ; if ( ! result . isPresent ( ) ) { Set < Class > allInterfaces = ReflectionUtils . getAllInterfaces ( declaringType ) ; for ( Class i : allInterfaces ) { result = beanContext . findExecutionHandle ( i , Qualifiers . byStereotype ( Fallback . class ) , context . getMethodName ( ) , context . getArgumentTypes ( ) ) ; if ( result . isPresent ( ) ) { return result ; } } } return result ; |
public class SubscriptionMessageHandler { /** * Method to reset the Subscription message object and
* reinitialise it as a Reply proxy subscription message */
protected void resetReplySubscriptionMessage ( ) { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "resetReplySubscriptionMessage" ) ; // Reset the state
reset ( ) ; // Indicate that this is a create message
iSubscriptionMessage . setSubscriptionMessageType ( SubscriptionMessageType . REPLY ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "resetReplySubscriptionMessage" ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link CoordinateSystemRefType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link CoordinateSystemRefType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "coordinateSystemRef" ) public JAXBElement < CoordinateSystemRefType > createCoordinateSystemRef ( CoordinateSystemRefType value ) { } } | return new JAXBElement < CoordinateSystemRefType > ( _CoordinateSystemRef_QNAME , CoordinateSystemRefType . class , null , value ) ; |
public class BasicModelUtils { /** * Words nearest based on positive and negative words
* @ param positive the positive words
* @ param negative the negative words
* @ param top the top n words
* @ return the words nearest the mean of the words */
@ Override public Collection < String > wordsNearestSum ( Collection < String > positive , Collection < String > negative , int top ) { } } | INDArray words = Nd4j . create ( lookupTable . layerSize ( ) ) ; // Set < String > union = SetUtils . union ( new HashSet < > ( positive ) , new HashSet < > ( negative ) ) ;
for ( String s : positive ) words . addi ( lookupTable . vector ( s ) ) ; for ( String s : negative ) words . addi ( lookupTable . vector ( s ) . mul ( - 1 ) ) ; return wordsNearestSum ( words , top ) ; |
public class TripleDES { /** * encrypt a plain password
* @ param aPlainPass a password in plain text
* @ return an encrypted password
* @ throws Exception */
public static String encryptPassword ( @ NotNull final String aPlainPass ) throws Exception { } } | byte [ ] encBytes = encryptString ( aPlainPass . getBytes ( DEFAULT_CODEPAGE ) ) ; return Base64 . encodeBase64String ( encBytes ) ; |
public class WebElementAdapter { /** * { @ inheritDoc }
* < p > The method using the elements matched by findElements must implement a catch for
* StaleElementReferenceException , because if a AJAX reloads one of the elements , the
* exceptions is not solved by WebElementAdapter . */
@ Override public List < WebElement > findElements ( final By by ) { } } | return ( List < WebElement > ) ( new StaleExceptionResolver < List < WebElement > > ( ) { @ Override public List < WebElement > execute ( WebElement element ) { List < WebElement > elements = new ArrayList < WebElement > ( ) ; // create
// new
// list
// of
// WebElements
for ( WebElement webElement : element . findElements ( by ) ) { // encapsule the WebElements inside of a WebElementAdapter
elements . add ( new WebElementAdapter ( webElement , thisObject , by , false ) ) ; } // end for
return elements ; } // end execute
} ) . waitForElement ( ) ; |
public class MockResponse { /** * Throttles the request reader and response writer to sleep for the given period after each
* series of { @ code bytesPerPeriod } bytes are transferred . Use this to simulate network behavior . */
public MockResponse throttleBody ( long bytesPerPeriod , long period , TimeUnit unit ) { } } | this . throttleBytesPerPeriod = bytesPerPeriod ; this . throttlePeriodAmount = period ; this . throttlePeriodUnit = unit ; return this ; |
public class BaseServer { /** * Returns hostname of this server . The format of the host conforms
* to RFC 2732 , i . e . for a literal IPv6 address , this method will
* return the IPv6 address enclosed in square brackets ( ' [ ' and ' ] ' ) .
* @ return hostname */
public String getHost ( ) { } } | String host = Util . getLocalHostAddress ( ) ; try { URL u = new URL ( "http" , host , 80 , "/" ) ; return u . getHost ( ) ; } catch ( MalformedURLException e ) { return host ; } |
public class ExternalContextUtils { /** * Runs a method on an object and returns the result
* @ param obj the object to run the method on
* @ param methodName the name of the method
* @ return the results of the method run */
private static Object _runMethod ( Object obj , String methodName ) { } } | try { Method sessionIdMethod = obj . getClass ( ) . getMethod ( methodName ) ; return sessionIdMethod . invoke ( obj ) ; } catch ( Exception e ) { return null ; } |
public class AbstractDirectory { /** * Replaces all entries in this directory .
* @ param newEntries the new directory entries */
public void setEntries ( List < FatDirectoryEntry > newEntries ) { } } | if ( newEntries . size ( ) > capacity ) throw new IllegalArgumentException ( "too many entries" ) ; this . entries . clear ( ) ; this . entries . addAll ( newEntries ) ; |
public class State { /** * 获取最大的值
* @ return */
public Integer getLargestValueId ( ) { } } | if ( emits == null || emits . size ( ) == 0 ) return null ; return emits . iterator ( ) . next ( ) ; |
import java . util . * ; class GetMaxElement { /** * Extract the maximum value from a list .
* For instance :
* > > > get _ max _ element ( [ 1 , 2 , 3 ] )
* > > > get _ max _ element ( [ 5 , 3 , - 5 , 2 , - 3 , 3 , 9 , 0 , 123 , 1 , - 10 ] )
* 123
* : param input _ list : A list of numerical values
* : return : Returns the highest numerical value in the list */
public static int getMaxElement ( ArrayList < Integer > inputList ) { } } | int maxValue = inputList . get ( 0 ) ; for ( int value : inputList ) { if ( value > maxValue ) { maxValue = value ; } } return maxValue ; |
public class ManagementEnforcer { /** * hasNamedPolicy determines whether a named authorization rule exists .
* @ param ptype the policy type , can be " p " , " p2 " , " p3 " , . .
* @ param params the " p " policy rule .
* @ return whether the rule exists . */
public boolean hasNamedPolicy ( String ptype , String ... params ) { } } | return hasNamedPolicy ( ptype , Arrays . asList ( params ) ) ; |
public class Filters { /** * Convert a DimFilter to a Filter .
* @ param dimFilter dimFilter
* @ return converted filter , or null if input was null */
@ Nullable public static Filter toFilter ( @ Nullable DimFilter dimFilter ) { } } | return dimFilter == null ? null : dimFilter . toFilter ( ) ; |
public class VirtualNetworkGatewaysInner { /** * This operation retrieves a list of routes the virtual network gateway is advertising to the specified peer .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayName The name of the virtual network gateway .
* @ param peer The IP address of the peer
* @ 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 GatewayRouteListResultInner object if successful . */
public GatewayRouteListResultInner beginGetAdvertisedRoutes ( String resourceGroupName , String virtualNetworkGatewayName , String peer ) { } } | return beginGetAdvertisedRoutesWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName , peer ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ContentSpec { /** * Set the default publican . cfg configuration that should be used when building .
* @ param defaultPublicanCfg The name of the default publican . cfg to use when building . */
public void setDefaultPublicanCfg ( final String defaultPublicanCfg ) { } } | if ( defaultPublicanCfg == null && this . defaultPublicanCfg == null ) { return ; } else if ( defaultPublicanCfg == null ) { removeChild ( this . defaultPublicanCfg ) ; this . defaultPublicanCfg = null ; } else if ( this . defaultPublicanCfg == null ) { this . defaultPublicanCfg = new KeyValueNode < String > ( CommonConstants . CS_DEFAULT_PUBLICAN_CFG_TITLE , defaultPublicanCfg ) ; appendChild ( this . defaultPublicanCfg , false ) ; } else { this . defaultPublicanCfg . setValue ( defaultPublicanCfg ) ; } |
public class ScriptRunnerController { /** * Starts a Script . Will redirect the request to the jobs controller , showing the progress of the
* started { @ link ScriptJobExecution } . The Script ' s output will be written to the log of the
* { @ link ScriptJobExecution } . If the Script has an outputFile , the URL of that file will be
* written to the { @ link ScriptJobExecution # getResultUrl ( ) }
* @ param scriptName name of the Script to start
* @ param parameters parameter values for the script
* @ throws IOException if an input or output exception occurs when redirecting */
@ SuppressWarnings ( "squid:S3752" ) // backwards compatability : multiple methods required
@ RequestMapping ( method = { } } | RequestMethod . GET , RequestMethod . POST } , value = "/scripts/{name}/start" ) public void startScript ( @ PathVariable ( "name" ) String scriptName , @ RequestParam Map < String , Object > parameters , HttpServletResponse response ) throws IOException { String scriptJobExecutionHref = submitScript ( scriptName , parameters ) . getBody ( ) ; response . sendRedirect ( jobsController . createJobExecutionViewHref ( scriptJobExecutionHref , 1000 ) ) ; |
public class TimeBasedLinearMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TimeBasedLinear timeBasedLinear , ProtocolMarshaller protocolMarshaller ) { } } | if ( timeBasedLinear == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( timeBasedLinear . getLinearPercentage ( ) , LINEARPERCENTAGE_BINDING ) ; protocolMarshaller . marshall ( timeBasedLinear . getLinearInterval ( ) , LINEARINTERVAL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CmsExplorerTypeAccessFlushListener { /** * Flushes the cache for all registered access setting objects . < p > */
protected synchronized void doFlush ( ) { } } | Iterator < WeakReference < CmsExplorerTypeAccess > > iter = m_contents . iterator ( ) ; while ( iter . hasNext ( ) ) { WeakReference < CmsExplorerTypeAccess > ref = iter . next ( ) ; CmsExplorerTypeAccess access = ref . get ( ) ; if ( access == null ) { iter . remove ( ) ; } else { access . flushCache ( ) ; } } |
public class MediaDefault { /** * Get the resources prefix .
* @ return The resources prefix . */
private String getPrefix ( ) { } } | final String prefix ; if ( loader . isPresent ( ) ) { prefix = loader . get ( ) . getPackage ( ) . getName ( ) . replace ( Constant . DOT , File . separator ) ; } else { prefix = resourcesDir ; } return prefix ; |
public class JSRepeated { /** * Convert to printable form ( subroutine of toString ) */
public void format ( StringBuffer fmt , Set done , Set todo , int indent ) { } } | formatName ( fmt , indent ) ; fmt . append ( "*(\n" ) ; itemType . format ( fmt , done , todo , indent + 2 ) ; fmt . append ( "\n" ) ; indent ( fmt , indent ) ; fmt . append ( ")*" ) ; |
public class IOSCollator { /** * Sets decomposition field , but is otherwise unused . */
@ Override public void setDecomposition ( int value ) { } } | if ( value < Collator . NO_DECOMPOSITION || value > Collator . FULL_DECOMPOSITION ) { throw new IllegalArgumentException ( ) ; } decomposition = value ; |
public class Fastpath { /** * Creates a FastpathArg with an oid parameter . This is here instead of a constructor of
* FastpathArg because the constructor can ' t tell the difference between an long that ' s really
* int8 and a long thats an oid .
* @ param oid input oid
* @ return FastpathArg with an oid parameter */
public static FastpathArg createOIDArg ( long oid ) { } } | if ( oid > Integer . MAX_VALUE ) { oid -= NUM_OIDS ; } return new FastpathArg ( ( int ) oid ) ; |
public class IfcPropertyEnumeratedValueImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcValue > getEnumerationValues ( ) { } } | return ( EList < IfcValue > ) eGet ( Ifc2x3tc1Package . Literals . IFC_PROPERTY_ENUMERATED_VALUE__ENUMERATION_VALUES , true ) ; |
public class AbstractQueueFactory { /** * Creates & Initializes a new queue instance .
* @ param spec
* @ return
* @ throws Exception */
protected T createAndInitQueue ( QueueSpec spec ) throws Exception { } } | T queue = createQueueInstance ( spec ) ; queue . setQueueName ( spec . name ) ; initQueue ( queue , spec ) ; return queue ; |
public class MessageProcessor { /** * Convert message parts which data part exceed the limit of characters ( { @ link MessageProcessor # maxPartSize } ) to content data . */
private void convertLargeParts ( ) { } } | List < Attachment > newAttachments = new ArrayList < > ( ) ; if ( ! publicParts . isEmpty ( ) ) { try { List < Part > toLarge = new ArrayList < > ( ) ; for ( Part p : publicParts ) { if ( p . getData ( ) != null && p . getData ( ) . length ( ) > maxPartSize ) { String type = p . getType ( ) != null ? p . getType ( ) : "application/octet-stream" ; newAttachments . add ( Attachment . create ( p . getData ( ) , type , Attachment . LOCAL_AUTO_CONVERTED_FOLDER , p . getName ( ) ) ) ; toLarge . add ( p ) ; log . w ( "Message part " + p . getName ( ) + " to large (" + p . getData ( ) . length ( ) + ">" + maxPartSize + ") - converting to attachment." ) ; } } if ( ! toLarge . isEmpty ( ) ) { publicParts . removeAll ( toLarge ) ; } } catch ( Exception e ) { log . f ( "Error when removing large message parts" , e ) ; } } attachments . addAll ( newAttachments ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.