signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Messenger { /** * Starting new group call
* @ param gid group you want to call
* @ return command to execute */
@ ObjectiveCName ( "doCallWithGid:" ) public Command < Long > doGroupCall ( int gid ) { } } | return modules . getCallsModule ( ) . makeCall ( Peer . group ( gid ) , false ) ; |
public class UUIDSet { /** * 解析如下格式字符串为Interval : 1 = > Interval { start : 1 , stop : 2 } 1-3 = >
* Interval { start : 1 , stop : 4 } 注意 ! 字符串格式表达时 [ n , m ] 是两侧都包含的 , Interval表达时 [ n , m ) 右侧开
* @ param str
* @ return */
public static Interval parseInterval ( String str ) { } } | String [ ] ss = str . split ( "-" ) ; Interval interval = new Interval ( ) ; switch ( ss . length ) { case 1 : interval . start = Long . parseLong ( ss [ 0 ] ) ; interval . stop = interval . start + 1 ; break ; case 2 : interval . start = Long . parseLong ( ss [ 0 ] ) ; interval . stop = Long . parseLong ( ss [ 1 ] ) + 1 ; break ; default : throw new RuntimeException ( String . format ( "parseInterval failed due to wrong format: %s" , str ) ) ; } return interval ; |
public class ScriptRunner { /** * Invokes the specified < code > Task < / code > with the specified
* < code > TaskRequest < / code > and returns the < code > RETURN _ VALUE < / code > .
* Use this overload of the < code > evaluate < / code > method if you need to
* pre - load information into the < code > TaskRequest < / code > .
* @ param k A fully - bootstrapped < code > Task < / code > object .
* @ param req A < code > TaskRequest < / code > prepared externally .
* @ return The < code > RETURN _ VALUE < / code > of the specified task . */
public Object evaluate ( Task k , TaskRequest req ) { } } | return evaluate ( k , req , new RuntimeRequestResponse ( ) ) ; |
public class ServerParams { /** * Get the parameters defined for the given module in the given parameter map . This
* method first attempts to load the class information for the given module . If it
* cannot be loaded , an IllegalArgumentException is thrown . Otherwise , it searches the
* given map for parameters defined for the module whose name matches the given class ' s
* " simple name " . It also searches for and adds " inherited " parameters belonging to its
* superclasses . For example , assume the class hierarchy :
* < pre >
* ThriftService extends CassandraService extends DBService
* < / pre >
* A method called for the ThriftService module searches the given paramMap for
* parameters defined for ThriftService , CassandraService , or DBService and merges
* them into a single map . If a parameter is defined at multiple levels , the
* lowest - level value is used . If no parameters are found for the given module class
* its superclasses , null is returned .
* @ param modulePackageName
* Full module package name . Example : " com . dell . doradus . db . thrift . ThriftService " .
* @ param paramMap
* Parameter map to search . This map should use the same module / parameter format
* as the ServerParams class .
* @ return
* Module ' s direct and inherited parameters or null if none are found . */
@ SuppressWarnings ( "unchecked" ) public static Map < String , Object > getAllModuleParams ( String modulePackageName , Map < String , Object > paramMap ) { } } | Map < String , Object > result = new HashMap < > ( ) ; try { Class < ? > moduleClass = Class . forName ( modulePackageName ) ; while ( ! moduleClass . getSimpleName ( ) . equals ( "Object" ) ) { Map < String , Object > moduleParams = ( Map < String , Object > ) paramMap . get ( moduleClass . getSimpleName ( ) ) ; if ( moduleParams != null ) { for ( String paramName : moduleParams . keySet ( ) ) { if ( ! result . containsKey ( paramName ) ) { result . put ( paramName , moduleParams . get ( paramName ) ) ; } } } moduleClass = moduleClass . getSuperclass ( ) ; } } catch ( Exception e ) { throw new IllegalArgumentException ( "Could not locate class '" + modulePackageName + "'" , e ) ; } return result . size ( ) == 0 ? null : result ; |
public class CryptoUtil { /** * A utility method to encrypt the value of field marked by the @ Secret annotation using its
* setter / mutator method .
* @ param object the actual Object representing the POJO we want the Id of .
* @ param cmd the CollectionMetaData object from which we can obtain the list
* containing names of fields which have the @ Secret annotation
* @ param cipher the actual cipher implementation to use
* @ throws IllegalAccessException Error when invoking method for a @ Secret annotated field due to permissions
* @ throws IllegalArgumentException Error when invoking method for a @ Secret annotated field due to wrong arguments
* @ throws InvocationTargetException Error when invoking method for a @ Secret annotated field , the method threw a exception */
public static void encryptFields ( Object object , CollectionMetaData cmd , ICipher cipher ) throws IllegalAccessException , IllegalArgumentException , InvocationTargetException { } } | for ( String secretAnnotatedFieldName : cmd . getSecretAnnotatedFieldNames ( ) ) { Method getterMethod = cmd . getGetterMethodForFieldName ( secretAnnotatedFieldName ) ; Method setterMethod = cmd . getSetterMethodForFieldName ( secretAnnotatedFieldName ) ; String value ; String encryptedValue = null ; try { value = ( String ) getterMethod . invoke ( object ) ; if ( null != value ) { encryptedValue = cipher . encrypt ( value ) ; setterMethod . invoke ( object , encryptedValue ) ; } } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { logger . error ( "Error when invoking method for a @Secret annotated field" , e ) ; throw e ; } } |
public class OptionalHeader { /** * Checks if image base is too large or zero and relocates it accordingly .
* Otherwise the usual image base is returned .
* see : @ see < a
* href = " https : / / code . google . com / p / corkami / wiki / PE # ImageBase " > corkami < / a >
* @ return relocated image base */
public long getRelocatedImageBase ( ) { } } | long imageBase = get ( WindowsEntryKey . IMAGE_BASE ) ; long sizeOfImage = get ( WindowsEntryKey . SIZE_OF_IMAGE ) ; if ( imageBase + sizeOfImage >= 0x80000000L || imageBase == 0L ) { return 0x10000L ; } return imageBase ; |
public class FXBinder { /** * Start point of the fluent API to create a binding .
* @ param property the Dolphin Platform property
* @ return binder that can be used by the fluent API to create binding . */
public static NumericDolphinBinder < Long > bindLong ( Property < Long > property ) { } } | requireNonNull ( property , "property" ) ; return new LongDolphinBinder ( property ) ; |
public class BasicUserProfile { /** * Add permissions .
* @ param permissions the permissions to add . */
@ Override public void addPermissions ( final Collection < String > permissions ) { } } | CommonHelper . assertNotNull ( "permissions" , permissions ) ; this . permissions . addAll ( permissions ) ; |
public class CmsResourceUtil { /** * Returns < code > true < / code > if the given resource is editable by the current user . < p >
* Returns < code > false < / code > if no request context is set . < p >
* @ return < code > true < / code > if the given resource is editable by the current user */
public boolean isEditable ( ) { } } | if ( m_request == null ) { return false ; } CmsExplorerTypeSettings settings = OpenCms . getWorkplaceManager ( ) . getExplorerTypeSetting ( getResourceTypeName ( ) ) ; if ( settings != null ) { String rightSite = OpenCms . getSiteManager ( ) . getSiteRoot ( getResource ( ) . getRootPath ( ) ) ; if ( rightSite == null ) { rightSite = "" ; } String currentSite = getCms ( ) . getRequestContext ( ) . getSiteRoot ( ) ; try { getCms ( ) . getRequestContext ( ) . setSiteRoot ( rightSite ) ; return settings . isEditable ( getCms ( ) , getResource ( ) ) ; } finally { getCms ( ) . getRequestContext ( ) . setSiteRoot ( currentSite ) ; } } return false ; |
public class VorbisFile { /** * In Reading mode , will close the underlying ogg
* file and free its resources .
* In Writing mode , will write out the Info , Comments
* and Setup objects , and then the audio data . */
public void close ( ) throws IOException { } } | if ( r != null ) { r = null ; ogg . close ( ) ; ogg = null ; } if ( w != null ) { w . bufferPacket ( info . write ( ) , true ) ; w . bufferPacket ( comment . write ( ) , false ) ; w . bufferPacket ( setup . write ( ) , true ) ; long lastGranule = 0 ; for ( VorbisAudioData vd : writtenPackets ) { // Update the granule position as we go
if ( vd . getGranulePosition ( ) >= 0 && lastGranule != vd . getGranulePosition ( ) ) { w . flush ( ) ; lastGranule = vd . getGranulePosition ( ) ; w . setGranulePosition ( lastGranule ) ; } // Write the data , flushing if needed
w . bufferPacket ( vd . write ( ) ) ; if ( w . getSizePendingFlush ( ) > 16384 ) { w . flush ( ) ; } } w . close ( ) ; w = null ; ogg . close ( ) ; ogg = null ; } |
public class InternalPureXbaseParser { /** * InternalPureXbase . g : 6853:1 : ruleQualifiedNameInStaticImport returns [ AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken ( ) ] : ( this _ ValidID _ 0 = ruleValidID kw = ' . ' ) + ; */
public final AntlrDatatypeRuleToken ruleQualifiedNameInStaticImport ( ) throws RecognitionException { } } | AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken ( ) ; Token kw = null ; AntlrDatatypeRuleToken this_ValidID_0 = null ; enterRule ( ) ; try { // InternalPureXbase . g : 6859:2 : ( ( this _ ValidID _ 0 = ruleValidID kw = ' . ' ) + )
// InternalPureXbase . g : 6860:2 : ( this _ ValidID _ 0 = ruleValidID kw = ' . ' ) +
{ // InternalPureXbase . g : 6860:2 : ( this _ ValidID _ 0 = ruleValidID kw = ' . ' ) +
int cnt124 = 0 ; loop124 : do { int alt124 = 2 ; int LA124_0 = input . LA ( 1 ) ; if ( ( LA124_0 == RULE_ID ) ) { int LA124_2 = input . LA ( 2 ) ; if ( ( LA124_2 == 54 ) ) { alt124 = 1 ; } } switch ( alt124 ) { case 1 : // InternalPureXbase . g : 6861:3 : this _ ValidID _ 0 = ruleValidID kw = ' . '
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getQualifiedNameInStaticImportAccess ( ) . getValidIDParserRuleCall_0 ( ) ) ; } pushFollow ( FOLLOW_76 ) ; this_ValidID_0 = ruleValidID ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( this_ValidID_0 ) ; } if ( state . backtracking == 0 ) { afterParserOrEnumRuleCall ( ) ; } kw = ( Token ) match ( input , 54 , FOLLOW_83 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current . merge ( kw ) ; newLeafNode ( kw , grammarAccess . getQualifiedNameInStaticImportAccess ( ) . getFullStopKeyword_1 ( ) ) ; } } break ; default : if ( cnt124 >= 1 ) break loop124 ; if ( state . backtracking > 0 ) { state . failed = true ; return current ; } EarlyExitException eee = new EarlyExitException ( 124 , input ) ; throw eee ; } cnt124 ++ ; } while ( true ) ; } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class BuildStepsInner { /** * Creates a build step for a build task .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param buildTaskName The name of the container registry build task .
* @ param stepName The name of a build step for a container registry build task .
* @ param properties The properties of a build step .
* @ 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 BuildStepInner object if successful . */
public BuildStepInner create ( String resourceGroupName , String registryName , String buildTaskName , String stepName , BuildStepProperties properties ) { } } | return createWithServiceResponseAsync ( resourceGroupName , registryName , buildTaskName , stepName , properties ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class DefaultHistoryService { /** * ~ Methods * * * * * */
@ Override @ Transactional public void deleteExpiredHistory ( ) { } } | requireNotDisposed ( ) ; try { int deletedCount = History . deleteExpiredHistory ( emf . get ( ) ) ; _logger . info ( "Deleted {} expired job history records." , deletedCount ) ; } catch ( Exception ex ) { _logger . warn ( "Couldn't delete expired job history : {}" , ex . getMessage ( ) ) ; } |
public class BMPCLocalManager { /** * Check if Local BrowserMob Proxy is running .
* @ return " true " if Local BrowserMob Proxy is running . */
public synchronized boolean isRunning ( ) { } } | if ( null == process ) return false ; try { process . exitValue ( ) ; return false ; } catch ( IllegalThreadStateException itse ) { return true ; } |
public class OWLSameIndividualAxiomImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } .
* @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the
* object ' s content from
* @ param instance the object instance to deserialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the deserialization operation is not
* successful */
@ Override public void deserializeInstance ( SerializationStreamReader streamReader , OWLSameIndividualAxiomImpl instance ) throws SerializationException { } } | deserialize ( streamReader , instance ) ; |
public class ConstructorGenericsContext { /** * { @ code < T extends Serializable > Some ( T arg ) ; } .
* < pre > { @ code context . constructor ( Some . class . getConstructor ( Object . class ) ) . constructorGenericTypes ( ) = =
* [ Class < Serializable > ] } < / pre >
* @ return current constructor generics types */
public List < Type > constructorGenericTypes ( ) { } } | return constructorGenerics . isEmpty ( ) ? Collections . < Type > emptyList ( ) : new ArrayList < Type > ( constructorGenerics . values ( ) ) ; |
public class SimpleMonthView { /** * Called when the user clicks on a day . Handles callbacks to the
* { @ link OnDayClickListener } if one is set .
* @ param day A time object representing the day that was clicked */
private void onDayClick ( CalendarDay day ) { } } | if ( mOnDayClickListener != null ) { mOnDayClickListener . onDayClick ( this , day ) ; } // This is a no - op if accessibility is turned off .
mNodeProvider . sendEventForItem ( day , AccessibilityEvent . TYPE_VIEW_CLICKED ) ; |
public class AbstractDb { /** * 结果的条目数
* @ param where 查询条件
* @ return 复合条件的结果数
* @ throws SQLException SQL执行异常 */
public int count ( Entity where ) throws SQLException { } } | Connection conn = null ; try { conn = this . getConnection ( ) ; return runner . count ( conn , where ) ; } catch ( SQLException e ) { throw e ; } finally { this . closeConnection ( conn ) ; } |
public class Container { /** * Add a server event listener .
* @ param listener ComponentEventListener or LifeCycleEventListener */
public void addEventListener ( EventListener listener ) throws IllegalArgumentException { } } | if ( _eventListeners == null ) _eventListeners = new ArrayList ( ) ; if ( listener instanceof ComponentListener || listener instanceof LifeCycleListener ) { if ( log . isDebugEnabled ( ) ) log . debug ( "addEventListener: " + listener ) ; _eventListeners = LazyList . add ( _eventListeners , listener ) ; } |
public class ServletAsyncSpec { /** * Create an async spec with 99999 ( debug mode ) or 30 ( production ) seconds
* timeout and no async listeners .
* @ return A new { @ link ServletAsyncSpec } and never < code > null < / code > . */
@ Nonnull public static ServletAsyncSpec createAsyncDefault ( ) { } } | return createAsync ( GlobalDebug . isDebugMode ( ) ? 999_999 * CGlobal . MILLISECONDS_PER_SECOND : 30 * CGlobal . MILLISECONDS_PER_SECOND , null ) ; |
public class EnvironmentClassLoader { /** * Adds a listener to detect environment lifecycle changes . */
public void removeListener ( EnvLoaderListener listener ) { } } | super . removeListener ( listener ) ; ArrayList < EnvLoaderListener > listeners = _listeners ; if ( _listeners == null ) return ; synchronized ( listeners ) { for ( int i = listeners . size ( ) - 1 ; i >= 0 ; i -- ) { EnvLoaderListener oldListener = listeners . get ( i ) ; if ( listener == oldListener ) { listeners . remove ( i ) ; return ; } else if ( oldListener == null ) { listeners . remove ( i ) ; } } } |
public class SgMethod { /** * Returns the name of the method ( first character upper case ) and the
* argument types divided by by an underscore .
* @ return Method name and argument types ( like
* " MethodXY _ String _ int _ boolean " ) . */
public final String getUnderscoredNameAndTypes ( ) { } } | final StringBuffer sb = new StringBuffer ( ) ; sb . append ( SgUtils . firstCharUpper ( getName ( ) ) ) ; sb . append ( "_" ) ; for ( int i = 0 ; i < getArguments ( ) . size ( ) ; i ++ ) { if ( i > 0 ) { sb . append ( "_" ) ; } final SgArgument arg = getArguments ( ) . get ( i ) ; final String typeName = arg . getType ( ) . getSimpleName ( ) ; sb . append ( SgUtils . replace ( typeName , "[]" , "ARRAY" , - 1 ) ) ; } return sb . toString ( ) ; |
public class SessionController { /** * Action called to clear the session */
@ Route ( method = HttpMethod . POST , uri = "/session/clear" ) public Result clear ( ) { } } | session ( ) . clear ( ) ; return redirect ( router . getReverseRouteFor ( this , "index" ) ) ; |
public class SignalServiceMessageSender { /** * Send a message to a group .
* @ param recipients The group members .
* @ param message The group message .
* @ throws IOException */
public List < SendMessageResult > sendMessage ( List < SignalServiceAddress > recipients , List < Optional < UnidentifiedAccessPair > > unidentifiedAccess , SignalServiceDataMessage message ) throws IOException , UntrustedIdentityException { } } | byte [ ] content = createMessageContent ( message ) ; long timestamp = message . getTimestamp ( ) ; List < SendMessageResult > results = sendMessage ( recipients , getTargetUnidentifiedAccess ( unidentifiedAccess ) , timestamp , content , false ) ; boolean needsSyncInResults = false ; for ( SendMessageResult result : results ) { if ( result . getSuccess ( ) != null && result . getSuccess ( ) . isNeedsSync ( ) ) { needsSyncInResults = true ; break ; } } if ( needsSyncInResults || ( isMultiDevice . get ( ) ) ) { byte [ ] syncMessage = createMultiDeviceSentTranscriptContent ( content , Optional . < SignalServiceAddress > absent ( ) , timestamp , results ) ; sendMessage ( localAddress , Optional . < UnidentifiedAccess > absent ( ) , timestamp , syncMessage , false ) ; } return results ; |
public class ExpressionColumn { /** * Append the names of all the elements in the set of resolutions to the
* string buffer . This is only used for error messages . */
private < T > void appendNameList ( StringBuffer sb , java . util . Set < T > resolutions , String sep ) { } } | for ( T oneRes : resolutions ) { sb . append ( sep ) . append ( oneRes . toString ( ) ) ; sep = ", " ; } |
public class ArrayHeap { /** * Remove the last element of the heap ( last in the index array ) .
* Do not call this on other entries ; the last entry is only passed
* in for efficiency .
* @ param entry the last entry in the array */
private void removeLast ( HeapEntry < E > entry ) { } } | indexToEntry . remove ( entry . index ) ; objectToEntry . remove ( entry . object ) ; |
public class DescribeSubscriptionFiltersResult { /** * The subscription filters .
* @ return The subscription filters . */
public java . util . List < SubscriptionFilter > getSubscriptionFilters ( ) { } } | if ( subscriptionFilters == null ) { subscriptionFilters = new com . amazonaws . internal . SdkInternalList < SubscriptionFilter > ( ) ; } return subscriptionFilters ; |
public class WhileyFileParser { /** * Parse a range expression , which has the form :
* < pre >
* RangeExpr : : = Expr " . . " Expr
* < / pre >
* @ param scope
* The enclosing scope for this statement , which determines the
* set of visible ( i . e . declared ) variables and also the current
* indentation level .
* @ param terminated
* This indicates that the expression is known to be terminated
* ( or not ) . An expression that ' s known to be terminated is one
* which is guaranteed to be followed by something . This is
* important because it means that we can ignore any newline
* characters encountered in parsing this expression , and that
* we ' ll never overrun the end of the expression ( i . e . because
* there ' s guaranteed to be something which terminates this
* expression ) . A classic situation where terminated is true is
* when parsing an expression surrounded in braces . In such case ,
* we know the right - brace will always terminate this expression .
* @ return */
private Expr parseRangeExpression ( EnclosingScope scope , boolean terminated ) { } } | int start = index ; Expr lhs = parseAdditiveExpression ( scope , true ) ; match ( DotDot ) ; Expr rhs = parseAdditiveExpression ( scope , true ) ; Expr range = new Expr . ArrayRange ( Type . Void , lhs , rhs ) ; return annotateSourceLocation ( range , start ) ; |
public class AbstractCLA { /** * createCamelCapVersionOfKeyword .
* @ param _ keyword a { @ link java . lang . String } object .
* @ return a { @ link java . lang . String } object . */
static public String createCamelCapVersionOfKeyword ( final String _keyword ) { } } | if ( _keyword == null || _keyword . trim ( ) . length ( ) == 0 ) return null ; final StringBuilder sb = new StringBuilder ( ) ; if ( Character . isLowerCase ( _keyword . charAt ( 0 ) ) ) sb . append ( Character . toUpperCase ( _keyword . charAt ( 0 ) ) ) ; final Matcher matcher = CAMELCAPS . matcher ( _keyword ) ; while ( matcher . find ( ) ) sb . append ( matcher . group ( ) ) ; return sb . toString ( ) ; |
public class Config { public static Long getPropertyLong ( Class < ? > aClass , String key , long aDefault ) { } } | return getSettings ( ) . getPropertyLong ( aClass , key , aDefault ) ; |
public class ProactiveDetectionConfigurationsInner { /** * Update the ProactiveDetection configuration for this configuration id .
* @ param resourceGroupName The name of the resource group .
* @ param resourceName The name of the Application Insights component resource .
* @ param configurationId The ProactiveDetection configuration ID . This is unique within a Application Insights component .
* @ param proactiveDetectionProperties Properties that need to be specified to update the ProactiveDetection configuration .
* @ 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 ApplicationInsightsComponentProactiveDetectionConfigurationInner object if successful . */
public ApplicationInsightsComponentProactiveDetectionConfigurationInner update ( String resourceGroupName , String resourceName , String configurationId , ApplicationInsightsComponentProactiveDetectionConfigurationInner proactiveDetectionProperties ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , resourceName , configurationId , proactiveDetectionProperties ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class RuleModel { /** * This will return the ActionInsertFact that a variable is bound to .
* @ param var The bound fact variable ( NOT bound field ) .
* @ return null or the ActionInsertFact found . */
public ActionInsertFact getRHSBoundFact ( final String var ) { } } | if ( this . rhs == null ) { return null ; } for ( int i = 0 ; i < this . rhs . length ; i ++ ) { if ( this . rhs [ i ] instanceof ActionInsertFact ) { final ActionInsertFact p = ( ActionInsertFact ) this . rhs [ i ] ; if ( p . getBoundName ( ) != null && var . equals ( p . getBoundName ( ) ) ) { return p ; } } } return null ; |
public class SerializationUtils { /** * Decode and serialize object .
* @ param < T > the type parameter
* @ param object the object
* @ param cipher the cipher
* @ param type the type
* @ param parameters the parameters
* @ return the t
* @ since 4.2 */
@ SneakyThrows public static < T extends Serializable > T decodeAndDeserializeObject ( final byte [ ] object , final CipherExecutor cipher , final Class < T > type , final Object [ ] parameters ) { } } | val decoded = ( byte [ ] ) cipher . decode ( object , parameters ) ; return deserializeAndCheckObject ( decoded , type ) ; |
public class StructuredQueryBuilder { /** * Matches an element , attribute , JSON property , or field
* that has at least one of the criteria words .
* @ param index the word container
* @ param words the possible words to match
* @ return the StructuredQueryDefinition for the word query */
public StructuredQueryDefinition word ( TextIndex index , String ... words ) { } } | return new WordQuery ( index , null , null , null , words ) ; |
public class MapReduceServletImpl { /** * Handle POST http requests . */
public static void doPost ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } } | String handler = getHandler ( request ) ; if ( handler . startsWith ( CONTROLLER_PATH ) ) { if ( ! checkForTaskQueue ( request , response ) ) { return ; } new ShardedJobRunner < > ( ) . completeShard ( checkNotNull ( request . getParameter ( JOB_ID_PARAM ) , "Null job id" ) , checkNotNull ( request . getParameter ( TASK_ID_PARAM ) , "Null task id" ) ) ; } else if ( handler . startsWith ( WORKER_PATH ) ) { if ( ! checkForTaskQueue ( request , response ) ) { return ; } new ShardedJobRunner < > ( ) . runTask ( checkNotNull ( request . getParameter ( JOB_ID_PARAM ) , "Null job id" ) , checkNotNull ( request . getParameter ( TASK_ID_PARAM ) , "Null task id" ) , Integer . parseInt ( request . getParameter ( SEQUENCE_NUMBER_PARAM ) ) ) ; } else if ( handler . startsWith ( COMMAND_PATH ) ) { if ( ! checkForAjax ( request , response ) ) { return ; } StatusHandler . handleCommand ( handler . substring ( COMMAND_PATH . length ( ) + 1 ) , request , response ) ; } else { throw new RuntimeException ( "Received an unknown MapReduce request handler. See logs for more detail." ) ; } |
public class PruneStructureFromSceneProjective { /** * Computes reprojection error for all features . Sorts the resulting residuals by magnitude .
* Prunes observations which have the largest errors first . After calling this function you should
* call { @ link # prunePoints ( int ) } and { @ link # pruneViews ( int ) } to ensure the scene is still valid .
* @ param inlierFraction Fraction of observations to keep . 0 to 1 . 1 = no change . 0 = everything is pruned . */
public void pruneObservationsByErrorRank ( double inlierFraction ) { } } | Point2D_F64 observation = new Point2D_F64 ( ) ; Point2D_F64 predicted = new Point2D_F64 ( ) ; Point3D_F64 X3 = new Point3D_F64 ( ) ; Point4D_F64 X4 = new Point4D_F64 ( ) ; // Create a list of observation errors
List < Errors > errors = new ArrayList < > ( ) ; for ( int viewIndex = 0 ; viewIndex < observations . views . length ; viewIndex ++ ) { SceneObservations . View v = observations . views [ viewIndex ] ; SceneStructureProjective . View view = structure . views [ viewIndex ] ; for ( int indexInView = 0 ; indexInView < v . point . size ; indexInView ++ ) { int pointID = v . point . data [ indexInView ] ; SceneStructureMetric . Point f = structure . points [ pointID ] ; // Get observation in image pixels
v . get ( indexInView , observation ) ; // Get feature location in world and predict the pixel observation
if ( structure . homogenous ) { f . get ( X4 ) ; PerspectiveOps . renderPixel ( view . worldToView , X4 , predicted ) ; } else { f . get ( X3 ) ; PerspectiveOps . renderPixel ( view . worldToView , X3 , predicted ) ; } Errors e = new Errors ( ) ; e . view = viewIndex ; e . pointIndexInView = indexInView ; e . error = predicted . distance2 ( observation ) ; errors . add ( e ) ; } } errors . sort ( Comparator . comparingDouble ( a -> a . error ) ) ; // Mark observations which are to be removed . Can ' t remove yet since the indexes will change
int index0 = ( int ) ( errors . size ( ) * inlierFraction + 0.5 ) ; for ( int i = index0 ; i < errors . size ( ) ; i ++ ) { Errors e = errors . get ( i ) ; SceneObservations . View v = observations . views [ e . view ] ; v . set ( e . pointIndexInView , Float . NaN , Float . NaN ) ; } // Remove all marked features
removeMarkedObservations ( ) ; |
public class GuicedResteasy { /** * Try to initialise a ServletContainerDispatcher with the connection to the Guice REST services */
protected void configure ( ServletContainerDispatcher dispatcher ) throws ServletException { } } | // Make sure we are registered with the Guice registry
registry . register ( this , true ) ; // Configure the dispatcher
final Registry resteasyRegistry ; final ResteasyProviderFactory providerFactory ; { final ResteasyRequestResponseFactory converter = new ResteasyRequestResponseFactory ( dispatcher ) ; dispatcher . init ( context , bootstrap , converter , converter ) ; if ( filterConfig != null ) dispatcher . getDispatcher ( ) . getDefaultContextObjects ( ) . put ( FilterConfig . class , filterConfig ) ; if ( servletConfig != null ) dispatcher . getDispatcher ( ) . getDefaultContextObjects ( ) . put ( ServletConfig . class , servletConfig ) ; resteasyRegistry = dispatcher . getDispatcher ( ) . getRegistry ( ) ; providerFactory = dispatcher . getDispatcher ( ) . getProviderFactory ( ) ; } // Register the REST provider classes
for ( Class < ? > providerClass : ResteasyProviderRegistry . getClasses ( ) ) { log . debug ( "Registering REST providers: " + providerClass . getName ( ) ) ; providerFactory . registerProvider ( providerClass ) ; } // Register the REST provider singletons
for ( Object provider : ResteasyProviderRegistry . getSingletons ( ) ) { log . debug ( "Registering REST provider singleton: " + provider ) ; providerFactory . registerProviderInstance ( provider ) ; } providerFactory . registerProviderInstance ( new LogReportMessageBodyReader ( ) ) ; // Register the JAXBContext provider
providerFactory . registerProviderInstance ( jaxbContextResolver ) ; // Register the exception mapper
{ // Register the ExceptionMapper for ApplicationException
providerFactory . register ( this . exceptionMapper ) ; log . trace ( "ExceptionMapper registered for ApplicationException" ) ; } // Register the REST resources
for ( RestResource resource : RestResourceRegistry . getResources ( ) ) { log . debug ( "Registering REST resource: " + resource . getResourceClass ( ) . getName ( ) ) ; resteasyRegistry . addResourceFactory ( new ResteasyGuiceResource ( injector , resource . getResourceClass ( ) ) ) ; } |
public class HostMessenger { /** * Generate a slot for the mailbox and put a noop box there . Can also
* supply a value */
public long generateMailboxId ( Long mailboxId ) { } } | final long hsId = mailboxId == null ? getHSIdForLocalSite ( m_nextSiteId . getAndIncrement ( ) ) : mailboxId ; addMailbox ( hsId , new Mailbox ( ) { @ Override public void send ( long hsId , VoltMessage message ) { } @ Override public void send ( long [ ] hsIds , VoltMessage message ) { } @ Override public void deliver ( VoltMessage message ) { networkLog . info ( "No-op mailbox(" + CoreUtils . hsIdToString ( hsId ) + ") dropped message " + message ) ; } @ Override public void deliverFront ( VoltMessage message ) { } @ Override public VoltMessage recv ( ) { return null ; } @ Override public VoltMessage recvBlocking ( ) { return null ; } @ Override public VoltMessage recvBlocking ( long timeout ) { return null ; } @ Override public VoltMessage recv ( Subject [ ] s ) { return null ; } @ Override public VoltMessage recvBlocking ( Subject [ ] s ) { return null ; } @ Override public VoltMessage recvBlocking ( Subject [ ] s , long timeout ) { return null ; } @ Override public long getHSId ( ) { return 0L ; } @ Override public void setHSId ( long hsId ) { } } ) ; return hsId ; |
public class ConstraintsBase { /** * Constraint that ensures that the proxy - prefetching - limit has a valid value .
* @ param def The descriptor ( class , reference , collection )
* @ param checkLevel The current check level ( this constraint is checked in basic and strict ) */
protected void checkProxyPrefetchingLimit ( DefBase def , String checkLevel ) throws ConstraintException { } } | if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } if ( def . hasProperty ( PropertyHelper . OJB_PROPERTY_PROXY_PREFETCHING_LIMIT ) ) { if ( ! def . hasProperty ( PropertyHelper . OJB_PROPERTY_PROXY ) ) { if ( def instanceof ClassDescriptorDef ) { LogHelper . warn ( true , ConstraintsBase . class , "checkProxyPrefetchingLimit" , "The class " + def . getName ( ) + " has a proxy-prefetching-limit property but no proxy property" ) ; } else { LogHelper . warn ( true , ConstraintsBase . class , "checkProxyPrefetchingLimit" , "The feature " + def . getName ( ) + " in class " + def . getOwner ( ) . getName ( ) + " has a proxy-prefetching-limit property but no proxy property" ) ; } } String propValue = def . getProperty ( PropertyHelper . OJB_PROPERTY_PROXY_PREFETCHING_LIMIT ) ; try { int value = Integer . parseInt ( propValue ) ; if ( value < 0 ) { if ( def instanceof ClassDescriptorDef ) { throw new ConstraintException ( "The proxy-prefetching-limit value of class " + def . getName ( ) + " must be a non-negative number" ) ; } else { throw new ConstraintException ( "The proxy-prefetching-limit value of the feature " + def . getName ( ) + " in class " + def . getOwner ( ) . getName ( ) + " must be a non-negative number" ) ; } } } catch ( NumberFormatException ex ) { if ( def instanceof ClassDescriptorDef ) { throw new ConstraintException ( "The proxy-prefetching-limit value of the class " + def . getName ( ) + " is not a number" ) ; } else { throw new ConstraintException ( "The proxy-prefetching-limit value of the feature " + def . getName ( ) + " in class " + def . getOwner ( ) . getName ( ) + " is not a number" ) ; } } } |
public class JsonReader { /** * Begins an object with an expected name .
* @ param expectedName The name that the next object should have
* @ return the structured reader
* @ throws IOException Something happened reading or the expected name was not found */
public JsonReader beginObject ( String expectedName ) throws IOException { } } | String name = beginObject ( ) ; if ( ! StringUtils . isNullOrBlank ( expectedName ) && ! name . equals ( expectedName ) ) { throw new IOException ( "Expected " + expectedName ) ; } return this ; |
public class FNCImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . FNC__RETIRED : setRetired ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__PAT_TECH : setPatTech ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__RESERVED1 : setReserved1 ( ( byte [ ] ) newValue ) ; return ; case AfplibPackage . FNC__FNT_FLAGS : setFntFlags ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__XUNIT_BASE : setXUnitBase ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__YUNIT_BASE : setYUnitBase ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__XFT_UNITS : setXftUnits ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__YFT_UNITS : setYftUnits ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__MAX_BOX_WD : setMaxBoxWd ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__MAX_BOX_HT : setMaxBoxHt ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__FNORG_LEN : setFNORGLen ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__FNIRG_LEN : setFNIRGLen ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__PAT_ALIGN : setPatAlign ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__RPAT_DCNT : setRPatDCnt ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__FNPRG_LEN : setFNPRGLen ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__FNMRG_LEN : setFNMRGLen ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__RES_XU_BASE : setResXUBase ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__RES_YU_BASE : setResYUBase ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__XFR_UNITS : setXfrUnits ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__YFR_UNITS : setYfrUnits ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__OPAT_DCNT : setOPatDCnt ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__RESERVED2 : setReserved2 ( ( byte [ ] ) newValue ) ; return ; case AfplibPackage . FNC__FNNRG_LEN : setFNNRGLen ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__FNND_CNT : setFNNDCnt ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__FNN_MAP_CNT : setFNNMapCnt ( ( Integer ) newValue ) ; return ; case AfplibPackage . FNC__TRIPLETS : getTriplets ( ) . clear ( ) ; getTriplets ( ) . addAll ( ( Collection < ? extends Triplet > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class IonBinary { /** * TODO : move this to IonConstants or IonUTF8 */
static final public int makeUTF8IntFromScalar ( int c ) throws IOException { } } | // TO DO : check this encoding , it is from :
// http : / / en . wikipedia . org / wiki / UTF - 8
// we probably should use some sort of Java supported
// library for this . this class might be of interest :
// CharsetDecoder ( Charset cs , float averageCharsPerByte , float maxCharsPerByte )
// in : java . nio . charset . CharsetDecoder
int value = 0 ; // first the quick , easy and common case - ascii
if ( c < 0x80 ) { value = ( 0xff & c ) ; } else if ( c < 0x800 ) { // 2 bytes characters from 0x000080 to 0x0007FF
value = ( 0xff & ( 0xC0 | ( c >> 6 ) ) ) ; value |= ( 0xff & ( 0x80 | ( c & 0x3F ) ) ) << 8 ; } else if ( c < 0x10000 ) { // 3 byte characters from 0x800 to 0xFFFF
// but only 0x800 . . . 0xD7FF and 0xE000 . . . 0xFFFF are valid
if ( c > 0xD7FF && c < 0xE000 ) { throwUTF8Exception ( ) ; } value = ( 0xff & ( 0xE0 | ( c >> 12 ) ) ) ; value |= ( 0xff & ( 0x80 | ( ( c >> 6 ) & 0x3F ) ) ) << 8 ; value |= ( 0xff & ( 0x80 | ( c & 0x3F ) ) ) << 16 ; } else if ( c <= 0x10FFFF ) { // 4 byte characters 0x010000 to 0x10FFFF
// these are are valid
value = ( 0xff & ( 0xF0 | ( c >> 18 ) ) ) ; value |= ( 0xff & ( 0x80 | ( ( c >> 12 ) & 0x3F ) ) ) << 8 ; value |= ( 0xff & ( 0x80 | ( ( c >> 6 ) & 0x3F ) ) ) << 16 ; value |= ( 0xff & ( 0x80 | ( c & 0x3F ) ) ) << 24 ; } else { throwUTF8Exception ( ) ; } return value ; |
public class OutboundConnectionTracker { /** * Purges a conneciton from the tracker . This is invoked when an error is detected on
* a connection and we do not want any further conversations to attempt to use it .
* @ param connection The connection to purge
* @ param notifyPeer Should we send notification to the connections peer that the purge
* is taking place ? */
public void purgeFromInvalidateImpl ( OutboundConnection connection , boolean notifyPeer ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "purgeFromInvalidateImpl" , new Object [ ] { connection , "" + notifyPeer } ) ; connection . getConnectionData ( ) . getConnectionDataGroup ( ) . purgeFromInvalidateImpl ( connection , notifyPeer ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "purgeFromInvalidateImpl" ) ; |
public class AbstractElementTransformer { /** * class OR is defined on a supertype or interface of an enclosing class */
protected boolean isMemberOnEnhancementOfEnclosingType ( AbstractDynamicSymbol symbol ) { } } | if ( ! _cc ( ) . isNonStaticInnerClass ( ) ) { return false ; } IType enhancement = symbol . getGosuClass ( ) ; if ( ! ( enhancement instanceof IGosuEnhancement ) ) { return false ; } IType enhancedType = ( ( IGosuEnhancement ) enhancement ) . getEnhancedType ( ) ; // If the symbol is on this class , or any ancestors , it ' s not enclosed
// noinspection SuspiciousMethodCalls
if ( getGosuClass ( ) . getAllTypesInHierarchy ( ) . contains ( enhancedType ) ) { return false ; } ICompilableTypeInternal enclosingClass = _cc ( ) . getEnclosingType ( ) ; while ( enclosingClass != null ) { // noinspection SuspiciousMethodCalls
if ( enclosingClass . getAllTypesInHierarchy ( ) . contains ( enhancedType ) ) { return true ; } enclosingClass = enclosingClass . getEnclosingType ( ) ; } return false ; |
public class DelayedQueue { /** * Return the next object that is safe for delivery or null
* if there are no safe objects to deliver .
* Null response could mean empty , or could mean all objects
* are scheduled for the future .
* @ param systemCurrentTimeMillis The current time .
* @ return Object of type T . */
public T nextReady ( long systemCurrentTimeMillis ) { } } | if ( delayed . size ( ) == 0 ) { return null ; } // no ready objects
if ( delayed . firstKey ( ) > systemCurrentTimeMillis ) { return null ; } Entry < Long , Object [ ] > entry = delayed . pollFirstEntry ( ) ; Object [ ] values = entry . getValue ( ) ; @ SuppressWarnings ( "unchecked" ) T value = ( T ) values [ 0 ] ; // if this map entry had multiple values , put all but one
// of them back
if ( values . length > 1 ) { int prevLength = values . length ; values = Arrays . copyOfRange ( values , 1 , values . length ) ; assert ( values . length == prevLength - 1 ) ; delayed . put ( entry . getKey ( ) , values ) ; } m_size -- ; return value ; |
public class SupervisorEndpoint { /** * Register a remote location where Restcomm will send monitoring updates */
@ Path ( "/remote" ) @ POST @ Produces ( { } } | MediaType . APPLICATION_XML , MediaType . APPLICATION_JSON } ) public Response registerForMetricsUpdates ( @ PathParam ( "accountSid" ) final String accountSid , @ Context UriInfo info , @ HeaderParam ( "Accept" ) String accept ) { return registerForUpdates ( accountSid , info , retrieveMediaType ( accept ) ) ; |
public class HttpServer { void statsCloseConnection ( long duration , int requests ) { } } | synchronized ( _statsLock ) { _connections ++ ; _connectionsOpen -- ; _connectionsDurationTotal += duration ; if ( _connectionsOpen < 0 ) _connectionsOpen = 0 ; if ( _connectionsOpen < _connectionsOpenMin ) _connectionsOpenMin = _connectionsOpen ; if ( _connectionsDurationMin == 0 || duration < _connectionsDurationMin ) _connectionsDurationMin = duration ; if ( duration > _connectionsDurationMax ) _connectionsDurationMax = duration ; if ( _connectionsRequestsMin == 0 || requests < _connectionsRequestsMin ) _connectionsRequestsMin = requests ; if ( requests > _connectionsRequestsMax ) _connectionsRequestsMax = requests ; } |
public class JobScheduleEnableOptions { /** * Set a timestamp indicating the last modified time of the resource known to the client . The operation will be performed only if the resource on the service has been modified since the specified time .
* @ param ifModifiedSince the ifModifiedSince value to set
* @ return the JobScheduleEnableOptions object itself . */
public JobScheduleEnableOptions withIfModifiedSince ( DateTime ifModifiedSince ) { } } | if ( ifModifiedSince == null ) { this . ifModifiedSince = null ; } else { this . ifModifiedSince = new DateTimeRfc1123 ( ifModifiedSince ) ; } return this ; |
public class TransportProtocol { /** * Request that the remote server starts a transport protocol service . This
* is only available in CLIENT _ MODE .
* @ param servicename
* @ throws IOException */
public void startService ( String servicename ) throws SshException { } } | ByteArrayWriter baw = new ByteArrayWriter ( ) ; try { baw . write ( SSH_MSG_SERVICE_REQUEST ) ; baw . writeString ( servicename ) ; if ( Log . isDebugEnabled ( ) ) { Log . debug ( this , "Sending SSH_MSG_SERVICE_REQUEST" ) ; } sendMessage ( baw . toByteArray ( ) , true ) ; byte [ ] msg ; do { msg = readMessage ( ) ; } while ( processMessage ( msg ) || msg [ 0 ] != SSH_MSG_SERVICE_ACCEPT ) ; if ( Log . isDebugEnabled ( ) ) { Log . debug ( this , "Received SSH_MSG_SERVICE_ACCEPT" ) ; } } catch ( IOException ex ) { throw new SshException ( ex , SshException . INTERNAL_ERROR ) ; } finally { try { baw . close ( ) ; } catch ( IOException e ) { } } |
public class NodeUtil { /** * Permanently delete all the children of the given node , including reporting changes . */
public static void deleteChildren ( Node n , AbstractCompiler compiler ) { } } | while ( n . hasChildren ( ) ) { deleteNode ( n . getFirstChild ( ) , compiler ) ; } |
public class ClientImpl { /** * Synchronously invoke a procedure call blocking until a result is available .
* @ param batchTimeout procedure invocation batch timeout .
* @ param procName class name ( not qualified by package ) of the procedure to execute .
* @ param parameters vararg list of procedure ' s parameter values .
* @ return array of VoltTable results .
* @ throws org . voltdb . client . ProcCallException
* @ throws NoConnectionsException */
@ Override public ClientResponse callProcedureWithTimeout ( int batchTimeout , String procName , Object ... parameters ) throws IOException , NoConnectionsException , ProcCallException { } } | return callProcedureWithClientTimeout ( batchTimeout , procName , Distributer . USE_DEFAULT_CLIENT_TIMEOUT , TimeUnit . SECONDS , parameters ) ; |
public class UrlUtilities { /** * Get content from the passed in URL . This code will open a connection to
* the passed in server , fetch the requested content , and return it as a
* byte [ ] .
* Anyone using the proxy calls such as this one should have that managed by the jvm with - D parameters :
* http . proxyHost
* http . proxyPort ( default : 80)
* http . nonProxyHosts ( should always include localhost )
* https . proxyHost
* https . proxyPort
* Example : - Dhttp . proxyHost = proxy . example . org - Dhttp . proxyPort = 8080 - Dhttps . proxyHost = proxy . example . org - Dhttps . proxyPort = 8080 - Dhttp . nonProxyHosts = * . foo . com | localhost | * . td . afg
* @ param url URL to hit
* @ param inCookies Map of session cookies ( or null if not needed )
* @ param outCookies Map of session cookies ( or null if not needed )
* @ param proxy Proxy server to create connection ( or null if not needed )
* @ return byte [ ] of content fetched from URL .
* @ deprecated As of release 1.13.0 , replaced by { @ link # getContentFromUrl ( String , java . util . Map , java . util . Map , boolean ) } */
@ Deprecated public static byte [ ] getContentFromUrl ( URL url , Map inCookies , Map outCookies , Proxy proxy , boolean allowAllCerts ) { } } | return getContentFromUrl ( url , inCookies , outCookies , allowAllCerts ) ; |
public class Responder { /** * Close the socket and tell the processing loop to terminate . This is a
* forced shutdown rather then a natural shutdown . A natural shutdown happens
* when the shutdown hook fires when the VM exists . This method forces all
* that to happen . This is done to allow multiple Responders to be created and
* destroyed during a single VM session . Necessary for various testing and
* management procedures . */
public void stopResponder ( ) { } } | LOGGER . info ( "Force shutdown of Responder [" + _runtimeId + "]" ) ; _shutdownHook . start ( ) ; Runtime . getRuntime ( ) . removeShutdownHook ( _shutdownHook ) ; |
public class ListAssignmentsForHITRequest { /** * The status of the assignments to return : Submitted | Approved | Rejected
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAssignmentStatuses ( java . util . Collection ) } or { @ link # withAssignmentStatuses ( java . util . Collection ) } if
* you want to override the existing values .
* @ param assignmentStatuses
* The status of the assignments to return : Submitted | Approved | Rejected
* @ return Returns a reference to this object so that method calls can be chained together .
* @ see AssignmentStatus */
public ListAssignmentsForHITRequest withAssignmentStatuses ( String ... assignmentStatuses ) { } } | if ( this . assignmentStatuses == null ) { setAssignmentStatuses ( new java . util . ArrayList < String > ( assignmentStatuses . length ) ) ; } for ( String ele : assignmentStatuses ) { this . assignmentStatuses . add ( ele ) ; } return this ; |
public class DistributedLogSessionClient { /** * Returns a new distributed log session builder .
* @ return a new distributed log session builder */
public LogSession . Builder sessionBuilder ( ) { } } | return new DistributedLogSession . Builder ( ) { @ Override public LogSession build ( ) { return new DistributedLogSession ( partitionId , sessionIdProvider . get ( ) . join ( ) , clusterMembershipService , protocol , primaryElection , threadContextFactory . createContext ( ) ) ; } } ; |
public class StoreFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public ActionState createActionStateFromString ( EDataType eDataType , String initialValue ) { } } | ActionState result = ActionState . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class HttpServerExchange { /** * Get the response sender .
* For blocking exchanges this will return a sender that uses the underlying output stream .
* @ return the response sender , or { @ code null } if another party already acquired the channel or the sender
* @ see # getResponseChannel ( ) */
public Sender getResponseSender ( ) { } } | if ( blockingHttpExchange != null ) { return blockingHttpExchange . getSender ( ) ; } if ( sender != null ) { return sender ; } return sender = new AsyncSenderImpl ( this ) ; |
public class StorableGenerator { /** * Returns the properties that match on a given case . The array length is
* the same as the case count . Each list represents the matches . The lists
* themselves may be null if no matches for that case . */
private List < StorableProperty < ? > > [ ] caseMatches ( int caseCount ) { } } | List < StorableProperty < ? > > [ ] cases = new List [ caseCount ] ; for ( StorableProperty < ? > prop : mAllProperties . values ( ) ) { int hashCode = prop . getName ( ) . hashCode ( ) ; int caseValue = ( hashCode & 0x7fffffff ) % caseCount ; List matches = cases [ caseValue ] ; if ( matches == null ) { matches = cases [ caseValue ] = new ArrayList < StorableProperty < ? > > ( ) ; } matches . add ( prop ) ; } return cases ; |
public class DefaultRoleManager { /** * getRoles gets the roles that a subject inherits .
* domain is a prefix to the roles . */
@ Override public List < String > getRoles ( String name , String ... domain ) { } } | if ( domain . length == 1 ) { name = domain [ 0 ] + "::" + name ; } else if ( domain . length > 1 ) { throw new Error ( "error: domain should be 1 parameter" ) ; } if ( ! hasRole ( name ) ) { throw new Error ( "error: name does not exist" ) ; } List < String > roles = createRole ( name ) . getRoles ( ) ; if ( domain . length == 1 ) { for ( int i = 0 ; i < roles . size ( ) ; i ++ ) { roles . set ( i , roles . get ( i ) . substring ( domain [ 0 ] . length ( ) + 2 , roles . get ( i ) . length ( ) ) ) ; } } return roles ; |
public class PKeyArea { /** * Delete the key from this buffer .
* @ param table The basetable .
* @ param keyArea The basetable ' s key area .
* @ param buffer The buffer to compare .
* @ exception DBException File exception . */
public void doRemove ( FieldTable table , KeyAreaInfo keyArea , BaseBuffer buffer ) throws DBException { } } | if ( ! this . atCurrent ( buffer ) ) { buffer = this . doSeek ( "==" , table , keyArea ) ; if ( buffer == null ) throw new DBException ( Constants . FILE_INCONSISTENCY ) ; } this . removeCurrent ( buffer ) ; |
public class LibUtils { /** * Returns a the < strong > lower case < / strong > String representation of
* the { @ link # calculateOS ( ) OSType } of this platform . E . g .
* < code > " windows " < / code > .
* @ return The string describing the operating system */
private static String osString ( ) { } } | OSType osType = calculateOS ( ) ; return osType . toString ( ) . toLowerCase ( Locale . ENGLISH ) ; |
public class HttpResendQueue { /** * Drains the resend queue until empty or error
* @ param httpClient The HTTP client
* @ param path REST path
* @ param gzip True if the post should be gzipped , false otherwise */
public void drain ( final HttpClient httpClient , final String path , final boolean gzip ) { } } | if ( ! resendQueue . isEmpty ( ) ) { // queued items are available for retransmission
try { // drain resend queue until empty or first exception
LOGGER . info ( "Attempting to retransmit {} requests" , resendQueue . size ( ) ) ; while ( ! resendQueue . isEmpty ( ) ) { // get next item off queue
HttpResendQueueItem item = resendQueue . peek ( ) ; try { // retransmit queued request
byte [ ] jsonBytes = item . getJsonBytes ( ) ; httpClient . post ( path , jsonBytes , gzip ) ; // retransmission successful
// remove from queue and sleep for 250ms
resendQueue . remove ( ) ; Threads . sleepQuietly ( 250 , TimeUnit . MILLISECONDS ) ; } catch ( Throwable t ) { // retransmission failed
// increment the item ' s counter
item . failed ( ) ; // remove it from the queue if we have had MAX _ POST _ ATTEMPTS ( 3 ) failures for the same request
if ( MAX_POST_ATTEMPTS <= item . getNumFailures ( ) ) { resendQueue . remove ( ) ; } // rethrow original exception from retransmission
throw t ; } } } catch ( Throwable t ) { LOGGER . info ( "Failure retransmitting queued requests" , t ) ; } } |
public class AbcGrammar { /** * field - notes : : = % x4E . 3A * WSP tex - text header - eol < p >
* < tt > N : < / tt > */
Rule FieldNotes ( ) { } } | return Sequence ( String ( "N:" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , TexText ( ) , HeaderEol ( ) ) . label ( FieldNotes ) ; |
public class RemoveFromLoadAllOperation { /** * Removes keys from the provided collection which
* are contained in the partition record store .
* @ param keys the keys to be filtered */
private void removeExistingKeys ( Collection < Data > keys ) { } } | if ( keys == null || keys . isEmpty ( ) ) { return ; } Storage storage = recordStore . getStorage ( ) ; keys . removeIf ( storage :: containsKey ) ; |
public class PID { /** * Return the normalized form of the given pid string , or throw a
* MalformedPIDException .
* @ param pidString
* @ return String normalized version of the pid
* @ throws MalformedPIDException */
public static String normalize ( String pidString ) throws MalformedPIDException { } } | if ( pidString == null ) { throw new MalformedPIDException ( "PID is null." ) ; } return normalize ( pidString , 0 , pidString . length ( ) ) ; |
public class PasswordService { /** * Checks the asserted BCrypt formatted hashed password and determines if the password should
* be rehashed or not . If the BCrypt work factor is increased ( from 12 to 14 for example ) ,
* passwords should be evaluated and if the existing stored hash uses a work factor less than
* what is configured , then the bcryptHash should be rehashed . The same does not apply in
* reverse . Stored hashed passwords with a work factor greater than the configured work factor
* will return false , meaning they should not be rehashed .
* If the bcryptHash length is less than the minimum length of a BCrypt hash , this method
* will return true .
* @ param bcryptHash the hashed BCrypt to check
* @ return true if the password should be rehashed , false if not
* @ since 1.0.0 */
public static boolean shouldRehash ( final char [ ] bcryptHash ) { } } | int rounds ; if ( bcryptHash . length < 59 ) { return true ; } final StringBuilder sb = new StringBuilder ( ) ; sb . append ( bcryptHash [ 4 ] ) ; if ( bcryptHash [ 5 ] != '$' ) { sb . append ( bcryptHash [ 5 ] ) ; } rounds = Integer . valueOf ( sb . toString ( ) ) ; return rounds < ROUNDS ; |
public class AbstractCli { /** * Runs the program , parsing any options from { @ code args } .
* @ param args arguments to the program , in the same format as
* provided by { @ code main } . */
public void run ( String [ ] args ) { } } | // Add and parse options .
OptionParser parser = new OptionParser ( ) ; initializeCommonOptions ( parser ) ; initializeOptions ( parser ) ; String errorMessage = null ; try { parsedOptions = parser . parse ( args ) ; } catch ( OptionException e ) { errorMessage = e . getMessage ( ) ; } boolean printHelp = false ; if ( errorMessage != null ) { // If an error occurs , the options don ' t parse .
// Therefore , we must manually check if the help option was
// given .
for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] . equals ( "--help" ) ) { printHelp = true ; } } } if ( errorMessage != null && ! printHelp ) { System . err . println ( errorMessage ) ; System . err . println ( "Try --help for more information about options." ) ; System . exit ( 1 ) ; } if ( printHelp || parsedOptions . has ( helpOpt ) ) { // If a help option is given , print help then quit .
try { parser . printHelpOn ( System . err ) ; } catch ( IOException ioException ) { throw new RuntimeException ( ioException ) ; } System . exit ( 0 ) ; } // Log any passed - in options .
if ( ! parsedOptions . has ( noPrintOptions ) ) { System . out . println ( "Command-line options:" ) ; for ( OptionSpec < ? > optionSpec : parsedOptions . specs ( ) ) { if ( parsedOptions . hasArgument ( optionSpec ) ) { System . out . println ( "--" + Iterables . getFirst ( optionSpec . options ( ) , "" ) + " " + Joiner . on ( " " ) . join ( parsedOptions . valuesOf ( optionSpec ) ) ) ; } else { System . out . println ( "--" + Iterables . getFirst ( optionSpec . options ( ) , "" ) ) ; } } System . out . println ( "" ) ; } // Run the program .
long startTime = System . currentTimeMillis ( ) ; processOptions ( parsedOptions ) ; run ( parsedOptions ) ; long endTime = System . currentTimeMillis ( ) ; if ( ! parsedOptions . has ( noPrintOptions ) ) { System . out . println ( "Total time elapsed: " + TimeUtils . durationToString ( endTime - startTime ) ) ; } System . exit ( 0 ) ; |
public class DatePicker { /** * zSetAppropriateTextFieldMinimumWidth , This sets the minimum ( and preferred ) width of the date
* picker text field . The width will be determined ( or calculated ) from the current date picker
* settings , as described below .
* If the programmer has not supplied a setting for the minimum size , then a default minimum
* size will be calculated from the AD date format , the locale , and the font for valid dates .
* If the programmer has supplied a setting for the text field minimum size , then the programmer
* supplied value will be used instead , unless a default override is allowed . ( In this case , the
* default value will only be used if the default setting is larger than the programmer supplied
* setting ) .
* For additional details , see the javadoc for this function :
* DatePickerSettings . setSizeTextFieldMinimumWidthDefaultOverride ( ) . */
void zSetAppropriateTextFieldMinimumWidth ( ) { } } | if ( settings == null ) { return ; } Integer programmerSuppliedWidth = settings . getSizeTextFieldMinimumWidth ( ) ; // Determine the appropriate minimum width for the text field .
int minimumWidthPixels = CalculateMinimumDateFieldSize . getFormattedDateWidthInPixels ( settings . getFormatForDatesCommonEra ( ) , settings . getLocale ( ) , settings . getFontValidDate ( ) , 0 ) ; if ( programmerSuppliedWidth != null ) { if ( settings . getSizeTextFieldMinimumWidthDefaultOverride ( ) ) { minimumWidthPixels = Math . max ( programmerSuppliedWidth , minimumWidthPixels ) ; } else { minimumWidthPixels = programmerSuppliedWidth ; } } // Apply the minimum and preferred width to the text field .
// Note that we only change the width , not the height .
Dimension newMinimumSize = dateTextField . getMinimumSize ( ) ; newMinimumSize . width = minimumWidthPixels ; dateTextField . setMinimumSize ( newMinimumSize ) ; Dimension newPreferredSize = dateTextField . getPreferredSize ( ) ; newPreferredSize . width = minimumWidthPixels ; dateTextField . setPreferredSize ( newPreferredSize ) ; this . validate ( ) ; |
public class DailyZipRollingFileAppender { /** * Rollover the current file to a new file . */
void rollOver ( ) throws IOException { } } | // If compression is enabled we start a separated thread
if ( getCompressBackups ( ) . equalsIgnoreCase ( "YES" ) || getCompressBackups ( ) . equalsIgnoreCase ( "TRUE" ) ) { File file = new File ( fileName ) ; Thread fileCompressor = new Thread ( new CompressFile ( file ) ) ; fileCompressor . start ( ) ; } /* Compute filename , but only if datePattern is specified */
if ( datePattern == null ) { errorHandler . error ( "Missing DatePattern option in rollOver()." ) ; return ; } String datedFilename = baseFileName + sdf . format ( now ) ; // It is too early to roll over because we are still within the
// bounds of the current interval . Rollover will occur once the
// next interval is reached .
if ( scheduledFilename . equals ( datedFilename ) ) { return ; } activateOptions ( ) ; |
public class DirectoryScanner { /** * Do we have to traverse a symlink when trying to reach path from
* basedir ?
* @ param base base File ( dir ) .
* @ param pathElements Vector of path elements ( dirs . . . file ) .
* @ since Ant 1.6 */
private boolean isSymlink ( File base , Vector pathElements ) { } } | if ( pathElements . size ( ) > 0 ) { String current = ( String ) pathElements . remove ( 0 ) ; try { return FileUtil . isSymbolicLink ( base , current ) || isSymlink ( new File ( base , current ) , pathElements ) ; } catch ( IOException ioe ) { String msg = "IOException caught while checking " + "for links, couldn't get canonical path!" ; // will be caught and redirected to Ant ' s logging system
System . err . println ( msg ) ; } } return false ; |
public class Beans { /** * New attribute repository person attribute dao .
* @ param p the properties
* @ return the person attribute dao */
@ SneakyThrows public static IPersonAttributeDao newStubAttributeRepository ( final PrincipalAttributesProperties p ) { } } | val dao = new NamedStubPersonAttributeDao ( ) ; val pdirMap = new LinkedHashMap < String , List < Object > > ( ) ; val stub = p . getStub ( ) ; stub . getAttributes ( ) . forEach ( ( key , value ) -> { val vals = StringUtils . commaDelimitedListToStringArray ( value ) ; pdirMap . put ( key , Arrays . stream ( vals ) . collect ( Collectors . toList ( ) ) ) ; } ) ; dao . setBackingMap ( pdirMap ) ; if ( StringUtils . hasText ( stub . getId ( ) ) ) { dao . setId ( stub . getId ( ) ) ; } return dao ; |
public class SipServletRequestImpl { /** * { @ inheritDoc } */
public Proxy getProxy ( boolean create ) throws TooManyHopsException { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getProxy - create=" + create ) ; } checkReadOnly ( ) ; final MobicentsSipSession session = getSipSession ( ) ; if ( session . getB2buaHelper ( ) != null ) throw new IllegalStateException ( "Cannot proxy request" ) ; final MaxForwardsHeader mfHeader = ( MaxForwardsHeader ) this . message . getHeader ( MaxForwardsHeader . NAME ) ; if ( mfHeader . getMaxForwards ( ) <= 0 ) { try { this . createResponse ( Response . TOO_MANY_HOPS , "Too many hops" ) . send ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "could not send the Too many hops response out !" , e ) ; } throw new TooManyHopsException ( ) ; } // For requests like PUBLISH dialogs ( sessions ) do not exist , but some clients
// attempt to send them in sequence as if they support dialogs and when such a subsequent request
// comes in it gets assigned to the previous request session where the proxy is destroyed .
// In this case we must create a new proxy . And we recoginze this case by additionally checking
// if this request is initial . TODO : Consider deleting the session contents too ? JSR 289 says
// the session is keyed against the headers , not against initial / non - initial . . .
if ( create ) { MobicentsProxy proxy = session . getProxy ( ) ; boolean createNewProxy = false ; if ( isInitial ( ) && proxy != null && proxy . getOriginalRequest ( ) == null ) { createNewProxy = true ; } if ( proxy == null || createNewProxy ) { session . setProxy ( new ProxyImpl ( this , super . sipFactoryImpl ) ) ; } } return session . getProxy ( ) ; |
public class LinkedList { /** * Links e as last element . */
void linkLast ( E e ) { } } | final Node < E > l = last ; final Node < E > newNode = new Node < > ( l , e , null ) ; last = newNode ; if ( l == null ) first = newNode ; else l . next = newNode ; size ++ ; modCount ++ ; |
public class OutboundVirtualConnectionFactoryImpl { /** * This method is only ever called from the framework ' s clear method which is
* only
* called when the framework is being destroyed or when automated tests are
* clearing
* out the frameworks config . */
public void destroyInternal ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "destroyInternal; " + this ) ; } // Stop and destroy the chain . Ignore exceptions
try { this . cf . stopChainInternal ( getChain ( ) , 0 ) ; this . cf . destroyChainInternal ( getChain ( ) ) ; } catch ( ChannelException e ) { // No FFDC required
} catch ( ChainException e ) { // No FFCD required
} if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "destroyInternal" ) ; } |
public class ListQueueTagsResult { /** * The list of all tags added to the specified queue .
* @ param tags
* The list of all tags added to the specified queue .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListQueueTagsResult withTags ( java . util . Map < String , String > tags ) { } } | setTags ( tags ) ; return this ; |
public class EllipseClustersIntoGrid { /** * Finds all the nodes which form an approximate line
* @ param seed First ellipse
* @ param next Second ellipse , specified direction of line relative to seed
* @ param line
* @ return All the nodes along the line */
protected static List < NodeInfo > findLine ( NodeInfo seed , NodeInfo next , int clusterSize , List < NodeInfo > line , boolean ccw ) { } } | if ( next == null ) return null ; if ( line == null ) line = new ArrayList < > ( ) ; else line . clear ( ) ; next . marked = true ; double anglePrev = direction ( next , seed ) ; double prevDist = next . ellipse . center . distance ( seed . ellipse . center ) ; line . add ( seed ) ; line . add ( next ) ; NodeInfo previous = seed ; for ( int i = 0 ; i < clusterSize + 1 ; i ++ ) { // find the child of next which is within tolerance and closest to it
double bestScore = Double . MAX_VALUE ; double bestDistance = Double . MAX_VALUE ; double bestAngle = Double . NaN ; double closestDistance = Double . MAX_VALUE ; NodeInfo best = null ; double previousLength = next . ellipse . center . distance ( previous . ellipse . center ) ; // System . out . println ( " - - - - line connecting " + i ) ;
for ( int j = 0 ; j < next . edges . size ( ) ; j ++ ) { double angle = next . edges . get ( j ) . angle ; NodeInfo c = next . edges . get ( j ) . target ; if ( c . marked ) continue ; double candidateLength = next . ellipse . center . distance ( c . ellipse . center ) ; double ratioLengths = previousLength / candidateLength ; double ratioSize = previous . ellipse . a / c . ellipse . a ; if ( ratioLengths > 1 ) { ratioLengths = 1.0 / ratioLengths ; ratioSize = 1.0 / ratioSize ; } if ( Math . abs ( ratioLengths - ratioSize ) > 0.4 ) continue ; double angleDist = ccw ? UtilAngle . distanceCCW ( anglePrev , angle ) : UtilAngle . distanceCW ( anglePrev , angle ) ; if ( angleDist <= Math . PI + MAX_LINE_ANGLE_CHANGE ) { double d = c . ellipse . center . distance ( next . ellipse . center ) ; double score = d / prevDist + angleDist ; if ( score < bestScore ) { // System . out . println ( " ratios : " + ratioLengths + " " + ratioSize ) ;
bestDistance = d ; bestScore = score ; bestAngle = angle ; best = c ; } closestDistance = Math . min ( d , closestDistance ) ; } } if ( best == null || bestDistance > closestDistance * 2.0 ) { return line ; } else { best . marked = true ; prevDist = bestDistance ; line . add ( best ) ; anglePrev = UtilAngle . bound ( bestAngle + Math . PI ) ; previous = next ; next = best ; } } // if ( verbose ) {
// System . out . println ( " Stuck in a loop ? Maximum line length exceeded " ) ;
return null ; |
public class Constraints { /** * we have only one implementation on classpath . */
private static Constraint loadConstraint ( Annotation context ) { } } | Constraint constraint = null ; final ServiceLoader < Constraint > constraints = ServiceLoader . load ( Constraint . class ) ; for ( Constraint aConstraint : constraints ) { try { aConstraint . getClass ( ) . getDeclaredMethod ( "check" , context . annotationType ( ) ) ; constraint = aConstraint ; break ; } catch ( NoSuchMethodException e ) { // Look for next implementation if method not found with required signature .
} } if ( constraint == null ) { throw new IllegalStateException ( "Couldn't found any implementation of " + Constraint . class . getName ( ) ) ; } return constraint ; |
public class SpiderScan { /** * Stops the scan .
* The call to this method has no effect if the scan was not yet started or has already finished . */
@ Override public void stopScan ( ) { } } | lock . lock ( ) ; try { if ( ! State . NOT_STARTED . equals ( state ) && ! State . FINISHED . equals ( state ) ) { spiderThread . stopScan ( ) ; state = State . FINISHED ; SpiderEventPublisher . publishScanEvent ( ScanEventPublisher . SCAN_STOPPED_EVENT , this . scanId ) ; } } finally { lock . unlock ( ) ; } |
public class Termination { /** * The countries to which calls are allowed .
* @ param callingRegions
* The countries to which calls are allowed . */
public void setCallingRegions ( java . util . Collection < String > callingRegions ) { } } | if ( callingRegions == null ) { this . callingRegions = null ; return ; } this . callingRegions = new java . util . ArrayList < String > ( callingRegions ) ; |
public class StringUtils { /** * Prepends the prefix to the start of the string if the string does not
* already start with any of the prefixes .
* < pre >
* StringUtils . prependIfMissing ( null , null ) = null
* StringUtils . prependIfMissing ( " abc " , null ) = " abc "
* StringUtils . prependIfMissing ( " " , " xyz " ) = " xyz "
* StringUtils . prependIfMissing ( " abc " , " xyz " ) = " xyzabc "
* StringUtils . prependIfMissing ( " xyzabc " , " xyz " ) = " xyzabc "
* StringUtils . prependIfMissing ( " XYZabc " , " xyz " ) = " xyzXYZabc "
* < / pre >
* < p > With additional prefixes , < / p >
* < pre >
* StringUtils . prependIfMissing ( null , null , null ) = null
* StringUtils . prependIfMissing ( " abc " , null , null ) = " abc "
* StringUtils . prependIfMissing ( " " , " xyz " , null ) = " xyz "
* StringUtils . prependIfMissing ( " abc " , " xyz " , new CharSequence [ ] { null } ) = " xyzabc "
* StringUtils . prependIfMissing ( " abc " , " xyz " , " " ) = " abc "
* StringUtils . prependIfMissing ( " abc " , " xyz " , " mno " ) = " xyzabc "
* StringUtils . prependIfMissing ( " xyzabc " , " xyz " , " mno " ) = " xyzabc "
* StringUtils . prependIfMissing ( " mnoabc " , " xyz " , " mno " ) = " mnoabc "
* StringUtils . prependIfMissing ( " XYZabc " , " xyz " , " mno " ) = " xyzXYZabc "
* StringUtils . prependIfMissing ( " MNOabc " , " xyz " , " mno " ) = " xyzMNOabc "
* < / pre >
* @ param str The string .
* @ param prefix The prefix to prepend to the start of the string .
* @ param prefixes Additional prefixes that are valid .
* @ return A new String if prefix was prepended , the same string otherwise .
* @ since 3.2 */
public static String prependIfMissing ( final String str , final CharSequence prefix , final CharSequence ... prefixes ) { } } | return prependIfMissing ( str , prefix , false , prefixes ) ; |
public class LZ4DecompressorWithLength { /** * Decompresses < code > src [ srcOff : ] < / code > into < code > dest [ destOff : ] < / code >
* and returns the number of bytes read from < code > src < / code > .
* The positions and limits of the { @ link ByteBuffer } s remain unchanged .
* @ param src the compressed data
* @ param srcOff the start offset in src
* @ param dest the destination buffer to store the decompressed data
* @ param destOff the start offset in dest
* @ return the number of bytes read to restore the original input */
public int decompress ( ByteBuffer src , int srcOff , ByteBuffer dest , int destOff ) { } } | final int destLen = getDecompressedLength ( src , srcOff ) ; return decompressor . decompress ( src , srcOff + 4 , dest , destOff , destLen ) + 4 ; |
public class AbstractWComponent { /** * Adds the given component as a child of this component .
* @ param component the component to add . */
void add ( final WComponent component ) { } } | assertAddSupported ( component ) ; assertNotReparenting ( component ) ; if ( ! ( this instanceof Container ) ) { throw new UnsupportedOperationException ( "Components can only be added to a container" ) ; } ComponentModel model = getOrCreateComponentModel ( ) ; if ( model . getChildren ( ) == null ) { model . setChildren ( new ArrayList < WComponent > ( 1 ) ) ; } model . getChildren ( ) . add ( component ) ; if ( isLocked ( ) ) { component . setLocked ( true ) ; } if ( component instanceof AbstractWComponent ) { ( ( AbstractWComponent ) component ) . getOrCreateComponentModel ( ) . setParent ( ( Container ) this ) ; ( ( AbstractWComponent ) component ) . addNotify ( ) ; } |
public class TLSTransportClient { /** * only client side */
public void start ( ) throws InterruptedException { } } | logger . debug ( "Staring client TLSTransportClient {} " , socketDescription ) ; if ( isConnected ( ) ) { logger . debug ( "Already connected TLSTransportClient {} " , socketDescription ) ; return ; } workerGroup = new NioEventLoopGroup ( ) ; Bootstrap bootstrap = new Bootstrap ( ) ; bootstrap . group ( workerGroup ) . channel ( NioSocketChannel . class ) . handler ( new ChannelInitializer < SocketChannel > ( ) { @ Override protected void initChannel ( SocketChannel channel ) throws Exception { ChannelPipeline pipeline = channel . pipeline ( ) ; pipeline . addLast ( "decoder" , new DiameterMessageDecoder ( parentConnection , parser ) ) ; pipeline . addLast ( "msgHandler" , new DiameterMessageHandler ( parentConnection , false ) ) ; pipeline . addLast ( "startTlsInitiator" , new StartTlsInitiator ( config , TLSTransportClient . this ) ) ; pipeline . addLast ( "encoder" , new DiameterMessageEncoder ( parser ) ) ; pipeline . addLast ( "inbandWriter" , new InbandSecurityHandler ( ) ) ; } } ) ; this . channel = bootstrap . remoteAddress ( destAddress ) . connect ( ) . sync ( ) . channel ( ) ; parentConnection . onConnected ( ) ; logger . debug ( "Started TLS Transport on Socket {}" , socketDescription ) ; |
public class ShutdownHooks { /** * Register an action to be run when the JVM exits .
* @ param priority The priority level at which this action should be run . Lower values will run earlier .
* @ param runOnCrash Whether or not this action should be performed if the server is shutting down
* due to a call to crashVoltDB ( )
* @ param action A Runnable containing the action to be run on shutdown . */
public static void registerShutdownHook ( int priority , boolean runOnCrash , Runnable action ) { } } | m_instance . addHook ( priority , runOnCrash , action ) ; // Any hook registered lets print crash messsage .
ShutdownHooks . m_crashMessage = true ; |
public class Cyc { /** * Returns a Object which is the best representation for a given String , so long as it doesn ' t
* need to be created in the KB . This static method wraps a call to
* { @ link KbService # getApiObjectDwim ( java . lang . String ) } ; see that method ' s documentation for more
* details .
* @ param cycLOrId
* @ return an Object ( possibly a KbObject ) which is the best representation for the given input
* @ throws KbTypeException
* @ throws CreateException
* @ see KbService # getApiObjectDwim ( java . lang . String ) */
public static Object getApiObjectDwim ( String cycLOrId ) throws KbTypeException , CreateException { } } | /* if ( cycLOrId . startsWith ( " { " ) & & cycLOrId . endsWith ( " } " ) ) {
cycLOrId = " ( TheSet " + cycLOrId . substring ( 1 , cycLOrId . length ( ) - 1 ) + " ) " ;
if ( cycLOrId . startsWith ( " [ " ) & & cycLOrId . endsWith ( " ] " ) ) {
cycLOrId = " ( TheList " + cycLOrId . substring ( 1 , cycLOrId . length ( ) - 1 ) + " ) " ;
return KB _ SVC . getApiObject ( cycLOrId ) ; */
return getLoader ( ) . getKbApiServices ( ) . getKbService ( ) . getApiObjectDwim ( cycLOrId ) ; |
public class AmazonSimpleEmailServiceClient { /** * Modifies an association between a configuration set and a custom domain for open and click event tracking .
* By default , images and links used for tracking open and click events are hosted on domains operated by Amazon
* SES . You can configure a subdomain of your own to handle these events . For information about using custom
* domains , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / configure - custom - open - click - domains . html " > Amazon SES
* Developer Guide < / a > .
* @ param updateConfigurationSetTrackingOptionsRequest
* Represents a request to update the tracking options for a configuration set .
* @ return Result of the UpdateConfigurationSetTrackingOptions operation returned by the service .
* @ throws ConfigurationSetDoesNotExistException
* Indicates that the configuration set does not exist .
* @ throws TrackingOptionsDoesNotExistException
* Indicates that the TrackingOptions object you specified does not exist .
* @ throws InvalidTrackingOptionsException
* Indicates that the custom domain to be used for open and click tracking redirects is invalid . This error
* appears most often in the following situations : < / p >
* < ul >
* < li >
* When the tracking domain you specified is not verified in Amazon SES .
* < / li >
* < li >
* When the tracking domain you specified is not a valid domain or subdomain .
* < / li >
* @ sample AmazonSimpleEmailService . UpdateConfigurationSetTrackingOptions
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / email - 2010-12-01 / UpdateConfigurationSetTrackingOptions "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateConfigurationSetTrackingOptionsResult updateConfigurationSetTrackingOptions ( UpdateConfigurationSetTrackingOptionsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateConfigurationSetTrackingOptions ( request ) ; |
public class CmsLock { /** * Returns the html code to build the dialogs default confirmation message js . < p >
* @ return html code */
public String buildDefaultConfirmationJS ( ) { } } | StringBuffer html = new StringBuffer ( 512 ) ; html . append ( "<script type='text/javascript'><!--\n" ) ; html . append ( "function setConfirmationMessage(locks, blockinglocks) {\n" ) ; html . append ( "\tvar confMsg = document.getElementById('conf-msg');\n" ) ; html . append ( "\tif (locks > -1) {\n" ) ; if ( ! getSettings ( ) . getUserSettings ( ) . getDialogShowLock ( ) && ( CmsLock . getDialogAction ( getCms ( ) ) != CmsLock . TYPE_LOCKS ) ) { // auto commit if lock dialog disabled
html . append ( "\t\tif (blockinglocks == 0) {\n" ) ; html . append ( "\t\t\tsubmitAction('" ) ; html . append ( CmsDialog . DIALOG_OK ) ; html . append ( "', null, 'main');\n" ) ; html . append ( "\t\t\tdocument.forms['main'].submit();\n" ) ; html . append ( "\t\t\treturn;\n" ) ; html . append ( "\t\t}\n" ) ; } html . append ( "\t\tdocument.getElementById('lock-body-id').className = '';\n" ) ; html . append ( "\t\tif (locks > '0') {\n" ) ; html . append ( "\t\t\tshowAjaxReportContent();\n" ) ; html . append ( "\t\t\tconfMsg.innerHTML = '" ) ; html . append ( getConfirmationMessage ( false ) ) ; html . append ( "';\n" ) ; html . append ( "\t\t} else {\n" ) ; html . append ( "\t\t\tshowAjaxOk();\n" ) ; html . append ( "\t\t\tconfMsg.innerHTML = '" ) ; html . append ( getConfirmationMessage ( true ) ) ; html . append ( "';\n" ) ; html . append ( "\t\t}\n" ) ; html . append ( "\t} else {\n" ) ; html . append ( "\t\tconfMsg.innerHTML = '" ) ; html . append ( key ( org . opencms . workplace . Messages . GUI_AJAX_REPORT_WAIT_0 ) ) ; html . append ( "';\n" ) ; html . append ( "\t}\n" ) ; html . append ( "}\n" ) ; html . append ( "// -->\n" ) ; html . append ( "</script>\n" ) ; return html . toString ( ) ; |
public class ContainerSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ContainerSettings containerSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( containerSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( containerSettings . getContainer ( ) , CONTAINER_BINDING ) ; protocolMarshaller . marshall ( containerSettings . getF4vSettings ( ) , F4VSETTINGS_BINDING ) ; protocolMarshaller . marshall ( containerSettings . getM2tsSettings ( ) , M2TSSETTINGS_BINDING ) ; protocolMarshaller . marshall ( containerSettings . getM3u8Settings ( ) , M3U8SETTINGS_BINDING ) ; protocolMarshaller . marshall ( containerSettings . getMovSettings ( ) , MOVSETTINGS_BINDING ) ; protocolMarshaller . marshall ( containerSettings . getMp4Settings ( ) , MP4SETTINGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class VirtualFile { /** * Returns view of content .
* @ return ByteBuffer position set to given position limit is position + needs . */
ByteBuffer writeView ( int position , int needs ) throws IOException { } } | int waterMark = position + needs ; if ( waterMark > content . capacity ( ) ) { if ( refSet . containsKey ( content ) ) { throw new IOException ( "cannot grow file because of writable mapping for content. (non carbage collected mapping?)" ) ; } int blockSize = fileStore . getBlockSize ( ) ; int newCapacity = Math . max ( ( ( waterMark / blockSize ) + 1 ) * blockSize , 2 * content . capacity ( ) ) ; ByteBuffer newBB = ByteBuffer . allocateDirect ( newCapacity ) ; newBB . put ( content ) ; newBB . flip ( ) ; content = newBB ; } ByteBuffer bb = content . duplicate ( ) ; refSet . add ( content , bb ) ; bb . limit ( waterMark ) . position ( position ) ; return bb ; |
public class DefaultWatchThread { /** * Closes the watch service . */
protected void closeWatchService ( ) { } } | try { getWatchService ( ) . close ( ) ; } catch ( IOException e ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( "Error stopping file watch service: " + e . getMessage ( ) , e ) ; } } |
public class GlobalLogFactory { /** * 自定义日志实现
* @ see Slf4jLogFactory
* @ see Log4jLogFactory
* @ see Log4j2LogFactory
* @ see ApacheCommonsLogFactory
* @ see JdkLogFactory
* @ see ConsoleLogFactory
* @ param logFactory 日志工厂类对象
* @ return 自定义的日志工厂类 */
public static LogFactory set ( LogFactory logFactory ) { } } | logFactory . getLog ( GlobalLogFactory . class ) . debug ( "Custom Use [{}] Logger." , logFactory . name ) ; currentLogFactory = logFactory ; return currentLogFactory ; |
public class Util { /** * Returns all the super classes of given type . I . e . the returned list does NOT contain any interfaces
* the class or tis superclasses implement .
* @ param types the Types instance of the compilation environment from which the type comes from
* @ param type the type
* @ return the list of super classes */
@ Nonnull public static List < TypeMirror > getAllSuperClasses ( @ Nonnull Types types , @ Nonnull TypeMirror type ) { } } | List < TypeMirror > ret = new ArrayList < > ( ) ; try { List < ? extends TypeMirror > superTypes = types . directSupertypes ( type ) ; while ( superTypes != null && ! superTypes . isEmpty ( ) ) { TypeMirror superClass = superTypes . get ( 0 ) ; ret . add ( superClass ) ; superTypes = types . directSupertypes ( superClass ) ; } } catch ( RuntimeException e ) { LOG . debug ( "Failed to find all super classes of type '" + toHumanReadableString ( type ) + ". Possibly " + "missing classes?" , e ) ; } return ret ; |
public class Vector3d { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3dc # sub ( org . joml . Vector3dc , org . joml . Vector3d ) */
public Vector3d sub ( Vector3dc v , Vector3d dest ) { } } | dest . x = x - v . x ( ) ; dest . y = y - v . y ( ) ; dest . z = z - v . z ( ) ; return dest ; |
public class ViewPortHandler { /** * Apply more { @ link Boundary } s to the detection conditions . */
public ViewPortHandler or ( Boundary boundary ) { } } | if ( ! boundaries . contains ( boundary ) ) { boundaries . add ( boundary ) ; } return this ; |
public class ExecutionChain { /** * Add a { @ link Task } to be run on a { @ link org . gearvrf . utility . Threads # spawn ( Runnable )
* background thread } . It will be run after all Tasks added prior to this
* call .
* @ param task
* { @ code Task } to run
* @ return Reference to the { @ code ExecutionChain } .
* @ throws IllegalStateException
* if the chain of execution has already been { @ link # execute ( )
* started } . */
public < T , U > ExecutionChain runOnBackgroundThread ( Task < T , U > task ) { } } | runOnThread ( Context . Type . BACKGROUND , task ) ; return this ; |
public class ProvideForkJoinTask { /** * Makes a copy of the data in the packet to make the packet safe to store for longer periods of time .
* JDA changed to have only one backing array for all packets , to reduce allocations .
* This means that in JAPP code we have to copy the packet data before storing it for longer periods of time .
* @ param packet the packet to copy the data for
* @ return the adjusted packet */
private static DatagramPacket optionallyCopyData ( DatagramPacket packet ) { } } | if ( packet != null ) { packet . setData ( packet . getData ( ) . clone ( ) , packet . getOffset ( ) , packet . getLength ( ) ) ; } return packet ; |
public class Service { /** * A histogram that maps the spread of service durations .
* @ param durationHistogram
* A histogram that maps the spread of service durations . */
public void setDurationHistogram ( java . util . Collection < HistogramEntry > durationHistogram ) { } } | if ( durationHistogram == null ) { this . durationHistogram = null ; return ; } this . durationHistogram = new java . util . ArrayList < HistogramEntry > ( durationHistogram ) ; |
public class NumbersClient { /** * Start renting a Nexmo Virtual Number .
* @ param country A String containing a 2 - character ISO country code .
* @ param msisdn The phone number to be bought .
* @ throws IOException if an error occurs contacting the Nexmo API
* @ throws NexmoClientException if an error is returned by the server . */
public void buyNumber ( String country , String msisdn ) throws IOException , NexmoClientException { } } | this . buyNumber . execute ( new BuyNumberRequest ( country , msisdn ) ) ; |
public class UfsJournalFile { /** * Creates a temporary checkpoint file .
* @ param location the file location
* @ return the file */
static UfsJournalFile createTmpCheckpointFile ( URI location ) { } } | return new UfsJournalFile ( location , UfsJournal . UNKNOWN_SEQUENCE_NUMBER , UfsJournal . UNKNOWN_SEQUENCE_NUMBER , false ) ; |
public class UnitJudge { /** * 注意 : 请先使用 { { @ link # defined ( String , String ) } } 检查合法性 , 然后再使用本方法取属性
* @ return 判定指定的unit是否是广播型 */
public static boolean isBroadcast ( String groupName , String unitName ) { } } | try { return UnitRouter . SINGLETON . newestDefinition ( Unit . fullName ( groupName , unitName ) ) . getMeta ( ) . getBroadcast ( ) != null ; } catch ( UnitUndefinedException e ) { throw new RuntimeException ( "Please call UnitJudge.defined() first." , e ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.