signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class UpdateFunctionConfigurationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateFunctionConfigurationRequest updateFunctionConfigurationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateFunctionConfigurationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getFunctionName ( ) , FUNCTIONNAME_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getRole ( ) , ROLE_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getHandler ( ) , HANDLER_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getTimeout ( ) , TIMEOUT_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getMemorySize ( ) , MEMORYSIZE_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getVpcConfig ( ) , VPCCONFIG_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getEnvironment ( ) , ENVIRONMENT_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getRuntime ( ) , RUNTIME_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getDeadLetterConfig ( ) , DEADLETTERCONFIG_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getKMSKeyArn ( ) , KMSKEYARN_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getTracingConfig ( ) , TRACINGCONFIG_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getRevisionId ( ) , REVISIONID_BINDING ) ; protocolMarshaller . marshall ( updateFunctionConfigurationRequest . getLayers ( ) , LAYERS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CSSCombineMediaPostProcessor { /** * ( non - Javadoc ) * @ see net . jawr . web . resource . bundle . postprocess . * AbstractChainedResourceBundlePostProcessor * # doPostProcessBundle ( net . jawr . web . resource . bundle . postprocess * . BundleProcessingStatus , java . lang . StringBuffer ) */ @ Override protected StringBuffer doPostProcessBundle ( BundleProcessingStatus status , StringBuffer bundleData ) throws IOException { } }
LOGGER . info ( "Post processing file '" + status . getLastPathAdded ( ) + "'" ) ; String bundleMediaTypePropertyName = "jawr.css.bundle." + status . getCurrentBundle ( ) . getName ( ) + ".media" ; JawrConfig config = status . getJawrConfig ( ) ; String bundleMediaType = ( String ) config . getProperty ( bundleMediaTypePropertyName ) ; if ( bundleMediaType == null ) { LOGGER . warn ( "no bundle media type provided; use 'screen'" ) ; bundleMediaType = "screen" ; } LOGGER . info ( "bundle media type: " + bundleMediaType ) ; StringBuffer sb = new StringBuffer ( CSS_MEDIA_RULE + " " + bundleMediaType + " " + CSS_MEDIA_RULE_OPEN + StringUtils . STR_LINE_FEED ) ; sb . append ( bundleData ) ; sb . append ( CSS_MEDIA_RULE_CLOSE + StringUtils . STR_LINE_FEED + StringUtils . STR_LINE_FEED ) ; LOGGER . info ( "Postprocessing finished" ) ; return sb ;
public class PoolableObjects { /** * Queues the { @ code future } into the waiting list * @ param future the future who is waiting to borrow from this pool */ public void queue ( final PoolWaitFuture < PoolableObject < V > > future ) { } }
if ( future == null ) return ; waiting . add ( future ) ;
public class ClientImpl { /** * Synchronously invoke a procedure call blocking until a result is available . * @ param batchTimeout procedure invocation batch timeout . * @ param allPartition whether this is an all - partition invocation * @ param procName class name ( not qualified by package ) of the procedure to execute . * @ param clientTimeout timeout for the procedure * @ param unit TimeUnit of procedure timeout * @ param parameters vararg list of procedure ' s parameter values . * @ return ClientResponse for execution . * @ throws org . voltdb . client . ProcCallException * @ throws NoConnectionsException */ public ClientResponse callProcedureWithClientTimeout ( int batchTimeout , boolean allPartition , String procName , long clientTimeout , TimeUnit unit , Object ... parameters ) throws IOException , NoConnectionsException , ProcCallException { } }
long handle = m_handle . getAndIncrement ( ) ; ProcedureInvocation invocation = new ProcedureInvocation ( handle , batchTimeout , allPartition , procName , parameters ) ; long nanos = unit . toNanos ( clientTimeout ) ; return internalSyncCallProcedure ( nanos , invocation ) ;
public class GenerateServiceTicketAction { /** * Checks if { @ code gateway } is present in the request params . * @ param context the context * @ return true , if gateway present */ protected boolean isGatewayPresent ( final RequestContext context ) { } }
val requestParameterMap = context . getExternalContext ( ) . getRequestParameterMap ( ) ; return StringUtils . hasText ( requestParameterMap . get ( CasProtocolConstants . PARAMETER_GATEWAY ) ) ;
public class OCP_Sample { /** * tag OCP request - > HTTPMessage */ public static void httpComponentWithTry ( HttpPut request , String auth ) { } }
auth = auth + "password" ; try { // this will probably be tagged with // CSI _ CHAR _ SET _ ISSUES _ USE _ STANDARD _ CHARSET , if compiled under JDK 7 // or later request . addHeader ( "Authorization" , Base64 . encodeBase64String ( auth . getBytes ( "UTF-8" ) ) ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; }
public class I2CDeviceImpl { /** * This method writes several bytes to the i2c device from given buffer at given offset . * @ param data buffer of data to be written to the i2c device in one go * @ param offset offset in buffer * @ param size number of bytes to be written * @ throws IOException thrown in case byte cannot be written to the i2c device or i2c bus */ @ Override public void write ( final byte [ ] data , final int offset , final int size ) throws IOException { } }
getBus ( ) . writeBytesDirect ( this , size , offset , data ) ;
public class Simple16 { /** * Uncompress data from an array to another array . * Both inpos and outpos parameters are modified to indicate new positions * after read / write . * @ param in * array containing data in compressed form * @ param tmpinpos * where to start reading in the array * @ param inlength * length of the compressed data ( ignored by some schemes ) * @ param out * array where to write the compressed output * @ param currentPos * where to write the compressed output in out * @ param outlength * number of integers we want to decode */ public static void uncompress ( int [ ] in , int tmpinpos , int inlength , int [ ] out , int currentPos , int outlength ) { } }
final int finalpos = tmpinpos + inlength ; while ( tmpinpos < finalpos ) { final int howmany = decompressblock ( out , currentPos , in , tmpinpos , outlength ) ; outlength -= howmany ; currentPos += howmany ; tmpinpos += 1 ; }
public class AWSIotClient { /** * Gets the search configuration . * @ param getIndexingConfigurationRequest * @ return Result of the GetIndexingConfiguration operation returned by the service . * @ throws InvalidRequestException * The request is not valid . * @ throws ThrottlingException * The rate exceeds the limit . * @ throws UnauthorizedException * You are not authorized to perform this operation . * @ throws ServiceUnavailableException * The service is temporarily unavailable . * @ throws InternalFailureException * An unexpected error has occurred . * @ sample AWSIot . GetIndexingConfiguration */ @ Override public GetIndexingConfigurationResult getIndexingConfiguration ( GetIndexingConfigurationRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetIndexingConfiguration ( request ) ;
public class AbstractHCElement { /** * Note : return type cannot by IMicroElement since the checkbox object * delivers an IMicroNodeList ! */ @ Override @ Nonnull @ OverridingMethodsMustInvokeSuper protected IMicroNode internalConvertToMicroNode ( @ Nonnull final IHCConversionSettingsToNode aConversionSettings ) { } }
// Create the element final IMicroElement ret = createMicroElement ( aConversionSettings ) ; if ( ret == null ) throw new IllegalStateException ( "Created a null element!" ) ; // Set all HTML attributes etc . fillMicroElement ( ret , aConversionSettings ) ; // Optional callback after everything was done ( implementation dependent ) finishMicroElement ( ret , aConversionSettings ) ; return ret ;
public class Expressions { /** * Create a new Path expression * @ param type element type * @ param queryType element expression type * @ param metadata path metadata * @ param < E > element type * @ param < Q > element expression type * @ return path expression */ public static < E , Q extends SimpleExpression < ? super E > > ListPath < E , Q > listPath ( Class < E > type , Class < Q > queryType , PathMetadata metadata ) { } }
return new ListPath < E , Q > ( type , queryType , metadata ) ;
public class CommandLineJmxClient { /** * Run a script . This might go recursive if we run from within a script . */ private void runScript ( String alias , int levelC ) throws IOException { } }
String scriptFile = alias ; InputStream stream ; try { stream = getInputStream ( scriptFile ) ; if ( stream == null ) { System . out . println ( "Error. Script file is not found: " + scriptFile ) ; return ; } } catch ( IOException e ) { System . out . println ( "Error. Could not load script file " + scriptFile + ": " + e . getMessage ( ) ) ; return ; } final BufferedReader reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; try { doLines ( levelC + 1 , new LineReader ( ) { @ Override public String getNextLine ( String prompt ) throws IOException { return reader . readLine ( ) ; } } , true ) ; } finally { reader . close ( ) ; }
public class BplusTreeFile { /** * Create a LRU hashmap of size maxSize * @ param maxSize * @ return IntLinkedHashMap */ @ SuppressWarnings ( "rawtypes" ) private IntLinkedHashMap < Node > createCacheLRUlinked ( final int maxSize ) { } }
return new IntLinkedHashMap < Node > ( ( int ) ( maxSize * 1.5f ) , Node . class , true ) ;
public class SFTPRepositoryStrategy { /** * Ermittelt anhand der < code > SUBDIR _ POLICY < / code > das Unterverzeichnis , in dem das Item zu der übergebenen Id * gepeichert ist bzw . werden muss . * Das Verzeichnis wird angelegt , falls es nicht existiert . * @ param id * des Items * @ return Verzeichnis , in dem das Item gespeichert ist bzw . werden soll . */ private String subDirForId ( String id ) { } }
String path = objs + UNIX_PATH_SEPERATOR + id . substring ( 0 , SUBDIR_POLICY ) ; safeMkdir ( path ) ; return path ;
public class SipParser { /** * Expect the next byte to be a white space * @ param buffer */ public static int expectWS ( final Buffer buffer ) throws SipParseException { } }
int consumed = 0 ; try { if ( buffer . hasReadableBytes ( ) ) { final byte b = buffer . getByte ( buffer . getReaderIndex ( ) ) ; if ( b == SP || b == HTAB ) { // ok , it was a WS so consume the byte buffer . readByte ( ) ; ++ consumed ; } else { throw new SipParseException ( buffer . getReaderIndex ( ) , "Expected WS" ) ; } } else { throw new SipParseException ( buffer . getReaderIndex ( ) , "Expected WS but nothing more to read in the buffer" ) ; } } catch ( final IOException e ) { throw new SipParseException ( buffer . getReaderIndex ( ) , UNABLE_TO_READ_FROM_STREAM , e ) ; } return consumed ;
public class ChangeTagsForResourceRequest { /** * A complex type that contains a list of the tags that you want to add to the specified health check or hosted zone * and / or the tags that you want to edit < code > Value < / code > for . * You can add a maximum of 10 tags to a health check or a hosted zone . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setAddTags ( java . util . Collection ) } or { @ link # withAddTags ( java . util . Collection ) } if you want to override * the existing values . * @ param addTags * A complex type that contains a list of the tags that you want to add to the specified health check or * hosted zone and / or the tags that you want to edit < code > Value < / code > for . < / p > * You can add a maximum of 10 tags to a health check or a hosted zone . * @ return Returns a reference to this object so that method calls can be chained together . */ public ChangeTagsForResourceRequest withAddTags ( Tag ... addTags ) { } }
if ( this . addTags == null ) { setAddTags ( new com . amazonaws . internal . SdkInternalList < Tag > ( addTags . length ) ) ; } for ( Tag ele : addTags ) { this . addTags . add ( ele ) ; } return this ;
public class SearchResult { /** * The requested facet information . * @ param facets * The requested facet information . * @ return Returns a reference to this object so that method calls can be chained together . */ public SearchResult withFacets ( java . util . Map < String , BucketInfo > facets ) { } }
setFacets ( facets ) ; return this ;
public class InternalSubchannel { /** * Returns a READY transport that will be used to create new streams . * < p > Returns { @ code null } if the state is not READY . Will try to connect if state is IDLE . */ @ Nullable ClientTransport obtainActiveTransport ( ) { } }
ClientTransport savedTransport = activeTransport ; if ( savedTransport != null ) { return savedTransport ; } try { synchronized ( lock ) { savedTransport = activeTransport ; // Check again , since it could have changed before acquiring the lock if ( savedTransport != null ) { return savedTransport ; } if ( state . getState ( ) == IDLE ) { channelLogger . log ( ChannelLogLevel . INFO , "CONNECTING as requested" ) ; gotoNonErrorState ( CONNECTING ) ; startNewTransport ( ) ; } } } finally { syncContext . drain ( ) ; } return null ;
public class Utils { /** * in CBLMisc . m * BOOL CBLMayBeTransientError ( NSError * error ) */ public static boolean isTransientError ( Throwable throwable ) { } }
if ( throwable instanceof CouchbaseLiteException ) { CouchbaseLiteException e = ( CouchbaseLiteException ) throwable ; return isTransientError ( e . getCBLStatus ( ) . getCode ( ) ) ; } else if ( throwable instanceof RemoteRequestResponseException ) { RemoteRequestResponseException e = ( RemoteRequestResponseException ) throwable ; return isTransientError ( e . getCode ( ) ) ; } else if ( throwable instanceof java . net . SocketTimeoutException ) // connection and socket timeouts = > transient error return true ; else if ( throwable instanceof java . net . ConnectException ) return true ; else if ( throwable instanceof java . net . SocketException ) return true ; else if ( throwable instanceof IOException ) // NOTE : Exception is thrown from HttpClient . execute ( ) or InputStream . read ( ) // As InputStream . read ( ) thrown IOException , So IOException is considered // temporary issue . return true ; else return false ;
public class StandaloneAhcWSResponse { /** * Get all the HTTP headers of the response as a case - insensitive map */ @ Override public Map < String , List < String > > getHeaders ( ) { } }
final Map < String , List < String > > headerMap = new TreeMap < > ( String . CASE_INSENSITIVE_ORDER ) ; final HttpHeaders headers = ahcResponse . getHeaders ( ) ; for ( String name : headers . names ( ) ) { final List < String > values = headers . getAll ( name ) ; headerMap . put ( name , values ) ; } return headerMap ;
public class LogHelper { /** * Log error to a logging service ( if available ) , otherwise log to std error * @ param pBundleContext bundle context to lookup LogService * @ param pMessage message to log * @ param pThrowable an exception to log */ public static void logError ( BundleContext pBundleContext , String pMessage , Throwable pThrowable ) { } }
final ServiceReference lRef = pBundleContext . getServiceReference ( LogService . class . getName ( ) ) ; if ( lRef != null ) { try { final LogService logService = ( LogService ) pBundleContext . getService ( lRef ) ; if ( logService != null ) { logService . log ( LogService . LOG_ERROR , pMessage , pThrowable ) ; return ; } } finally { pBundleContext . ungetService ( lRef ) ; } } System . err . println ( "Jolokia-Error: " + pMessage + " : " + pThrowable . getMessage ( ) ) ;
public class LabelFMESVisitor { /** * Add leaf node label . */ private void addLeafLabel ( ) { } }
final int nodeKind = mRtx . getNode ( ) . getKind ( ) ; if ( ! mLeafLabels . containsKey ( nodeKind ) ) { mLeafLabels . put ( nodeKind , new ArrayList < ITreeData > ( ) ) ; } mLeafLabels . get ( nodeKind ) . add ( mRtx . getNode ( ) ) ;
public class FeatureTransaction { /** * Transform this object into a DTO feature transaction . * @ return feature transaction DTO */ public org . geomajas . layer . feature . FeatureTransaction toDto ( ) { } }
org . geomajas . layer . feature . FeatureTransaction dto = new org . geomajas . layer . feature . FeatureTransaction ( ) ; dto . setLayerId ( layer . getServerLayerId ( ) ) ; if ( oldFeatures != null ) { org . geomajas . layer . feature . Feature [ ] oldDto = new org . geomajas . layer . feature . Feature [ oldFeatures . length ] ; for ( int i = 0 ; i < oldFeatures . length ; i ++ ) { oldDto [ i ] = oldFeatures [ i ] . toDto ( ) ; } dto . setOldFeatures ( oldDto ) ; } if ( newFeatures != null ) { org . geomajas . layer . feature . Feature [ ] newDto = new org . geomajas . layer . feature . Feature [ newFeatures . length ] ; for ( int i = 0 ; i < newFeatures . length ; i ++ ) { newDto [ i ] = newFeatures [ i ] . toDto ( ) ; } dto . setNewFeatures ( newDto ) ; } return dto ;
public class RevocableLicense { /** * Check if the license is revoked or not . To get the revocation information * the method tries to issue a http connection ( GET ) to the url specified in * the license feature { @ code revocationUrl } . If the URL returns anything * with http status code { @ code 200 } then the license is not revoked . * The url string in the feature { @ code revocationUrl } may contain the place * holder < code > $ { licenseId } < / code > , which is replaced by the feature value * { @ code licenseId } . This feature makes it possible to setup a revocation * service and use a constant string in the different licenses . * The method can work in two different ways . One way is to ensure that the * license is not revoked and return { @ code true } only if it is sure that * the license is revoked or revocation information is not available . * The other way is to ensure that the license is revoked and return * { @ code false } if the license was not revoked or the revocation * information is not available . * The difference is whether to treat the license revoked when the * revocation service is not reachable . * @ param defaultRevocationState should be { @ code true } to treat the license revoked when the * revocation service is not reachable . Setting this argument * { @ code false } makes the revocation handling more polite : if * the license revocation service is not reachable then the * license is treated as not revoked . * @ return { @ code true } if the license is revoked and { @ code false } if the * license is not revoked . */ public boolean isRevoked ( final boolean defaultRevocationState ) { } }
var revoked = true ; try { final var url = getRevocationURL ( ) ; if ( url == null ) { return false ; } final var con = httpHandler . open ( url ) ; con . setUseCaches ( false ) ; if ( con instanceof HttpURLConnection ) { final var hCon = ( HttpURLConnection ) con ; hCon . connect ( ) ; return httpHandler . responseCode ( hCon ) != HttpURLConnection . HTTP_OK ; } return false ; } catch ( final IOException exception ) { revoked = defaultRevocationState ; } return revoked ;
public class CommerceRegionPersistenceImpl { /** * Returns all the commerce regions where commerceCountryId = & # 63 ; . * @ param commerceCountryId the commerce country ID * @ return the matching commerce regions */ @ Override public List < CommerceRegion > findByCommerceCountryId ( long commerceCountryId ) { } }
return findByCommerceCountryId ( commerceCountryId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ;
public class SolrTermVector { /** * Converts doc - level term vector information the Solr QueryResponse into a SolrTermVector . */ public static SolrTermVector newInstance ( String docId , HashingTF hashingTF , NamedList < Object > termList ) { } }
int termCount = termList . size ( ) ; int [ ] indices = new int [ termCount ] ; double [ ] weights = new double [ termCount ] ; String [ ] terms = new String [ termCount ] ; Iterator < Map . Entry < String , Object > > termsIter = termList . iterator ( ) ; int idx = - 1 ; while ( termsIter . hasNext ( ) ) { Map . Entry < String , Object > termEntry = termsIter . next ( ) ; double weight = 0d ; Object termVal = termEntry . getValue ( ) ; if ( termVal instanceof NamedList ) { Object w = ( ( NamedList ) termVal ) . get ( "tf-idf" ) ; if ( w != null ) { weight = ( w instanceof Number ) ? ( ( Number ) w ) . doubleValue ( ) : Double . parseDouble ( w . toString ( ) ) ; } } ++ idx ; String term = termEntry . getKey ( ) ; terms [ idx ] = term ; indices [ idx ] = hashingTF . indexOf ( term ) ; weights [ idx ] = weight ; } return new SolrTermVector ( docId , terms , hashingTF . numFeatures ( ) , indices , weights ) ;
public class StatsServlet { /** * Update tracking interval for a given metrics */ private void handleChangeMetricInterval ( final HttpServletRequest req , final Map < String , Object > ret ) throws ServletException { } }
try { final String metricName = getParam ( req , STATS_MAP_METRICNAMEPARAM ) ; final long newInterval = getLongParam ( req , STATS_MAP_REPORTINGINTERVAL ) ; if ( MetricReportManager . isAvailable ( ) ) { final MetricReportManager metricManager = MetricReportManager . getInstance ( ) ; final TimeBasedReportingMetric < ? > metric = ( TimeBasedReportingMetric < ? > ) metricManager . getMetricFromName ( metricName ) ; metric . updateInterval ( newInterval ) ; ret . put ( STATUS_PARAM , RESPONSE_SUCCESS ) ; } else { ret . put ( RESPONSE_ERROR , "MetricManager is not available" ) ; } } catch ( final Exception e ) { logger . error ( e ) ; ret . put ( RESPONSE_ERROR , e . getMessage ( ) ) ; }
public class BigDecimal { /** * Returns a { @ code BigDecimal } whose value is < tt > ( this & times ; * multiplicand ) < / tt > , and whose scale is { @ code ( this . scale ( ) + * multiplicand . scale ( ) ) } . * @ param multiplicand value to be multiplied by this { @ code BigDecimal } . * @ return { @ code this * multiplicand } */ public BigDecimal multiply ( BigDecimal multiplicand ) { } }
int productScale = checkScale ( ( long ) scale + multiplicand . scale ) ; if ( this . intCompact != INFLATED ) { if ( ( multiplicand . intCompact != INFLATED ) ) { return multiply ( this . intCompact , multiplicand . intCompact , productScale ) ; } else { return multiply ( this . intCompact , multiplicand . intVal , productScale ) ; } } else { if ( ( multiplicand . intCompact != INFLATED ) ) { return multiply ( multiplicand . intCompact , this . intVal , productScale ) ; } else { return multiply ( this . intVal , multiplicand . intVal , productScale ) ; } }
public class AbstractCache { /** * Returns directly the < code > Future < / code > associated with the key or null * if an entry does not exist . This method will not create a task for a * non - existent entry . This method is primarily used for testing . * @ param key * Key to use for the entity lookup . * @ return < code > Future < / code > for the named template or null if it is not * in the cache */ public Future < T > retrieve ( String key ) { } }
assert ( key != null ) ; return cache . get ( key ) ;
public class StateMachine { /** * Private method to set the state - not available to subclasses . < br > * Restricted to ensure mod never gets into an illegal state . * @ param toState state we are transitioning to . */ private void setState ( IState toState ) { } }
// We want to make sure state changes happen purely on the " home " thread , // for the sake of sanity and avoiding many obscure race - condition bugs . if ( Thread . currentThread ( ) == this . homeThread ) { // We are on the home thread , so safe to proceed : if ( this . state != toState ) { System . out . println ( getName ( ) + " enter state: " + toState ) ; TCPUtils . Log ( Level . INFO , "======== " + getName ( ) + " enter state: " + toState + " ========" ) ; this . state = toState ; onPreStateChange ( toState ) ; onStateChange ( ) ; } } else { // We are not on the home thread ; queue this state transition // so that the home thread can act on it . queueStateChange ( toState ) ; }
public class NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl { /** * Waits until the latch reaches to zero and then checks if the expected result * @ param latch The latch . * @ param expected The expected number . * @ param actual The actual number . * @ param amount The amount of time to wait . * @ param timeUnit The timeUnit . * @ return */ private static boolean checkConditionMetForAll ( CountDownLatch latch , int expected , AtomicInteger actual , long amount , TimeUnit timeUnit ) { } }
try { if ( latch . await ( amount , timeUnit ) ) { return actual . intValue ( ) == expected ; } return false ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; return false ; }
public class CausticUtil { /** * Checks if two OpenGL versioned object have compatible version . Throws an exception if that ' s not the case . A version is determined to be compatible with another is it ' s lower than the said * version . This isn ' t always true when deprecation is involved , but it ' s an acceptable way of doing this in most implementations . * @ param required The required version * @ param object The object to check the version of * @ throws IllegalStateException If the object versions are not compatible */ public static void checkVersion ( GLVersioned required , GLVersioned object ) { } }
if ( ! debug ) { return ; } final GLVersion requiredVersion = required . getGLVersion ( ) ; final GLVersion objectVersion = object . getGLVersion ( ) ; if ( objectVersion . getMajor ( ) > requiredVersion . getMajor ( ) && objectVersion . getMinor ( ) > requiredVersion . getMinor ( ) ) { throw new IllegalStateException ( "Versions not compatible: expected " + requiredVersion + " or lower, got " + objectVersion ) ; }
public class Stream { /** * Terminal operation returning an immutable SortedSet with all the elements of this Stream , * sorted using the supplied { @ code Comparator } . Use { @ link Ordering # natural ( ) } to sort * Comparable elements based on { @ link Comparable # compareTo ( Object ) } order . Call this method * only if there is enough memory to hold the resulting SortedSet . * @ param comparator * the { @ code Comparator } to sort elements , not null * @ return the resulting immutable SortedSet */ public final SortedSet < T > toSortedSet ( final Comparator < ? super T > comparator ) { } }
return ImmutableSortedSet . copyOf ( comparator , toCollection ( Lists . < T > newArrayListWithCapacity ( 256 ) ) ) ;
public class ServiceApiWrapper { /** * Get profile details from the service . * @ param token Comapi access token . * @ param profileId Profile Id of the user . * @ return Profile details from the service . */ Observable < ComapiResult < Map < String , Object > > > doGetProfile ( @ NonNull final String token , @ NonNull final String profileId ) { } }
return wrapObservable ( service . getProfile ( AuthManager . addAuthPrefix ( token ) , apiSpaceId , profileId ) . map ( mapToComapiResult ( ) ) , log , "Getting profile " + profileId ) ;
public class AsperaTransactionImpl { /** * Check if the status been passed through to check matches the * current status of the xferId within the transferListener * @ param status * @ return boolean */ private boolean doesStatusMatch ( String status ) { } }
return ( status . equals ( transferListener . getStatus ( xferid ) ) ? true : false ) ;
public class NodeWriteTrx { /** * Adapting the structure with a rolling hash for all ancestors only with * remove . * @ throws TTIOException * if anything weird happened */ private void rollingRemove ( ) throws TTException { } }
final ITreeData startNode = mDelegate . getCurrentNode ( ) ; long hashToRemove = startNode . getHash ( ) ; long hashToAdd = 0 ; long newHash = 0 ; // go the path to the root do { synchronized ( mDelegate . getCurrentNode ( ) ) { getPtx ( ) . getData ( mDelegate . getCurrentNode ( ) . getDataKey ( ) ) ; if ( mDelegate . getCurrentNode ( ) . getDataKey ( ) == startNode . getDataKey ( ) ) { // the begin node is always null newHash = 0 ; } else if ( mDelegate . getCurrentNode ( ) . getDataKey ( ) == startNode . getParentKey ( ) ) { // the parent node is just removed newHash = mDelegate . getCurrentNode ( ) . getHash ( ) - ( hashToRemove * PRIME ) ; hashToRemove = mDelegate . getCurrentNode ( ) . getHash ( ) ; } else { // the ancestors are all touched regarding the modification newHash = mDelegate . getCurrentNode ( ) . getHash ( ) - ( hashToRemove * PRIME ) ; newHash = newHash + hashToAdd * PRIME ; hashToRemove = mDelegate . getCurrentNode ( ) . getHash ( ) ; } mDelegate . getCurrentNode ( ) . setHash ( newHash ) ; hashToAdd = newHash ; getPtx ( ) . setData ( mDelegate . getCurrentNode ( ) ) ; } } while ( moveTo ( mDelegate . getCurrentNode ( ) . getParentKey ( ) ) ) ; mDelegate . setCurrentNode ( startNode ) ;
public class EquivalenceBasedProvenancedAlignment { /** * Any equivalence class is by definition aligned to itself if it is present on both the left * and the right . Otherwise , it has no alignment . */ private Collection < EqClassT > getAlignedTo ( final Object item ) { } }
if ( rightEquivalenceClassesToProvenances . containsKey ( item ) && leftEquivalenceClassesToProvenances . containsKey ( item ) ) { return ImmutableList . of ( ( EqClassT ) item ) ; } else { return ImmutableList . of ( ) ; }
public class CmsLocationPicker { /** * Sets the preview visible . < p > * @ param visible < code > true < / code > to set the preview visible */ protected void setPreviewVisible ( boolean visible ) { } }
if ( visible ) { addStyleName ( I_CmsLayoutBundle . INSTANCE . locationPickerCss ( ) . hasPreview ( ) ) ; } else { removeStyleName ( I_CmsLayoutBundle . INSTANCE . locationPickerCss ( ) . hasPreview ( ) ) ; }
public class OperaSettings { /** * Sets the profile to use as an Opera profile represented as an object . * @ param profile the Opera profile to use * @ throws NullPointerException if argument is null */ public void setProfile ( OperaProfile profile ) { } }
options . get ( PROFILE ) . setValue ( PROFILE . sanitize ( profile ) ) ; supportsPd = true ;
public class KnowledgeBaseImpl { /** * Handles the write serialization of the Package . Patterns in Rules may reference generated data which cannot be serialized by default methods . * The Package uses PackageCompilationData to hold a reference to the generated bytecode . The generated bytecode must be restored before any Rules . */ public void writeExternal ( final ObjectOutput out ) throws IOException { } }
ObjectOutput droolsStream ; boolean isDrools = out instanceof DroolsObjectOutputStream ; ByteArrayOutputStream bytes ; out . writeBoolean ( isDrools ) ; if ( isDrools ) { droolsStream = out ; bytes = null ; } else { bytes = new ByteArrayOutputStream ( ) ; droolsStream = new DroolsObjectOutputStream ( bytes ) ; } // must write this option first in order to properly deserialize later droolsStream . writeBoolean ( this . config . isClassLoaderCacheEnabled ( ) ) ; droolsStream . writeObject ( ( ( ProjectClassLoader ) rootClassLoader ) . getStore ( ) ) ; droolsStream . writeObject ( this . config ) ; droolsStream . writeObject ( this . pkgs ) ; // Rules must be restored by an ObjectInputStream that can resolve using a given ClassLoader to handle seaprately by storing as // a byte [ ] droolsStream . writeObject ( this . id ) ; droolsStream . writeInt ( this . workingMemoryCounter . get ( ) ) ; droolsStream . writeObject ( this . processes ) ; droolsStream . writeUTF ( this . factHandleFactory . getClass ( ) . getName ( ) ) ; droolsStream . writeObject ( buildGlobalMapForSerialization ( ) ) ; this . eventSupport . removeEventListener ( KieBaseEventListener . class ) ; droolsStream . writeObject ( this . eventSupport ) ; droolsStream . writeObject ( this . reteooBuilder ) ; droolsStream . writeObject ( this . rete ) ; droolsStream . writeObject ( this . resolvedReleaseId ) ; if ( ! isDrools ) { droolsStream . flush ( ) ; droolsStream . close ( ) ; bytes . close ( ) ; out . writeObject ( bytes . toByteArray ( ) ) ; }
public class CharBuffer { /** * Appends < code > sb < / code > to the end of this CharBuffer . * This method involves copying the new data once ! * @ param sb the StringBuffer to append or null */ public void append ( final StringBuffer sb ) { } }
if ( sb == null ) { return ; } provideCapacity ( length + sb . length ( ) ) ; sb . getChars ( 0 , sb . length ( ) , c , length ) ; length += sb . length ( ) ;
public class JSettingsPanel { /** * GEN - LAST : event _ jCheckBoxDrawFinalZeroingLinesActionPerformed */ private void jCheckBoxDrawCurrentXActionPerformed ( java . awt . event . ActionEvent evt ) // GEN - FIRST : event _ jCheckBoxDrawCurrentXActionPerformed { } }
// GEN - HEADEREND : event _ jCheckBoxDrawCurrentXActionPerformed parent . getGraphPanelChart ( ) . getChartSettings ( ) . setDrawCurrentX ( jCheckBoxDrawCurrentX . isSelected ( ) ) ; refreshGraphPreview ( ) ;
public class PatternToExpVisitor { /** * Now , compound patterns involve recursive calls to expand their pattern components to expressions . * @ param node * @ return * @ throws AnalysisException */ public PExp caseARecordPattern ( ARecordPattern node ) throws AnalysisException { } }
AMkTypeExp mkExp = new AMkTypeExp ( ) ; mkExp . setTypeName ( node . getTypename ( ) . clone ( ) ) ; List < PExp > args = new Vector < PExp > ( ) ; for ( PPattern p : node . getPlist ( ) ) { args . add ( p . apply ( this ) . clone ( ) ) ; } addPossibleType ( mkExp , node ) ; mkExp . setArgs ( args ) ; return mkExp ;
public class SerIteratorFactory { /** * Gets an iterable wrapper for { @ code List } . * @ param valueType the value type , not null * @ param valueTypeTypes the generic parameters of the value type * @ return the iterable , not null */ public static final SerIterable list ( final Class < ? > valueType , final List < Class < ? > > valueTypeTypes ) { } }
final List < Object > coll = new ArrayList < > ( ) ; return new SerIterable ( ) { @ Override public SerIterator iterator ( ) { return collection ( coll , Object . class , valueType , valueTypeTypes ) ; } @ Override public void add ( Object key , Object column , Object value , int count ) { if ( key != null ) { throw new IllegalArgumentException ( "Unexpected key" ) ; } for ( int i = 0 ; i < count ; i ++ ) { coll . add ( value ) ; } } @ Override public Object build ( ) { return coll ; } @ Override public Class < ? > valueType ( ) { return valueType ; } @ Override public List < Class < ? > > valueTypeTypes ( ) { return valueTypeTypes ; } } ;
public class MapBasedConnPropsBuilder { /** * suppress warnings about not using an object for the four strings in this PRIVATE method */ @ SuppressWarnings ( { } }
"PMD.UseObjectForClearerAPI" } ) // CHECKSTYLE : ON private static void logDefault ( final String key , final String invalidValue , final String validationError , final String defaultValue ) { if ( LOG . isWarnEnabled ( ) ) { final StringBuilder msg = new StringBuilder ( "Invalid value ('" ) . append ( invalidValue ) . append ( "', " ) . append ( validationError ) . append ( ") for key '" ) . append ( key ) . append ( "', using default instead ('" ) ; if ( defaultValue == null ) { msg . append ( "null')" ) ; } else { msg . append ( defaultValue ) . append ( "')" ) ; } LOG . warn ( msg . toString ( ) ) ; }
public class IronJacamar { /** * { @ inheritDoc } */ @ Override protected Statement withAfters ( final FrameworkMethod method , final Object target , final Statement statement ) { } }
final Statement afters = super . withAfters ( method , target , new NoopStatement ( ) ) ; return new Statement ( ) { @ Override public void evaluate ( ) throws Throwable { statement . evaluate ( ) ; afters . evaluate ( ) ; TestClass tc = getTestClass ( ) ; // Non - static @ Resource List < FrameworkField > fields = tc . getAnnotatedFields ( Resource . class ) ; if ( fields != null && ! fields . isEmpty ( ) ) { for ( FrameworkField f : fields ) { SecurityActions . setAccessible ( f . getField ( ) ) ; if ( ! Modifier . isStatic ( f . getField ( ) . getModifiers ( ) ) && ! f . getField ( ) . getDeclaringClass ( ) . isPrimitive ( ) ) { f . getField ( ) . set ( target , null ) ; } } } // Non - static @ Inject / @ Named fields = tc . getAnnotatedFields ( javax . inject . Inject . class ) ; if ( fields != null && ! fields . isEmpty ( ) ) { for ( FrameworkField f : fields ) { SecurityActions . setAccessible ( f . getField ( ) ) ; if ( ! Modifier . isStatic ( f . getField ( ) . getModifiers ( ) ) && ! f . getField ( ) . getDeclaringClass ( ) . isPrimitive ( ) ) { f . getField ( ) . set ( target , null ) ; } } } // Non - static @ Deployment if ( ! deployments . isEmpty ( ) ) { for ( int i = deployments . size ( ) - 1 ; i >= 0 ; i -- ) { Object deployment = deployments . get ( i ) ; if ( deployment instanceof URL ) { embedded . undeploy ( ( URL ) deployment ) ; } else if ( deployment instanceof ResourceAdapterArchive ) { embedded . undeploy ( ( ResourceAdapterArchive ) deployment ) ; } else if ( deployment instanceof Descriptor ) { embedded . undeploy ( ( Descriptor ) deployment ) ; } } } deployments . clear ( ) ; } } ;
public class FunctionTypeBuilder { /** * Clobber the templateTypeNames from the JSDoc with builtin ones for native types . */ private boolean maybeUseNativeClassTemplateNames ( JSDocInfo info ) { } }
// TODO ( b / 74253232 ) : maybeGetNativeTypesOfBuiltin should also handle cases where a local type // declaration shadows a templatized native type . ImmutableList < TemplateType > nativeKeys = typeRegistry . maybeGetTemplateTypesOfBuiltin ( fnName ) ; // TODO ( b / 73386087 ) : Make infoTemplateTypeNames . size ( ) = = nativeKeys . size ( ) a // Preconditions check . It currently fails for " var symbol " in the externs . if ( nativeKeys != null && info . getTemplateTypeNames ( ) . size ( ) == nativeKeys . size ( ) ) { this . templateTypeNames = nativeKeys ; return true ; } return false ;
public class EntityListenerDescFactory { /** * / * * インポート名を処理します 。 * @ param entityListenerDesc エンティティリスナー記述 * @ param entityDesc エンティティ記述 */ protected void handleImportName ( EntityListenerDesc entityListenerDesc , EntityDesc entityDesc ) { } }
classDescSupport . addImportName ( entityListenerDesc , entityDesc . getQualifiedName ( ) ) ; if ( superclassName == null ) { classDescSupport . addImportName ( entityListenerDesc , ClassConstants . EntityListener ) ; classDescSupport . addImportName ( entityListenerDesc , ClassConstants . PreInsertContext ) ; classDescSupport . addImportName ( entityListenerDesc , ClassConstants . PreUpdateContext ) ; classDescSupport . addImportName ( entityListenerDesc , ClassConstants . PreDeleteContext ) ; classDescSupport . addImportName ( entityListenerDesc , ClassConstants . PostInsertContext ) ; classDescSupport . addImportName ( entityListenerDesc , ClassConstants . PostUpdateContext ) ; classDescSupport . addImportName ( entityListenerDesc , ClassConstants . PostDeleteContext ) ; } else { classDescSupport . addImportName ( entityListenerDesc , superclassName ) ; }
public class ParsedColInfo { /** * and syncs with ( table / column ) * ( name / alias ) . */ public ParsedColInfo toTVE ( int indx , int diff ) { } }
TupleValueExpression exp = new TupleValueExpression ( m_tableName , m_tableAlias , m_columnName , m_alias , m_expression , indx ) ; exp . setDifferentiator ( diff ) ; m_expression = exp ; return this ;
public class VirtualMachineScaleSetsInner { /** * Reimages ( upgrade the operating system ) one or more virtual machines in a VM scale set . * @ param resourceGroupName The name of the resource group . * @ param vmScaleSetName The name of the VM scale set . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the OperationStatusResponseInner object */ public Observable < OperationStatusResponseInner > beginReimageAsync ( String resourceGroupName , String vmScaleSetName ) { } }
return beginReimageWithServiceResponseAsync ( resourceGroupName , vmScaleSetName ) . map ( new Func1 < ServiceResponse < OperationStatusResponseInner > , OperationStatusResponseInner > ( ) { @ Override public OperationStatusResponseInner call ( ServiceResponse < OperationStatusResponseInner > response ) { return response . body ( ) ; } } ) ;
public class FileSender { /** * Sends the file to the given output group . */ private void doSendFile ( final AsyncFile file , final OutputGroup group , final int position , final Handler < AsyncResult < Void > > doneHandler ) { } }
if ( ! group . sendQueueFull ( ) ) { file . read ( new Buffer ( BUFFER_SIZE ) , 0 , position , BUFFER_SIZE , new Handler < AsyncResult < Buffer > > ( ) { @ Override public void handle ( AsyncResult < Buffer > result ) { if ( result . failed ( ) ) { new DefaultFutureResult < Void > ( result . cause ( ) ) . setHandler ( doneHandler ) ; } else { Buffer buffer = result . result ( ) ; if ( buffer . length ( ) > 0 ) { group . send ( buffer ) ; doSendFile ( file , group , position + buffer . length ( ) , doneHandler ) ; } else { group . end ( ) ; new DefaultFutureResult < Void > ( ( Void ) null ) . setHandler ( doneHandler ) ; } } } } ) ; } else { group . drainHandler ( new Handler < Void > ( ) { @ Override public void handle ( Void event ) { doSendFile ( file , group , position , doneHandler ) ; } } ) ; }
public class DefaultEventbus { /** * - - - RECEIVE EVENT FROM REMOTE SERVICE - - - */ @ Override public void receiveEvent ( Tree message ) { } }
// Verify protocol version if ( checkVersion ) { String ver = message . get ( "ver" , "unknown" ) ; if ( ! ServiceBroker . PROTOCOL_VERSION . equals ( ver ) ) { logger . warn ( "Invalid protocol version (" + ver + ")!" ) ; return ; } } // Get event property String name = message . get ( "event" , ( String ) null ) ; if ( name == null || name . isEmpty ( ) ) { logger . warn ( "Missing \"event\" property!" ) ; return ; } // Get data Tree payload = message . get ( "data" ) ; // Process events in Moleculer V2 style Tree groupArray = message . get ( "groups" ) ; Groups groups = null ; if ( groupArray != null ) { int size = groupArray . size ( ) ; if ( size > 0 ) { String [ ] array = new String [ groupArray . size ( ) ] ; int i = 0 ; for ( Tree group : groupArray ) { array [ i ++ ] = group . asString ( ) ; } groups = Groups . of ( array ) ; } } // Emit or broadcast ? if ( message . get ( "broadcast" , true ) ) { // Broadcast broadcast ( name , payload , groups , true ) ; } else { // Emit emit ( name , payload , groups , true ) ; }
public class XsdSupportingStructure { /** * Creates the TextGroup interface . * Methods : * < R > T text ( R text ) * < R > T comment ( R comment ) * @ param apiName The name of the generated fluent interface . */ private static void createTextGroup ( String apiName ) { } }
ClassWriter classWriter = generateClass ( TEXT_GROUP , JAVA_OBJECT , new String [ ] { ELEMENT } , "<T::" + elementTypeDesc + "Z::" + elementTypeDesc + ">" + JAVA_OBJECT_DESC + "L" + elementType + "<TT;TZ;>;" , ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE , apiName ) ; textGroupMethod ( classWriter , "text" , "visitText" ) ; textGroupMethod ( classWriter , "comment" , "visitComment" ) ; writeClassToFile ( TEXT_GROUP , classWriter , apiName ) ;
public class LinkOptionsExample { /** * this is were the majority of the work is done for building the link . Note that it is in a container that is * reset , effectively creating a new link . this is only done to enable to dynamically change the link to a button * and back . */ private void applySettings ( ) { } }
linkContainer . reset ( ) ; WLink exampleLink = new WLink ( ) ; exampleLink . setText ( tfLinkLabel . getText ( ) ) ; final String url = tfUrlField . getValue ( ) ; if ( "" . equals ( url ) || ! isValidUrl ( url ) ) { tfUrlField . setText ( URL ) ; exampleLink . setUrl ( URL ) ; } else { exampleLink . setUrl ( url ) ; } exampleLink . setRenderAsButton ( cbRenderAsButton . isSelected ( ) ) ; exampleLink . setText ( tfLinkLabel . getText ( ) ) ; if ( cbSetImage . isSelected ( ) ) { WImage linkImage = new WImage ( "/image/attachment.png" , "Add attachment" ) ; exampleLink . setImage ( linkImage . getImage ( ) ) ; exampleLink . setImagePosition ( ( ImagePosition ) ddImagePosition . getSelected ( ) ) ; } exampleLink . setDisabled ( cbDisabled . isSelected ( ) ) ; if ( tfAccesskey . getText ( ) != null && tfAccesskey . getText ( ) . length ( ) > 0 ) { exampleLink . setAccessKey ( tfAccesskey . getText ( ) . toCharArray ( ) [ 0 ] ) ; } if ( cbOpenNew . isSelected ( ) ) { exampleLink . setOpenNewWindow ( true ) ; exampleLink . setTargetWindowName ( "_blank" ) ; } else { exampleLink . setOpenNewWindow ( false ) ; } linkContainer . add ( exampleLink ) ;
public class AuditBaseDao { /** * Checks if the database is MySQL . * @ return true , if is my sql database * @ throws HandlerException the handler exception */ protected boolean isMySQLDatabase ( ) throws HandlerException { } }
String dbName = determineDatabaseType ( ) ; if ( dbName == null ) { return false ; } return "MySQL" . equalsIgnoreCase ( dbName ) ;
public class Main { /** * copy all jars * @ param outputDir output directory * @ throws IOException ioException */ private static void copyAllJars ( String outputDir ) throws IOException { } }
File out = new File ( outputDir ) ; String targetPath = out . getAbsolutePath ( ) + File . separatorChar + "lib" ; File current = new File ( "." ) ; String path = current . getCanonicalPath ( ) ; String libPath = path + File . separatorChar + ".." + File . separatorChar + ".." + File . separatorChar + "lib" ; Utils . copyFolder ( libPath , targetPath , "jar" , false ) ;
public class VariableLengthRowBasedKeyValueBatch { /** * Returns the key row in this batch at ` rowId ` . Returned key row is reused across calls . */ @ Override public UnsafeRow getKeyRow ( int rowId ) { } }
assert ( rowId >= 0 ) ; assert ( rowId < numRows ) ; if ( keyRowId != rowId ) { // if keyRowId = = rowId , desired keyRow is already cached long offset = keyOffsets [ rowId ] ; int klen = Platform . getInt ( base , offset - 4 ) ; keyRow . pointTo ( base , offset , klen ) ; // set keyRowId so we can check if desired row is cached keyRowId = rowId ; } return keyRow ;
public class Unpooled { /** * Creates a new buffer whose content is a merged copy of the specified * { @ code buffers } ' slices . The new buffer ' s { @ code readerIndex } and * { @ code writerIndex } are { @ code 0 } and the sum of all buffers ' * { @ code remaining } respectively . * @ throws IllegalArgumentException * if the specified buffers ' endianness are different from each * other */ public static ByteBuf copiedBuffer ( ByteBuffer ... buffers ) { } }
switch ( buffers . length ) { case 0 : return EMPTY_BUFFER ; case 1 : return copiedBuffer ( buffers [ 0 ] ) ; } // Merge the specified buffers into one buffer . ByteOrder order = null ; int length = 0 ; for ( ByteBuffer b : buffers ) { int bLen = b . remaining ( ) ; if ( bLen <= 0 ) { continue ; } if ( Integer . MAX_VALUE - length < bLen ) { throw new IllegalArgumentException ( "The total length of the specified buffers is too big." ) ; } length += bLen ; if ( order != null ) { if ( ! order . equals ( b . order ( ) ) ) { throw new IllegalArgumentException ( "inconsistent byte order" ) ; } } else { order = b . order ( ) ; } } if ( length == 0 ) { return EMPTY_BUFFER ; } byte [ ] mergedArray = PlatformDependent . allocateUninitializedArray ( length ) ; for ( int i = 0 , j = 0 ; i < buffers . length ; i ++ ) { // Duplicate the buffer so we not adjust the position during our get operation . // See https : / / github . com / netty / netty / issues / 3896 ByteBuffer b = buffers [ i ] . duplicate ( ) ; int bLen = b . remaining ( ) ; b . get ( mergedArray , j , bLen ) ; j += bLen ; } return wrappedBuffer ( mergedArray ) . order ( order ) ;
public class TypeResolver { /** * Resolves a given type variable . This is achieved by a lookup in the { @ link # resolvedTypeVariables } map . */ public Type resolveType ( TypeVariable < ? > variable ) { } }
Type resolvedType = this . resolvedTypeVariables . get ( variable ) ; if ( resolvedType == null ) { return variable ; // we are not able to resolve } return resolvedType ;
public class Less { /** * Compile the less data from a string . * @ param baseURL * the baseURL for import of external less data . * @ param lessData * the input less data * @ param options * some optional options , see constants for details * @ param readerFactory * A factory for the readers for imports . * @ return the resulting less data * @ throws LessException * if any error occur on compiling . */ public static String compile ( URL baseURL , String lessData , Map < String , String > options , ReaderFactory readerFactory ) throws LessException { } }
try { if ( options == null ) { options = Collections . emptyMap ( ) ; } LessParser parser = new LessParser ( ) ; parser . parse ( baseURL , new StringReader ( lessData ) , readerFactory ) ; boolean compress = Boolean . parseBoolean ( options . get ( COMPRESS ) ) ; CssFormatter formatter = compress ? new CompressCssFormatter ( ) : new CssFormatter ( ) ; parser . parseLazy ( formatter ) ; StringBuilder builder = new StringBuilder ( ) ; formatter . format ( parser , baseURL , readerFactory , builder , options ) ; return builder . toString ( ) ; } catch ( LessException ex ) { throw ex ; } catch ( Exception ex ) { throw new LessException ( ex ) ; }
public class OjbTagsHandler { /** * Processes the template for all indices of the current table . * @ param template The template * @ param attributes The attributes of the tag * @ exception XDocletException if an error occurs * @ doc . tag type = " block " * @ doc . param name = " unique " optional = " true " description = " Whether to process the unique indices or not " * values = " true , false " */ public void forAllIndices ( String template , Properties attributes ) throws XDocletException { } }
boolean processUnique = TypeConversionUtil . stringToBoolean ( attributes . getProperty ( ATTRIBUTE_UNIQUE ) , false ) ; // first the default index _curIndexDef = _curTableDef . getIndex ( null ) ; if ( ( _curIndexDef != null ) && ( processUnique == _curIndexDef . isUnique ( ) ) ) { generate ( template ) ; } for ( Iterator it = _curTableDef . getIndices ( ) ; it . hasNext ( ) ; ) { _curIndexDef = ( IndexDef ) it . next ( ) ; if ( ! _curIndexDef . isDefault ( ) && ( processUnique == _curIndexDef . isUnique ( ) ) ) { generate ( template ) ; } } _curIndexDef = null ;
public class location { /** * Use this API to fetch location resources of given names . */ public static location [ ] get ( nitro_service service , String ipfrom [ ] ) throws Exception { } }
if ( ipfrom != null && ipfrom . length > 0 ) { location response [ ] = new location [ ipfrom . length ] ; location obj [ ] = new location [ ipfrom . length ] ; for ( int i = 0 ; i < ipfrom . length ; i ++ ) { obj [ i ] = new location ( ) ; obj [ i ] . set_ipfrom ( ipfrom [ i ] ) ; response [ i ] = ( location ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ;
public class LayerImpl { /** * Unfolds a folded module list and returns a list of Source objects * @ param request The request * @ return A list of Source objects * @ throws IOException */ protected ModuleList getModules ( HttpServletRequest request ) throws IOException { } }
final String sourceMethod = "getModules" ; // $ NON - NLS - 1 $ final boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( sourceMethod , sourceMethod , new Object [ ] { request } ) ; } ModuleList result = ( ModuleList ) request . getAttribute ( MODULE_FILES_PROPNAME ) ; if ( result == null ) { IAggregator aggr = ( IAggregator ) request . getAttribute ( IAggregator . AGGREGATOR_REQATTRNAME ) ; IRequestedModuleNames requestedModuleNames = ( IRequestedModuleNames ) request . getAttribute ( IHttpTransport . REQUESTEDMODULENAMES_REQATTRNAME ) ; result = new ModuleList ( ) ; if ( requestedModuleNames != null ) { Features features = ( Features ) request . getAttribute ( IHttpTransport . FEATUREMAP_REQATTRNAME ) ; Set < String > dependentFeatures = new HashSet < String > ( ) ; DependencyList requiredList = null , preloadList = null , excludeList = null , moduleList = null ; ModuleDeps combined = new ModuleDeps ( ) , explicit = new ModuleDeps ( ) ; Set < String > resultNames = new HashSet < String > ( ) ; List < String > names = requestedModuleNames . getModules ( ) ; boolean isDepExpLogging = RequestUtil . isDependencyExpansionLogging ( request ) ; if ( ! names . isEmpty ( ) ) { for ( String name : names ) { if ( name != null ) { name = aggr . getConfig ( ) . resolve ( name , features , dependentFeatures , null , false , // Don ' t resolve aliases when locating modules requested by the loader // because the loader should have already done alias resolution and // we can ' t rename a requested module . false // Loader doesn ' t request modules with has ! plugin ) ; resultNames . add ( name ) ; result . add ( new ModuleList . ModuleListEntry ( newModule ( request , name ) , ModuleSpecifier . MODULES ) ) ; } } if ( RequestUtil . isServerExpandedLayers ( request ) ) { moduleList = newDependencyList ( DEPSOURCE_MODULEDEPS , requestedModuleNames . getModules ( ) , aggr , features , true , // resolveAliases isDepExpLogging , // include details false // include require deps ) ; // When doing server expanded layers , we treat undefined features as false // for the purpose of evaluating has ! loader plugin conditionals . We can do // this because 1 . ) unlike with require list expansion , the feature values are // less likely to change before being evaluated by the loader so an undefined // feature is likely to be meant to represent false , and 2 . ) even if // we get it wrong , there is no harm done other than including a module // ( and its dependencies ) that won ' t get defined . moduleList . setCoerceUndefinedToFalse ( true ) ; dependentFeatures . addAll ( moduleList . getDependentFeatures ( ) ) ; explicit . addAll ( moduleList . getExplicitDeps ( ) ) ; combined . addAll ( moduleList . getExpandedDeps ( ) ) ; } } boolean includeRequireDeps = RequestUtil . isIncludeRequireDeps ( request ) ; names = requestedModuleNames . getScripts ( ) ; for ( String name : names ) { if ( name != null ) { name = aggr . getConfig ( ) . resolve ( name , features , dependentFeatures , null , false , // Don ' t resolve aliases when locating modules requested by the loader // because the loader should have already done alias resolution and // we can ' t rename a requested module . true // Resolve has ! loader plugin ) ; result . add ( new ModuleList . ModuleListEntry ( newModule ( request , name ) , ModuleSpecifier . SCRIPTS ) ) ; } } // See if we need to add required modules . if ( ! requestedModuleNames . getDeps ( ) . isEmpty ( ) ) { // If there ' s a required module , then add it and its dependencies // to the module list . requiredList = newDependencyList ( DEPSOURCE_REQDEPS , requestedModuleNames . getDeps ( ) , aggr , features , true , // resolveAliases isDepExpLogging , // include details includeRequireDeps ) ; dependentFeatures . addAll ( requiredList . getDependentFeatures ( ) ) ; result . setRequiredModules ( requiredList . getExplicitDeps ( ) . getModuleIds ( ) ) ; explicit . addAll ( requiredList . getExplicitDeps ( ) ) ; combined . addAll ( requiredList . getExplicitDeps ( ) ) ; combined . addAll ( requiredList . getExpandedDeps ( ) ) ; } if ( ! requestedModuleNames . getPreloads ( ) . isEmpty ( ) ) { preloadList = newDependencyList ( DEPSOURCE_REQPRELOADS , requestedModuleNames . getPreloads ( ) , aggr , features , true , // resolveAliases isDepExpLogging , // include details includeRequireDeps ) ; dependentFeatures . addAll ( preloadList . getDependentFeatures ( ) ) ; explicit . addAll ( preloadList . getExplicitDeps ( ) ) ; combined . addAll ( preloadList . getExplicitDeps ( ) ) ; combined . addAll ( preloadList . getExpandedDeps ( ) ) ; } if ( ! requestedModuleNames . getExcludes ( ) . isEmpty ( ) ) { excludeList = newDependencyList ( DEPSOURCE_EXCLUDES , requestedModuleNames . getExcludes ( ) , aggr , features , true , // resolveAliases isDepExpLogging , // include details false ) ; dependentFeatures . addAll ( excludeList . getDependentFeatures ( ) ) ; combined . subtractAll ( excludeList . getExplicitDeps ( ) ) ; combined . subtractAll ( excludeList . getExpandedDeps ( ) ) ; } if ( RequestUtil . isServerExpandedLayers ( request ) ) { // Expanding requests on the server , so treat undefined features as false // for the purpose of dependency expansion combined . resolveWith ( features , true /* coerceUndefinedToFalse */ ) ; } boolean isAssertNoNLS = RequestUtil . isAssertNoNLS ( request ) ; for ( Map . Entry < String , ModuleDepInfo > entry : combined . entrySet ( ) ) { String name = entry . getKey ( ) ; if ( isAssertNoNLS && nlsPat . matcher ( name ) . find ( ) ) { throw new BadRequestException ( "AssertNoNLS: " + name ) ; // $ NON - NLS - 1 $ } ModuleDepInfo info = entry . getValue ( ) ; if ( aggr . getTransport ( ) . isServerExpandable ( request , name ) ) { int idx = name . indexOf ( "!" ) ; // $ NON - NLS - 1 $ if ( idx != - 1 ) { // convert name to a delegate plugin if necessary String plugin = name . substring ( 0 , idx ) ; if ( aggr . getConfig ( ) . getTextPluginDelegators ( ) . contains ( plugin ) ) { name = aggr . getTransport ( ) . getAggregatorTextPluginName ( ) + name . substring ( idx ) ; } else if ( aggr . getConfig ( ) . getJsPluginDelegators ( ) . contains ( plugin ) ) { name = name . substring ( idx + 1 ) ; } else { // Don ' t know how to handle plugin , so ignore continue ; } } Boolean includeStatus = info . getIncludeStatus ( ) ; if ( includeStatus == Boolean . TRUE || // condition is TRUE RequestUtil . isIncludeUndefinedFeatureDeps ( request ) && includeStatus == null ) { IModule module = newModule ( request , name ) ; if ( ! explicit . containsKey ( name ) && aggr . getResourceFactory ( new MutableObject < URI > ( module . getURI ( ) ) ) == null ) { // Module is server - expanded and it ' s not a server resource type that we // know how handle , so just ignore it . if ( isTraceLogging ) { log . logp ( Level . FINER , sourceClass , sourceMethod , "Ignoring module " + name + " due to no resource factory found." ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ } continue ; } if ( resultNames . add ( module . getModuleId ( ) ) ) { result . add ( new ModuleList . ModuleListEntry ( module , ModuleSpecifier . LAYER , ! explicit . containsKey ( name ) ) ) ; } } } } if ( ( moduleList != null || requiredList != null || preloadList != null ) && isDepExpLogging ) { ModuleDeps expanded = new ModuleDeps ( ) ; if ( requiredList != null ) { expanded . addAll ( requiredList . getExpandedDeps ( ) ) ; } if ( preloadList != null ) { expanded . addAll ( preloadList . getExpandedDeps ( ) ) ; } if ( moduleList != null ) { expanded . addAll ( moduleList . getExpandedDeps ( ) ) ; } if ( excludeList != null ) { expanded . subtractAll ( excludeList . getExplicitDeps ( ) ) ; expanded . subtractAll ( excludeList . getExpandedDeps ( ) ) ; } request . setAttribute ( EXPANDEDDEPS_PROPNAME , new DependencyList ( explicit , expanded , dependentFeatures ) ) ; } resultNames . clear ( ) ; result . setDependenentFeatures ( dependentFeatures ) ; } if ( result . isEmpty ( ) ) { throw new BadRequestException ( request . getQueryString ( ) ) ; } request . setAttribute ( MODULE_FILES_PROPNAME , result ) ; } if ( isTraceLogging ) { log . exiting ( sourceClass , sourceMethod , result ) ; } return result ;
public class ControlMessageFactoryImpl { /** * Create a new , empty Subscription Propagation message * @ return The new SubscriptionMessage * @ exception MessageCreateFailedException Thrown if such a message can not be created */ public final SubscriptionMessage createNewSubscriptionMessage ( ) throws MessageCreateFailedException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createNewSubscriptionMessage" ) ; SubscriptionMessage msg = null ; try { msg = new SubscriptionMessageImpl ( MfpConstants . CONSTRUCTOR_NO_OP ) ; } catch ( MessageDecodeFailedException e ) { /* No need to FFDC this as JsMsgObject will already have done so */ // No FFDC code needed throw new MessageCreateFailedException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createNewSubscriptionMessage" ) ; return msg ;
public class Context { /** * Handle a proxy request for this context . * @ param target the proxy target * @ param exchange the http server exchange * @ param callback the proxy callback * @ param timeout the timeout * @ param timeUnit the time unit * @ param exclusive whether this connection is exclusive */ void handleRequest ( final ModClusterProxyTarget target , final HttpServerExchange exchange , final ProxyCallback < ProxyConnection > callback , long timeout , TimeUnit timeUnit , boolean exclusive ) { } }
if ( addRequest ( ) ) { exchange . addExchangeCompleteListener ( new ExchangeCompletionListener ( ) { @ Override public void exchangeEvent ( HttpServerExchange exchange , NextListener nextListener ) { requestDone ( ) ; nextListener . proceed ( ) ; } } ) ; node . getConnectionPool ( ) . connect ( target , exchange , callback , timeout , timeUnit , exclusive ) ; } else { callback . failed ( exchange ) ; }
public class DefaultNameGenerator { /** * Validates a name prefix . */ private void checkPrefix ( String prefix ) { } }
if ( prefix . length ( ) > 0 ) { // Make sure that prefix starts with a legal character . if ( ! contains ( firstChars , prefix . charAt ( 0 ) ) ) { char [ ] chars = new char [ firstChars . length ] ; for ( int i = 0 ; i < chars . length ; i ++ ) { chars [ i ] = firstChars [ i ] . name ; } throw new IllegalArgumentException ( "prefix must start with one of: " + Arrays . toString ( chars ) ) ; } for ( int pos = 1 ; pos < prefix . length ( ) ; ++ pos ) { char [ ] chars = new char [ nonFirstChars . length ] ; for ( int i = 0 ; i < chars . length ; i ++ ) { chars [ i ] = nonFirstChars [ i ] . name ; } if ( ! contains ( nonFirstChars , prefix . charAt ( pos ) ) ) { throw new IllegalArgumentException ( "prefix has invalid characters, must be one of: " + Arrays . toString ( chars ) ) ; } } }
public class KmeansCalculator { /** * KMeans + + アルゴリズムで初期の中心点リストを生成する 。 * @ param basePoints 中心点を生成するベースデータ * @ param clusterNum クラスタ数 * @ return 中心点リスト */ public static List < KmeansPoint > createInitialCentroids ( List < KmeansPoint > basePoints , int clusterNum ) { } }
Random random = new Random ( ) ; List < KmeansPoint > resultList = Lists . newArrayList ( ) ; // ベースデータリストを更新しないためにコピーを生成して用いる List < KmeansPoint > pointList = Lists . newArrayList ( basePoints ) ; KmeansPoint firstCentroid = pointList . remove ( random . nextInt ( pointList . size ( ) ) ) ; resultList . add ( firstCentroid ) ; double [ ] dxs ; // KMeans + + 方式による中心点算出をクラスタの数だけ実施する 。 // 最初の1点はランダムで算出しているため 、 1オリジンで開始している 。 for ( int centroidIndex = 1 ; centroidIndex < clusterNum ; centroidIndex ++ ) { // 各データポイントに対する距離を用いて重みつき確率分布を算出する 。 dxs = computeDxs ( pointList , resultList ) ; // 重みつき確率分布を用いて次の中心点を選出する 。 double r = random . nextDouble ( ) * dxs [ dxs . length - 1 ] ; int next = Arrays . binarySearch ( dxs , r ) ; int index = 0 ; if ( next > 0 ) { index = next - 1 ; } else if ( next < 0 ) { index = COMPENSATE_INDEX - next ; } while ( index > 0 && resultList . contains ( pointList . get ( index ) ) ) { index = index - 1 ; } resultList . add ( pointList . get ( index ) ) ; } return resultList ;
public class DragHelper { /** * Returns the speed of the drag gesture in pixels per millisecond . * @ return The speed of the drag gesture as a { @ link Float } value or - 1 , if the threshold has * not been reached yet */ public final float getDragSpeed ( ) { } }
if ( hasThresholdBeenReached ( ) ) { long interval = System . currentTimeMillis ( ) - dragStartTime ; return Math . abs ( getDragDistance ( ) ) / ( float ) interval ; } else { return - 1 ; }
public class FormatStringBuffer { /** * Skip digits and return the number they form . */ private int skipDigits ( ) { } }
char ch ; int i = 0 ; while ( index < format . length ( ) ) { if ( Character . isDigit ( ch = format . charAt ( index ) ) ) { index ++ ; i = i * 10 + Character . digit ( ch , 10 ) ; } else { break ; } } return i ;
public class CalendarParserImpl { /** * { @ inheritDoc } */ public final void parse ( final Reader in , final ContentHandler handler ) throws IOException , ParserException { } }
final StreamTokenizer tokeniser = new StreamTokenizer ( in ) ; try { tokeniser . resetSyntax ( ) ; tokeniser . wordChars ( WORD_CHAR_START , WORD_CHAR_END ) ; tokeniser . whitespaceChars ( WHITESPACE_CHAR_START , WHITESPACE_CHAR_END ) ; tokeniser . ordinaryChar ( ':' ) ; tokeniser . ordinaryChar ( ';' ) ; tokeniser . ordinaryChar ( '=' ) ; tokeniser . ordinaryChar ( '\t' ) ; tokeniser . eolIsSignificant ( true ) ; tokeniser . whitespaceChars ( 0 , 0 ) ; tokeniser . quoteChar ( '"' ) ; parseCalendarList ( tokeniser , in , handler ) ; } catch ( IOException | ParseException | URISyntaxException | RuntimeException e ) { if ( e instanceof IOException ) { throw ( IOException ) e ; } if ( e instanceof ParserException ) { throw ( ParserException ) e ; } else { throw new ParserException ( e . getMessage ( ) , getLineNumber ( tokeniser , in ) , e ) ; } }
public class StatementBuilder { /** * Gets the { @ link Statement } representing the state of this statement * builder . * @ return the { @ link Statement } */ public Statement toStatement ( ) { } }
Statement statement = new Statement ( ) ; statement . setQuery ( queryBuilder . buildQuery ( ) ) ; statement . setValues ( Maps . toList ( queryBuilder . getBindVariableMap ( ) , String_ValueMapEntry . class ) . toArray ( new String_ValueMapEntry [ ] { } ) ) ; return statement ;
public class FastStr { /** * Construct a FastStr from a String * @ param s the String * @ return a FastStr */ public static FastStr of ( String s ) { } }
int sz = s . length ( ) ; if ( sz == 0 ) return EMPTY_STR ; char [ ] buf = s . toCharArray ( ) ; return new FastStr ( buf , 0 , sz ) ;
public class PrettyTime { /** * / * [ deutsch ] * < p > Definiert das lokalisierte Minuszeichen . < / p > * < p > In den meisten Sprachen ist es einfach das Zeichen { @ code U + 002D } . * Per Vorgabe wird Time4J versuchen , die Konfiguration des * i18n - Moduls oder sonst die JDK - Einstellung zu verwenden . Diese * Methode & uuml ; berschreibt jedoch den Standard . Besonders f & uuml ; r * Arabisch kann es sinnvoll sein , vor dem eigentlichen Minuszeichen * einen Unicode - Marker ( entweder LRM { @ code U + 200E } oder RLM * { @ code U + 200F } ) einzuf & uuml ; gen , um die Orientierung des Minuszeichens * in der traditionellen Rechts - nach - links - Schreibweise zu * kontrollieren . < / p > * @ param minusSign localized minus sign ( possibly with unicode markers ) * @ return changed copy of this instance * @ since 2.1 * @ see java . text . DecimalFormatSymbols # getMinusSign ( ) * @ see net . time4j . format . NumberSymbolProvider # getMinusSign ( Locale ) */ public PrettyTime withMinusSign ( String minusSign ) { } }
if ( minusSign . equals ( this . minusSign ) ) { // NPE - check return this ; } return new PrettyTime ( this . locale , this . refClock , this . zeroDigit , minusSign , this . emptyUnit , this . weekToDays , this . shortStyle , this . stdListSeparator , this . endListSeparator ) ;
public class _ComponentAttributesMap { /** * Execute the getter method of the specified property on the underlying * component . * @ param propertyDescriptor specifies which property to read . * @ return the value returned by the getter method . * @ throws IllegalArgumentException if the property is not readable . * @ throws FacesException if any other problem occurs while invoking * the getter method . */ private Object getComponentProperty ( _PropertyDescriptorHolder propertyDescriptor ) { } }
Method readMethod = propertyDescriptor . getReadMethod ( ) ; if ( readMethod == null ) { throw new IllegalArgumentException ( "Component property " + propertyDescriptor . getName ( ) + " is not readable" ) ; } try { return readMethod . invoke ( _component , EMPTY_ARGS ) ; } catch ( Exception e ) { FacesContext facesContext = _component . getFacesContext ( ) ; throw new FacesException ( "Could not get property " + propertyDescriptor . getName ( ) + " of component " + _component . getClientId ( facesContext ) , e ) ; }
public class GeoRSSModule { /** * ( non - Javadoc ) * @ see com . rometools . rome . feed . CopyFrom # copyFrom ( java . lang . Object ) */ @ Override public void copyFrom ( final CopyFrom obj ) { } }
final GeoRSSModule geoRSSModule = ( GeoRSSModule ) obj ; geometry = geoRSSModule . getGeometry ( ) ; try { geometry = ( AbstractGeometry ) geometry . clone ( ) ; } catch ( final CloneNotSupportedException ex ) { LOG . error ( "Error" , ex ) ; }
public class ProtocolCompatible { /** * Check if the client and DataNode have compatible ClientDataNodeProtocol versions * @ param clientVersion the version of ClientDatanodeProtocol that client has * @ param serverVersion the version of ClientDatanodeProtocol that DataNode has * @ return true if two versions are compatible */ public static boolean isCompatibleClientDatanodeProtocol ( long clientVersion , long serverVersion ) { } }
return clientVersion == serverVersion || ( ( clientVersion == ClientDatanodeProtocol . GET_BLOCKINFO_VERSION - 1 || clientVersion == ClientDatanodeProtocol . GET_BLOCKINFO_VERSION || clientVersion == ClientDatanodeProtocol . COPY_BLOCK_VERSION ) && ( serverVersion == ClientDatanodeProtocol . GET_BLOCKINFO_VERSION - 1 || serverVersion == ClientDatanodeProtocol . GET_BLOCKINFO_VERSION || serverVersion == ClientDatanodeProtocol . COPY_BLOCK_VERSION ) ) ;
public class filterhtmlinjectionvariable { /** * Use this API to fetch filterhtmlinjectionvariable resources of given names . */ public static filterhtmlinjectionvariable [ ] get ( nitro_service service , String variable [ ] ) throws Exception { } }
if ( variable != null && variable . length > 0 ) { filterhtmlinjectionvariable response [ ] = new filterhtmlinjectionvariable [ variable . length ] ; filterhtmlinjectionvariable obj [ ] = new filterhtmlinjectionvariable [ variable . length ] ; for ( int i = 0 ; i < variable . length ; i ++ ) { obj [ i ] = new filterhtmlinjectionvariable ( ) ; obj [ i ] . set_variable ( variable [ i ] ) ; response [ i ] = ( filterhtmlinjectionvariable ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ;
public class ArrayQueue { /** * Inserts the specified element at the end of this queue . * < p > This method is equivalent to { @ link # offer } . * @ param e the element to add * @ return < tt > true < / tt > ( as specified by { @ link Collection # add } ) * @ throws NullPointerException if the specified element is null */ @ Override public boolean add ( E e ) { } }
if ( e == null ) throw new NullPointerException ( "e == null" ) ; elements [ tail ] = e ; if ( ( tail = ( tail + 1 ) & ( elements . length - 1 ) ) == head ) doubleCapacity ( ) ; return true ;
public class HttpTextViewUtils { /** * Validates the given { @ code start } and { @ code end } positions . * @ param start the start position to be validated * @ param end the end position to be validated * @ throws IllegalArgumentException if any of the conditions is true : * < ul > * < li > the { @ code start } position is negative ; < / li > * < li > the { @ code end } position is negative ; < / li > * < li > the { @ code start } position is greater than the { @ code end } position . < / li > * < / ul > */ private static void validateStartEnd ( int start , int end ) { } }
if ( start < 0 ) { throw new IllegalArgumentException ( "Parameter start must not be negative." ) ; } if ( end < 0 ) { throw new IllegalArgumentException ( "Parameter end must not be negative." ) ; } if ( start > end ) { throw new IllegalArgumentException ( "Parameter start must not be greater than end." ) ; }
public class SimpleDOWriter { /** * from the relationship subject , determine which datastream to modify etc */ private String resolveSubjectToDatastream ( String subject ) throws ServerException { } }
String pidURI = PID . toURI ( m_obj . getPid ( ) ) ; if ( subject . startsWith ( pidURI ) ) { if ( subject . length ( ) == pidURI . length ( ) ) { return "RELS-EXT" ; } if ( subject . charAt ( pidURI . length ( ) ) == '/' ) { return "RELS-INT" ; } } throw new GeneralException ( "Cannot determine which relationship datastream to update for subject " + subject + ". Relationship subjects must be the URI of the object or the URI of a datastream within the object." ) ;
public class CommerceDiscountRelPersistenceImpl { /** * Creates a new commerce discount rel with the primary key . Does not add the commerce discount rel to the database . * @ param commerceDiscountRelId the primary key for the new commerce discount rel * @ return the new commerce discount rel */ @ Override public CommerceDiscountRel create ( long commerceDiscountRelId ) { } }
CommerceDiscountRel commerceDiscountRel = new CommerceDiscountRelImpl ( ) ; commerceDiscountRel . setNew ( true ) ; commerceDiscountRel . setPrimaryKey ( commerceDiscountRelId ) ; commerceDiscountRel . setCompanyId ( companyProvider . getCompanyId ( ) ) ; return commerceDiscountRel ;
public class HttpHandlerImpl { /** * Actually sorts the paths , which is not appreciated and not even used anywhere * @ return */ private Set < String > findExclusionPaths ( ) throws InitException { } }
Set < String > exclusions = new TreeSet < String > ( ) ; // Let other handlers deal with folders that do not reside in the WEB - INF or META - INF List < String > collect = null ; File webapp = new File ( deploymentInfo . getRealPath ( "" ) ) ; String [ ] paths = webapp . list ( ) ; if ( webapp . exists ( ) && paths != null ) collect = Arrays . asList ( paths ) ; if ( webapp . exists ( ) && ! webapp . canRead ( ) ) { // It means that the server cannot read files at all throw new InitException ( HttpHandlerImpl . class . getName ( ) + " cannot read files. Reason is unknown" ) ; } else if ( ! webapp . exists ( ) || collect == null || collect . isEmpty ( ) ) { // Whenever this is empty it might just be because someone forgot to add the ' webapp ' folder to the distribution // OR the framework is used without the need for serving files ( such as views ) . logger . error ( "HttpHandlerImpl did not find any files in webapp - not serving any files then" ) ; return exclusions ; } Set < String > resourcePaths = new TreeSet < > ( collect ) ; // servletContext . getResourcePaths ( " / " ) ; resourcePaths . removeIf ( path -> path . contains ( "-INF" ) || path . contains ( "-inf" ) ) ; // We still need to also remove the views folder from being processed by other handlers resourcePaths . removeIf ( path -> path . contains ( TemplateEngine . TEMPLATES_FOLDER ) ) ; // Add the remaining paths to exclusions for ( String path : resourcePaths ) { // add leading slash if ( path . charAt ( 0 ) != '/' ) path = '/' + path ; // remove the last slash if ( path . charAt ( path . length ( ) - 1 ) == '/' ) path = path . substring ( 0 , path . length ( ) - 1 ) ; exclusions . add ( path ) ; } return exclusions ;
public class BandImageDataImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setDATA ( byte [ ] newDATA ) { } }
byte [ ] oldDATA = data ; data = newDATA ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . BAND_IMAGE_DATA__DATA , oldDATA , data ) ) ;
public class ComapiChatClient { /** * Method to close the client state , won ' t be usable anymore . Useful e . g . for unit testing . * @ param context Context . */ public void close ( Context context ) { } }
client . clean ( context . getApplicationContext ( ) ) ; if ( db != null ) { db . closeDatabase ( ) ; }
public class CmsJspContentLoadBean { /** * Initialize this instance . < p > * @ param cms the OpenCms context of the current user * @ param locale the Locale to use when accessing the content * @ param content the content to access , must contain Object of type { @ link CmsResource } */ public void init ( CmsObject cms , Locale locale , List < CmsResource > content ) { } }
m_cms = cms ; m_locale = locale ; m_content = convertResourceList ( m_cms , m_locale , content ) ;
public class DefaultDataGridStateCodec { /** * Decode a Map of URL parameters . This method will convert a complete set of URL parameters into several * buckets including the sorts , filters , and paging information for the data grid name associated with this * state codec . In addition , a bucket of ' other ' parameters is also collected which are the ones that * were in the current request URL and should be maintained on all generated URLs . * @ param parameters the list of parameters to decode */ private void decode ( Map parameters ) { } }
_decoded = true ; String namespacePrefix = getGridName ( ) + ";" ; Iterator keys = parameters . keySet ( ) . iterator ( ) ; while ( keys . hasNext ( ) ) { String key = ( String ) keys . next ( ) ; String [ ] values = ( String [ ] ) parameters . get ( key ) ; if ( key . equals ( PARAM_KEY_SORT ) ) { List sorts = null ; for ( int i = 0 ; i < values . length ; i ++ ) { String value = values [ i ] ; if ( value . startsWith ( namespacePrefix ) ) sorts = decodeSort ( value ) ; else addParam ( key , value ) ; } SortModel sortModel = _config . createSortModel ( sorts ) ; _state . setSortModel ( sortModel ) ; } else if ( key . equals ( PARAM_KEY_FILTER ) ) { List filters = null ; for ( int i = 0 ; i < values . length ; i ++ ) { String value = values [ i ] ; if ( value . startsWith ( namespacePrefix ) ) filters = decodeFilter ( value ) ; else addParam ( key , value ) ; } FilterModel filterModel = _config . createFilterModel ( filters ) ; _state . setFilterModel ( filterModel ) ; } else if ( key . equals ( PARAM_KEY_ROW ) ) { int row = DEFAULT_ROW ; for ( int i = 0 ; i < values . length ; i ++ ) { String value = values [ i ] ; if ( value . startsWith ( namespacePrefix ) ) row = decodeRow ( value ) . intValue ( ) ; else addParam ( key , value ) ; } PagerModel pagerModel = _state . getPagerModel ( ) ; if ( pagerModel == null ) { pagerModel = _config . createPagerModel ( ) ; _state . setPagerModel ( pagerModel ) ; } pagerModel . setRow ( row ) ; } else if ( key . equals ( PARAM_KEY_PAGE_SIZE ) ) { int pageSize = DEFAULT_PAGE_SIZE ; for ( int i = 0 ; i < values . length ; i ++ ) { String value = values [ i ] ; if ( value . startsWith ( namespacePrefix ) ) pageSize = decodeRow ( value ) . intValue ( ) ; else addParam ( key , value ) ; } PagerModel pagerModel = _state . getPagerModel ( ) ; if ( pagerModel == null ) { pagerModel = _config . createPagerModel ( ) ; _state . setPagerModel ( pagerModel ) ; } pagerModel . setPageSize ( pageSize ) ; } else if ( key . startsWith ( InternalConstants . ACTION_OVERRIDE_PREFIX ) ) { // discard the param } else addParam ( key , values ) ; } /* ensure that there is something created for the grid state model objects */ if ( _state . getSortModel ( ) == null ) _state . setSortModel ( _config . createSortModel ( null ) ) ; if ( _state . getFilterModel ( ) == null ) _state . setFilterModel ( _config . createFilterModel ( null ) ) ; if ( _state . getPagerModel ( ) == null ) _state . setPagerModel ( _config . createPagerModel ( ) ) ;
public class HashMapJsonDeserializer { /** * < p > newInstance < / p > * @ param keyDeserializer { @ link KeyDeserializer } used to deserialize the keys . * @ param valueDeserializer { @ link JsonDeserializer } used to deserialize the values . * @ param < K > Type of the keys inside the { @ link HashMap } * @ param < V > Type of the values inside the { @ link HashMap } * @ return a new instance of { @ link HashMapJsonDeserializer } */ public static < K , V > HashMapJsonDeserializer < K , V > newInstance ( KeyDeserializer < K > keyDeserializer , JsonDeserializer < V > valueDeserializer ) { } }
return new HashMapJsonDeserializer < K , V > ( keyDeserializer , valueDeserializer ) ;
public class servicegroup { /** * Use this API to fetch all the servicegroup resources that are configured on netscaler . * This uses servicegroup _ args which is a way to provide additional arguments while fetching the resources . */ public static servicegroup [ ] get ( nitro_service service , servicegroup_args args ) throws Exception { } }
servicegroup obj = new servicegroup ( ) ; options option = new options ( ) ; option . set_args ( nitro_util . object_to_string_withoutquotes ( args ) ) ; servicegroup [ ] response = ( servicegroup [ ] ) obj . get_resources ( service , option ) ; return response ;
public class Validation { /** * method to valid all existent connections in the Notation objects * @ param helm2notation * HELM2Notation object * @ return true if all connections are valid , false otherwise * @ throws NotationException * if notation is not valid * @ throws ChemistryException * if the Chemistry Engine can not be initialized */ public static boolean validateConnections ( HELM2Notation helm2notation ) throws NotationException , ChemistryException { } }
try { LOG . info ( "Validation of Connection section starts" ) ; List < ConnectionNotation > listConnections = helm2notation . getListOfConnections ( ) ; List < String > listPolymerIDs = helm2notation . getPolymerAndGroupingIDs ( ) ; /* Hash - Map to save only specific InterConnections */ InterConnections interconnection = new InterConnections ( ) ; boolean specific = true ; /* check for each single connection */ for ( ConnectionNotation connection : listConnections ) { /* check polymer ids */ checkPolymerIDSConnection ( connection , listPolymerIDs ) ; /* check for unspecific interaction */ if ( connection . getSourceId ( ) instanceof GroupEntity || connection . getTargetId ( ) instanceof GroupEntity ) { specific = false ; } /* check Monomers : - > can be number */ PolymerNotation source = helm2notation . getPolymerNotation ( connection . getSourceId ( ) . getId ( ) ) ; String sourceUnit = connection . getSourceUnit ( ) ; PolymerNotation target = helm2notation . getPolymerNotation ( connection . getTargetId ( ) . getId ( ) ) ; String targetUnit = connection . getTargetUnit ( ) ; /* check for specific interactions */ if ( isConnectionSpecific ( connection ) && specific ) { /* * interaction seems to be specific : it is given in number * - > place of monomer */ /* Get Monomers */ specific = true ; int occurenceOne = Integer . parseInt ( sourceUnit ) ; int occurenceTwo = Integer . parseInt ( targetUnit ) ; /* * if the monomers are a group or a list of monomers - > is * it no more specific */ /* can the two form a connection */ List < Monomer > listMonomersOne ; listMonomersOne = getAllMonomers ( source . getMonomerNotation ( occurenceOne ) , occurenceOne ) ; List < Monomer > listMonomersTwo = getAllMonomers ( target . getMonomerNotation ( occurenceTwo ) , occurenceTwo ) ; /* check each single Attachment */ checkAttachment ( listMonomersOne , listMonomersTwo , connection , helm2notation , interconnection , specific ) ; } /* Unspecific Interaction */ else { List < Integer > listMonomerOccurencesOne = getOccurencesOfMonomerNotation ( sourceUnit , connection . getSourceId ( ) , helm2notation ) ; List < Integer > listMonomerOccurencesTwo = getOccurencesOfMonomerNotation ( targetUnit , connection . getTargetId ( ) , helm2notation ) ; /* ? - section has to be included */ if ( listMonomerOccurencesOne . isEmpty ( ) ) { for ( Integer occurenceTwo : listMonomerOccurencesTwo ) { List < Monomer > listMonomersTwo = getAllMonomers ( target . getMonomerNotation ( occurenceTwo ) , occurenceTwo ) ; checkSingleAttachment ( listMonomersTwo , connection . getrGroupTarget ( ) , helm2notation , connection , interconnection , connection . getTargetId ( ) . getId ( ) ) ; } } for ( Integer occurenceOne : listMonomerOccurencesOne ) { /* get Monomers */ List < Monomer > listMonomersOne = getAllMonomers ( source . getMonomerNotation ( occurenceOne ) , occurenceOne ) ; checkSingleAttachment ( listMonomersOne , connection . getrGroupSource ( ) , helm2notation , connection , interconnection , connection . getSourceId ( ) . getId ( ) ) ; /* check single attachment */ for ( Integer occurenceTwo : listMonomerOccurencesTwo ) { List < Monomer > listMonomersTwo = getAllMonomers ( target . getMonomerNotation ( occurenceTwo ) , occurenceTwo ) ; checkSingleAttachment ( listMonomersTwo , connection . getrGroupTarget ( ) , helm2notation , connection , interconnection , connection . getTargetId ( ) . getId ( ) ) ; checkAttachment ( listMonomersOne , listMonomersTwo , connection , helm2notation , interconnection , false ) ; } } } } return true ; } catch ( PolymerIDsException | AttachmentException | HELM2HandledException | MonomerException | IOException | org . helm . notation2 . parser . exceptionparser . NotationException | CTKException e ) { e . printStackTrace ( ) ; LOG . info ( e . getMessage ( ) ) ; return false ; }
public class ArrayUtil { /** * Determines if the array has a null column for any of the positions given * in the rowColMap array . */ public static boolean hasNull ( Object [ ] array , int [ ] columnMap ) { } }
int count = columnMap . length ; for ( int i = 0 ; i < count ; i ++ ) { if ( array [ columnMap [ i ] ] == null ) { return true ; } } return false ;
public class RuntimeTypeAdapterFactory { /** * Creates a new runtime type adapter using for { @ code baseType } using { @ code * typeFieldName } as the type field name . Type field names are case sensitive . * { @ code maintainType } flag decide if the type will be stored in pojo or not . */ public static < T > RuntimeTypeAdapterFactory < T > of ( Class < T > baseType , String typeFieldName , boolean maintainType ) { } }
return new RuntimeTypeAdapterFactory < T > ( baseType , typeFieldName , maintainType ) ;
public class AsyncExample { /** * tag : : url - manifest [ ] */ @ Route ( method = HttpMethod . GET , uri = "/manifest" ) public Result manifest ( ) throws MalformedURLException { } }
URL manifest = this . getClass ( ) . getClassLoader ( ) . getResource ( "/META-INF/MANIFEST.MF" ) ; return ok ( manifest ) . as ( MimeTypes . TEXT ) ;
public class QrCodeUtil { /** * 生成二维码或条形码图片 * @ param content 文本内容 * @ param format 格式 , 可选二维码或者条形码 * @ param width 宽度 * @ param height 高度 * @ return 二维码图片 ( 黑白 ) */ public static BufferedImage generate ( String content , BarcodeFormat format , int width , int height ) { } }
return generate ( content , format , new QrConfig ( width , height ) ) ;
public class GoogleAccount { /** * Creates one single calendar with the given name and style . * @ param name The name of the calendar . * @ param style The style of the calendar . * @ return The new google calendar . */ public final GoogleCalendar createCalendar ( String name , Calendar . Style style ) { } }
GoogleCalendar calendar = new GoogleCalendar ( ) ; calendar . setName ( name ) ; calendar . setStyle ( style ) ; return calendar ;
public class JsonFormat { /** * Converts an object into a JSON - compatible object . */ public < T > Object writeObject ( final T object , final DataTypeDescriptor < T > descriptor ) { } }
try { return objectFormat . write ( object , descriptor ) ; } catch ( Exception e ) { throw propagate ( e ) ; }
public class ManagementModule { /** * { @ inheritDoc } */ @ Override public String ingest ( Context context , InputStream serialization , String logMessage , String format , String encoding , String pid ) throws ServerException { } }
return mgmt . ingest ( context , serialization , logMessage , format , encoding , pid ) ;
public class BitStrings { /** * 比较两个等长字符串的每一位 , 相或 < br > * 适用于仅含有1和0的字符串 . * @ param first a { @ link java . lang . String } object . * @ param second a { @ link java . lang . String } object . * @ return a { @ link java . lang . String } object . */ public static String or ( final String first , final String second ) { } }
final StringBuilder buffer = new StringBuilder ( ) ; for ( int i = 0 ; i < first . length ( ) ; i ++ ) { if ( '0' == first . charAt ( i ) && '0' == second . charAt ( i ) ) { buffer . append ( '0' ) ; } else { buffer . append ( '1' ) ; } } return buffer . toString ( ) ;
public class ParenthesizedCondition { /** * Returns a parenthesized condition for the given condition if the given * condition is not already a parenthesized condition ; or the original * condition otherwise . */ public static ParenthesizedCondition getInstance ( Condition condition ) { } }
return condition instanceof ParenthesizedCondition ? ( ParenthesizedCondition ) condition : new ParenthesizedCondition ( condition ) ;
public class FileBytes { /** * Maps a portion of the randomAccessFile into memory and returns a { @ link UnsafeMappedBytes } instance . * @ param offset The offset from which to map the randomAccessFile into memory . * @ param size The count of the bytes to map into memory . * @ param mode The mode in which to map the randomAccessFile into memory . * @ return The mapped bytes . * @ throws IllegalArgumentException If { @ code count } is greater than the maximum allowed * { @ link java . nio . MappedByteBuffer } count : { @ link Integer # MAX _ VALUE } */ public MappedBytes map ( int offset , int size , FileChannel . MapMode mode ) { } }
MappedByteBuffer mappedByteBuffer = mapFile ( randomAccessFile , offset , size , mode ) ; return new MappedBytes ( file , randomAccessFile , mappedByteBuffer , mode ) ;
public class MultiObserverImpl { /** * Called when an event is received that does not have an onNext method definition * in TSubCls . Override in TSubClas to handle the error . * @ param event A reference to an object which is an event not handled by TSubCls . * @ param < TEvent > The type of the event being processed . */ private < TEvent > void unimplemented ( final long identifier , final TEvent event ) { } }
LOG . log ( Level . SEVERE , "Unimplemented event: [{0}]: {1}" , new Object [ ] { identifier , event } ) ; throw new RuntimeException ( "Event not supported: " + event ) ;