signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SDVariable { /** * See { @ link # std ( String , boolean , boolean , int . . . ) } */
public SDVariable std ( String name , boolean biasCorrected , int ... dimensions ) { } } | return sameDiff . standardDeviation ( name , this , biasCorrected , dimensions ) ; |
public class Router { /** * in CBL _ Router + Handlers . m
* - ( CBLStatus ) update : ( CBLDatabase * ) db
* docID : ( NSString * ) docID
* body : ( CBL _ Body * ) body
* deleting : ( BOOL ) deleting
* error : ( NSError * * ) outError */
private Status update ( Database _db , String docID , Body body , boolean deleting ) { } } | Status status = new Status ( ) ; if ( docID != null && docID . isEmpty ( ) == false ) { // On PUT / DELETE , get revision ID from either ? rev = query or doc body :
String revParam = getQuery ( "rev" ) ; String ifMatch = getRequestHeaderValue ( "If-Match" ) ; if ( ifMatch != null ) { if ( revParam == null ) revParam = ifMatch ; else if ( ! ifMatch . equals ( revParam ) ) return new Status ( Status . BAD_REQUEST ) ; } if ( revParam != null && body != null ) { String revProp = ( String ) body . getProperties ( ) . get ( "_rev" ) ; if ( revProp == null ) { // No _ rev property in body , so use ? rev = query param instead :
body . getProperties ( ) . put ( "_rev" , revParam ) ; // body = new Body ( bodyDict ) ;
} else if ( ! revParam . equals ( revProp ) ) { throw new IllegalArgumentException ( "Mismatch between _rev and rev" ) ; } } } RevisionInternal rev = update ( _db , docID , body , deleting , false , status ) ; if ( status . isSuccessful ( ) ) { cacheWithEtag ( rev . getRevID ( ) ) ; // set ETag
if ( ! deleting ) { URL url = connection . getURL ( ) ; String urlString = url . toExternalForm ( ) ; if ( docID != null ) { urlString += '/' + rev . getDocID ( ) ; try { url = new URL ( urlString ) ; } catch ( MalformedURLException e ) { Log . w ( "Malformed URL" , e ) ; } } setResponseLocation ( url ) ; } Map < String , Object > result = new HashMap < String , Object > ( ) ; result . put ( "ok" , true ) ; result . put ( "id" , rev . getDocID ( ) ) ; result . put ( "rev" , rev . getRevID ( ) ) ; connection . setResponseBody ( new Body ( result ) ) ; } return status ; |
public class JobHistory { /** * Parse a single line of history .
* @ param line
* @ param l
* @ throws IOException */
private static void parseLine ( String line , Listener l , boolean isEscaped ) throws IOException { } } | // extract the record type
int idx = line . indexOf ( ' ' ) ; String recType = line . substring ( 0 , idx ) ; String data = line . substring ( idx + 1 , line . length ( ) ) ; Matcher matcher = pattern . matcher ( data ) ; Map < Keys , String > parseBuffer = new HashMap < Keys , String > ( ) ; while ( matcher . find ( ) ) { String tuple = matcher . group ( 0 ) ; String [ ] parts = StringUtils . split ( tuple , StringUtils . ESCAPE_CHAR , '=' ) ; String value = parts [ 1 ] . substring ( 1 , parts [ 1 ] . length ( ) - 1 ) ; if ( isEscaped ) { value = StringUtils . unEscapeString ( value , StringUtils . ESCAPE_CHAR , charsToEscape ) ; } parseBuffer . put ( Keys . valueOf ( parts [ 0 ] ) , value ) ; } l . handle ( RecordTypes . valueOf ( recType ) , parseBuffer ) ; parseBuffer . clear ( ) ; |
public class AbstractModule { /** * Registers a controller component with the module . The name of the
* component is derived from the class name , e . g .
* < pre >
* / / Derived name is " com . example . MyController " .
* controller ( com . example . MyController . class ) ;
* < / pre >
* @ param klass Controller type . */
public < C extends Controller > AbstractModule controller ( Class < C > klass ) { } } | String name = klass . getName ( ) ; JSClosure constructor = JSClosure . create ( new DefaultControllerConstructor < C > ( name , klass ) ) ; ControllerDependencyInspector inspector = GWT . create ( ControllerDependencyInspector . class ) ; JSArray < String > dependencies = JSArray . create ( inspector . inspect ( klass ) ) ; dependencies . unshift ( "$scope" ) ; ngo . controller ( name , dependencies , constructor ) ; return this ; |
public class Shape { /** * Fills the Shape using the passed attributes .
* This method will silently also fill the Shape to its unique rgb color if the context is a buffer .
* @ param context
* @ param attr */
protected boolean fill ( final Context2D context , final Attributes attr , double alpha ) { } } | final boolean filled = attr . hasFill ( ) ; if ( ( filled ) || ( attr . isFillShapeForSelection ( ) ) ) { alpha = alpha * attr . getFillAlpha ( ) ; if ( alpha <= 0 ) { return false ; } if ( context . isSelection ( ) ) { final String color = getColorKey ( ) ; if ( null == color ) { return false ; } context . save ( ) ; context . setFillColor ( color ) ; context . fill ( ) ; context . restore ( ) ; return true ; } if ( false == filled ) { return false ; } context . save ( ) ; if ( attr . hasShadow ( ) ) { doApplyShadow ( context , attr ) ; } context . setGlobalAlpha ( alpha ) ; final String fill = attr . getFillColor ( ) ; if ( null != fill ) { context . setFillColor ( fill ) ; context . fill ( ) ; context . restore ( ) ; return true ; } final FillGradient grad = attr . getFillGradient ( ) ; if ( null != grad ) { final String type = grad . getType ( ) ; if ( LinearGradient . TYPE . equals ( type ) ) { context . setFillGradient ( grad . asLinearGradient ( ) ) ; context . fill ( ) ; context . restore ( ) ; return true ; } else if ( RadialGradient . TYPE . equals ( type ) ) { context . setFillGradient ( grad . asRadialGradient ( ) ) ; context . fill ( ) ; context . restore ( ) ; return true ; } else if ( PatternGradient . TYPE . equals ( type ) ) { context . setFillGradient ( grad . asPatternGradient ( ) ) ; context . fill ( ) ; context . restore ( ) ; return true ; } } context . restore ( ) ; } return false ; |
public class ListRegexPatternSetsResult { /** * An array of < a > RegexPatternSetSummary < / a > objects .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setRegexPatternSets ( java . util . Collection ) } or { @ link # withRegexPatternSets ( java . util . Collection ) } if you
* want to override the existing values .
* @ param regexPatternSets
* An array of < a > RegexPatternSetSummary < / a > objects .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListRegexPatternSetsResult withRegexPatternSets ( RegexPatternSetSummary ... regexPatternSets ) { } } | if ( this . regexPatternSets == null ) { setRegexPatternSets ( new java . util . ArrayList < RegexPatternSetSummary > ( regexPatternSets . length ) ) ; } for ( RegexPatternSetSummary ele : regexPatternSets ) { this . regexPatternSets . add ( ele ) ; } return this ; |
public class AbstractCommand { /** * Returns the defaultFaceDescriptor . Creates one if needed . */
private CommandFaceDescriptor getOrCreateFaceDescriptor ( ) { } } | if ( ! isFaceConfigured ( ) ) { if ( logger . isInfoEnabled ( ) ) { logger . info ( "Lazily instantiating default face descriptor on behalf of caller to prevent npe; " + "command is being configured manually, right?" ) ; } if ( ValkyrieRepository . isCurrentlyRunningInContext ( ) ) { ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . commandConfigurer ( ) . configure ( this ) ; } else { setFaceDescriptor ( new CommandFaceDescriptor ( ) ) ; } } return getFaceDescriptor ( ) ; |
public class CmsSetupBean { /** * Returns the key of the selected database server ( e . g . " mysql " , " generic " or " oracle " ) . < p >
* @ return the key of the selected database server ( e . g . " mysql " , " generic " or " oracle " ) */
public String getDatabase ( ) { } } | if ( m_databaseKey == null ) { m_databaseKey = getExtProperty ( "db.name" ) ; } if ( CmsStringUtil . isEmpty ( m_databaseKey ) ) { m_databaseKey = getSortedDatabases ( ) . get ( 0 ) ; } return m_databaseKey ; |
public class ParsePackage { /** * Method getProcessName . The process name is normally enclosed in quotes
* but it might be omitted in which case we generate a unique one .
* @ return String
* @ throws ParserException */
private String getProcessName ( ProcessTextProvider textProvider ) { } } | if ( ! quotedString ( '"' , textProvider ) ) { return "P" + ( textProvider . incrementProcessCount ( ) ) ; } if ( textProvider . getLastToken ( ) . contains ( "_" ) ) { throw new ParserException ( "Process names nust not include underbar: " + textProvider . getLastToken ( ) ) ; } return textProvider . getLastToken ( ) ; |
public class DictionaryMaker { /** * 从磁盘加载
* @ param path
* @ return */
public static DictionaryMaker load ( String path ) { } } | DictionaryMaker dictionaryMaker = new DictionaryMaker ( ) ; dictionaryMaker . addAll ( DictionaryMaker . loadAsItemList ( path ) ) ; return dictionaryMaker ; |
public class ClustersInner { /** * Gets information about a Cluster .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param workspaceName The name of the workspace . Workspace names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long .
* @ param clusterName The name of the cluster within the specified resource group . Cluster names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long .
* @ 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 ClusterInner object if successful . */
public ClusterInner get ( String resourceGroupName , String workspaceName , String clusterName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , workspaceName , clusterName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class FieldMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Field field , ProtocolMarshaller protocolMarshaller ) { } } | if ( field == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( field . getKey ( ) , KEY_BINDING ) ; protocolMarshaller . marshall ( field . getStringValue ( ) , STRINGVALUE_BINDING ) ; protocolMarshaller . marshall ( field . getRefValue ( ) , REFVALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CompareFacesResult { /** * An array of faces in the target image that did not match the source image face .
* @ param unmatchedFaces
* An array of faces in the target image that did not match the source image face . */
public void setUnmatchedFaces ( java . util . Collection < ComparedFace > unmatchedFaces ) { } } | if ( unmatchedFaces == null ) { this . unmatchedFaces = null ; return ; } this . unmatchedFaces = new java . util . ArrayList < ComparedFace > ( unmatchedFaces ) ; |
public class Get { /** * Retrieves the rows in the element . If the element isn ' t present or a
* table , a null value will be returned . The rows will be returned in one element
* and they can be iterated through , or selecting using the ` setMatch ` method
* @ return List : a list of the table rows as WebElements */
@ SuppressWarnings ( "squid:S1168" ) public Element tableRows ( ) { } } | if ( ! element . is ( ) . present ( ) ) { return null ; // returning an empty array could be confused with no rows
} if ( ! element . is ( ) . table ( ) ) { return null ; // returning an empty array could be confused with no rows
} return element . findChild ( app . newElement ( Locator . TAGNAME , "tr" ) ) ; |
public class JsIterables { /** * Given a type , if it is an iterable or async iterable , will return its template . If not a
* subtype of Iterable | AsyncIterable , returns an object that has no match , and will indicate the
* mismatch . e . g . both { @ code number } and { @ code number | Iterable } are not subtypes of
* Iterable | AsyncIterable . */
static final MaybeBoxedIterableOrAsyncIterable maybeBoxIterableOrAsyncIterable ( JSType type , JSTypeRegistry typeRegistry ) { } } | List < JSType > templatedTypes = new ArrayList < > ( ) ; // Note : we don ' t just use JSType . autobox ( ) here because that removes null and undefined .
// We want to keep null and undefined around because they should cause a mismatch .
if ( type . isUnionType ( ) ) { for ( JSType alt : type . toMaybeUnionType ( ) . getAlternates ( ) ) { alt = alt . isBoxableScalar ( ) ? alt . autoboxesTo ( ) : alt ; boolean isIterable = alt . isSubtypeOf ( typeRegistry . getNativeType ( ITERABLE_TYPE ) ) ; boolean isAsyncIterable = alt . isSubtypeOf ( typeRegistry . getNativeType ( ASYNC_ITERABLE_TYPE ) ) ; if ( ! isIterable && ! isAsyncIterable ) { return new MaybeBoxedIterableOrAsyncIterable ( null , alt ) ; } JSTypeNative iterableType = isAsyncIterable ? ASYNC_ITERABLE_TYPE : ITERABLE_TYPE ; templatedTypes . add ( alt . getInstantiatedTypeArgument ( typeRegistry . getNativeType ( iterableType ) ) ) ; } } else { JSType autoboxedType = type . isBoxableScalar ( ) ? type . autoboxesTo ( ) : type ; boolean isIterable = autoboxedType . isSubtypeOf ( typeRegistry . getNativeType ( ITERABLE_TYPE ) ) ; boolean isAsyncIterable = autoboxedType . isSubtypeOf ( typeRegistry . getNativeType ( ASYNC_ITERABLE_TYPE ) ) ; if ( ! isIterable && ! isAsyncIterable ) { return new MaybeBoxedIterableOrAsyncIterable ( null , autoboxedType ) ; } JSTypeNative iterableType = isAsyncIterable ? ASYNC_ITERABLE_TYPE : ITERABLE_TYPE ; templatedTypes . add ( autoboxedType . getInstantiatedTypeArgument ( typeRegistry . getNativeType ( iterableType ) ) ) ; } return new MaybeBoxedIterableOrAsyncIterable ( typeRegistry . createUnionType ( templatedTypes ) , null ) ; |
public class Solo { /** * Waits for a View matching the specified class .
* @ param viewClass the { @ link View } class to wait for
* @ param minimumNumberOfMatches the minimum number of matches that are expected to be found . { @ code 0 } means any number of matches
* @ param timeout the amount of time in milliseconds to wait
* @ return { @ code true } if the { @ link View } is displayed and { @ code false } if it is not displayed before the timeout */
public < T extends View > boolean waitForView ( final Class < T > viewClass , final int minimumNumberOfMatches , final int timeout ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "waitForView(" + viewClass + ", " + minimumNumberOfMatches + ", " + timeout + ")" ) ; } int index = minimumNumberOfMatches - 1 ; if ( index < 1 ) index = 0 ; return waiter . waitForView ( viewClass , index , timeout , true ) ; |
public class ComponentDisplayable { /** * Remove displayable and its layer .
* @ param layer The layer index .
* @ param displayable The displayable to remove . */
private void remove ( Integer layer , Displayable displayable ) { } } | final Collection < Displayable > displayables = getLayer ( layer ) ; displayables . remove ( displayable ) ; if ( displayables . isEmpty ( ) ) { indexs . remove ( layer ) ; } |
public class UriComponentEncoder { /** * Encodes an HTTP URI Path .
* @ param path
* @ return
* @ throws NullPointerException */
public static String encodePath ( String path ) throws NullPointerException { } } | return new String ( encode ( path , UriComponentEncoderBitSets . allowed_abs_path ) ) ; |
public class DeadboltAnalyzer { /** * Check the pattern for equality against the { @ link Permission } s of the user .
* @ param subjectOption an option for the subject
* @ param patternValueOption an option for the pattern value
* @ return true iff the pattern is equal to at least one of the subject ' s permissions */
public boolean checkPatternEquality ( final Optional < Subject > subjectOption , final Optional < String > patternValueOption ) { } } | final boolean [ ] roleOk = { false } ; subjectOption . ifPresent ( subject -> patternValueOption . ifPresent ( patternValue -> { final List < ? extends Permission > permissions = subject . getPermissions ( ) ; if ( permissions != null ) { for ( Iterator < ? extends Permission > iterator = permissions . iterator ( ) ; ! roleOk [ 0 ] && iterator . hasNext ( ) ; ) { final Permission permission = iterator . next ( ) ; roleOk [ 0 ] = patternValue . equals ( permission . getValue ( ) ) ; } } } ) ) ; return roleOk [ 0 ] ; |
public class ClientCookieEncoder { /** * Encodes the specified cookie into a Cookie header value .
* @ param name the cookie name
* @ param value the cookie value
* @ return a Rfc6265 style Cookie header value */
@ Deprecated public static String encode ( String name , String value ) { } } | return io . netty . handler . codec . http . cookie . ClientCookieEncoder . LAX . encode ( name , value ) ; |
public class DatabasesInner { /** * Remove Database principals permissions .
* @ param resourceGroupName The name of the resource group containing the Kusto cluster .
* @ param clusterName The name of the Kusto cluster .
* @ param databaseName The name of the database in the Kusto cluster .
* @ 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 DatabasePrincipalListResultInner object if successful . */
public DatabasePrincipalListResultInner removePrincipals ( String resourceGroupName , String clusterName , String databaseName ) { } } | return removePrincipalsWithServiceResponseAsync ( resourceGroupName , clusterName , databaseName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Jar { /** * Adds a class entry to this JAR .
* @ param clazz the class to add to the JAR .
* @ return { @ code this } */
public Jar addClass ( Class < ? > clazz ) throws IOException { } } | final String resource = clazz . getName ( ) . replace ( '.' , '/' ) + ".class" ; return addEntry ( resource , clazz . getClassLoader ( ) . getResourceAsStream ( resource ) ) ; |
public class StorageSnippets { /** * [ VARIABLE " my _ unique _ bucket " ] */
public Acl updateBucketAcl ( String bucketName ) { } } | // [ START updateBucketAcl ]
Acl acl = storage . updateAcl ( bucketName , Acl . of ( User . ofAllAuthenticatedUsers ( ) , Role . OWNER ) ) ; // [ END updateBucketAcl ]
return acl ; |
public class SystemSecurityContext { /** * Exception squid : S2221 - Callable declares Exception */
@ SuppressWarnings ( "squid:S2221" ) public < T > T runAsSystem ( final Callable < T > callable ) { } } | return runAsSystemAsTenant ( callable , tenantAware . getCurrentTenant ( ) ) ; |
public class MessageTemplate { /** * Build and get message as a string
* @ return String the final message */
public String build ( ) { } } | this . message_string = "{" ; if ( this . recipient_id != null ) { this . message_string += "\"recipient\": {\"id\": \"" + this . recipient_id + "\"}," ; } if ( ( this . message_text != null ) || ( ! this . message_attachment . isEmpty ( ) ) || ( ! this . message_quick_replies . isEmpty ( ) ) || ( this . message_metadata != null ) ) { this . message_string += "\"message\": {" ; if ( this . message_text != null ) { this . message_string += "\"text\": \"" + this . message_text + "\"," ; } if ( ! this . message_attachment . isEmpty ( ) ) { this . message_string += "\"attachment\":{\"type\":\"" + this . message_attachment . get ( "type" ) + "\",\"payload\":{\"url\":\"" + this . message_attachment . get ( "url" ) + "\",\"is_reusable\": " + this . message_attachment . get ( "is_reusable" ) + "}}," ; } if ( ! this . message_quick_replies . isEmpty ( ) ) { this . message_string += "\"quick_replies\":[" ; for ( int j = 0 ; j < this . message_quick_replies . size ( ) ; j ++ ) { HashMap < String , String > quick_reply = this . message_quick_replies . get ( j ) ; this . message_string += "{" ; if ( ! quick_reply . get ( "content_type" ) . equals ( "" ) ) { this . message_string += "\"content_type\":\"" + quick_reply . get ( "content_type" ) + "\"," ; } if ( ! quick_reply . get ( "title" ) . equals ( "" ) ) { this . message_string += "\"title\":\"" + quick_reply . get ( "title" ) + "\"," ; } if ( ! quick_reply . get ( "payload" ) . equals ( "" ) ) { this . message_string += "\"payload\":\"" + quick_reply . get ( "payload" ) + "\"," ; } if ( ! quick_reply . get ( "image_url" ) . equals ( "" ) ) { this . message_string += "\"image_url\":\"" + quick_reply . get ( "image_url" ) + "\"," ; } this . message_string = this . message_string . replaceAll ( ",$" , "" ) ; this . message_string += "}," ; } this . message_string = this . message_string . replaceAll ( ",$" , "" ) ; this . message_string += "]," ; } if ( this . message_metadata != null ) { this . message_string += "\"metadata\": \"" + this . message_metadata + "\"," ; } this . message_string = this . message_string . replaceAll ( ",$" , "" ) ; this . message_string += "}," ; } if ( this . sender_action != null ) { this . message_string += "\"sender_action\":\"" + this . sender_action + "\"," ; } if ( this . notification_type != null ) { this . message_string += "\"notification_type\":\"" + this . notification_type + "\"," ; } this . message_string = this . message_string . replaceAll ( ",$" , "" ) ; this . message_string += "}" ; return this . message_string ; |
public class Parser { /** * Converts digit at position { @ code pos } in string { @ code s } to integer or throws .
* @ param s input string
* @ param pos position ( 0 - based )
* @ return integer value of a digit at position pos
* @ throws NumberFormatException if character at position pos is not an integer */
public static int digitAt ( String s , int pos ) { } } | int c = s . charAt ( pos ) - '0' ; if ( c < 0 || c > 9 ) { throw new NumberFormatException ( "Input string: \"" + s + "\", position: " + pos ) ; } return c ; |
public class EditScript { /** * Adds a change to the edit script .
* @ param paramChange
* { @ link Diff } reference
* @ return the change */
public Diff add ( final Diff paramChange ) { } } | assert paramChange != null ; final ITreeData item = paramChange . getDiff ( ) == EDiff . DELETED ? paramChange . getOldNode ( ) : paramChange . getNewNode ( ) ; if ( mChangeByNode . containsKey ( item ) ) { return paramChange ; } mChanges . add ( paramChange ) ; return mChangeByNode . put ( item , paramChange ) ; |
public class MtasTokenizerFactory { /** * Creates the .
* @ param configuration the configuration
* @ return the mtas tokenizer
* @ throws IOException Signals that an I / O exception has occurred . */
public MtasTokenizer create ( String configuration , String defaultConfiguration ) throws IOException { } } | return create ( TokenStream . DEFAULT_TOKEN_ATTRIBUTE_FACTORY , configuration , defaultConfiguration ) ; |
public class MPDAdmin { /** * Sends the appropriate { @ link MPDChangeEvent } to all registered
* { @ link MPDChangeListener } s .
* @ param event the { @ link MPDChangeEvent . Event } to send */
protected synchronized void fireMPDChangeEvent ( MPDChangeEvent . Event event ) { } } | MPDChangeEvent mce = new MPDChangeEvent ( this , event ) ; for ( MPDChangeListener mcl : listeners ) { mcl . mpdChanged ( mce ) ; } |
public class BaseRTMPClientHandler { /** * Creates the default connection parameters collection . Many implementations of this handler will create a tcUrl if not found , it is
* created with the current server url .
* @ param server
* the server location
* @ param port
* the port for the protocol
* @ param application
* the application name at the given server
* @ return connection parameters map */
@ Override public Map < String , Object > makeDefaultConnectionParams ( String server , int port , String application ) { } } | Map < String , Object > params = new ObjectMap < > ( ) ; params . put ( "app" , application ) ; params . put ( "objectEncoding" , Integer . valueOf ( 0 ) ) ; params . put ( "fpad" , Boolean . FALSE ) ; params . put ( "flashVer" , "WIN 11,2,202,235" ) ; params . put ( "audioCodecs" , Integer . valueOf ( 3575 ) ) ; params . put ( "videoFunction" , Integer . valueOf ( 1 ) ) ; params . put ( "pageUrl" , null ) ; params . put ( "path" , application ) ; params . put ( "capabilities" , Integer . valueOf ( 15 ) ) ; params . put ( "swfUrl" , null ) ; params . put ( "videoCodecs" , Integer . valueOf ( 252 ) ) ; return params ; |
public class DwgObject { /** * Reads the header of an object in a DWG file Version 15
* @ param data Array of unsigned bytes obtained from the DWG binary file
* @ param offset The current bit offset where the value begins
* @ return int New offset
* @ throws Exception If an unexpected bit value is found in the DWG file . Occurs
* when we are looking for LwPolylines . */
public int readObjectHeaderV15 ( int [ ] data , int offset ) throws Exception { } } | int bitPos = offset ; Integer mode = ( Integer ) DwgUtil . getBits ( data , 2 , bitPos ) ; bitPos = bitPos + 2 ; setMode ( mode . intValue ( ) ) ; Vector v = DwgUtil . getBitLong ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; int rnum = ( ( Integer ) v . get ( 1 ) ) . intValue ( ) ; setNumReactors ( rnum ) ; v = DwgUtil . testBit ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; boolean nolinks = ( ( Boolean ) v . get ( 1 ) ) . booleanValue ( ) ; setNoLinks ( nolinks ) ; v = DwgUtil . getBitShort ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; int color = ( ( Integer ) v . get ( 1 ) ) . intValue ( ) ; setColor ( color ) ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; float ltscale = ( ( Double ) v . get ( 1 ) ) . floatValue ( ) ; Integer ltflag = ( Integer ) DwgUtil . getBits ( data , 2 , bitPos ) ; bitPos = bitPos + 2 ; Integer psflag = ( Integer ) DwgUtil . getBits ( data , 2 , bitPos ) ; bitPos = bitPos + 2 ; v = DwgUtil . getBitShort ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; int invis = ( ( Integer ) v . get ( 1 ) ) . intValue ( ) ; v = DwgUtil . getRawChar ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; int weight = ( ( Integer ) v . get ( 1 ) ) . intValue ( ) ; return bitPos ; |
public class CSSCompressor { /** * Get the rewritten version of the passed CSS code . This is done by
* interpreting the CSS and than writing it again with the passed settings .
* This can e . g . be used to create a compressed version of a CSS .
* @ param sOriginalCSS
* The original CSS code to be compressed .
* @ param aSettings
* The CSS writer settings to use . The version is used to read the
* original CSS .
* @ return If compression failed because the CSS is invalid or whatsoever , the
* original CSS is returned , else the rewritten version is returned . */
@ Nonnull public static String getRewrittenCSS ( @ Nonnull final String sOriginalCSS , @ Nonnull final CSSWriterSettings aSettings ) { } } | ValueEnforcer . notNull ( sOriginalCSS , "OriginalCSS" ) ; ValueEnforcer . notNull ( aSettings , "Settings" ) ; final CascadingStyleSheet aCSS = CSSReader . readFromString ( sOriginalCSS , aSettings . getVersion ( ) ) ; if ( aCSS != null ) { try { return new CSSWriter ( aSettings ) . getCSSAsString ( aCSS ) ; } catch ( final Exception ex ) { LOGGER . warn ( "Failed to write optimized CSS!" , ex ) ; } } return sOriginalCSS ; |
public class PageFlowController { /** * Store information about recent pages displayed . This is a framework - invoked method that should not normally be
* called directly . */
public void savePreviousPageInfo ( ActionForward forward , ActionForm form , ActionMapping mapping , HttpServletRequest request , ServletContext servletContext , boolean isSpecialForward ) { } } | if ( forward != null ) { // If previous - page is disabled ( unused in this pageflow ) , or if we ' ve already saved prevous - page info in
// this request ( for example , forward to foo . faces which forwards to foo . jsp ) , just return .
if ( request . getAttribute ( SAVED_PREVIOUS_PAGE_INFO_ATTR ) != null || isPreviousPageInfoDisabled ( ) ) return ; String path = forward . getPath ( ) ; int queryPos = path . indexOf ( '?' ) ; if ( queryPos != - 1 ) path = path . substring ( 0 , queryPos ) ; // If a form bean was generated in this request , add it to the most recent PreviousPageInfo , so when we
// go back to that page , the * updated * field values are restored ( i . e . , we don ' t revert to the values of
// the form that was passed into the page originally ) .
if ( form != null && _currentPageInfo != null ) { ActionForm oldForm = _currentPageInfo . getForm ( ) ; if ( oldForm == null || oldForm . getClass ( ) . equals ( form . getClass ( ) ) ) { _currentPageInfo . setForm ( form ) ; _currentPageInfo . setMapping ( mapping ) ; } } // Only keep track of * pages * forwarded to - - not actions or pageflows .
if ( ! FileUtils . osSensitiveEndsWith ( path , ACTION_EXTENSION ) ) { // Only save previous - page info if the page is within this pageflow .
if ( isLocalFile ( forward ) ) // | | PageFlowUtils . osSensitiveEndsWith ( path , JPF _ EXTENSION ) )
{ _previousPageInfo = _currentPageInfo ; _currentPageInfo = new PreviousPageInfo ( forward , form , mapping , request . getQueryString ( ) ) ; request . setAttribute ( SAVED_PREVIOUS_PAGE_INFO_ATTR , Boolean . TRUE ) ; } } } |
public class GuidCompressor { /** * Converts a compressed String representation of a GUID into an uncompressed one
* @ param compressedString the String representation which gets uncompressed
* @ return the uncompressed String representation
* @ throws InvalidGuidException */
public static String uncompressGuidString ( String compressedString ) throws InvalidGuidException { } } | Guid guid = new Guid ( ) ; getGuidFromCompressedString ( compressedString , guid ) ; return getUncompressedStringFromGuid ( guid ) ; |
public class IdentifierValidator { /** * Check persisted job instance id and throw exception if any ids violate
* batch id rule : Cannot be < = 0 */
public static void validatePersistedJobInstanceIds ( JobInstanceEntity instance ) throws PersistenceException { } } | if ( instance . getInstanceId ( ) <= 0 ) { long id = instance . getInstanceId ( ) ; PersistenceException e = new PersistenceException ( new BatchIllegalIDPersistedException ( Long . toString ( id ) ) ) ; logger . log ( Level . SEVERE , "error.invalid.persisted.job.id" , new Object [ ] { Long . toString ( id ) , e } ) ; throw e ; } |
public class FieldData { /** * Add this field in the Record ' s field sequence . */
public BaseField setupField ( int iFieldSeq ) { } } | BaseField field = null ; if ( iFieldSeq == 0 ) { field = new CounterField ( this , ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; field . setHidden ( true ) ; } // if ( iFieldSeq = = 1)
// field = new RecordChangedField ( this , LAST _ CHANGED , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ;
// field . setHidden ( true ) ;
// if ( iFieldSeq = = 2)
// field = new BooleanField ( this , DELETED , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ;
// field . setHidden ( true ) ;
if ( iFieldSeq == 3 ) { field = new StringField ( this , FIELD_NAME , 40 , null , null ) ; field . setNullable ( false ) ; } if ( iFieldSeq == 4 ) field = new FieldClassField ( this , FIELD_CLASS , 40 , null , null ) ; if ( iFieldSeq == 5 ) field = new StringField ( this , BASE_FIELD_NAME , 40 , null , null ) ; if ( iFieldSeq == 6 ) field = new StringField ( this , DEPENDENT_FIELD_NAME , 40 , null , null ) ; if ( iFieldSeq == 7 ) field = new ShortField ( this , MINIMUM_LENGTH , 4 , null , null ) ; if ( iFieldSeq == 8 ) field = new ShortField ( this , MAXIMUM_LENGTH , 5 , null , null ) ; if ( iFieldSeq == 9 ) field = new StringField ( this , DEFAULT_VALUE , 50 , null , null ) ; if ( iFieldSeq == 10 ) field = new StringField ( this , INITIAL_VALUE , 50 , null , null ) ; if ( iFieldSeq == 11 ) field = new StringField ( this , FIELD_DESCRIPTION , 100 , null , null ) ; if ( iFieldSeq == 12 ) field = new StringField ( this , FIELD_DESC_VERTICAL , 14 , null , null ) ; if ( iFieldSeq == 13 ) field = new FieldTypeField ( this , FIELD_TYPE , 1 , null , null ) ; if ( iFieldSeq == 14 ) field = new ShortField ( this , FIELD_DIMENSION , 3 , null , null ) ; if ( iFieldSeq == 15 ) field = new StringField ( this , FIELD_FILE_NAME , 40 , null , null ) ; if ( iFieldSeq == 16 ) field = new ShortField ( this , FIELD_SEQ_NO , 4 , null , null ) ; if ( iFieldSeq == 17 ) field = new BooleanField ( this , FIELD_NOT_NULL , 1 , null , null ) ; if ( iFieldSeq == 18 ) { field = new StringField ( this , DATA_CLASS , 20 , null , null ) ; field . setVirtual ( true ) ; } if ( iFieldSeq == 19 ) field = new BooleanField ( this , HIDDEN , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 20 ) { field = new IncludeScopeField ( this , INCLUDE_SCOPE , Constants . DEFAULT_FIELD_LENGTH , null , new Integer ( 0x004 ) ) ; field . addListener ( new InitOnceFieldHandler ( null ) ) ; } if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ; |
public class CreateColumnFamilyStatement { /** * Column definitions */
private List < ColumnDefinition > getColumns ( CFMetaData cfm ) throws InvalidRequestException { } } | List < ColumnDefinition > columnDefs = new ArrayList < > ( columns . size ( ) ) ; for ( Map . Entry < Term , String > col : columns . entrySet ( ) ) { try { ByteBuffer columnName = cfm . comparator . asAbstractType ( ) . fromStringCQL2 ( col . getKey ( ) . getText ( ) ) ; String validatorClassName = CFPropDefs . comparators . containsKey ( col . getValue ( ) ) ? CFPropDefs . comparators . get ( col . getValue ( ) ) : col . getValue ( ) ; AbstractType < ? > validator = TypeParser . parse ( validatorClassName ) ; columnDefs . add ( ColumnDefinition . regularDef ( cfm , columnName , validator , null ) ) ; } catch ( ConfigurationException e ) { InvalidRequestException ex = new InvalidRequestException ( e . toString ( ) ) ; ex . initCause ( e ) ; throw ex ; } catch ( SyntaxException e ) { InvalidRequestException ex = new InvalidRequestException ( e . toString ( ) ) ; ex . initCause ( e ) ; throw ex ; } } return columnDefs ; |
public class SeaGlassSplitPaneUI { /** * Uninstalls the UI defaults . */
protected void uninstallDefaults ( ) { } } | SeaGlassContext context = getContext ( splitPane , ENABLED ) ; style . uninstallDefaults ( context ) ; context . dispose ( ) ; style = null ; context = getContext ( splitPane , Region . SPLIT_PANE_DIVIDER , ENABLED ) ; dividerStyle . uninstallDefaults ( context ) ; context . dispose ( ) ; dividerStyle = null ; super . uninstallDefaults ( ) ; |
public class JaspiServletFilter { /** * If a JASPI provider returned request / response wrappers in the MessageInfo object then
* use those wrappers instead of the original request / response objects for web request .
* @ see javax . servlet . Filter # doFilter ( javax . servlet . ServletRequest , javax . servlet . ServletResponse , javax . servlet . FilterChain ) */
@ Override public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } } | HttpServletRequestWrapper reqestWrapper = ( HttpServletRequestWrapper ) request . getAttribute ( "com.ibm.ws.security.jaspi.servlet.request.wrapper" ) ; HttpServletResponseWrapper responseWrapper = ( HttpServletResponseWrapper ) request . getAttribute ( "com.ibm.ws.security.jaspi.servlet.response.wrapper" ) ; ServletRequest req = reqestWrapper != null ? reqestWrapper : request ; ServletResponse res = responseWrapper != null ? responseWrapper : response ; chain . doFilter ( req , res ) ; |
public class JsHdrsImpl { /** * Get the next Messaging Engine that will store the message .
* Javadoc description supplied by CommonMessageHeaders interface . */
public final SIBUuid8 getGuaranteedTargetMessagingEngineUUID ( ) { } } | byte [ ] b = ( byte [ ] ) getHdr2 ( ) . getField ( JsHdr2Access . GUARANTEED_SET_TARGETMEUUID ) ; if ( b != null ) return new SIBUuid8 ( b ) ; return null ; |
public class DialogPlus { /** * Invoked when back button is pressed . Automatically dismiss the dialog . */
public void onBackPressed ( @ NonNull DialogPlus dialogPlus ) { } } | if ( onCancelListener != null ) { onCancelListener . onCancel ( DialogPlus . this ) ; } dismiss ( ) ; |
public class Database { public static void main ( String [ ] args ) { } } | try { if ( args . length > 0 ) { if ( args [ 0 ] . equals ( "-hosts" ) ) { String [ ] hosts = ApiUtil . get_db_obj ( ) . get_device_member ( "tango/admin/*" ) ; for ( String host : hosts ) { System . out . println ( host ) ; } } } else { System . err . println ( "Parameters ?" ) ; System . err . println ( "\t-hosts: display controlled (by a Starter) host list" ) ; } } catch ( DevFailed e ) { System . err . println ( e . errors [ 0 ] . desc ) ; } |
public class DbEntityCache { /** * get an object from the cache
* @ param type the type of the object
* @ param id the id of the object
* @ return the object or ' null ' if the object is not in the cache
* @ throws ProcessEngineException if an object for the given id can be found but is of the wrong type . */
@ SuppressWarnings ( "unchecked" ) public < T extends DbEntity > T get ( Class < T > type , String id ) { } } | Class < ? > cacheKey = cacheKeyMapping . getEntityCacheKey ( type ) ; CachedDbEntity cachedDbEntity = getCachedEntity ( cacheKey , id ) ; if ( cachedDbEntity != null ) { DbEntity dbEntity = cachedDbEntity . getEntity ( ) ; try { return ( T ) dbEntity ; } catch ( ClassCastException e ) { throw LOG . entityCacheLookupException ( type , id , dbEntity . getClass ( ) , e ) ; } } else { return null ; } |
public class Computer { /** * Returns the transient { @ link Action } s associated with the computer . */
@ SuppressWarnings ( "deprecation" ) public List < Action > getActions ( ) { } } | List < Action > result = new ArrayList < > ( ) ; result . addAll ( super . getActions ( ) ) ; synchronized ( this ) { if ( transientActions == null ) { transientActions = TransientComputerActionFactory . createAllFor ( this ) ; } result . addAll ( transientActions ) ; } return Collections . unmodifiableList ( result ) ; |
public class DITypeInfo { /** * Retrieves a character sequence representing a CSV list , in
* DDL declaraion order , of the create parameters for the type . < p >
* @ return a character sequence representing a CSV
* list , in DDL declaraion order , of the create
* parameters for the type . */
String getCreateParams ( ) { } } | if ( ! locale_set ) { setLocale ( Locale . getDefault ( ) ) ; } String names ; switch ( type ) { case Types . SQL_BINARY : case Types . SQL_CHAR : case Types . SQL_NCHAR : case Types . SQL_CLOB : case Types . NCLOB : case Types . SQL_VARBINARY : case Types . SQL_VARCHAR : case Types . SQL_NVARCHAR : names = "LENGTH" ; break ; case Types . SQL_DECIMAL : case Types . SQL_NUMERIC : names = "PRECISION,SCALE" ; break ; case Types . SQL_FLOAT : case Types . SQL_TIMESTAMP : names = "PRECISION" ; break ; default : names = null ; break ; } return names ; |
public class DynaPluginRepository { /** * Loops through all the directories present inside the JNRPE plugin
* directory .
* @ param fDirectory
* The JNRPE plugins directory
* @ throws PluginConfigurationException */
public final void load ( final File fDirectory ) throws PluginConfigurationException { } } | File [ ] vFiles = fDirectory . listFiles ( ) ; if ( vFiles != null ) { for ( File f : vFiles ) { if ( f . isDirectory ( ) ) { configurePlugins ( f ) ; } } } |
public class ClassUtils { /** * Get an { @ link Iterable } that can iterate over a class hierarchy in ascending ( subclass to superclass ) order ,
* excluding interfaces .
* @ param type the type to get the class hierarchy from
* @ return Iterable an Iterable over the class hierarchy of the given class
* @ since 3.2 */
@ GwtIncompatible ( "incompatible method" ) public static Iterable < Class < ? > > hierarchy ( final Class < ? > type ) { } } | return hierarchy ( type , Interfaces . EXCLUDE ) ; |
public class ReflectionUtils { /** * Asserts method is not static .
* @ param method to validate
* @ param annotation annotation to propagate in exception message */
public static void assertNotStatic ( final Method method , Class < ? extends Annotation > annotation ) { } } | if ( Modifier . isStatic ( method . getModifiers ( ) ) ) { throw annotation == null ? MESSAGES . methodCannotBeStatic ( method ) : MESSAGES . methodCannotBeStatic2 ( method , annotation ) ; } |
public class SingletonList { /** * set is implemented purely to allow the List to be sorted , not because this List should be considered mutable . */
public T set ( int index , T element ) { } } | if ( index == 0 ) { T previousElement = this . element1 ; this . element1 = element ; return previousElement ; } throw new IndexOutOfBoundsException ( "Index: " + index + ", Size: " + this . size ( ) ) ; |
public class WebSocketConnectionHandler { /** * Called by implementation class once websocket connection established
* at networking layer .
* @ param context the websocket context */
protected final void _onConnect ( WebSocketContext context ) { } } | if ( null != connectionListener ) { connectionListener . onConnect ( context ) ; } connectionListenerManager . notifyFreeListeners ( context , false ) ; Act . eventBus ( ) . emit ( new WebSocketConnectEvent ( context ) ) ; |
public class WriterSubPlanAssembler { /** * Pull a join order out of the join orders deque , compute all possible plans
* for that join order , then append them to the computed plans deque . */
@ Override AbstractPlanNode nextPlan ( ) { } } | if ( ! m_generatedPlans ) { assert ( m_parsedStmt . m_joinTree != null ) ; // Clone the node to make make sure that analyze expression is called
// only once on the node .
JoinNode tableNode = ( JoinNode ) m_parsedStmt . m_joinTree . clone ( ) ; // Analyze join conditions
tableNode . analyzeJoinExpressions ( m_parsedStmt . m_noTableSelectionList ) ; // these just shouldn ' t happen right ?
assert ( m_parsedStmt . m_noTableSelectionList . size ( ) == 0 ) ; m_generatedPlans = true ; // This is either UPDATE or DELETE statement . Consolidate all expressions
// into the WHERE list .
tableNode . m_whereInnerList . addAll ( tableNode . m_joinInnerList ) ; tableNode . m_joinInnerList . clear ( ) ; tableNode . m_accessPaths . addAll ( getRelevantAccessPathsForTable ( tableNode . getTableScan ( ) , null , tableNode . m_whereInnerList , null ) ) ; for ( AccessPath path : tableNode . m_accessPaths ) { tableNode . m_currentAccessPath = path ; AbstractPlanNode plan = getAccessPlanForTable ( tableNode ) ; m_plans . add ( plan ) ; } } return m_plans . poll ( ) ; |
public class JideAbstractView { /** * Activates this view taking care of EDT issues */
public void activateView ( ) { } } | if ( SwingUtilities . isEventDispatchThread ( ) ) { ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . windowManager ( ) . getActiveWindow ( ) . getPage ( ) . showView ( getId ( ) ) ; } else { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { ValkyrieRepository . getInstance ( ) . getApplicationConfig ( ) . windowManager ( ) . getActiveWindow ( ) . getPage ( ) . showView ( getId ( ) ) ; } } ) ; } |
public class AlertPoliciesDeserializer { /** * Gson invokes this call - back method during deserialization when it encounters a field of the specified type .
* @ param element The Json data being deserialized
* @ param type The type of the Object to deserialize to
* @ param context The JSON deserialization context
* @ return The alert policies */
@ Override public Collection < AlertPolicy > deserialize ( JsonElement element , Type type , JsonDeserializationContext context ) throws JsonParseException { } } | JsonObject obj = element . getAsJsonObject ( ) ; JsonArray policies = obj . getAsJsonArray ( "policies" ) ; List < AlertPolicy > values = new ArrayList < AlertPolicy > ( ) ; if ( policies != null && policies . isJsonArray ( ) ) { for ( JsonElement policy : policies ) values . add ( gson . fromJson ( policy , AlertPolicy . class ) ) ; } return values ; |
public class Configuration { /** * Sets all deprecated properties that are not currently set but have a
* corresponding new property that is set . Useful for iterating the
* properties when all deprecated properties for currently set properties
* need to be present . */
public void setDeprecatedProperties ( ) { } } | DeprecationContext deprecations = deprecationContext . get ( ) ; Properties props = getProps ( ) ; Properties overlay = getOverlay ( ) ; for ( Map . Entry < String , DeprecatedKeyInfo > entry : deprecations . getDeprecatedKeyMap ( ) . entrySet ( ) ) { String depKey = entry . getKey ( ) ; if ( ! overlay . contains ( depKey ) ) { for ( String newKey : entry . getValue ( ) . newKeys ) { String val = overlay . getProperty ( newKey ) ; if ( val != null ) { props . setProperty ( depKey , val ) ; overlay . setProperty ( depKey , val ) ; break ; } } } } |
public class UsagesInner { /** * Fetches the usages of the vault .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param vaultName The name of the recovery services vault .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; VaultUsageInner & gt ; object */
public Observable < ServiceResponse < List < VaultUsageInner > > > listByVaultsWithServiceResponseAsync ( String resourceGroupName , String vaultName ) { } } | if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( vaultName == null ) { throw new IllegalArgumentException ( "Parameter vaultName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . listByVaults ( this . client . subscriptionId ( ) , resourceGroupName , vaultName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < List < VaultUsageInner > > > > ( ) { @ Override public Observable < ServiceResponse < List < VaultUsageInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < VaultUsageInner > > result = listByVaultsDelegate ( response ) ; List < VaultUsageInner > items = null ; if ( result . body ( ) != null ) { items = result . body ( ) . items ( ) ; } ServiceResponse < List < VaultUsageInner > > clientResponse = new ServiceResponse < List < VaultUsageInner > > ( items , result . response ( ) ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class Validate { /** * < p > Validate that the argument condition is { @ code false } ; otherwise throwing an exception with the specified message . This method is useful when validating according to an arbitrary boolean
* expression , such as validating a primitive number or using your own custom validation expression . < / p >
* < pre >
* Validate . isFalse ( age & lt ; = 20 , " The age must be greater than 20 : & # 37 ; d " , age ) ;
* < / pre >
* < p > For performance reasons , the long value is passed as a separate parameter and appended to the exception message only in the case of an error . < / p >
* @ param expression
* the boolean expression to check
* @ param message
* the { @ link String # format ( String , Object . . . ) } exception message if invalid , not null
* @ param value
* the value to append to the message when invalid
* @ throws IllegalArgumentValidationException
* if expression is { @ code true }
* @ see # isFalse ( boolean )
* @ see # isFalse ( boolean , String , double )
* @ see # isFalse ( boolean , String , Object . . . ) */
public static void isFalse ( final boolean expression , final String message , final long value ) { } } | INSTANCE . isFalse ( expression , message , value ) ; |
public class DexMaker { /** * Declares a field .
* @ param flags a bitwise combination of { @ link Modifier # PUBLIC } , { @ link
* Modifier # PRIVATE } , { @ link Modifier # PROTECTED } , { @ link Modifier # STATIC } ,
* { @ link Modifier # FINAL } , { @ link Modifier # VOLATILE } , and { @ link
* Modifier # TRANSIENT } .
* @ param staticValue a constant representing the initial value for the
* static field , possibly null . This must be null if this field is
* non - static . */
public void declare ( FieldId < ? , ? > fieldId , int flags , Object staticValue ) { } } | TypeDeclaration typeDeclaration = getTypeDeclaration ( fieldId . declaringType ) ; if ( typeDeclaration . fields . containsKey ( fieldId ) ) { throw new IllegalStateException ( "already declared: " + fieldId ) ; } int supportedFlags = Modifier . PUBLIC | Modifier . PRIVATE | Modifier . PROTECTED | Modifier . STATIC | Modifier . FINAL | Modifier . VOLATILE | Modifier . TRANSIENT | AccessFlags . ACC_SYNTHETIC ; if ( ( flags & ~ supportedFlags ) != 0 ) { throw new IllegalArgumentException ( "Unexpected flag: " + Integer . toHexString ( flags ) ) ; } if ( ( flags & Modifier . STATIC ) == 0 && staticValue != null ) { throw new IllegalArgumentException ( "staticValue is non-null, but field is not static" ) ; } FieldDeclaration fieldDeclaration = new FieldDeclaration ( fieldId , flags , staticValue ) ; typeDeclaration . fields . put ( fieldId , fieldDeclaration ) ; |
public class Grammar { /** * Returns a symbols that can derive the empty word . Also called removable symbols */
public void addNullable ( IntBitSet result ) { } } | IntBitSet remaining ; // indexes of productions
boolean modified ; int i ; int prod ; int max ; remaining = new IntBitSet ( ) ; remaining . addRange ( 0 , getProductionCount ( ) - 1 ) ; do { modified = false ; for ( prod = remaining . first ( ) ; prod != - 1 ; prod = remaining . next ( prod ) ) { if ( result . contains ( getLeft ( prod ) ) ) { remaining . remove ( prod ) ; } else { max = getLength ( prod ) ; for ( i = 0 ; i < max ; i ++ ) { if ( ! result . contains ( getRight ( prod , i ) ) ) { break ; } } if ( i == max ) { result . add ( getLeft ( prod ) ) ; modified = true ; } } } } while ( modified ) ; |
public class PlaceManager { /** * Called when we transition from having bodies in the place to not having any bodies in the
* place . Some places may take this as a sign to pack it in , others may wish to stick
* around . In any case , they can override this method to do their thing . */
protected void placeBecameEmpty ( ) { } } | // let our delegates know what ' s up
applyToDelegates ( new DelegateOp ( PlaceManagerDelegate . class ) { @ Override public void apply ( PlaceManagerDelegate delegate ) { delegate . placeBecameEmpty ( ) ; } } ) ; // Log . info ( " Place became empty " + where ( ) + " . " ) ;
checkShutdownInterval ( ) ; |
public class StatementBuilder { /** * exec ( ) . { expression } . endExec ( )
* @ return an expression builder */
final public ExecExpressionBuilder < T > exec ( ) { } } | final int sourceLineNumber = builder . getSourceLineNumber ( ) ; return new ExecExpressionBuilder < T > ( new ExpressionHandler < T > ( ) { public T handleExpression ( Expression e ) { return statementHandler ( ) . handleStatement ( new ExpressionStatement ( sourceLineNumber , e ) ) ; } } ) ; |
public class GoogleMapShapeConverter { /** * Convert a { @ link MultiPolygon } to a { @ link MultiPolygonOptions }
* @ param multiPolygon multi polygon
* @ return multi polygon options */
public MultiPolygonOptions toPolygons ( MultiPolygon multiPolygon ) { } } | MultiPolygonOptions polygons = new MultiPolygonOptions ( ) ; for ( Polygon polygon : multiPolygon . getPolygons ( ) ) { PolygonOptions polygonOptions = toPolygon ( polygon ) ; polygons . add ( polygonOptions ) ; } return polygons ; |
public class DefaultClusterContext { /** * Fire member removed event */
private void fireMemberRemoved ( MemberId exMember ) { } } | GL . debug ( GL . CLUSTER_LOGGER_NAME , "Firing member removed for: {}" , exMember ) ; for ( MembershipEventListener listener : membershipEventListeners ) { try { listener . memberRemoved ( exMember ) ; } catch ( Throwable e ) { GL . error ( GL . CLUSTER_LOGGER_NAME , "Error in member removed event {}" , e ) ; } } |
public class VarInt { /** * Encodes the value into its minimal representation .
* @ return the minimal encoded bytes of the value */
public byte [ ] encode ( ) { } } | byte [ ] bytes ; switch ( sizeOf ( value ) ) { case 1 : return new byte [ ] { ( byte ) value } ; case 3 : bytes = new byte [ 3 ] ; bytes [ 0 ] = ( byte ) 253 ; Utils . uint16ToByteArrayLE ( ( int ) value , bytes , 1 ) ; return bytes ; case 5 : bytes = new byte [ 5 ] ; bytes [ 0 ] = ( byte ) 254 ; Utils . uint32ToByteArrayLE ( value , bytes , 1 ) ; return bytes ; default : bytes = new byte [ 9 ] ; bytes [ 0 ] = ( byte ) 255 ; Utils . int64ToByteArrayLE ( value , bytes , 1 ) ; return bytes ; } |
public class CollationData { /** * Finds the reordering group which contains the primary weight .
* @ return the first script of the group , or - 1 if the weight is beyond the last group */
public int getGroupForPrimary ( long p ) { } } | p >>= 16 ; if ( p < scriptStarts [ 1 ] || scriptStarts [ scriptStarts . length - 1 ] <= p ) { return - 1 ; } int index = 1 ; while ( p >= scriptStarts [ index + 1 ] ) { ++ index ; } for ( int i = 0 ; i < numScripts ; ++ i ) { if ( scriptsIndex [ i ] == index ) { return i ; } } for ( int i = 0 ; i < MAX_NUM_SPECIAL_REORDER_CODES ; ++ i ) { if ( scriptsIndex [ numScripts + i ] == index ) { return Collator . ReorderCodes . FIRST + i ; } } return - 1 ; |
public class TimeBaseProvider { /** * Registers the time provider with the appropriate managers . Called by the presents server at
* startup . */
public static void init ( InvocationManager invmgr , RootDObjectManager omgr ) { } } | // we ' ll need these later
_invmgr = invmgr ; _omgr = omgr ; // register a provider instance
invmgr . registerProvider ( new TimeBaseProvider ( ) , TimeBaseMarshaller . class , GLOBAL_GROUP ) ; |
public class Container { /** * The IDs of each GPU assigned to the container .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setGpuIds ( java . util . Collection ) } or { @ link # withGpuIds ( java . util . Collection ) } if you want to override the
* existing values .
* @ param gpuIds
* The IDs of each GPU assigned to the container .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Container withGpuIds ( String ... gpuIds ) { } } | if ( this . gpuIds == null ) { setGpuIds ( new com . amazonaws . internal . SdkInternalList < String > ( gpuIds . length ) ) ; } for ( String ele : gpuIds ) { this . gpuIds . add ( ele ) ; } return this ; |
public class JPATxEmInvocation { /** * ( non - Javadoc )
* @ see javax . persistence . EntityManager # createQuery ( java . lang . String ) */
@ Override public Query createQuery ( String qlString ) { } } | try { return ivEm . createQuery ( qlString ) ; } finally { if ( ! inJTATransaction ( ) ) { ivEm . clear ( ) ; } } |
public class DefaultBeanContext { /** * Find a concrete candidate for the given qualifier .
* @ param beanType The bean type
* @ param qualifier The qualifier
* @ param throwNonUnique Whether to throw an exception if the bean is not found
* @ param includeProvided Whether to include provided resolution
* @ param < T > The bean generic type
* @ return The concrete bean definition candidate */
@ SuppressWarnings ( "unchecked" ) private < T > Optional < BeanDefinition < T > > findConcreteCandidate ( Class < T > beanType , Qualifier < T > qualifier , boolean throwNonUnique , boolean includeProvided ) { } } | return ( Optional ) beanConcreteCandidateCache . computeIfAbsent ( new BeanKey ( beanType , qualifier ) , beanKey -> ( Optional ) findConcreteCandidateNoCache ( beanType , qualifier , throwNonUnique , includeProvided , true ) ) ; |
public class RuntimeUtil { /** * 执行系统命令 , 使用系统默认编码
* @ param charset 编码
* @ param cmds 命令列表 , 每个元素代表一条命令
* @ return 执行结果 , 按行区分
* @ throws IORuntimeException IO异常
* @ since 3.1.2 */
public static List < String > execForLines ( Charset charset , String ... cmds ) throws IORuntimeException { } } | return getResultLines ( exec ( cmds ) , charset ) ; |
public class Matrix4x3d { /** * Apply a mirror / reflection transformation to this matrix that reflects about the given plane
* specified via the plane normal and a point on the plane .
* If < code > M < / code > is < code > this < / code > matrix and < code > R < / code > the reflection matrix ,
* then the new matrix will be < code > M * R < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * R * v < / code > , the
* reflection will be applied first !
* @ param normal
* the plane normal
* @ param point
* a point on the plane
* @ return this */
public Matrix4x3d reflect ( Vector3dc normal , Vector3dc point ) { } } | return reflect ( normal . x ( ) , normal . y ( ) , normal . z ( ) , point . x ( ) , point . y ( ) , point . z ( ) ) ; |
public class SheetRowResourcesImpl { /** * Update rows .
* It mirrors to the following Smartsheet REST API method : PUT / sheets / { sheetId } / rows
* Exceptions :
* IllegalArgumentException : if any argument is null
* InvalidRequestException : if there is any problem with the REST API request
* AuthorizationException : if there is any problem with the REST API authorization ( access token )
* ServiceUnavailableException : if the REST API service is not available ( possibly due to rate limiting )
* SmartsheetRestException : if there is any other REST API related error occurred during the operation
* SmartsheetException : if there is any other error occurred during the operation
* @ param sheetId the id of the sheet
* @ param rows the list of rows
* @ return a list of rows
* @ throws SmartsheetException the smartsheet exception */
public List < Row > updateRows ( long sheetId , List < Row > rows ) throws SmartsheetException { } } | return this . putAndReceiveList ( "sheets/" + sheetId + "/rows" , rows , Row . class ) ; |
public class ExecutorQueryServiceImpl { /** * { @ inheritDoc } */
@ Override public List < RequestInfo > getRequestsByStatus ( List < STATUS > statuses ) { } } | return getRequestsByStatus ( statuses , new QueryContext ( 0 , 100 ) ) ; |
public class DefaultMultifactorAuthenticationContextValidator { /** * { @ inheritDoc }
* If the authentication event is established as part trusted / device browser
* such that MFA was skipped , allow for validation to execute successfully .
* If authentication event did bypass MFA , let for allow for validation to execute successfully .
* @ param authentication the authentication
* @ param requestedContext the requested context
* @ param service the service
* @ return true if the context can be successfully validated . */
@ Override public Pair < Boolean , Optional < MultifactorAuthenticationProvider > > validate ( final Authentication authentication , final String requestedContext , final RegisteredService service ) { } } | val attributes = authentication . getAttributes ( ) ; val ctxAttr = attributes . get ( this . authenticationContextAttribute ) ; val contexts = CollectionUtils . toCollection ( ctxAttr ) ; LOGGER . trace ( "Attempting to match requested authentication context [{}] against [{}]" , requestedContext , contexts ) ; val providerMap = MultifactorAuthenticationUtils . getAvailableMultifactorAuthenticationProviders ( this . applicationContext ) ; LOGGER . trace ( "Available MFA providers are [{}]" , providerMap . values ( ) ) ; val requestedProvider = locateRequestedProvider ( providerMap . values ( ) , requestedContext ) ; if ( requestedProvider . isEmpty ( ) ) { LOGGER . debug ( "Requested authentication provider cannot be recognized." ) ; return Pair . of ( Boolean . FALSE , Optional . empty ( ) ) ; } LOGGER . debug ( "Requested context is [{}] and available contexts are [{}]" , requestedContext , contexts ) ; if ( contexts . stream ( ) . anyMatch ( ctx -> ctx . toString ( ) . equals ( requestedContext ) ) ) { LOGGER . debug ( "Requested authentication context [{}] is satisfied" , requestedContext ) ; return Pair . of ( Boolean . TRUE , requestedProvider ) ; } if ( StringUtils . isNotBlank ( this . mfaTrustedAuthnAttributeName ) && attributes . containsKey ( this . mfaTrustedAuthnAttributeName ) ) { LOGGER . debug ( "Requested authentication context [{}] is satisfied since device is already trusted" , requestedContext ) ; return Pair . of ( Boolean . TRUE , requestedProvider ) ; } val satisfiedProviders = getSatisfiedAuthenticationProviders ( authentication , providerMap . values ( ) ) ; if ( satisfiedProviders != null && ! satisfiedProviders . isEmpty ( ) ) { val providers = satisfiedProviders . toArray ( MultifactorAuthenticationProvider [ ] :: new ) ; OrderComparator . sortIfNecessary ( providers ) ; val result = Arrays . stream ( providers ) . filter ( provider -> { val p = requestedProvider . get ( ) ; return provider . equals ( p ) || provider . getOrder ( ) >= p . getOrder ( ) ; } ) . findFirst ( ) ; if ( result . isPresent ( ) ) { LOGGER . debug ( "Current provider [{}] already satisfies the authentication requirements of [{}]; proceed with flow normally." , result . get ( ) , requestedProvider ) ; return Pair . of ( Boolean . TRUE , requestedProvider ) ; } } val provider = requestedProvider . get ( ) ; LOGGER . debug ( "No multifactor providers could be located to satisfy the requested context for [{}]" , provider ) ; return Pair . of ( Boolean . FALSE , requestedProvider ) ; |
public class NetflixConfig { /** * Create a config to be used in the Netflix Cloud . */
public static Config createConfig ( Config config ) { } } | try { // We cannot use the libraries layer as the nf - archaius2 - platform - bridge
// will delegate the Config binding to archaius1 and the libraries layer
// then wraps that . So anything added to the libraries layer will not get
// picked up by anything injecting Config .
// Instead we just create a composite where the injected config will override
// the prop files . If no config binding is present use the environment and
// system properties config .
CompositeConfig cc = new DefaultCompositeConfig ( true ) ; cc . addConfig ( "ATLAS" , loadPropFiles ( ) ) ; cc . addConfig ( "ENVIRONMENT" , EnvironmentConfig . INSTANCE ) ; cc . addConfig ( "SYS" , SystemConfig . INSTANCE ) ; if ( config != null ) { LOGGER . debug ( "found injected config, adding as override layer" ) ; cc . addConfig ( "INJECTED" , config ) ; } else { LOGGER . debug ( "no injected config found" ) ; } return cc ; } catch ( ConfigException e ) { throw new IllegalStateException ( "failed to load atlas config" , e ) ; } |
public class CmsUserTable { /** * Checks is it is allown for the current user to see given user . < p >
* @ param user to be checked
* @ return boolean
* @ throws CmsException exception */
private boolean isAllowedUser ( CmsUser user ) throws CmsException { } } | if ( user . getOuFqn ( ) . startsWith ( m_cms . getRequestContext ( ) . getOuFqn ( ) ) ) { return true ; } return OpenCms . getRoleManager ( ) . getRolesOfUser ( m_cms , user . getName ( ) , m_ou , true , true , false ) . size ( ) > 0 ; |
public class WebUtils { /** * True if should be shown for this filtering .
* @ param user User to check
* @ param userFilterSet Set of valid users
* @ param poolInfo Pool info to check
* @ param poolGroupFilterSet Set of valid pool groups
* @ param poolInfoFilterSet Set of valid pool infos
* @ return True if should be shown . */
public static boolean showUserPoolInfo ( String user , Set < String > userFilterSet , PoolInfo poolInfo , Set < String > poolGroupFilterSet , Set < PoolInfo > poolInfoFilterSet ) { } } | boolean showUser = false ; if ( userFilterSet . isEmpty ( ) || userFilterSet . contains ( user ) ) { showUser = true ; } return showUser && showPoolInfo ( poolInfo , poolGroupFilterSet , poolInfoFilterSet ) ; |
public class NetworkWatchersInner { /** * Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server .
* @ param resourceGroupName The name of the network watcher resource group .
* @ param networkWatcherName The name of the network watcher resource .
* @ param parameters Parameters that determine how the connectivity check will be performed .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ConnectivityInformationInner object */
public Observable < ServiceResponse < ConnectivityInformationInner > > beginCheckConnectivityWithServiceResponseAsync ( String resourceGroupName , String networkWatcherName , ConnectivityParameters parameters ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( networkWatcherName == null ) { throw new IllegalArgumentException ( "Parameter networkWatcherName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( parameters == null ) { throw new IllegalArgumentException ( "Parameter parameters is required and cannot be null." ) ; } Validator . validate ( parameters ) ; final String apiVersion = "2018-06-01" ; return service . beginCheckConnectivity ( resourceGroupName , networkWatcherName , this . client . subscriptionId ( ) , parameters , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < ConnectivityInformationInner > > > ( ) { @ Override public Observable < ServiceResponse < ConnectivityInformationInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < ConnectivityInformationInner > clientResponse = beginCheckConnectivityDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class AndroidEncryptionUtils { /** * Returns the encryption key stored on { @ link SharedPreferences } . If the key is already on memory , it doesn ' t access the file system .
* You shouldn ' t call this method in the UI thread . */
private static String getBase64Key ( ) { } } | if ( base64Key == null ) { base64Key = SharedPreferencesHelper . get ( ) . loadPreference ( BASE64_KEY ) ; if ( base64Key == null ) { base64Key = generateBase64Key ( ) ; SharedPreferencesHelper . get ( ) . savePreference ( BASE64_KEY , base64Key ) ; } } return base64Key ; |
public class Proxy { /** * Sets SOCKS4 proxy as default .
* @ param hostName Host name on which SOCKS4 server is running .
* @ param port Port on which SOCKS4 server is running .
* @ param user Username to use for communications with proxy . */
public static void setDefaultProxy ( String hostName , int port , String user ) throws UnknownHostException { } } | defaultProxy = new Socks4Proxy ( hostName , port , user ) ; |
public class Util { /** * Returns a JavaScript representation of the character in a hex escaped
* format .
* @ param codePoint The code point to append .
* @ param out The buffer to which the hex representation should be appended . */
private static void appendHexJavaScriptRepresentation ( int codePoint , Appendable out ) throws IOException { } } | if ( Character . isSupplementaryCodePoint ( codePoint ) ) { // Handle supplementary Unicode values which are not representable in
// JavaScript . We deal with these by escaping them as two 4B sequences
// so that they will round - trip properly when sent from Java to JavaScript
// and back .
char [ ] surrogates = Character . toChars ( codePoint ) ; appendHexJavaScriptRepresentation ( surrogates [ 0 ] , out ) ; appendHexJavaScriptRepresentation ( surrogates [ 1 ] , out ) ; return ; } out . append ( "\\u" ) . append ( HEX_CHARS [ ( codePoint >>> 12 ) & 0xf ] ) . append ( HEX_CHARS [ ( codePoint >>> 8 ) & 0xf ] ) . append ( HEX_CHARS [ ( codePoint >>> 4 ) & 0xf ] ) . append ( HEX_CHARS [ codePoint & 0xf ] ) ; |
public class JSONParser { /** * by making HTTP POST or GET method */
public JSONObject makeHttpRequest ( String url ) throws IOException { } } | InputStream is = null ; JSONObject jObj = null ; String json = null ; // Making HTTP request
try { is = new URL ( url ) . openStream ( ) ; } catch ( Exception ex ) { Log . d ( "Networking" , ex . getLocalizedMessage ( ) ) ; throw new IOException ( "Error connecting" ) ; } try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( is , "iso-8859-1" ) , 8 ) ; StringBuilder sb = new StringBuilder ( ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line + "\n" ) ; } json = sb . toString ( ) ; reader . close ( ) ; } catch ( Exception e ) { Log . e ( "Buffer Error" , "Error converting result " + e . toString ( ) ) ; } finally { try { is . close ( ) ; } catch ( Exception ex ) { } } // try parse the string to a JSON object
try { jObj = new JSONObject ( json ) ; } catch ( JSONException e ) { Log . e ( "JSON Parser" , "Error parsing data " + e . toString ( ) ) ; } // return JSON String
return jObj ; |
public class ReleaseAction { /** * Add some of the release build properties to a map . */
public void addVars ( Map < String , String > env ) { } } | if ( tagUrl != null ) { env . put ( "RELEASE_SCM_TAG" , tagUrl ) ; env . put ( RT_RELEASE_STAGING + "SCM_TAG" , tagUrl ) ; } if ( releaseBranch != null ) { env . put ( "RELEASE_SCM_BRANCH" , releaseBranch ) ; env . put ( RT_RELEASE_STAGING + "SCM_BRANCH" , releaseBranch ) ; } if ( releaseVersion != null ) { env . put ( RT_RELEASE_STAGING + "VERSION" , releaseVersion ) ; } if ( nextVersion != null ) { env . put ( RT_RELEASE_STAGING + "NEXT_VERSION" , nextVersion ) ; } |
public class ArgumentParser { /** * Print the option usage list . Essentially printed as a list of options
* with the description indented where it overflows the available line
* width .
* @ param out The output stream .
* @ param showHidden Whether to show hidden options . */
public void printUsage ( OutputStream out , boolean showHidden ) { } } | printUsage ( new PrintWriter ( new OutputStreamWriter ( out , UTF_8 ) ) , showHidden ) ; |
public class SpatialAnchorsAccountsInner { /** * Updating a Spatial Anchors Account .
* @ param resourceGroupName Name of an Azure resource group .
* @ param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account .
* @ param spatialAnchorsAccount Spatial Anchors Account parameter .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < SpatialAnchorsAccountInner > updateAsync ( String resourceGroupName , String spatialAnchorsAccountName , SpatialAnchorsAccountInner spatialAnchorsAccount , final ServiceCallback < SpatialAnchorsAccountInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , spatialAnchorsAccountName , spatialAnchorsAccount ) , serviceCallback ) ; |
public class MutableDoubleArrayTrieInteger { /** * 删除键
* @ param key
* @ return 值 */
public int delete ( String key ) { } } | if ( key == null ) { return - 1 ; } int curState = 1 ; int [ ] ids = this . charMap . toIdList ( key ) ; int [ ] path = new int [ ids . length + 1 ] ; int i = 0 ; for ( ; i < ids . length ; i ++ ) { int c = ids [ i ] ; if ( ( getBase ( curState ) + c >= getBaseArraySize ( ) ) || ( getCheck ( getBase ( curState ) + c ) != curState ) ) { break ; } curState = getBase ( curState ) + c ; path [ i ] = curState ; } int ret = - 1 ; if ( i == ids . length ) { if ( getCheck ( getBase ( curState ) + UNUSED_CHAR_VALUE ) == curState ) { -- this . size ; ret = getLeafValue ( getBase ( getBase ( curState ) + UNUSED_CHAR_VALUE ) ) ; path [ ( path . length - 1 ) ] = ( getBase ( curState ) + UNUSED_CHAR_VALUE ) ; for ( int j = path . length - 1 ; j >= 0 ; -- j ) { boolean isLeaf = true ; int state = path [ j ] ; for ( int k = 0 ; k < this . charMap . getCharsetSize ( ) ; k ++ ) { if ( isLeafValue ( getBase ( state ) ) ) { break ; } if ( ( getBase ( state ) + k < getBaseArraySize ( ) ) && ( getCheck ( getBase ( state ) + k ) == state ) ) { isLeaf = false ; break ; } } if ( ! isLeaf ) { break ; } addFreeLink ( state ) ; } } } return ret ; |
public class Intersectiond { /** * Test whether the given sphere with center < code > ( sX , sY , sZ ) < / code > intersects the triangle given by its three vertices , and if they intersect
* store the point of intersection into < code > result < / code > .
* This method also returns whether the point of intersection is on one of the triangle ' s vertices , edges or on the face .
* Reference : Book " Real - Time Collision Detection " chapter 5.2.7 " Testing Sphere Against Triangle "
* @ param sX
* the x coordinate of the sphere ' s center
* @ param sY
* the y coordinate of the sphere ' s center
* @ param sZ
* the z coordinate of the sphere ' s center
* @ param sR
* the sphere ' s radius
* @ param v0X
* the x coordinate of the first vertex of the triangle
* @ param v0Y
* the y coordinate of the first vertex of the triangle
* @ param v0Z
* the z coordinate of the first vertex of the triangle
* @ param v1X
* the x coordinate of the second vertex of the triangle
* @ param v1Y
* the y coordinate of the second vertex of the triangle
* @ param v1Z
* the z coordinate of the second vertex of the triangle
* @ param v2X
* the x coordinate of the third vertex of the triangle
* @ param v2Y
* the y coordinate of the third vertex of the triangle
* @ param v2Z
* the z coordinate of the third vertex of the triangle
* @ param result
* will hold the point of intersection
* @ return one of { @ link # POINT _ ON _ TRIANGLE _ VERTEX _ 0 } , { @ link # POINT _ ON _ TRIANGLE _ VERTEX _ 1 } , { @ link # POINT _ ON _ TRIANGLE _ VERTEX _ 2 } ,
* { @ link # POINT _ ON _ TRIANGLE _ EDGE _ 01 } , { @ link # POINT _ ON _ TRIANGLE _ EDGE _ 12 } , { @ link # POINT _ ON _ TRIANGLE _ EDGE _ 20 } or
* { @ link # POINT _ ON _ TRIANGLE _ FACE } or < code > 0 < / code > */
public static int intersectSphereTriangle ( double sX , double sY , double sZ , double sR , double v0X , double v0Y , double v0Z , double v1X , double v1Y , double v1Z , double v2X , double v2Y , double v2Z , Vector3d result ) { } } | int closest = findClosestPointOnTriangle ( v0X , v0Y , v0Z , v1X , v1Y , v1Z , v2X , v2Y , v2Z , sX , sY , sZ , result ) ; double vX = result . x - sX , vY = result . y - sY , vZ = result . z - sZ ; double dot = vX * vX + vY * vY + vZ * vZ ; if ( dot <= sR * sR ) { return closest ; } return 0 ; |
public class ProductSearchClient { /** * Formats a string containing the fully - qualified path to represent a reference _ image resource .
* @ deprecated Use the { @ link ReferenceImageName } class instead . */
@ Deprecated public static final String formatReferenceImageName ( String project , String location , String product , String referenceImage ) { } } | return REFERENCE_IMAGE_PATH_TEMPLATE . instantiate ( "project" , project , "location" , location , "product" , product , "reference_image" , referenceImage ) ; |
public class PersistentFieldFactory { private static String getDefaultPersistentFieldClassName ( ) { } } | try { PersistenceBrokerConfiguration config = ( PersistenceBrokerConfiguration ) OjbConfigurator . getInstance ( ) . getConfigurationFor ( null ) ; Class clazz = config . getPersistentFieldClass ( ) ; return clazz . getName ( ) ; } catch ( ConfigurationException e ) { log . error ( "Cannot look-up PersistentField class, use default implementation instead" , e ) ; return DEFAULT_PERSISTENT_FIELD_IMPL . getName ( ) ; } |
public class PrintWriter { /** * Flushes the stream if it ' s not closed and checks its error state .
* @ return < code > true < / code > if the print stream has encountered an error ,
* either on the underlying output stream or during a format
* conversion . */
public boolean checkError ( ) { } } | if ( out != null ) { flush ( ) ; } if ( out instanceof java . io . PrintWriter ) { PrintWriter pw = ( PrintWriter ) out ; return pw . checkError ( ) ; } else if ( psOut != null ) { return psOut . checkError ( ) ; } return trouble ; |
public class AWSRAMClient { /** * Gets the associations for the specified resource share .
* @ param getResourceShareAssociationsRequest
* @ return Result of the GetResourceShareAssociations operation returned by the service .
* @ throws UnknownResourceException
* A specified resource was not found .
* @ throws MalformedArnException
* The format of an Amazon Resource Name ( ARN ) is not valid .
* @ throws InvalidNextTokenException
* The specified value for NextToken is not valid .
* @ throws InvalidParameterException
* A parameter is not valid .
* @ throws OperationNotPermittedException
* The requested operation is not permitted .
* @ throws ServerInternalException
* The service could not respond to the request due to an internal problem .
* @ throws ServiceUnavailableException
* The service is not available .
* @ sample AWSRAM . GetResourceShareAssociations
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ram - 2018-01-04 / GetResourceShareAssociations "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public GetResourceShareAssociationsResult getResourceShareAssociations ( GetResourceShareAssociationsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetResourceShareAssociations ( request ) ; |
public class TupleUtils { /** * Returns a { @ link Predicate } of { @ link Tuple7 } that wraps a predicate of the component values of the tuple
* @ param predicate the component value predicate
* @ param < T1 > the type of the first value
* @ param < T2 > the type of the second value
* @ param < T3 > the type of the third value
* @ param < T4 > the type of the fourth value
* @ param < T5 > the type of the fifth value
* @ param < T6 > the type of the sixth value
* @ param < T7 > the type of the seventh value
* @ return the wrapper predicate */
public static < T1 , T2 , T3 , T4 , T5 , T6 , T7 > Predicate < Tuple7 < T1 , T2 , T3 , T4 , T5 , T6 , T7 > > predicate ( Predicate7 < T1 , T2 , T3 , T4 , T5 , T6 , T7 > predicate ) { } } | return tuple -> predicate . test ( tuple . getT1 ( ) , tuple . getT2 ( ) , tuple . getT3 ( ) , tuple . getT4 ( ) , tuple . getT5 ( ) , tuple . getT6 ( ) , tuple . getT7 ( ) ) ; |
public class Links { /** * / * returns a copy of the link table */
synchronized Link [ ] links ( ) { } } | Link [ ] ret = null ; if ( count != 0 ) { ret = new Link [ count ] ; System . arraycopy ( links , 0 , ret , 0 , count ) ; } return ret ; |
public class BaseBuffer { /** * { @ inheritDoc } */
@ Override public final Buffer readUntilSafe ( final int maxBytes , final byte ... bytes ) throws IOException , IllegalArgumentException { } } | final int index = indexOf ( maxBytes , bytes ) ; if ( index == - 1 ) { return null ; } final int size = index - getReaderIndex ( ) ; Buffer result = null ; if ( size == 0 ) { result = Buffers . EMPTY_BUFFER ; } else { result = readBytes ( size ) ; } readByte ( ) ; // consume the one at the index as well
return result ; |
public class SimpleSortField { /** * Returns the Lucene { @ link org . apache . lucene . search . SortField } representing this { @ link SortField } .
* @ param schema the { @ link Schema } to be used
* @ return the equivalent Lucene sort field */
@ Override public org . apache . lucene . search . SortField sortField ( Schema schema ) { } } | if ( field . equalsIgnoreCase ( "score" ) ) { return FIELD_SCORE ; } Mapper mapper = schema . mapper ( field ) ; if ( mapper == null ) { throw new IndexException ( "No mapper found for sortFields field '{}'" , field ) ; } else if ( ! mapper . docValues ) { throw new IndexException ( "Field '{}' does not support sorting" , field ) ; } else { return mapper . sortField ( field , reverse ) ; } |
public class ManagerConnectionImpl { /** * Implements synchronous sending of event generating actions . */
public ResponseEvents sendEventGeneratingAction ( EventGeneratingAction action , long timeout ) throws IOException , EventTimeoutException , IllegalArgumentException , IllegalStateException { } } | final ResponseEventsImpl responseEvents ; final ResponseEventHandler responseEventHandler ; final String internalActionId ; if ( action == null ) { throw new IllegalArgumentException ( "Unable to send action: action is null." ) ; } else if ( action . getActionCompleteEventClass ( ) == null ) { throw new IllegalArgumentException ( "Unable to send action: actionCompleteEventClass for " + action . getClass ( ) . getName ( ) + " is null." ) ; } else if ( ! ResponseEvent . class . isAssignableFrom ( action . getActionCompleteEventClass ( ) ) ) { throw new IllegalArgumentException ( "Unable to send action: actionCompleteEventClass (" + action . getActionCompleteEventClass ( ) . getName ( ) + ") for " + action . getClass ( ) . getName ( ) + " is not a ResponseEvent." ) ; } if ( state != CONNECTED ) { throw new IllegalStateException ( "Actions may only be sent when in state " + "CONNECTED but connection is in state " + state ) ; } responseEvents = new ResponseEventsImpl ( ) ; responseEventHandler = new ResponseEventHandler ( responseEvents , action . getActionCompleteEventClass ( ) ) ; internalActionId = createInternalActionId ( ) ; try { // register response handler . . .
synchronized ( this . responseListeners ) { this . responseListeners . put ( internalActionId , responseEventHandler ) ; } // . . . and event handler .
synchronized ( this . responseEventListeners ) { this . responseEventListeners . put ( internalActionId , responseEventHandler ) ; } writer . sendAction ( action , internalActionId ) ; // only wait if response has not yet arrived .
if ( responseEvents . getResponse ( ) == null || ! responseEvents . isComplete ( ) ) { try { responseEvents . await ( timeout ) ; } catch ( InterruptedException e ) { logger . warn ( "Interrupted while waiting for response events." ) ; Thread . currentThread ( ) . interrupt ( ) ; } } // still no response or not all events received and timed out ?
if ( responseEvents . getResponse ( ) == null || ! responseEvents . isComplete ( ) ) { throw new EventTimeoutException ( "Timeout waiting for response or response events to " + action . getAction ( ) + ( action . getActionId ( ) == null ? "" : " (actionId: " + action . getActionId ( ) + ")" ) , responseEvents ) ; } } finally { // remove the event handler
synchronized ( this . responseEventListeners ) { this . responseEventListeners . remove ( internalActionId ) ; } // Note : The response handler should have already been removed
// when the response was received , however we remove it here
// just in case it was never received .
synchronized ( this . responseListeners ) { this . responseListeners . remove ( internalActionId ) ; } } return responseEvents ; |
public class FilesInner { /** * Get file information .
* The files resource is a nested , proxy - only resource representing a file stored under the project resource . This method retrieves information about a file .
* @ param groupName Name of the resource group
* @ param serviceName Name of the service
* @ param projectName Name of the project
* @ param fileName Name of the File
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ProjectFileInner object */
public Observable < ProjectFileInner > getAsync ( String groupName , String serviceName , String projectName , String fileName ) { } } | return getWithServiceResponseAsync ( groupName , serviceName , projectName , fileName ) . map ( new Func1 < ServiceResponse < ProjectFileInner > , ProjectFileInner > ( ) { @ Override public ProjectFileInner call ( ServiceResponse < ProjectFileInner > response ) { return response . body ( ) ; } } ) ; |
public class ReviewReport { /** * A list of ReviewResults objects for each action specified in the Review Policy .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setReviewResults ( java . util . Collection ) } or { @ link # withReviewResults ( java . util . Collection ) } if you want
* to override the existing values .
* @ param reviewResults
* A list of ReviewResults objects for each action specified in the Review Policy .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ReviewReport withReviewResults ( ReviewResultDetail ... reviewResults ) { } } | if ( this . reviewResults == null ) { setReviewResults ( new java . util . ArrayList < ReviewResultDetail > ( reviewResults . length ) ) ; } for ( ReviewResultDetail ele : reviewResults ) { this . reviewResults . add ( ele ) ; } return this ; |
public class RythmEngine { /** * Register { @ link org . rythmengine . extension . IFormatter formatters }
* @ param formatterClasses */
public void registerFormatter ( Class < IFormatter > ... formatterClasses ) { } } | for ( Class < IFormatter > cls : formatterClasses ) { try { IFormatter fmt = cls . newInstance ( ) ; extensionManager ( ) . registerFormatter ( fmt ) ; } catch ( Exception e ) { Logger . error ( e , "Error get formatter instance from class[%s]" , cls ) ; } } |
public class GroupApi { /** * Adds an LDAP group link .
* < pre > < code > GitLab Endpoint : POST / groups / : id / ldap _ group _ links < / code > < / pre >
* @ param groupIdOrPath the group ID , path of the group , or a Group instance holding the group ID or path
* @ param cn the CN of a LDAP group
* @ param groupAccess the minimum access level for members of the LDAP group
* @ param provider the LDAP provider for the LDAP group
* @ throws GitLabApiException if any exception occurs */
public void addLdapGroupLink ( Object groupIdOrPath , String cn , Integer groupAccess , String provider ) throws GitLabApiException { } } | GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "cn" , cn , true ) . withParam ( "group_access" , groupAccess , true ) . withParam ( "provider" , provider , true ) ; post ( Response . Status . CREATED , formData , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "ldap_group_links" ) ; |
public class SocketBackend { /** * send data from backend to frontend ( export data ) */
public static void receiveStream ( ObjectInputStream ois , OutputStream outputStream ) throws IOException { } } | int b ; while ( ( b = ois . read ( ) ) >= 0 ) { outputStream . write ( b ) ; } return ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.