signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RandomUtil { /** * 随机字母 , 固定长度 */
public static String randomLetterFixLength ( Random random , int length ) { } } | return RandomStringUtils . random ( length , 0 , 0 , true , false , null , random ) ; |
public class MsgpackIOUtil { /** * Serializes the { @ code message } using the given { @ code schema } . */
public static < T > byte [ ] toByteArray ( T message , Schema < T > schema , boolean numeric ) { } } | ArrayBufferOutput out = new ArrayBufferOutput ( ) ; try { writeTo ( out , message , schema , numeric ) ; } catch ( IOException e ) { throw new RuntimeException ( "Serializing to a byte array threw an IOException" , e ) ; } return out . toByteArray ( ) ; |
public class OperaProxy { /** * Parse an instance of { @ link Proxy } , merge and apply its configuration to the current Opera
* instance . */
public void parse ( Proxy proxy ) { } } | if ( proxy . getProxyType ( ) == Proxy . ProxyType . UNSPECIFIED ) { return ; } reset ( ) ; switch ( proxy . getProxyType ( ) ) { case DIRECT : if ( ! product . is ( MOBILE ) ) { setEnabled ( false ) ; } setUsePAC ( false ) ; break ; case MANUAL : if ( ! product . is ( MOBILE ) ) { setEnabled ( true ) ; } setUsePAC ( false ) ; // TODO ( andreastt ) : HTTPS proxy
// TODO ( andreastt ) : SOCKS proxy
if ( proxy . getHttpProxy ( ) != null ) { setHttpProxy ( proxy . getHttpProxy ( ) ) ; } if ( proxy . getFtpProxy ( ) != null ) { setFtpProxy ( proxy . getFtpProxy ( ) ) ; } break ; case PAC : if ( ! product . is ( MOBILE ) ) { setEnabled ( true ) ; } setUsePAC ( true ) ; if ( proxy . getProxyAutoconfigUrl ( ) != null ) { setAutoconfigUrl ( proxy . getProxyAutoconfigUrl ( ) ) ; } break ; default : logger . warning ( "Unsupported proxy type: " + proxy . getProxyType ( ) ) ; } |
public class Slidr { /** * Attach a slideable mechanism to an activity that adds the slide to dismiss functionality
* and allows for the statusbar to transition between colors
* @ param activity the activity to attach the slider to
* @ param statusBarColor1 the primaryDark status bar color of the interface that this will slide back to
* @ param statusBarColor2 the primaryDark status bar color of the activity this is attaching to that will transition
* back to the statusBarColor1 color
* @ return a { @ link com . r0adkll . slidr . model . SlidrInterface } that allows
* the user to lock / unlock the sliding mechanism for whatever purpose . */
@ NonNull public static SlidrInterface attach ( @ NonNull Activity activity , @ ColorInt int statusBarColor1 , @ ColorInt int statusBarColor2 ) { } } | // Setup the slider panel and attach it to the decor
final SliderPanel panel = attachSliderPanel ( activity , null ) ; // Set the panel slide listener for when it becomes closed or opened
panel . setOnPanelSlideListener ( new ColorPanelSlideListener ( activity , statusBarColor1 , statusBarColor2 ) ) ; // Return the lock interface
return panel . getDefaultInterface ( ) ; |
public class PluginWrapper { /** * Returns the URL of the index page jelly script . */
public URL getIndexPage ( ) { } } | // In the current impl dependencies are checked first , so the plugin itself
// will add the last entry in the getResources result .
URL idx = null ; try { Enumeration < URL > en = classLoader . getResources ( "index.jelly" ) ; while ( en . hasMoreElements ( ) ) idx = en . nextElement ( ) ; } catch ( IOException ignore ) { } // In case plugin has dependencies but is missing its own index . jelly ,
// check that result has this plugin ' s artifactId in it :
return idx != null && idx . toString ( ) . contains ( shortName ) ? idx : null ; |
public class StringIterate { /** * For each token in a string separated by the specified separator , execute the specified StringProcedure
* by calling the valueOfString method . */
public static void forEachToken ( String string , String separator , Procedure < String > procedure ) { } } | for ( StringTokenizer stringTokenizer = new StringTokenizer ( string , separator ) ; stringTokenizer . hasMoreTokens ( ) ; ) { String token = stringTokenizer . nextToken ( ) ; procedure . value ( token ) ; } |
public class QuickStart { /** * Main launcher for the QuickStart example . */
public static void main ( String [ ] args ) throws InterruptedException { } } | TagContextBuilder tagContextBuilder = tagger . currentBuilder ( ) . put ( FRONTEND_KEY , TagValue . create ( "mobile-ios9.3.5" ) ) ; SpanBuilder spanBuilder = tracer . spanBuilder ( "my.org/ProcessVideo" ) . setRecordEvents ( true ) . setSampler ( Samplers . alwaysSample ( ) ) ; viewManager . registerView ( VIDEO_SIZE_VIEW ) ; LoggingTraceExporter . register ( ) ; // Process video .
// Record the processed video size .
try ( Scope scopedTags = tagContextBuilder . buildScoped ( ) ; Scope scopedSpan = spanBuilder . startScopedSpan ( ) ) { tracer . getCurrentSpan ( ) . addAnnotation ( "Start processing video." ) ; // Sleep for [ 0,10 ] milliseconds to fake work .
Thread . sleep ( new Random ( ) . nextInt ( 10 ) + 1 ) ; statsRecorder . newMeasureMap ( ) . put ( VIDEO_SIZE , 25 * MiB ) . record ( ) ; tracer . getCurrentSpan ( ) . addAnnotation ( "Finished processing video." ) ; } catch ( Exception e ) { tracer . getCurrentSpan ( ) . addAnnotation ( "Exception thrown when processing video." ) ; tracer . getCurrentSpan ( ) . setStatus ( Status . UNKNOWN ) ; logger . severe ( e . getMessage ( ) ) ; } logger . info ( "Wait longer than the reporting duration..." ) ; // Wait for a duration longer than reporting duration ( 5s ) to ensure spans are exported .
// TODO ( songya ) : remove the gap once we add a shutdown hook for exporting unflushed spans .
Thread . sleep ( 5100 ) ; ViewData viewData = viewManager . getView ( VIDEO_SIZE_VIEW_NAME ) ; logger . info ( String . format ( "Recorded stats for %s:\n %s" , VIDEO_SIZE_VIEW_NAME . asString ( ) , viewData ) ) ; |
public class AWSSimpleSystemsManagementClient { /** * Modifies the target of an existing Maintenance Window . You can ' t change the target type , but you can change the
* following :
* The target from being an ID target to a Tag target , or a Tag target to an ID target .
* IDs for an ID target .
* Tags for a Tag target .
* Owner .
* Name .
* Description .
* If a parameter is null , then the corresponding field is not modified .
* @ param updateMaintenanceWindowTargetRequest
* @ return Result of the UpdateMaintenanceWindowTarget operation returned by the service .
* @ throws DoesNotExistException
* Error returned when the ID specified for a resource , such as a Maintenance Window or Patch baseline ,
* doesn ' t exist . < / p >
* For information about resource limits in Systems Manager , see < a
* href = " http : / / docs . aws . amazon . com / general / latest / gr / aws _ service _ limits . html # limits _ ssm " > AWS Systems
* Manager Limits < / a > .
* @ throws InternalServerErrorException
* An error occurred on the server side .
* @ sample AWSSimpleSystemsManagement . UpdateMaintenanceWindowTarget
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ssm - 2014-11-06 / UpdateMaintenanceWindowTarget "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateMaintenanceWindowTargetResult updateMaintenanceWindowTarget ( UpdateMaintenanceWindowTargetRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateMaintenanceWindowTarget ( request ) ; |
public class CircuitBreaker { /** * Wrap the given service call with the { @ link CircuitBreaker }
* protection logic .
* @ param r the { @ link Runnable } to attempt
* @ throws CircuitBreakerException if the
* breaker was OPEN or HALF _ CLOSED and this attempt wasn ' t the
* reset attempt
* @ throws Exception if < code > c < / code > throws one during
* execution */
public void invoke ( Runnable r ) throws Exception { } } | if ( ! byPass ) { if ( ! allowRequest ( ) ) { throw mapException ( new CircuitBreakerException ( ) ) ; } try { isAttemptLive = true ; r . run ( ) ; close ( ) ; return ; } catch ( Throwable cause ) { handleFailure ( cause ) ; } throw new IllegalStateException ( "not possible" ) ; } else { r . run ( ) ; } |
public class AutoMlClient { /** * Imports data into a dataset . For Tables this method can only be called on an empty Dataset .
* < p > For Tables : & # 42 ; A
* [ schema _ inference _ version ] [ google . cloud . automl . v1beta1 . InputConfig . params ] parameter must be
* explicitly set . Returns an empty response in the
* [ response ] [ google . longrunning . Operation . response ] field when it completes .
* < p > Sample code :
* < pre > < code >
* try ( AutoMlClient autoMlClient = AutoMlClient . create ( ) ) {
* DatasetName name = DatasetName . of ( " [ PROJECT ] " , " [ LOCATION ] " , " [ DATASET ] " ) ;
* InputConfig inputConfig = InputConfig . newBuilder ( ) . build ( ) ;
* autoMlClient . importDataAsync ( name , inputConfig ) . get ( ) ;
* < / code > < / pre >
* @ param name Required . Dataset name . Dataset must already exist . All imported annotations and
* examples will be added .
* @ param inputConfig Required . The desired input location and its domain specific semantics , if
* any .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi ( "The surface for long-running operations is not stable yet and may change in the future." ) public final OperationFuture < Empty , OperationMetadata > importDataAsync ( DatasetName name , InputConfig inputConfig ) { } } | ImportDataRequest request = ImportDataRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . setInputConfig ( inputConfig ) . build ( ) ; return importDataAsync ( request ) ; |
public class ValueCollectionFactory { /** * Returns corresponding { @ link MultiMapConfig . ValueCollectionType } of a { @ link java . util . Collection }
* @ param collection { @ link MultiMapConfig . ValueCollectionType } to be find
* @ return corresponding { @ link MultiMapConfig . ValueCollectionType } of a { @ link java . util . Collection }
* @ throws java . lang . IllegalArgumentException if collectionType is unknown */
private static MultiMapConfig . ValueCollectionType findCollectionType ( Collection collection ) { } } | if ( collection instanceof Set ) { return MultiMapConfig . ValueCollectionType . SET ; } else if ( collection instanceof List ) { return MultiMapConfig . ValueCollectionType . LIST ; } throw new IllegalArgumentException ( "[" + collection . getClass ( ) + "] is not a known MultiMapConfig.ValueCollectionType!" ) ; |
public class ST_Graph { /** * Create the nodes and edges tables from the input table containing
* LINESTRINGs in the given column .
* If the input table has name ' input ' , then the output tables are named
* ' input _ nodes ' and ' input _ edges ' .
* @ param connection Connection
* @ param tableName Input table
* @ param spatialFieldName Name of column containing LINESTRINGs
* @ return true if both output tables were created
* @ throws SQLException */
public static boolean createGraph ( Connection connection , String tableName , String spatialFieldName ) throws SQLException { } } | // The default tolerance is zero .
return createGraph ( connection , tableName , spatialFieldName , 0.0 ) ; |
public class NodeSchema { /** * Append the provided schema to this schema and return the result
* as a new schema . Columns order : [ this ] [ provided schema columns ] . */
NodeSchema join ( NodeSchema schema ) { } } | NodeSchema copy = this . clone ( ) ; for ( SchemaColumn column : schema . getColumns ( ) ) { copy . addColumn ( column . clone ( ) ) ; } return copy ; |
public class BunyanFormatter { /** * { @ inheritDoc } */
@ Override public String format ( LogRecord record ) { } } | final JsonObject jsonEvent = new JsonObject ( ) ; jsonEvent . addProperty ( "v" , 0 ) ; jsonEvent . addProperty ( "level" , BUNYAN_LEVEL . get ( record . getLevel ( ) ) ) ; jsonEvent . addProperty ( "name" , record . getLoggerName ( ) ) ; jsonEvent . addProperty ( "hostname" , HOSTNAME ) ; jsonEvent . addProperty ( "pid" , record . getThreadID ( ) ) ; jsonEvent . addProperty ( "time" , formatAsIsoUTCDateTime ( record . getMillis ( ) ) ) ; jsonEvent . addProperty ( "msg" , record . getMessage ( ) ) ; jsonEvent . addProperty ( "src" , record . getSourceClassName ( ) ) ; final Throwable thrown = record . getThrown ( ) ; if ( thrown != null && record . getLevel ( ) . intValue ( ) >= Level . WARNING . intValue ( ) ) { JsonObject jsonError = new JsonObject ( ) ; jsonError . addProperty ( "message" , thrown . getMessage ( ) ) ; jsonError . addProperty ( "name" , thrown . getClass ( ) . getSimpleName ( ) ) ; StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw ) ; thrown . printStackTrace ( pw ) ; jsonError . addProperty ( "stack" , sw . toString ( ) ) ; jsonEvent . add ( "err" , jsonError ) ; } return GSON . toJson ( jsonEvent ) + "\n" ; |
public class ArgumentUnitUtils { /** * Extract properties from { @ code properties } field of the given argument unit
* @ param argumentUnit argument unit
* @ return properties
* @ throws IllegalArgumentException if argumentUnit is null */
public static Properties getProperties ( ArgumentUnit argumentUnit ) throws IllegalArgumentException { } } | if ( argumentUnit == null ) { throw new IllegalArgumentException ( "argumentUnit is null" ) ; } return stringToProperties ( argumentUnit . getProperties ( ) ) ; |
public class AbstractVersionIdentifier { /** * This method performs the part of { @ link # compareTo ( VersionIdentifier ) } for the
* { @ link # getVersionSegment ( int ) version number } .
* @ param otherVersion is the { @ link VersionIdentifier } to compare to .
* @ return the result of comparison . */
private int compareToVersionNumber ( VersionIdentifier otherVersion ) { } } | // Example version : 1.2.3.4
// Direct successors : 1.2.3.5 / 1.2.4 [ . 0 ] / 1.3 . [ . 0 [ . 0 ] ] / 2 . [ . 0 [ . 0 [ . 0 ] ] ]
// Direct predecessors : 1.2.3.3 [ . * ]
boolean equivalent = true ; int result = 0 ; int maxSegmentCount = StrictMath . max ( getVersionSegmentCount ( ) , otherVersion . getVersionSegmentCount ( ) ) ; for ( int i = 0 ; i < maxSegmentCount ; i ++ ) { int segment = getVersionSegment ( i ) ; int otherSegment = otherVersion . getVersionSegment ( i ) ; if ( segment != otherSegment ) { int delta = segment - otherSegment ; if ( equivalent ) { result = delta ; } else { if ( result == COMPARE_TO_STRICT_SUCCESSOR ) { if ( segment != 0 ) { result ++ ; break ; } } else if ( result == COMPARE_TO_STRICT_PREDECESSOR ) { if ( otherSegment != 0 ) { result -- ; break ; } } } } } return result ; |
public class ValueReferenceScanner { /** * Scan given class and look for possible references annotated by given annotation
* @ param < H > Only field or method annotated with this annotation is inspected
* @ param expectedAnnotation Only field or method annotated with this annotation is inspected
* @ param listener Listener to handle found references */
public < H extends Annotation > void scanForAnnotation ( Class < H > expectedAnnotation , Listener < T , H > listener ) { } } | BeanInfo beanInfo ; try { beanInfo = Introspector . getBeanInfo ( beanType ) ; } catch ( IntrospectionException e ) { throw new RuntimeException ( "Can't get bean info of " + beanType ) ; } for ( PropertyDescriptor desc : beanInfo . getPropertyDescriptors ( ) ) { AccessibleObject access = findAnnotatedAccess ( desc , expectedAnnotation ) ; if ( access == null ) { continue ; } ValueReference < T > reference ; if ( access instanceof Field ) { reference = ValueReference . instanceOf ( ( Field ) access ) ; } else { reference = ValueReference . instanceOf ( desc ) ; } listener . handleReference ( reference , access . getAnnotation ( expectedAnnotation ) , access ) ; } for ( Field field : beanType . getFields ( ) ) { H annotation = field . getAnnotation ( expectedAnnotation ) ; if ( annotation == null ) { continue ; } ValueReference < T > reference = ValueReference . instanceOf ( field ) ; listener . handleReference ( reference , annotation , field ) ; } |
public class ProfilingFilter { /** * SAX methods */
@ Override public void startElement ( final String uri , final String localName , final String qName , final Attributes atts ) throws SAXException { } } | Set < Flag > flags = null ; final DitaClass cls = atts . getValue ( ATTRIBUTE_NAME_CLASS ) != null ? new DitaClass ( atts . getValue ( ATTRIBUTE_NAME_CLASS ) ) : new DitaClass ( "" ) ; if ( cls . isValid ( ) && ( TOPIC_TOPIC . matches ( cls ) || MAP_MAP . matches ( cls ) ) ) { final String domains = atts . getValue ( ATTRIBUTE_NAME_DOMAINS ) ; if ( domains == null ) { logger . info ( MessageUtils . getMessage ( "DOTJ029I" , localName ) . toString ( ) ) ; } else { props = StringUtils . getExtProps ( domains ) ; } } if ( exclude ) { // If it is the start of a child of an excluded tag , level increase
level ++ ; } else { // exclude shows whether it ' s excluded by filtering
if ( cls . isValid ( ) && filterUtils . stream ( ) . anyMatch ( f -> f . needExclude ( atts , props ) ) ) { exclude = true ; level = 0 ; } else { elementOutput = true ; for ( final Map . Entry < String , String > prefix : prefixes . entrySet ( ) ) { getContentHandler ( ) . startPrefixMapping ( prefix . getKey ( ) , prefix . getValue ( ) ) ; } prefixes . clear ( ) ; getContentHandler ( ) . startElement ( uri , localName , qName , atts ) ; if ( doFlag && cls . isValid ( ) ) { flags = filterUtils . stream ( ) . flatMap ( f -> f . getFlags ( atts , props ) . stream ( ) ) . map ( f -> f . adjustPath ( currentFile , job ) ) . collect ( Collectors . toSet ( ) ) ; for ( final Flag flag : flags ) { flag . writeStartFlag ( getContentHandler ( ) ) ; } } } } if ( doFlag ) { flagStack . push ( flags ) ; } |
public class ServerManager { /** * Stop the server and clear all
* @ throws DevFailed */
public void stop ( ) throws DevFailed { } } | try { if ( isStarted . get ( ) ) { tangoClasses . clear ( ) ; if ( tangoExporter != null ) { tangoExporter . clearClass ( ) ; tangoExporter . unexportAll ( ) ; } TangoCacheManager . shutdown ( ) ; EventManager . getInstance ( ) . close ( ) ; if ( monitoring != null ) { monitoring . stop ( ) ; } } } finally { ORBManager . shutdown ( ) ; logger . info ( "everything has been shutdown normally" ) ; isStarted . set ( false ) ; } |
public class ColorPicker { /** * Convert a color to an angle .
* @ param color The RGB value of the color to " find " on the color wheel .
* @ return The angle ( in rad ) the " normalized " color is displayed on the
* color wheel . */
private float colorToAngle ( int color ) { } } | float [ ] colors = new float [ 3 ] ; Color . colorToHSV ( color , colors ) ; return ( float ) Math . toRadians ( - colors [ 0 ] ) ; |
public class Compiler { /** * Compile a location path . The LocPathIterator itself may create
* { @ link org . apache . xpath . axes . AxesWalker } children .
* @ param opPos The current position in the m _ opMap array .
* @ return reference to { @ link org . apache . xpath . axes . LocPathIterator } instance .
* @ throws TransformerException if a error occurs creating the Expression . */
public Expression locationPath ( int opPos ) throws TransformerException { } } | locPathDepth ++ ; try { DTMIterator iter = WalkerFactory . newDTMIterator ( this , opPos , ( locPathDepth == 0 ) ) ; return ( Expression ) iter ; // cast OK , I guess .
} finally { locPathDepth -- ; } |
public class AbstractSecurityAuthorizationTable { /** * ( non - Javadoc )
* @ see com . ibm . ws . security . authorization . AuthorizationTableService # isAuthzInfoAvailableForApp ( java . lang . String ) */
@ Override public boolean isAuthzInfoAvailableForApp ( String appName ) { } } | if ( roles != null && ! roles . isEmpty ( ) ) return true ; else return false ; |
public class Entry { /** * Returns a newly - created { @ link Entry } of a JSON file .
* @ param revision the revision of the JSON file
* @ param path the path of the JSON file
* @ param content the content of the JSON file
* @ throws JsonParseException if the { @ code content } is not a valid JSON */
public static Entry < JsonNode > ofJson ( Revision revision , String path , String content ) throws JsonParseException { } } | return ofJson ( revision , path , Jackson . readTree ( content ) ) ; |
public class PathEndsWithOneOf { /** * Get a new < code > PathEndsWithOneOf < / code > that will accept only URIs whose suffix is one of the allowed suffixes
* @ param spec a string containing the allowed suffixes ( separated by ' , ' )
* @ return a new < code > PathEndsWithOneOf < / code > that will accept only URIs whose path suffix is one of the strings specified by < code > spec < / code > */
public static PathEndsWithOneOf valueOf ( String spec ) { } } | return new PathEndsWithOneOf ( Iterables . toArray ( SPLITTER . split ( spec ) , String . class ) ) ; |
public class PathResolver { /** * resolve symlinks to a path that could be the bin directory of the cloud sdk */
@ VisibleForTesting static void getLocationsFromLink ( List < String > possiblePaths , Path link ) { } } | try { Path resolvedLink = link . toRealPath ( ) ; Path possibleBinDir = resolvedLink . getParent ( ) ; // check if the parent is " bin " , we actually depend on that for other resolution
if ( possibleBinDir != null && possibleBinDir . getFileName ( ) . toString ( ) . equals ( "bin" ) ) { Path possibleCloudSdkHome = possibleBinDir . getParent ( ) ; if ( possibleCloudSdkHome != null && Files . exists ( possibleCloudSdkHome ) ) { possiblePaths . add ( possibleCloudSdkHome . toString ( ) ) ; } } } catch ( IOException ioe ) { // intentionally ignore exception
logger . log ( Level . FINE , "Non-critical exception when searching for cloud-sdk" , ioe ) ; } |
public class CustomAPI { /** * 删除客服帐号
* @ param accountName 客服帐号名
* @ return 删除结果 */
public ResultType deleteCustomAccount ( String accountName ) { } } | LOG . debug ( "删除客服帐号信息......" ) ; String url = BASE_API_URL + "customservice/kfaccount/del?access_token=#&kf_account=" + accountName ; BaseResponse response = executePost ( url , null ) ; return ResultType . get ( response . getErrcode ( ) ) ; |
public class SDVariable { /** * Maximum array reduction operation , optionally along specified dimensions < br >
* Note that if keepDims = true , the output variable has the same rank as the input variable ,
* with the reduced dimensions having size 1 . This can be useful for later broadcast operations ( such as subtracting
* the mean along a dimension ) . < br >
* Example : if input has shape [ a , b , c ] and dimensions = [ 1 ] then output has shape :
* keepDims = true : [ a , 1 , c ] < br >
* keepDims = false : [ a , c ]
* @ param name Output variable name
* @ param keepDims If true : keep the dimensions that are reduced on ( as size 1 ) . False : remove the reduction dimensions
* @ param dimensions Dimensions to reduce over . If dimensions are not specified , full array reduction is performed
* @ return Reduced array of rank ( input rank - num dimensions ) */
public SDVariable max ( String name , boolean keepDims , int ... dimensions ) { } } | return sameDiff . max ( name , this , keepDims , dimensions ) ; |
public class CacheUnitImpl { /** * This implements the method in the CacheUnit interface .
* This is called to create event source object .
* It calls ObjectCacheUnit to perform this operation .
* @ param createAsyncEventSource boolean true - using async thread context for callback ; false - using caller thread for callback
* @ param cacheName The cache name
* @ return EventSourceIntf The event source */
public EventSource createEventSource ( boolean createAsyncEventSource , String cacheName ) throws DynamicCacheServiceNotStarted { } } | if ( objectCacheUnit == null ) { throw new DynamicCacheServiceNotStarted ( "Object cache service has not been started." ) ; } return objectCacheUnit . createEventSource ( createAsyncEventSource , cacheName ) ; |
public class DirectedAcyclicGraph { /** * Convenience method for easily constructing an instance of { @ link IGraph } with an empty set of vertices .
* @ param < TVertex > Type of { @ link IVertex } of the vertices in the new { @ link IGraph } .
* @ return A new instance of { @ link IGraph } with an empty set of vertices . */
public static < TVertex extends IVertex < TValue > , TValue extends Object , TProcessedValue extends Object > IGraph < TVertex , TValue , TProcessedValue > create ( ) { } } | return build ( ( TVertex [ ] ) null ) ; |
public class XPath { /** * Returns a function view of this { @ code XPath } expression that produces a { @ code List < T > }
* result given an input object . If this { @ code XPath } is lenient , evaluation of the function
* will return an empty list on failure , rather than throwing an
* { @ link IllegalArgumentException } .
* @ param resultClass
* the { @ code Class } object for the list elements of the expected function result
* @ param < T >
* the type of result list element
* @ return the requested function view */
public final < T > Function < Object , List < T > > asFunction ( final Class < T > resultClass ) { } } | Preconditions . checkNotNull ( resultClass ) ; return new Function < Object , List < T > > ( ) { @ Override public List < T > apply ( @ Nullable final Object object ) { Preconditions . checkNotNull ( object ) ; return eval ( object , resultClass ) ; } } ; |
public class JapaneseDate { /** * Returns a copy of this date with the year altered .
* This method changes the year of the date .
* If the month - day is invalid for the year , then the previous valid day
* will be selected instead .
* This instance is immutable and unaffected by this method call .
* @ param era the era to set in the result , not null
* @ param yearOfEra the year - of - era to set in the returned date
* @ return a { @ code JapaneseDate } based on this date with the requested year , never null
* @ throws DateTimeException if { @ code year } is invalid */
private JapaneseDate withYear ( JapaneseEra era , int yearOfEra ) { } } | int year = JapaneseChronology . INSTANCE . prolepticYear ( era , yearOfEra ) ; return with ( isoDate . withYear ( year ) ) ; |
public class BackupSelectionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BackupSelection backupSelection , ProtocolMarshaller protocolMarshaller ) { } } | if ( backupSelection == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( backupSelection . getSelectionName ( ) , SELECTIONNAME_BINDING ) ; protocolMarshaller . marshall ( backupSelection . getIamRoleArn ( ) , IAMROLEARN_BINDING ) ; protocolMarshaller . marshall ( backupSelection . getResources ( ) , RESOURCES_BINDING ) ; protocolMarshaller . marshall ( backupSelection . getListOfTags ( ) , LISTOFTAGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class KeyUtils { /** * TODO If the given keys have different length the function will not give the right result . */
public static int compareKey ( byte [ ] key1 , byte [ ] key2 , int length ) { } } | return Bytes . compareTo ( key1 , 0 , length , key2 , 0 , length ) ; |
public class ServersInner { /** * List all the servers in a given resource group .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ return the observable to the List & lt ; ServerInner & gt ; object */
public Observable < Page < ServerInner > > listByResourceGroupAsync ( String resourceGroupName ) { } } | return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < List < ServerInner > > , Page < ServerInner > > ( ) { @ Override public Page < ServerInner > call ( ServiceResponse < List < ServerInner > > response ) { PageImpl < ServerInner > page = new PageImpl < > ( ) ; page . setItems ( response . body ( ) ) ; return page ; } } ) ; |
public class WorkBookAccesser { /** * 获取指定sheet的指定行列单元格
* @ param column 单元格所在列
* @ param row 单元格所在行
* @ return 指定行列的单元格 */
public Cell getCell ( int column , int row ) { } } | return this . workbook . getSheetAt ( sheetIndex ) . getRow ( row ) . getCell ( column ) ; |
public class DataLabelingServiceClient { /** * Creates an instruction for how data should be labeled .
* < p > Sample code :
* < pre > < code >
* try ( DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient . create ( ) ) {
* String formattedParent = DataLabelingServiceClient . formatProjectName ( " [ PROJECT ] " ) ;
* Instruction instruction = Instruction . newBuilder ( ) . build ( ) ;
* Instruction response = dataLabelingServiceClient . createInstructionAsync ( formattedParent , instruction ) . get ( ) ;
* < / code > < / pre >
* @ param parent Required . Instruction resource parent , format : projects / { project _ id }
* @ param instruction Required . Instruction of how to perform the labeling task .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi ( "The surface for long-running operations is not stable yet and may change in the future." ) public final OperationFuture < Instruction , CreateInstructionMetadata > createInstructionAsync ( String parent , Instruction instruction ) { } } | PROJECT_PATH_TEMPLATE . validate ( parent , "createInstruction" ) ; CreateInstructionRequest request = CreateInstructionRequest . newBuilder ( ) . setParent ( parent ) . setInstruction ( instruction ) . build ( ) ; return createInstructionAsync ( request ) ; |
public class SrvShoppingCart { /** * < p > Create OnlineBuyer . < / p >
* @ param pRqVs additional param
* @ param pRqDt Request Data
* @ return buyer
* @ throws Exception - an exception */
public final OnlineBuyer createOnlineBuyer ( final Map < String , Object > pRqVs , final IRequestData pRqDt ) throws Exception { } } | OnlineBuyer buyer = null ; List < OnlineBuyer > brs = getSrvOrm ( ) . retrieveListWithConditions ( pRqVs , OnlineBuyer . class , "where FRE=1 and REGISTEREDPASSWORD is null" ) ; if ( brs . size ( ) > 0 ) { double rd = Math . random ( ) ; if ( rd > 0.5 ) { buyer = brs . get ( brs . size ( ) - 1 ) ; } else { buyer = brs . get ( 0 ) ; } buyer . setFre ( false ) ; getSrvOrm ( ) . updateEntity ( pRqVs , buyer ) ; } if ( buyer == null ) { buyer = new OnlineBuyer ( ) ; buyer . setIsNew ( true ) ; buyer . setItsName ( "newbe" + new Date ( ) . getTime ( ) ) ; getSrvOrm ( ) . insertEntity ( pRqVs , buyer ) ; } return buyer ; |
public class PasswordFilter { /** * / * ( non - Javadoc )
* @ see java . util . logging . Logger # logrb ( java . util . logging . Level , java . lang . String , java . lang . String , java . util . ResourceBundle , java . lang . String , java . lang . Object [ ] ) */
@ Override public void logrb ( Level level , String sourceClass , String sourceMethod , ResourceBundle bundle , String msg , Object ... params ) { } } | super . logrb ( level , sourceClass , sourceMethod , bundle , maskPassword ( msg ) , params ) ; |
public class MemberUpdater { /** * Synchronize organization membership of a user from a list of ALM organization specific ids
* Please note that no commit will not be executed . */
public void synchronizeUserOrganizationMembership ( DbSession dbSession , UserDto user , ALM alm , Set < String > organizationAlmIds ) { } } | Set < String > userOrganizationUuids = dbClient . organizationMemberDao ( ) . selectOrganizationUuidsByUser ( dbSession , user . getId ( ) ) ; Set < String > userOrganizationUuidsWithMembersSyncEnabled = dbClient . organizationAlmBindingDao ( ) . selectByOrganizationUuids ( dbSession , userOrganizationUuids ) . stream ( ) . filter ( OrganizationAlmBindingDto :: isMembersSyncEnable ) . map ( OrganizationAlmBindingDto :: getOrganizationUuid ) . collect ( toSet ( ) ) ; Set < String > almOrganizationUuidsWithMembersSyncEnabled = dbClient . organizationAlmBindingDao ( ) . selectByOrganizationAlmIds ( dbSession , alm , organizationAlmIds ) . stream ( ) . filter ( OrganizationAlmBindingDto :: isMembersSyncEnable ) . map ( OrganizationAlmBindingDto :: getOrganizationUuid ) . collect ( toSet ( ) ) ; Set < String > organizationUuidsToBeAdded = difference ( almOrganizationUuidsWithMembersSyncEnabled , userOrganizationUuidsWithMembersSyncEnabled ) ; Set < String > organizationUuidsToBeRemoved = difference ( userOrganizationUuidsWithMembersSyncEnabled , almOrganizationUuidsWithMembersSyncEnabled ) ; Map < String , OrganizationDto > allOrganizationsByUuid = dbClient . organizationDao ( ) . selectByUuids ( dbSession , union ( organizationUuidsToBeAdded , organizationUuidsToBeRemoved ) ) . stream ( ) . collect ( uniqueIndex ( OrganizationDto :: getUuid ) ) ; allOrganizationsByUuid . entrySet ( ) . stream ( ) . filter ( entry -> organizationUuidsToBeAdded . contains ( entry . getKey ( ) ) ) . forEach ( entry -> addMemberInDb ( dbSession , entry . getValue ( ) , user ) ) ; allOrganizationsByUuid . entrySet ( ) . stream ( ) . filter ( entry -> organizationUuidsToBeRemoved . contains ( entry . getKey ( ) ) ) . forEach ( entry -> removeMemberInDb ( dbSession , entry . getValue ( ) , user ) ) ; |
public class RpcConfigs { /** * Gets string value .
* @ param primaryKey the primary key
* @ return the string value */
public static String getStringValue ( String primaryKey ) { } } | String val = ( String ) CFG . get ( primaryKey ) ; if ( val == null ) { throw new SofaRpcRuntimeException ( "Not Found Key: " + primaryKey ) ; } else { return val ; } |
public class QueryableStateClient { /** * Shuts down the client and waits until shutdown is completed .
* < p > If an exception is thrown , a warning is logged containing
* the exception message . */
public void shutdownAndWait ( ) { } } | try { client . shutdown ( ) . get ( ) ; LOG . info ( "The Queryable State Client was shutdown successfully." ) ; } catch ( Exception e ) { LOG . warn ( "The Queryable State Client shutdown failed: " , e ) ; } |
public class CmsVfsFileWidget { /** * Checks whether the given type list contains only folder types . < p >
* @ param types the type list
* @ return < code > true < / code > if the given type list contains only folder types */
private boolean isOnlyFolders ( String types ) { } } | boolean result = true ; for ( String type : types . split ( "[, ]+" ) ) { try { if ( ! OpenCms . getResourceManager ( ) . getResourceType ( type ) . isFolder ( ) ) { result = false ; break ; } } catch ( CmsLoaderException e ) { // ignore
} } return result ; |
public class MarkLogicRepositoryConnection { /** * remove without commit
* supplied to honor interface
* @ param subject
* @ param predicate
* @ param object
* @ param contexts
* @ throws RepositoryException */
@ Override protected void removeWithoutCommit ( Resource subject , URI predicate , Value object , Resource ... contexts ) throws RepositoryException { } } | remove ( subject , predicate , object , contexts ) ; |
public class Phaser { /** * Implementation of register , bulkRegister
* @ param registrations number to add to both parties and
* unarrived fields . Must be greater than zero . */
private int doRegister ( int registrations ) { } } | // adjustment to state
long adjust = ( ( long ) registrations << PARTIES_SHIFT ) | registrations ; final Phaser parent = this . parent ; int phase ; for ( ; ; ) { long s = ( parent == null ) ? state : reconcileState ( ) ; int counts = ( int ) s ; int parties = counts >>> PARTIES_SHIFT ; int unarrived = counts & UNARRIVED_MASK ; if ( registrations > MAX_PARTIES - parties ) throw new IllegalStateException ( badRegister ( s ) ) ; phase = ( int ) ( s >>> PHASE_SHIFT ) ; if ( phase < 0 ) break ; if ( counts != EMPTY ) { // not 1st registration
if ( parent == null || reconcileState ( ) == s ) { if ( unarrived == 0 ) // wait out advance
root . internalAwaitAdvance ( phase , null ) ; else if ( UNSAFE . compareAndSwapLong ( this , stateOffset , s , s + adjust ) ) break ; } } else if ( parent == null ) { // 1st root registration
long next = ( ( long ) phase << PHASE_SHIFT ) | adjust ; if ( UNSAFE . compareAndSwapLong ( this , stateOffset , s , next ) ) break ; } else { synchronized ( this ) { // 1st sub registration
if ( state == s ) { // recheck under lock
phase = parent . doRegister ( 1 ) ; if ( phase < 0 ) break ; // finish registration whenever parent registration
// succeeded , even when racing with termination ,
// since these are part of the same " transaction " .
while ( ! UNSAFE . compareAndSwapLong ( this , stateOffset , s , ( ( long ) phase << PHASE_SHIFT ) | adjust ) ) { s = state ; phase = ( int ) ( root . state >>> PHASE_SHIFT ) ; // assert ( int ) s = = EMPTY ;
} break ; } } } } return phase ; |
public class OBOOntology { /** * Look up a term by name , and return its ID and the IDs of all of its
* ancestors .
* @ param s
* The term name to look up .
* @ return The full set of IDs , empty if the term was not found . */
public Set < String > getIdsForTermWithAncestors ( String s ) { } } | if ( ! indexByName . containsKey ( s ) ) return new HashSet < String > ( ) ; Stack < String > idsToConsider = new Stack < String > ( ) ; idsToConsider . addAll ( getIdsForTerm ( s ) ) ; Set < String > resultIds = new HashSet < String > ( ) ; while ( ! idsToConsider . isEmpty ( ) ) { String id = idsToConsider . pop ( ) ; if ( ! resultIds . contains ( id ) ) { resultIds . add ( id ) ; idsToConsider . addAll ( terms . get ( id ) . getIsA ( ) ) ; } } return resultIds ; |
public class BlobContainersInner { /** * Creates a new container under the specified account as described by request body . The container resource includes metadata and properties for that container . It does not include a list of the blobs contained by the container .
* @ param resourceGroupName The name of the resource group within the user ' s subscription . The name is case insensitive .
* @ param accountName The name of the storage account within the specified resource group . Storage account names must be between 3 and 24 characters in length and use numbers and lower - case letters only .
* @ param containerName The name of the blob container within the specified storage account . Blob container names must be between 3 and 63 characters in length and use numbers , lower - case letters and dash ( - ) only . Every dash ( - ) character must be immediately preceded and followed by a letter or number .
* @ 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 < BlobContainerInner > createAsync ( String resourceGroupName , String accountName , String containerName , final ServiceCallback < BlobContainerInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( createWithServiceResponseAsync ( resourceGroupName , accountName , containerName ) , serviceCallback ) ; |
public class ServiceTicketRequestWebflowEventResolver { /** * Grant service ticket for the given credential based on the service and tgt
* that are found in the request context .
* @ param context the context
* @ return the resulting event . Warning , authentication failure or error .
* @ since 4.1.0 */
protected Event grantServiceTicket ( final RequestContext context ) { } } | val ticketGrantingTicketId = WebUtils . getTicketGrantingTicketId ( context ) ; val credential = getCredentialFromContext ( context ) ; try { val service = WebUtils . getService ( context ) ; val authn = getWebflowEventResolutionConfigurationContext ( ) . getTicketRegistrySupport ( ) . getAuthenticationFrom ( ticketGrantingTicketId ) ; val registeredService = getWebflowEventResolutionConfigurationContext ( ) . getServicesManager ( ) . findServiceBy ( service ) ; if ( authn != null && registeredService != null ) { LOGGER . debug ( "Enforcing access strategy policies for registered service [{}] and principal [{}]" , registeredService , authn . getPrincipal ( ) ) ; val audit = AuditableContext . builder ( ) . service ( service ) . authentication ( authn ) . registeredService ( registeredService ) . retrievePrincipalAttributesFromReleasePolicy ( Boolean . TRUE ) . build ( ) ; val accessResult = getWebflowEventResolutionConfigurationContext ( ) . getRegisteredServiceAccessStrategyEnforcer ( ) . execute ( audit ) ; accessResult . throwExceptionIfNeeded ( ) ; } val authenticationResult = getWebflowEventResolutionConfigurationContext ( ) . getAuthenticationSystemSupport ( ) . handleAndFinalizeSingleAuthenticationTransaction ( service , credential ) ; val serviceTicketId = getWebflowEventResolutionConfigurationContext ( ) . getCentralAuthenticationService ( ) . grantServiceTicket ( ticketGrantingTicketId , service , authenticationResult ) ; WebUtils . putServiceTicketInRequestScope ( context , serviceTicketId ) ; WebUtils . putWarnCookieIfRequestParameterPresent ( getWebflowEventResolutionConfigurationContext ( ) . getWarnCookieGenerator ( ) , context ) ; return newEvent ( CasWebflowConstants . TRANSITION_ID_WARN ) ; } catch ( final AuthenticationException | AbstractTicketException e ) { return newEvent ( CasWebflowConstants . TRANSITION_ID_AUTHENTICATION_FAILURE , e ) ; } |
public class MLFeatureUtils { /** * Generates a vector of regression outputs for every record
* @ param data
* @ return */
public static double [ ] toRegressionOutputVector ( Iterable < MLRegressionRecord > data ) { } } | final Stream < MLRegressionRecord > stream = StreamSupport . stream ( data . spliterator ( ) , false ) ; return stream . mapToDouble ( MLRegressionRecord :: getRegressionOutput ) . toArray ( ) ; |
public class DecimalFormatSymbols { /** * < strong > [ icu ] < / strong > Sets the string used for permille sign .
* < b > Note : < / b > When the input permille String is represented
* by multiple Java chars , then { @ link # getPerMill ( ) } will
* return the default permille character ( ' & # x2030 ; ' ) .
* @ param perMillString the permille string
* @ throws NullPointerException if < code > perMillString < / code > is null .
* @ see # getPerMillString ( )
* @ hide draft / provisional / internal are hidden on Android */
public void setPerMillString ( String perMillString ) { } } | if ( perMillString == null ) { throw new NullPointerException ( "The input permille string is null" ) ; } this . perMillString = perMillString ; if ( perMillString . length ( ) == 1 ) { this . perMill = perMillString . charAt ( 0 ) ; } else { // Use the default permille character as fallback
this . perMill = DEF_PERMILL ; } |
public class PlainDate { /** * / * [ deutsch ]
* < p > Entspricht { @ code at ( PlainTime . of ( hour , minute , second ) ) } . < / p >
* @ param hour hour of day in range ( 0-24)
* @ param minute minute of hour in range ( 0-59)
* @ param second second of hour in range ( 0-59)
* @ return local timestamp as composition of this date and given time
* @ throws IllegalArgumentException if any argument is out of range */
public PlainTimestamp atTime ( int hour , int minute , int second ) { } } | return this . at ( PlainTime . of ( hour , minute , second ) ) ; |
public class Icon { /** * Initializes this { @ link Icon } . Called from the icon this one depends on , copying the < b > baseIcon < / b > values .
* @ param baseIcon the base icon
* @ param width the width
* @ param height the height
* @ param x the x
* @ param y the y
* @ param rotated the rotated */
protected void initIcon ( Icon baseIcon , int width , int height , int x , int y , boolean rotated ) { } } | copyFrom ( baseIcon ) ; |
public class NearestNeighborsClient { /** * Add the specified authentication header to the specified HttpRequest
* @ param request HTTP Request to add the authentication header to */
protected HttpRequest addAuthHeader ( HttpRequest request ) { } } | if ( authToken != null ) { request . header ( "authorization" , "Bearer " + authToken ) ; } return request ; |
public class JwtWebSecurityConfigurer { /** * Configures application authorization for JWT signed with RS256.
* Will try to validate the token using the public key downloaded from " $ issuer / . well - known / jwks . json "
* and matched by the value of { @ code kid } of the JWT header
* @ param audience identifier of the API and must match the { @ code aud } value in the token
* @ param issuer of the token for this API and must match the { @ code iss } value in the token
* @ return JwtWebSecurityConfigurer for further configuration */
@ SuppressWarnings ( { } } | "WeakerAccess" , "SameParameterValue" } ) public static JwtWebSecurityConfigurer forRS256 ( String audience , String issuer ) { final JwkProvider jwkProvider = new JwkProviderBuilder ( issuer ) . build ( ) ; return new JwtWebSecurityConfigurer ( audience , issuer , new JwtAuthenticationProvider ( jwkProvider , issuer , audience ) ) ; |
public class WebElementFinder { /** * Creates an new { @ link WebElementFinder } based on this { @ link WebElementFinder } restricting the enabled status of elements .
* @ param theEnabled
* { @ code true } if elements must be enabled , { @ code false } if elements must not be enabled
* @ return the new { @ link WebElementFinder } instance
* @ see WebElement # isEnabled ( ) */
public WebElementFinder enabled ( final Boolean theEnabled ) { } } | Fields fields = new Fields ( this ) ; fields . enabled = theEnabled ; return new WebElementFinder ( fields ) ; |
public class KeyUtils { /** * Generates a { @ link RangeHashFunction } .
* @ param min
* the minimal value to expect
* @ param max
* the maximal value to expect
* @ param buckets
* the number of buckets
* @ param suffix
* the suffix for all files
* @ param prefix
* a prefix for all files
* @ return String representation of the the RangeHashFunction
* @ throws Exception */
public static String generateHashFunction ( byte [ ] min , byte [ ] max , int buckets , String suffix , String prefix ) throws Exception { } } | String [ ] Sbuckets = new String [ buckets ] ; for ( int i = 0 ; i < buckets ; i ++ ) { Sbuckets [ i ] = i + "" ; } return generateRangeHashFunction ( min , max , Sbuckets , suffix , prefix ) ; |
public class S3StorageProvider { /** * Adds content to a hidden space .
* @ param spaceId hidden spaceId
* @ param contentId
* @ param contentMimeType
* @ param content
* @ return */
public String addHiddenContent ( String spaceId , String contentId , String contentMimeType , InputStream content ) { } } | log . debug ( "addHiddenContent(" + spaceId + ", " + contentId + ", " + contentMimeType + ")" ) ; // Will throw if bucket does not exist
String bucketName = getBucketName ( spaceId ) ; // Wrap the content in order to be able to retrieve a checksum
if ( contentMimeType == null || contentMimeType . equals ( "" ) ) { contentMimeType = DEFAULT_MIMETYPE ; } ObjectMetadata objMetadata = new ObjectMetadata ( ) ; objMetadata . setContentType ( contentMimeType ) ; PutObjectRequest putRequest = new PutObjectRequest ( bucketName , contentId , content , objMetadata ) ; putRequest . setStorageClass ( DEFAULT_STORAGE_CLASS ) ; putRequest . setCannedAcl ( CannedAccessControlList . Private ) ; try { PutObjectResult putResult = s3Client . putObject ( putRequest ) ; return putResult . getETag ( ) ; } catch ( AmazonClientException e ) { String err = "Could not add content " + contentId + " with type " + contentMimeType + " to S3 bucket " + bucketName + " due to error: " + e . getMessage ( ) ; throw new StorageException ( err , e , NO_RETRY ) ; } |
public class JavaProxyFactory { /** * public static Object createProxy ( Config config , Component cfc , String className ) throws
* PageException , IOException { return createProxy ( cfc , null ,
* ClassUtil . loadClass ( config . getClassLoader ( ) , className ) ) ; } */
public static Object createProxy ( PageContext pc , Component cfc , Class extendz , Class ... interfaces ) throws PageException , IOException { } } | PageContextImpl pci = ( PageContextImpl ) pc ; // ( ( ConfigImpl ) pci . getConfig ( ) ) . getClassLoaderEnv ( )
ClassLoader [ ] parents = extractClassLoaders ( null , interfaces ) ; if ( extendz == null ) extendz = Object . class ; if ( interfaces == null ) interfaces = new Class [ 0 ] ; else { for ( int i = 0 ; i < interfaces . length ; i ++ ) { if ( ! interfaces [ i ] . isInterface ( ) ) throw new IOException ( "definition [" + interfaces [ i ] . getName ( ) + "] is a class and not a interface" ) ; } } Type typeExtends = Type . getType ( extendz ) ; Type [ ] typeInterfaces = ASMUtil . toTypes ( interfaces ) ; String [ ] strInterfaces = new String [ typeInterfaces . length ] ; for ( int i = 0 ; i < strInterfaces . length ; i ++ ) { strInterfaces [ i ] = typeInterfaces [ i ] . getInternalName ( ) ; } String className = createClassName ( extendz , interfaces ) ; // Mapping mapping = cfc . getPageSource ( ) . getMapping ( ) ;
// get ClassLoader
PhysicalClassLoader pcl = null ; try { pcl = ( PhysicalClassLoader ) pci . getRPCClassLoader ( false , parents ) ; // mapping . getConfig ( ) . getRPCClassLoader ( false )
} catch ( IOException e ) { throw Caster . toPageException ( e ) ; } Resource classFile = pcl . getDirectory ( ) . getRealResource ( className . concat ( ".class" ) ) ; // check if already exists , if yes return
if ( classFile . exists ( ) ) { try { Object obj = newInstance ( pcl , className , pc . getConfig ( ) , cfc ) ; if ( obj != null ) return obj ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } } /* * String classNameOriginal = component . getPageSource ( ) . getFullClassName ( ) ; String
* realOriginal = classNameOriginal . replace ( ' . ' , ' / ' ) ; Resource classFileOriginal =
* mapping . getClassRootDirectory ( ) . getRealResource ( realOriginal . concat ( " . class " ) ) ; */
ClassWriter cw = ASMUtil . getClassWriter ( ) ; cw . visit ( Opcodes . V1_6 , Opcodes . ACC_PUBLIC , className , null , typeExtends . getInternalName ( ) , strInterfaces ) ; // BytecodeContext statConstr = null ; / / new
// BytecodeContext ( null , null , null , cw , real , ga , Page . STATIC _ CONSTRUCTOR ) ;
// BytecodeContext constr = null ; / / new BytecodeContext ( null , null , null , cw , real , ga , Page . CONSTRUCTOR ) ;
// field Component
FieldVisitor _fv = cw . visitField ( Opcodes . ACC_PRIVATE , "cfc" , COMPONENT_NAME , null , null ) ; _fv . visitEnd ( ) ; _fv = cw . visitField ( Opcodes . ACC_PRIVATE , "config" , CONFIG_WEB_NAME , null , null ) ; _fv . visitEnd ( ) ; // Constructor
GeneratorAdapter adapter = new GeneratorAdapter ( Opcodes . ACC_PUBLIC , CONSTRUCTOR , null , null , cw ) ; Label begin = new Label ( ) ; adapter . visitLabel ( begin ) ; adapter . loadThis ( ) ; adapter . invokeConstructor ( Types . OBJECT , SUPER_CONSTRUCTOR ) ; // adapter . putField ( JAVA _ PROXY , arg1 , arg2)
adapter . visitVarInsn ( Opcodes . ALOAD , 0 ) ; adapter . visitVarInsn ( Opcodes . ALOAD , 1 ) ; adapter . visitFieldInsn ( Opcodes . PUTFIELD , className , "config" , CONFIG_WEB_NAME ) ; adapter . visitVarInsn ( Opcodes . ALOAD , 0 ) ; adapter . visitVarInsn ( Opcodes . ALOAD , 2 ) ; adapter . visitFieldInsn ( Opcodes . PUTFIELD , className , "cfc" , COMPONENT_NAME ) ; adapter . visitInsn ( Opcodes . RETURN ) ; Label end = new Label ( ) ; adapter . visitLabel ( end ) ; adapter . visitLocalVariable ( "config" , CONFIG_WEB_NAME , null , begin , end , 1 ) ; adapter . visitLocalVariable ( "cfc" , COMPONENT_NAME , null , begin , end , 2 ) ; // adapter . returnValue ( ) ;
adapter . endMethod ( ) ; // create methods
Set < Class > cDone = new HashSet < Class > ( ) ; Map < String , Class > mDone = new HashMap < String , Class > ( ) ; for ( int i = 0 ; i < interfaces . length ; i ++ ) { _createProxy ( cw , cDone , mDone , cfc , interfaces [ i ] , className ) ; } cw . visitEnd ( ) ; // create class file
byte [ ] barr = cw . toByteArray ( ) ; try { ResourceUtil . touch ( classFile ) ; IOUtil . copy ( new ByteArrayInputStream ( barr ) , classFile , true ) ; pcl = ( PhysicalClassLoader ) pci . getRPCClassLoader ( true , parents ) ; Class < ? > clazz = pcl . loadClass ( className , barr ) ; return newInstance ( clazz , pc . getConfig ( ) , cfc ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; throw Caster . toPageException ( t ) ; } |
public class Branch { /** * < p > Gets the credit history of the specified bucket and triggers a callback to handle the
* response . < / p >
* @ param bucket A { @ link String } value containing the name of the referral bucket that the
* code will belong to .
* @ param callback A { @ link BranchListResponseListener } callback instance that will trigger
* actions defined therein upon receipt of a response to a create link request . */
public void getCreditHistory ( @ NonNull final String bucket , BranchListResponseListener callback ) { } } | getCreditHistory ( bucket , null , 100 , CreditHistoryOrder . kMostRecentFirst , callback ) ; |
public class DeadAssignmentsElimination { /** * Determines if any local variables are dead after the instruction { @ code n }
* and are assigned within the subtree of { @ code n } . Removes those assignments
* if there are any .
* @ param n Target instruction .
* @ param exprRoot The CFG node where the liveness information in state is
* still correct .
* @ param state The liveness information at { @ code n } . */
private void tryRemoveAssignment ( NodeTraversal t , Node n , Node exprRoot , FlowState < LiveVariableLattice > state , Map < String , Var > allVarsInFn ) { } } | Node parent = n . getParent ( ) ; boolean isDeclarationNode = NodeUtil . isNameDeclaration ( parent ) ; if ( NodeUtil . isAssignmentOp ( n ) || n . isInc ( ) || n . isDec ( ) || isDeclarationNode ) { if ( parent . isConst ( ) ) { // Removing the RHS of a const produces as invalid AST .
return ; } Node lhs = isDeclarationNode ? n : n . getFirstChild ( ) ; Node rhs = NodeUtil . getRValueOfLValue ( lhs ) ; // Recurse first . Example : dead _ x = dead _ y = 1 ; We try to clean up dead _ y
// first .
if ( rhs != null ) { tryRemoveAssignment ( t , rhs , exprRoot , state , allVarsInFn ) ; rhs = NodeUtil . getRValueOfLValue ( lhs ) ; } // Multiple declarations should be processed from right - to - left to ensure side - effects
// are run in the correct order .
if ( isDeclarationNode && lhs . getNext ( ) != null ) { tryRemoveAssignment ( t , lhs . getNext ( ) , exprRoot , state , allVarsInFn ) ; } // Ignore declarations that don ' t initialize a value . Dead code removal will kill those nodes .
// Also ignore the var declaration if it ' s in a for - loop instantiation since there ' s not a
// safe place to move the side - effects .
if ( isDeclarationNode && ( rhs == null || NodeUtil . isAnyFor ( parent . getParent ( ) ) ) ) { return ; } if ( ! lhs . isName ( ) ) { return ; // Not a local variable assignment .
} String name = lhs . getString ( ) ; Scope scope = t . getScope ( ) ; checkState ( scope . isFunctionBlockScope ( ) || scope . isBlockScope ( ) ) ; if ( ! allVarsInFn . containsKey ( name ) ) { return ; } Var var = allVarsInFn . get ( name ) ; if ( liveness . getEscapedLocals ( ) . contains ( var ) ) { return ; // Local variable that might be escaped due to closures .
} // If we have an identity assignment such as a = a , always remove it
// regardless of what the liveness results because it
// does not change the result afterward .
if ( rhs != null && rhs . isName ( ) && rhs . getString ( ) . equals ( var . name ) && n . isAssign ( ) ) { n . removeChild ( rhs ) ; n . replaceWith ( rhs ) ; compiler . reportChangeToEnclosingScope ( rhs ) ; return ; } int index = liveness . getVarIndex ( var . name ) ; if ( state . getOut ( ) . isLive ( index ) ) { return ; // Variable not dead .
} if ( state . getIn ( ) . isLive ( index ) && isVariableStillLiveWithinExpression ( n , exprRoot , var . name ) ) { // The variable is killed here but it is also live before it .
// This is possible if we have say :
// if ( X = a & & a = C ) { . . } ; . . . . . ; a = S ;
// In this case we are safe to remove " a = C " because it is dead .
// However if we have :
// if ( a = C & & X = a ) { . . } ; . . . . . ; a = S ;
// removing " a = C " is NOT correct , although the live set at the node
// is exactly the same .
// TODO ( user ) : We need more fine grain CFA or we need to keep track
// of GEN sets when we recurse here .
return ; } if ( n . isAssign ( ) ) { n . removeChild ( rhs ) ; n . replaceWith ( rhs ) ; } else if ( NodeUtil . isAssignmentOp ( n ) ) { n . removeChild ( rhs ) ; n . removeChild ( lhs ) ; Node op = new Node ( NodeUtil . getOpFromAssignmentOp ( n ) , lhs , rhs ) ; parent . replaceChild ( n , op ) ; } else if ( n . isInc ( ) || n . isDec ( ) ) { if ( parent . isExprResult ( ) ) { parent . replaceChild ( n , IR . voidNode ( IR . number ( 0 ) . srcref ( n ) ) ) ; } else if ( n . isComma ( ) && n != parent . getLastChild ( ) ) { parent . removeChild ( n ) ; } else if ( parent . isVanillaFor ( ) && NodeUtil . getConditionExpression ( parent ) != n ) { parent . replaceChild ( n , IR . empty ( ) ) ; } else { // Cannot replace x = a + + with x = a because that ' s not valid
// when a is not a number .
return ; } } else if ( isDeclarationNode ) { lhs . removeChild ( rhs ) ; parent . getParent ( ) . addChildAfter ( IR . exprResult ( rhs ) , parent ) ; rhs . getParent ( ) . useSourceInfoFrom ( rhs ) ; } else { // Not reachable .
throw new IllegalStateException ( "Unknown statement" ) ; } compiler . reportChangeToEnclosingScope ( parent ) ; return ; } else { for ( Node c = n . getFirstChild ( ) ; c != null ; ) { Node next = c . getNext ( ) ; if ( ! ControlFlowGraph . isEnteringNewCfgNode ( c ) ) { tryRemoveAssignment ( t , c , exprRoot , state , allVarsInFn ) ; } c = next ; } return ; } |
public class MockSecurityGroupController { /** * Delete MockSecurityGroup .
* @ param securityGroupId
* securityGroupId to be deleted
* @ return MockSecurityGroup . */
public MockSecurityGroup deleteSecurityGroup ( final String securityGroupId ) { } } | if ( securityGroupId != null && allMockSecurityGroup . containsKey ( securityGroupId ) ) { return allMockSecurityGroup . remove ( securityGroupId ) ; } return null ; |
public class DocumentSession { /** * Query the specified index using Lucene syntax
* @ param clazz The result of the query */
public < T > IDocumentQuery < T > documentQuery ( Class < T > clazz ) { } } | return documentQuery ( clazz , null , null , false ) ; |
public class KeyStoreManager { /** * Adds the keyStore to the keyStoreMap .
* @ param keyStoreName
* @ param ks
* @ throws Exception */
public void addKeyStoreToMap ( String keyStoreName , WSKeyStore ks ) throws Exception { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addKeyStoreToMap: " + keyStoreName + ", ks=" + ks ) ; if ( keyStoreMap . containsKey ( keyStoreName ) ) keyStoreMap . remove ( keyStoreName ) ; keyStoreMap . put ( keyStoreName , ks ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addKeyStoreToMap" ) ; |
public class CheckboxTreeNodeChildren { /** * Optimized set implementation to be used in sorting
* @ param index index of the element to replace
* @ param node node to be stored at the specified position
* @ return the node previously at the specified position */
@ Override public TreeNode setSibling ( int index , TreeNode node ) { } } | if ( node == null ) { throw new NullPointerException ( ) ; } else if ( ( index < 0 ) || ( index >= size ( ) ) ) { throw new IndexOutOfBoundsException ( ) ; } else { if ( ! parent . equals ( node . getParent ( ) ) ) { eraseParent ( node ) ; } TreeNode previous = get ( index ) ; super . set ( index , node ) ; node . setParent ( parent ) ; updateRowKeys ( parent ) ; updateSelectionState ( parent ) ; return previous ; } |
public class CmsJlanNetworkFile { /** * Adds the name of a child resource to this file ' s path . < p >
* @ param child the child resource
* @ return the path of the child */
protected String getFullChildPath ( CmsResource child ) { } } | String childName = child . getName ( ) ; String sep = getFullName ( ) . endsWith ( "\\" ) ? "" : "\\" ; return getFullName ( ) + sep + childName ; |
public class GCBEZRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . GCBEZRG__XPOS : setXPOS ( XPOS_EDEFAULT ) ; return ; case AfplibPackage . GCBEZRG__YPOS : setYPOS ( YPOS_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class UEL { /** * Casts context objects per documented convention .
* @ param < T >
* @ param context
* @ param key
* @ param defaultValue
* @ return T */
public static < T > T getContext ( ELContext context , Class < T > key , T defaultValue ) { } } | @ SuppressWarnings ( "unchecked" ) final T result = ( T ) context . getContext ( key ) ; return result == null ? defaultValue : result ; |
public class RetryingOAuth { /** * Returns true if the access token has been updated */
public synchronized boolean updateAccessToken ( String requestAccessToken ) throws IOException { } } | if ( getAccessToken ( ) == null || getAccessToken ( ) . equals ( requestAccessToken ) ) { try { OAuthJSONAccessTokenResponse accessTokenResponse = oAuthClient . accessToken ( tokenRequestBuilder . buildBodyMessage ( ) ) ; if ( accessTokenResponse != null && accessTokenResponse . getAccessToken ( ) != null ) { setAccessToken ( accessTokenResponse . getAccessToken ( ) ) ; return ! getAccessToken ( ) . equals ( requestAccessToken ) ; } } catch ( OAuthSystemException | OAuthProblemException e ) { throw new IOException ( e ) ; } } return false ; |
public class ImageInfoSpecific { @ Nonnull public static ImageInfoSpecific qcow2 ( @ Nonnull ImageInfoSpecificQCow2 qcow2 ) { } } | ImageInfoSpecific self = new ImageInfoSpecific ( ) ; self . type = Discriminator . qcow2 ; self . qcow2 = qcow2 ; return self ; |
public class StringProperties { /** * GET with MapExpression */
private final String eval ( final String str ) throws InvalidExpression { } } | if ( str == null ) return null ; return new MapExpression ( str , null , mapper , false ) . eval ( ) . get ( ) ; |
public class ScriptRunner { /** * Invokes the script defined by the specified element with the specified
* < code > TaskRequest < / code > .
* @ param m An < code > Element < / code > that defines a Task .
* @ param req A < code > TaskRequest < / code > prepared externally .
* @ return The < code > TaskResponse < / code > that results from invoking the
* specified script . */
public TaskResponse run ( Element m , TaskRequest req ) { } } | // Assertions .
if ( m == null ) { String msg = "Argument 'm [Element]' cannot be null." ; throw new IllegalArgumentException ( msg ) ; } return run ( compileTask ( m ) , req ) ; |
public class EntryIterator { /** * region Helpers */
private CompletableFuture < PageWrapper > locateNextPage ( TimeoutTimer timer ) { } } | if ( this . lastPage . get ( ) == null ) { // This is our very first invocation . Find the page containing the first key .
return this . locatePage . apply ( this . firstKey , this . pageCollection , timer ) ; } else { // We already have a pointer to a page ; find next page .
return getNextLeafPage ( timer ) ; } |
public class PageContextImpl { /** * Proprietary method to evaluate EL expressions . XXX - This method should
* go away once the EL interpreter moves out of JSTL and into its own
* project . For now , this is necessary because the standard machinery is too
* slow .
* @ param expression
* The expression to be evaluated
* @ param expectedType
* The expected resulting type
* @ param pageContext
* The page context
* @ param functionMap
* Maps prefix and name to Method
* @ return The result of the evaluation */
@ SuppressWarnings ( "unchecked" ) public static Object proprietaryEvaluate ( final String expression , final Class expectedType , final PageContext pageContext , final ProtectedFunctionMapper functionMap , final boolean escape ) throws ELException { } } | Object retValue ; ExpressionFactory exprFactorySetInPageContext = ( ExpressionFactory ) pageContext . getAttribute ( Constants . JSP_EXPRESSION_FACTORY_OBJECT ) ; if ( exprFactorySetInPageContext == null ) { exprFactorySetInPageContext = JspFactory . getDefaultFactory ( ) . getJspApplicationContext ( pageContext . getServletContext ( ) ) . getExpressionFactory ( ) ; } final ExpressionFactory exprFactory = exprFactorySetInPageContext ; // if ( SecurityUtil . isPackageProtectionEnabled ( ) ) {
ELContextImpl ctx = ( ELContextImpl ) pageContext . getELContext ( ) ; ctx . setFunctionMapper ( new FunctionMapperImpl ( functionMap ) ) ; ValueExpression ve = exprFactory . createValueExpression ( ctx , expression , expectedType ) ; retValue = ve . getValue ( ctx ) ; if ( escape && retValue != null ) { retValue = XmlEscape ( retValue . toString ( ) ) ; } return retValue ; |
public class DefaultAWSCloudClient { /** * / * If the instance is tagged with correct */
private boolean isInstanceTagged ( Instance currInstance ) { } } | List < Tag > tags = currInstance . getTags ( ) ; if ( settings . getValidTagKey ( ) . isEmpty ( ) ) return false ; for ( Tag currTag : tags ) { for ( String tagKey : settings . getValidTagKey ( ) ) { if ( currTag . getKey ( ) . equals ( tagKey ) ) return true ; } } return false ; |
public class CmsRelationSystemValidator { /** * Validates the relations against the online project . < p >
* The result is printed to the given report . < p >
* Validating references means to answer the question , whether
* we would have broken links in the online project if the given
* publish list would get published . < p >
* @ param dbc the database context
* @ param publishList the publish list to validate
* @ param report a report to print messages
* @ return a map with lists of invalid links
* ( < code > { @ link org . opencms . relations . CmsRelation } } < / code > objects )
* keyed by root paths
* @ throws Exception if something goes wrong */
public Map < String , List < CmsRelation > > validateResources ( CmsDbContext dbc , CmsPublishList publishList , I_CmsReport report ) throws Exception { } } | // check if progress should be set in the thread
A_CmsProgressThread thread = null ; if ( Thread . currentThread ( ) instanceof A_CmsProgressThread ) { thread = ( A_CmsProgressThread ) Thread . currentThread ( ) ; } Map < String , List < CmsRelation > > invalidResources = new HashMap < String , List < CmsRelation > > ( ) ; boolean interProject = ( publishList != null ) ; if ( report != null ) { report . println ( Messages . get ( ) . container ( Messages . RPT_HTMLLINK_VALIDATOR_BEGIN_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; } List < CmsResource > resources = new ArrayList < CmsResource > ( ) ; if ( publishList == null ) { CmsResourceFilter filter = CmsResourceFilter . IGNORE_EXPIRATION ; List < I_CmsResourceType > resTypes = OpenCms . getResourceManager ( ) . getResourceTypes ( ) ; Iterator < I_CmsResourceType > itTypes = resTypes . iterator ( ) ; int count = 0 ; while ( itTypes . hasNext ( ) ) { // set progress in thread ( first 10 percent )
count ++ ; if ( thread != null ) { if ( thread . isInterrupted ( ) ) { throw new CmsIllegalStateException ( org . opencms . workplace . commons . Messages . get ( ) . container ( org . opencms . workplace . commons . Messages . ERR_PROGRESS_INTERRUPTED_0 ) ) ; } thread . setProgress ( ( count * 10 ) / resTypes . size ( ) ) ; } I_CmsResourceType type = itTypes . next ( ) ; if ( type instanceof I_CmsLinkParseable ) { filter = filter . addRequireType ( type . getTypeId ( ) ) ; try { resources . addAll ( m_driverManager . readResources ( dbc , m_driverManager . readResource ( dbc , "/" , filter ) , filter , true ) ) ; } catch ( CmsException e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_RETRIEVAL_RESOURCES_1 , type . getTypeName ( ) ) , e ) ; } } } } else { resources . addAll ( publishList . getAllResources ( ) ) ; } // populate a lookup map with the project resources that
// actually get published keyed by their resource names .
// second , resources that don ' t get validated are ignored .
Map < String , CmsResource > offlineFilesLookup = new HashMap < String , CmsResource > ( ) ; Iterator < CmsResource > itResources = resources . iterator ( ) ; int count = 0 ; while ( itResources . hasNext ( ) ) { // set progress in thread ( next 10 percent )
count ++ ; if ( thread != null ) { if ( thread . isInterrupted ( ) ) { throw new CmsIllegalStateException ( org . opencms . workplace . commons . Messages . get ( ) . container ( org . opencms . workplace . commons . Messages . ERR_PROGRESS_INTERRUPTED_0 ) ) ; } thread . setProgress ( ( ( count * 10 ) / resources . size ( ) ) + 10 ) ; } CmsResource resource = itResources . next ( ) ; offlineFilesLookup . put ( resource . getRootPath ( ) , resource ) ; } CmsProject project = dbc . currentProject ( ) ; if ( interProject ) { try { project = m_driverManager . readProject ( dbc , CmsProject . ONLINE_PROJECT_ID ) ; } catch ( CmsException e ) { // should never happen
LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } boolean foundBrokenLinks = false ; for ( int index = 0 , size = resources . size ( ) ; index < size ; index ++ ) { // set progress in thread ( next 20 percent ; leave rest for creating the list and the html )
if ( thread != null ) { if ( thread . isInterrupted ( ) ) { throw new CmsIllegalStateException ( org . opencms . workplace . commons . Messages . get ( ) . container ( org . opencms . workplace . commons . Messages . ERR_PROGRESS_INTERRUPTED_0 ) ) ; } thread . setProgress ( ( ( index * 20 ) / resources . size ( ) ) + 20 ) ; } CmsResource resource = resources . get ( index ) ; String resourceName = resource . getRootPath ( ) ; if ( report != null ) { report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_SUCCESSION_2 , new Integer ( index + 1 ) , new Integer ( size ) ) , I_CmsReport . FORMAT_NOTE ) ; report . print ( Messages . get ( ) . container ( Messages . RPT_HTMLLINK_VALIDATING_0 ) , I_CmsReport . FORMAT_NOTE ) ; report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , dbc . removeSiteRoot ( resourceName ) ) ) ; report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_DOTS_0 ) ) ; } List < CmsRelation > brokenLinks = validateLinks ( dbc , resource , offlineFilesLookup , project , report ) ; if ( brokenLinks . size ( ) > 0 ) { // the resource contains broken links
invalidResources . put ( resourceName , brokenLinks ) ; foundBrokenLinks = true ; } else { // the resource contains * NO * broken links
if ( report != null ) { report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; } } } if ( foundBrokenLinks ) { // print a summary if we found broken links in the validated resources
if ( report != null ) { report . println ( Messages . get ( ) . container ( Messages . RPT_HTMLLINK_VALIDATOR_ERROR_0 ) , I_CmsReport . FORMAT_ERROR ) ; } } if ( report != null ) { report . println ( Messages . get ( ) . container ( Messages . RPT_HTMLLINK_VALIDATOR_END_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; } return invalidResources ; |
public class PollingState { /** * Sets the polling status .
* @ param status the polling status .
* @ param statusCode the HTTP status code
* @ throws IllegalArgumentException thrown if status is null . */
PollingState < T > withStatus ( String status , int statusCode ) throws IllegalArgumentException { } } | if ( status == null ) { throw new IllegalArgumentException ( "Status is null." ) ; } this . status = status ; this . statusCode = statusCode ; return this ; |
public class VirtualMachine { /** * SDK2.5 signature for back compatibility */
public Task revertToCurrentSnapshot_Task ( HostSystem host ) throws VmConfigFault , SnapshotFault , TaskInProgress , InvalidState , InsufficientResourcesFault , NotFound , RuntimeFault , RemoteException { } } | return revertToCurrentSnapshot_Task ( host , null ) ; |
public class CmsContextMenu { /** * Opens the context menu of the given table . < p >
* @ param event the click event
* @ param table the table */
public void openForTable ( ItemClickEvent event , Table table ) { } } | fireEvent ( new ContextMenuOpenedOnTableRowEvent ( this , table , event . getItemId ( ) , event . getPropertyId ( ) ) ) ; open ( event . getClientX ( ) , event . getClientY ( ) ) ; |
public class AbstractPojoPathNavigator { /** * This method gets the { @ link PojoPathFunction } for the given { @ code functionName } .
* @ param functionName is the { @ link PojoPathFunctionManager # getFunction ( String ) name } of the requested
* { @ link PojoPathFunction } .
* @ param context is the { @ link PojoPathContext context } for this operation .
* @ return the requested { @ link PojoPathFunction } .
* @ throws ObjectNotFoundException if no { @ link PojoPathFunction } is defined for the given { @ code functionName } . */
@ SuppressWarnings ( "rawtypes" ) protected PojoPathFunction getFunction ( String functionName , PojoPathContext context ) throws ObjectNotFoundException { } } | PojoPathFunction function = null ; // context overrides functions . . .
PojoPathFunctionManager manager = context . getAdditionalFunctionManager ( ) ; if ( manager != null ) { function = manager . getFunction ( functionName ) ; } if ( function == null ) { // global functions as fallback . . .
manager = getFunctionManager ( ) ; if ( manager != null ) { function = manager . getFunction ( functionName ) ; } } if ( function == null ) { throw new ObjectNotFoundException ( PojoPathFunction . class , functionName ) ; } return function ; |
public class AbstractJobEntityImpl { /** * getters and setters / / / / / */
public void setExecution ( ExecutionEntity execution ) { } } | executionId = execution . getId ( ) ; processInstanceId = execution . getProcessInstanceId ( ) ; processDefinitionId = execution . getProcessDefinitionId ( ) ; |
public class LocalEnvironment { @ Override public JobExecutionResult execute ( String jobName ) throws Exception { } } | if ( executor == null ) { startNewSession ( ) ; } Plan p = createProgramPlan ( jobName ) ; // Session management is disabled , revert this commit to enable
// p . setJobId ( jobID ) ;
// p . setSessionTimeout ( sessionTimeout ) ;
JobExecutionResult result = executor . executePlan ( p ) ; this . lastJobExecutionResult = result ; return result ; |
public class InternalSARLParser { /** * InternalSARL . g : 12043:1 : ruleXAssignment returns [ EObject current = null ] : ( ( ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) ) ) | ( this _ XOrExpression _ 4 = ruleXOrExpression ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) ) ) ? ) ) ; */
public final EObject ruleXAssignment ( ) throws RecognitionException { } } | EObject current = null ; EObject lv_value_3_0 = null ; EObject this_XOrExpression_4 = null ; EObject lv_rightOperand_7_0 = null ; enterRule ( ) ; try { // InternalSARL . g : 12049:2 : ( ( ( ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) ) ) | ( this _ XOrExpression _ 4 = ruleXOrExpression ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) ) ) ? ) ) )
// InternalSARL . g : 12050:2 : ( ( ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) ) ) | ( this _ XOrExpression _ 4 = ruleXOrExpression ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) ) ) ? ) )
{ // InternalSARL . g : 12050:2 : ( ( ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) ) ) | ( this _ XOrExpression _ 4 = ruleXOrExpression ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) ) ) ? ) )
int alt299 = 2 ; alt299 = dfa299 . predict ( input ) ; switch ( alt299 ) { case 1 : // InternalSARL . g : 12051:3 : ( ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) ) )
{ // InternalSARL . g : 12051:3 : ( ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) ) )
// InternalSARL . g : 12052:4 : ( ) ( ( ruleFeatureCallID ) ) ruleOpSingleAssign ( ( lv _ value _ 3_0 = ruleXAssignment ) )
{ // InternalSARL . g : 12052:4 : ( )
// InternalSARL . g : 12053:5:
{ if ( state . backtracking == 0 ) { current = forceCreateModelElement ( grammarAccess . getXAssignmentAccess ( ) . getXAssignmentAction_0_0 ( ) , current ) ; } } // InternalSARL . g : 12059:4 : ( ( ruleFeatureCallID ) )
// InternalSARL . g : 12060:5 : ( ruleFeatureCallID )
{ // InternalSARL . g : 12060:5 : ( ruleFeatureCallID )
// InternalSARL . g : 12061:6 : ruleFeatureCallID
{ if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElement ( grammarAccess . getXAssignmentRule ( ) ) ; } } if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXAssignmentAccess ( ) . getFeatureJvmIdentifiableElementCrossReference_0_1_0 ( ) ) ; } pushFollow ( FOLLOW_83 ) ; ruleFeatureCallID ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { afterParserOrEnumRuleCall ( ) ; } } } if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXAssignmentAccess ( ) . getOpSingleAssignParserRuleCall_0_2 ( ) ) ; } pushFollow ( FOLLOW_45 ) ; ruleOpSingleAssign ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { afterParserOrEnumRuleCall ( ) ; } // InternalSARL . g : 12082:4 : ( ( lv _ value _ 3_0 = ruleXAssignment ) )
// InternalSARL . g : 12083:5 : ( lv _ value _ 3_0 = ruleXAssignment )
{ // InternalSARL . g : 12083:5 : ( lv _ value _ 3_0 = ruleXAssignment )
// InternalSARL . g : 12084:6 : lv _ value _ 3_0 = ruleXAssignment
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXAssignmentAccess ( ) . getValueXAssignmentParserRuleCall_0_3_0 ( ) ) ; } pushFollow ( FOLLOW_2 ) ; lv_value_3_0 = ruleXAssignment ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXAssignmentRule ( ) ) ; } set ( current , "value" , lv_value_3_0 , "org.eclipse.xtext.xbase.Xbase.XAssignment" ) ; afterParserOrEnumRuleCall ( ) ; } } } } } break ; case 2 : // InternalSARL . g : 12103:3 : ( this _ XOrExpression _ 4 = ruleXOrExpression ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) ) ) ? )
{ // InternalSARL . g : 12103:3 : ( this _ XOrExpression _ 4 = ruleXOrExpression ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) ) ) ? )
// InternalSARL . g : 12104:4 : this _ XOrExpression _ 4 = ruleXOrExpression ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) ) ) ?
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXAssignmentAccess ( ) . getXOrExpressionParserRuleCall_1_0 ( ) ) ; } pushFollow ( FOLLOW_112 ) ; this_XOrExpression_4 = ruleXOrExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = this_XOrExpression_4 ; afterParserOrEnumRuleCall ( ) ; } // InternalSARL . g : 12112:4 : ( ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) ) ) ?
int alt298 = 2 ; alt298 = dfa298 . predict ( input ) ; switch ( alt298 ) { case 1 : // InternalSARL . g : 12113:5 : ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) ) ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) )
{ // InternalSARL . g : 12113:5 : ( ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) ) )
// InternalSARL . g : 12114:6 : ( ( ( ) ( ( ruleOpMultiAssign ) ) ) ) = > ( ( ) ( ( ruleOpMultiAssign ) ) )
{ // InternalSARL . g : 12124:6 : ( ( ) ( ( ruleOpMultiAssign ) ) )
// InternalSARL . g : 12125:7 : ( ) ( ( ruleOpMultiAssign ) )
{ // InternalSARL . g : 12125:7 : ( )
// InternalSARL . g : 12126:8:
{ if ( state . backtracking == 0 ) { current = forceCreateModelElementAndSet ( grammarAccess . getXAssignmentAccess ( ) . getXBinaryOperationLeftOperandAction_1_1_0_0_0 ( ) , current ) ; } } // InternalSARL . g : 12132:7 : ( ( ruleOpMultiAssign ) )
// InternalSARL . g : 12133:8 : ( ruleOpMultiAssign )
{ // InternalSARL . g : 12133:8 : ( ruleOpMultiAssign )
// InternalSARL . g : 12134:9 : ruleOpMultiAssign
{ if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElement ( grammarAccess . getXAssignmentRule ( ) ) ; } } if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXAssignmentAccess ( ) . getFeatureJvmIdentifiableElementCrossReference_1_1_0_0_1_0 ( ) ) ; } pushFollow ( FOLLOW_45 ) ; ruleOpMultiAssign ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { afterParserOrEnumRuleCall ( ) ; } } } } } // InternalSARL . g : 12150:5 : ( ( lv _ rightOperand _ 7_0 = ruleXAssignment ) )
// InternalSARL . g : 12151:6 : ( lv _ rightOperand _ 7_0 = ruleXAssignment )
{ // InternalSARL . g : 12151:6 : ( lv _ rightOperand _ 7_0 = ruleXAssignment )
// InternalSARL . g : 12152:7 : lv _ rightOperand _ 7_0 = ruleXAssignment
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXAssignmentAccess ( ) . getRightOperandXAssignmentParserRuleCall_1_1_1_0 ( ) ) ; } pushFollow ( FOLLOW_2 ) ; lv_rightOperand_7_0 = ruleXAssignment ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXAssignmentRule ( ) ) ; } set ( current , "rightOperand" , lv_rightOperand_7_0 , "org.eclipse.xtext.xbase.Xbase.XAssignment" ) ; afterParserOrEnumRuleCall ( ) ; } } } } break ; } } } break ; } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class DnsNameResolver { /** * Hook designed for extensibility so one can pass a different cache on each resolution attempt
* instead of using the global one . */
protected void doResolveAll ( String inetHost , DnsRecord [ ] additionals , Promise < List < InetAddress > > promise , DnsCache resolveCache ) throws Exception { } } | if ( inetHost == null || inetHost . isEmpty ( ) ) { // If an empty hostname is used we should use " localhost " , just like InetAddress . getAllByName ( . . . ) does .
promise . setSuccess ( Collections . singletonList ( loopbackAddress ( ) ) ) ; return ; } final byte [ ] bytes = NetUtil . createByteArrayFromIpAddressString ( inetHost ) ; if ( bytes != null ) { // The unresolvedAddress was created via a String that contains an ipaddress .
promise . setSuccess ( Collections . singletonList ( InetAddress . getByAddress ( bytes ) ) ) ; return ; } final String hostname = hostname ( inetHost ) ; InetAddress hostsFileEntry = resolveHostsFileEntry ( hostname ) ; if ( hostsFileEntry != null ) { promise . setSuccess ( Collections . singletonList ( hostsFileEntry ) ) ; return ; } if ( ! doResolveAllCached ( hostname , additionals , promise , resolveCache , resolvedInternetProtocolFamilies ) ) { doResolveAllUncached ( hostname , additionals , promise , resolveCache , false ) ; } |
public class MakeValidOp { /** * Decompose a geometry recursively into simple components .
* @ param geometry input geometry
* @ param list a list of simple components ( Point , LineString or Polygon ) */
private static void decompose ( Geometry geometry , Collection < Geometry > list ) { } } | for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry component = geometry . getGeometryN ( i ) ; if ( component instanceof GeometryCollection ) { decompose ( component , list ) ; } else { list . add ( component ) ; } } |
public class InstanceFailoverGroupsInner { /** * Creates or updates a failover group .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param locationName The name of the region where the resource is located .
* @ param failoverGroupName The name of the failover group .
* @ param parameters The failover group parameters .
* @ 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 InstanceFailoverGroupInner object if successful . */
public InstanceFailoverGroupInner createOrUpdate ( String resourceGroupName , String locationName , String failoverGroupName , InstanceFailoverGroupInner parameters ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , locationName , failoverGroupName , parameters ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class GeoCodeBasic { /** * { @ inheritDoc } */
@ Override public final int countNotFound ( ) { } } | logger . debug ( "Count the places that couldn't be found" ) ; final int count = notFoundKeys ( ) . size ( ) ; logger . debug ( count + " places not found" ) ; return count ; |
public class FragmentSignatureUtils { /** * Processes a set of parameters that have been specified for a fragment signature .
* This processing matches the specified parameters against the ones in the signature , allowing the specified
* ones ( usually coming from a fragment selection like { @ code th : include } ) to be nameless , so that their values
* are matched to their corresponding variable name during this parameter processing operation .
* The resulting processed parameters are typically applied as local variables to the nodes of a
* selected fragment .
* @ param fragmentSignature the signature parameters should be processed against
* @ param specifiedParameters the set of specified parameters
* @ param parametersAreSynthetic whether the parameter names in the specifiedParameters map are synthetic or not
* @ return the processed set of parameters , ready to be applied as local variables to the fragment ' s nodes . */
public static Map < String , Object > processParameters ( final FragmentSignature fragmentSignature , final Map < String , Object > specifiedParameters , final boolean parametersAreSynthetic ) { } } | Validate . notNull ( fragmentSignature , "Fragment signature cannot be null" ) ; if ( specifiedParameters == null || specifiedParameters . size ( ) == 0 ) { if ( fragmentSignature . hasParameters ( ) ) { // Fragment signature requires parameters , but we haven ' t specified them !
throw new TemplateProcessingException ( "Cannot resolve fragment. Signature \"" + fragmentSignature . getStringRepresentation ( ) + "\" " + "declares parameters, but fragment selection did not specify any parameters." ) ; } return null ; } if ( parametersAreSynthetic && ! fragmentSignature . hasParameters ( ) ) { throw new TemplateProcessingException ( "Cannot resolve fragment. Signature \"" + fragmentSignature . getStringRepresentation ( ) + "\" " + "declares no parameters, but fragment selection did specify parameters in a synthetic manner " + "(without names), which is not correct due to the fact parameters cannot be assigned names " + "unless signature specifies these names." ) ; } if ( parametersAreSynthetic ) { // No need to match parameter names , just apply the ones from the signature
final List < String > signatureParameterNames = fragmentSignature . getParameterNames ( ) ; if ( signatureParameterNames . size ( ) != specifiedParameters . size ( ) ) { throw new TemplateProcessingException ( "Cannot resolve fragment. Signature \"" + fragmentSignature . getStringRepresentation ( ) + "\" " + "declares " + signatureParameterNames . size ( ) + " parameters, but fragment selection specifies " + specifiedParameters . size ( ) + " parameters. Fragment selection does not correctly match." ) ; } final Map < String , Object > processedParameters = new HashMap < String , Object > ( signatureParameterNames . size ( ) + 1 , 1.0f ) ; int index = 0 ; for ( final String parameterName : signatureParameterNames ) { final String syntheticParameterName = getSyntheticParameterNameForIndex ( index ++ ) ; final Object parameterValue = specifiedParameters . get ( syntheticParameterName ) ; processedParameters . put ( parameterName , parameterValue ) ; } return processedParameters ; } if ( ! fragmentSignature . hasParameters ( ) ) { // Parameters in fragment selection are not synthetic , and fragment signature has no parameters ,
// so we just use the " specified parameters " .
return specifiedParameters ; } // Parameters are not synthetic and signature does specify parameters , so their names should match ( all
// the parameters specified at the fragment signature should be specified at the fragment selection ,
// though fragment selection can specify more parameters , not present at the signature .
final List < String > parameterNames = fragmentSignature . getParameterNames ( ) ; for ( final String parameterName : parameterNames ) { if ( ! specifiedParameters . containsKey ( parameterName ) ) { throw new TemplateProcessingException ( "Cannot resolve fragment. Signature \"" + fragmentSignature . getStringRepresentation ( ) + "\" " + "declares parameter \"" + parameterName + "\", which is not specified at the fragment " + "selection." ) ; } } return specifiedParameters ; |
public class CandidateComparator { /** * < pre >
* function to actually calculate the scores for the two objects that are being compared .
* the comparison follows the following logic -
* 1 . if both objects are equal return 0 score for both .
* 2 . if one side is null , the other side gets all the score .
* 3 . if both sides are non - null value , both values will be passed to all the registered
* FactorComparators
* each factor comparator will generate a result based off it sole logic the weight of the
* comparator will be
* added to the wining side , if equal , no value will be added to either side .
* 4 . final result will be returned in a Pair container .
* < / pre >
* @ param object1 the first object ( left side ) to be compared .
* @ param object2 the second object ( right side ) to be compared .
* @ return a pair structure contains the score for both sides . */
public Pair < Integer , Integer > getComparisonScore ( final T object1 , final T object2 ) { } } | logger . debug ( String . format ( "start comparing '%s' with '%s', total weight = %s " , object1 == null ? "(null)" : object1 . toString ( ) , object2 == null ? "(null)" : object2 . toString ( ) , this . getTotalWeight ( ) ) ) ; int result1 = 0 ; int result2 = 0 ; // short cut if object equals .
if ( object1 == object2 ) { logger . debug ( "[Comparator] same object." ) ; } else // left side is null .
if ( object1 == null ) { logger . debug ( "[Comparator] left side is null, right side gets total weight." ) ; result2 = this . getTotalWeight ( ) ; } else // right side is null .
if ( object2 == null ) { logger . debug ( "[Comparator] right side is null, left side gets total weight." ) ; result1 = this . getTotalWeight ( ) ; } else // both side is not null , put them thru the full loop
{ final Collection < FactorComparator < T > > comparatorList = this . factorComparatorList . values ( ) ; for ( final FactorComparator < T > comparator : comparatorList ) { final int result = comparator . compare ( object1 , object2 ) ; result1 = result1 + ( result > 0 ? comparator . getWeight ( ) : 0 ) ; result2 = result2 + ( result < 0 ? comparator . getWeight ( ) : 0 ) ; logger . debug ( String . format ( "[Factor: %s] compare result : %s (current score %s vs %s)" , comparator . getFactorName ( ) , result , result1 , result2 ) ) ; } } // in case of same score , use tie - breaker to stabilize the result .
if ( result1 == result2 ) { final boolean result = this . tieBreak ( object1 , object2 ) ; logger . debug ( "[TieBreaker] TieBreaker chose " + ( result ? String . format ( "left side (%s)" , null == object1 ? "null" : object1 . toString ( ) ) : String . format ( "right side (%s)" , null == object2 ? "null" : object2 . toString ( ) ) ) ) ; if ( result ) { result1 ++ ; } else { result2 ++ ; } } logger . debug ( String . format ( "Result : %s vs %s " , result1 , result2 ) ) ; return new Pair < > ( result1 , result2 ) ; |
public class PlacementConstraintMarshaller { /** * Marshall the given parameter object . */
public void marshall ( PlacementConstraint placementConstraint , ProtocolMarshaller protocolMarshaller ) { } } | if ( placementConstraint == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( placementConstraint . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( placementConstraint . getExpression ( ) , EXPRESSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ContentSceneController { /** * Called on system pause . The current active content scene moves to invisible state - - see
* { @ link ContentScene # hide ( ) } */
public void pause ( ) { } } | new ExecutionChain ( mGvrContext ) . runOnMainThread ( new Runnable ( ) { @ Override public void run ( ) { if ( ! mContentSceneViewStack . isEmpty ( ) ) { mContentSceneViewStack . peek ( ) . hide ( ) ; WidgetLib . getTouchManager ( ) . setFlingHandler ( null ) ; } } } ) . execute ( ) ; |
public class ConnectionMaintainerImpl { /** * Returns a server identifier to try .
* @ return A server identifier to try . If we are unable to come up with any
* candidates , a < code > None < / code > object is returned . */
private Optional < T > getServerIdToTry ( ) { } } | if ( m_serverIdsToTry . isEmpty ( ) ) { final Collection < T > moreCandidates = getMoreCandidates ( ) ; if ( moreCandidates . isEmpty ( ) ) { // We were unable to find more candidates . To avoid hammering
// the service that provides potential candidates , flag that we
// should sleep for a little while before trying again to get
// more potential candidates .
m_sleepBeforeTryingToGetMoreCandidates = true ; return ( new NoneImpl < T > ( ) ) ; } else { // We successfully retrieved more candidates . We clear the
// flag that prevented requesting more potential candidates ,
// since all is well . Since we have candidates with which to
// work , we probably will not be hitting the service that
// provides potential candidates any time soon .
m_sleepBeforeTryingToGetMoreCandidates = false ; m_serverIdsToTry . addAll ( moreCandidates ) ; return ( new SomeImpl < T > ( m_serverIdsToTry . remove ( 0 ) ) ) ; } } else { // We already have servers to try . Try one of them .
return ( new SomeImpl < T > ( m_serverIdsToTry . remove ( 0 ) ) ) ; } |
public class AWSSystemsManagerPropertiesProvider { /** * todo - ensure prefixe parameter takes precedence */
private String forceResolve ( String key ) { } } | GetParametersRequest request ; if ( key . startsWith ( "aws." ) ) { log . warn ( "Will not try to resolve unprefixed key (" + key + ") - AWS does not allow this" ) ; if ( org . apache . commons . lang3 . StringUtils . isNotEmpty ( parameterPrefix ) ) { request = new GetParametersRequest ( ) . withNames ( parameterPrefix + key ) . withWithDecryption ( true ) ; } else { return null ; } } else { request = new GetParametersRequest ( ) . withNames ( parameterPrefix + key , key ) . withWithDecryption ( true ) ; } GetParametersResult result = ssmClient . getParameters ( request ) ; for ( Parameter parameter : result . getParameters ( ) ) { return parameter . getValue ( ) ; } return null ; |
public class authenticationradiuspolicy_systemglobal_binding { /** * Use this API to fetch authenticationradiuspolicy _ systemglobal _ binding resources of given name . */
public static authenticationradiuspolicy_systemglobal_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | authenticationradiuspolicy_systemglobal_binding obj = new authenticationradiuspolicy_systemglobal_binding ( ) ; obj . set_name ( name ) ; authenticationradiuspolicy_systemglobal_binding response [ ] = ( authenticationradiuspolicy_systemglobal_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class AmazonConfigClient { /** * Runs an on - demand remediation for the specified AWS Config rules against the last known remediation
* configuration . It runs an execution against the current state of your resources . Remediation execution is
* asynchronous .
* You can specify up to 100 resource keys per request . An existing StartRemediationExecution call for the specified
* resource keys must complete before you can call the API again .
* @ param startRemediationExecutionRequest
* @ return Result of the StartRemediationExecution operation returned by the service .
* @ throws InsufficientPermissionsException
* Indicates one of the following errors : < / p >
* < ul >
* < li >
* The rule cannot be created because the IAM role assigned to AWS Config lacks permissions to perform the
* config : Put * action .
* < / li >
* < li >
* The AWS Lambda function cannot be invoked . Check the function ARN , and check the function ' s permissions .
* < / li >
* @ throws NoSuchRemediationConfigurationException
* You specified an AWS Config rule without a remediation configuration .
* @ sample AmazonConfig . StartRemediationExecution
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / config - 2014-11-12 / StartRemediationExecution "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public StartRemediationExecutionResult startRemediationExecution ( StartRemediationExecutionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeStartRemediationExecution ( request ) ; |
public class OrRange { /** * ( non - Javadoc )
* @ see net . ossindex . version . IVersionRange # contains ( net . ossindex . version . IVersion ) */
@ Override public boolean contains ( IVersion version ) { } } | for ( IVersionRange range : ranges ) { if ( range . contains ( version ) ) { return true ; } } return false ; |
public class MMCIFFileTools { /** * Converts an Atom object to an { @ link AtomSite } object .
* @ param a the atom
* @ param model the model number for the output AtomSites
* @ param chainName the chain identifier ( author id ) for the output AtomSites
* @ param chainId the internal chain identifier ( asym id ) for the output AtomSites
* @ param atomId the atom id to be written to AtomSite
* @ return */
public static AtomSite convertAtomToAtomSite ( Atom a , int model , String chainName , String chainId , int atomId ) { } } | /* ATOM 7 C CD . GLU A 1 24 ? - 10.109 15.374 38.853 1.00 50.05 ? ? ? ? ? ? 24 GLU A CD 1
ATOM 8 O OE1 . GLU A 1 24 ? - 9.659 14.764 37.849 1.00 49.80 ? ? ? ? ? ? 24 GLU A OE1 1
ATOM 9 O OE2 . GLU A 1 24 ? - 11.259 15.171 39.310 1.00 50.51 ? ? ? ? ? ? 24 GLU A OE2 1
ATOM 10 N N . LEU A 1 25 ? - 5.907 18.743 37.412 1.00 41.55 ? ? ? ? ? ? 25 LEU A N 1
ATOM 11 C CA . LEU A 1 25 ? - 5.168 19.939 37.026 1.00 37.55 ? ? ? ? ? ? 25 LEU A CA 1 */
Group g = a . getGroup ( ) ; String record ; if ( g . getType ( ) . equals ( GroupType . HETATM ) ) { record = "HETATM" ; } else { record = "ATOM" ; } String entityId = "0" ; String labelSeqId = Integer . toString ( g . getResidueNumber ( ) . getSeqNum ( ) ) ; if ( g . getChain ( ) != null && g . getChain ( ) . getEntityInfo ( ) != null ) { entityId = Integer . toString ( g . getChain ( ) . getEntityInfo ( ) . getMolId ( ) ) ; if ( g . getChain ( ) . getEntityInfo ( ) . getType ( ) == EntityType . POLYMER ) { // this only makes sense for polymeric chains , non - polymer chains will never have seqres groups and there ' s no point in calling getAlignedResIndex
labelSeqId = Integer . toString ( g . getChain ( ) . getEntityInfo ( ) . getAlignedResIndex ( g , g . getChain ( ) ) ) ; } } Character altLoc = a . getAltLoc ( ) ; String altLocStr ; if ( altLoc == null || altLoc == ' ' ) { altLocStr = MMCIF_DEFAULT_VALUE ; } else { altLocStr = altLoc . toString ( ) ; } Element e = a . getElement ( ) ; String eString = e . toString ( ) . toUpperCase ( ) ; if ( e . equals ( Element . R ) ) { eString = "X" ; } String insCode = MMCIF_MISSING_VALUE ; if ( g . getResidueNumber ( ) . getInsCode ( ) != null ) { insCode = Character . toString ( g . getResidueNumber ( ) . getInsCode ( ) ) ; } AtomSite atomSite = new AtomSite ( ) ; atomSite . setGroup_PDB ( record ) ; atomSite . setId ( Integer . toString ( atomId ) ) ; atomSite . setType_symbol ( eString ) ; atomSite . setLabel_atom_id ( a . getName ( ) ) ; atomSite . setLabel_alt_id ( altLocStr ) ; atomSite . setLabel_comp_id ( g . getPDBName ( ) ) ; atomSite . setLabel_asym_id ( chainId ) ; atomSite . setLabel_entity_id ( entityId ) ; atomSite . setLabel_seq_id ( labelSeqId ) ; atomSite . setPdbx_PDB_ins_code ( insCode ) ; atomSite . setCartn_x ( FileConvert . d3 . format ( a . getX ( ) ) ) ; atomSite . setCartn_y ( FileConvert . d3 . format ( a . getY ( ) ) ) ; atomSite . setCartn_z ( FileConvert . d3 . format ( a . getZ ( ) ) ) ; atomSite . setOccupancy ( FileConvert . d2 . format ( a . getOccupancy ( ) ) ) ; atomSite . setB_iso_or_equiv ( FileConvert . d2 . format ( a . getTempFactor ( ) ) ) ; atomSite . setAuth_seq_id ( Integer . toString ( g . getResidueNumber ( ) . getSeqNum ( ) ) ) ; atomSite . setAuth_comp_id ( g . getPDBName ( ) ) ; atomSite . setAuth_asym_id ( chainName ) ; atomSite . setAuth_atom_id ( a . getName ( ) ) ; atomSite . setPdbx_PDB_model_num ( Integer . toString ( model ) ) ; return atomSite ; |
public class DiameterStackMultiplexer { /** * ( non - Javadoc )
* @ see org . mobicents . diameter . stack . DiameterStackMultiplexerMBean # _ Network _ Peers _ addPeer ( java . lang . String , boolean , int , String ) */
@ Override public void _Network_Peers_addPeer ( String name , boolean attemptConnect , int rating , String realm ) throws MBeanException { } } | try { NetworkImpl n = ( NetworkImpl ) stack . unwrap ( Network . class ) ; /* Peer p = */
n . addPeer ( name , realm , attemptConnect ) ; } catch ( IllegalArgumentException e ) { logger . warn ( e . getMessage ( ) ) ; } catch ( InternalException e ) { throw new MBeanException ( e , "Failed to add peer with name '" + name + "'" ) ; } |
public class PlainTextDocumentReaderAndWriter { /** * Print the classifications for the document to the given Writer . This method
* now checks the < code > outputFormat < / code > property , and can print in
* slashTags , inlineXML , or xml ( stand - Off XML ) . For both the XML output
* formats , it preserves spacing , while for the slashTags format , it prints
* tokenized ( since preserveSpacing output is somewhat dysfunctional with the
* slashTags format ) .
* @ param list
* List of tokens with classifier answers
* @ param out
* Where to print the output to */
public void printAnswers ( List < IN > list , PrintWriter out ) { } } | String style = null ; if ( flags != null ) { style = flags . outputFormat ; } if ( style == null || "" . equals ( style ) ) { style = "slashTags" ; } OutputStyle outputStyle = OutputStyle . fromShortName ( style ) ; printAnswers ( list , out , outputStyle , ! "slashTags" . equals ( style ) ) ; |
public class ResourceValues { /** * Returns new instance of OptionalValue with given value
* @ param value wrapped object
* @ param < T > type of the wrapped object
* @ return given object wrapped in OptionalValue */
public static < T > OptionalValue < T > ofNullable ( T value ) { } } | return new GenericOptionalValue < T > ( RUNTIME_SOURCE , DEFAULT_KEY , value ) ; |
public class ItemFilter { /** * add a list of items at the given position within the existing items
* @ param position the global position
* @ param items the items to add */
public ModelAdapter < ? , Item > add ( int position , List < Item > items ) { } } | if ( mOriginalItems != null && items . size ( ) > 0 ) { if ( mItemAdapter . isUseIdDistributor ( ) ) { mItemAdapter . getIdDistributor ( ) . checkIds ( items ) ; } mOriginalItems . addAll ( getAdapterPosition ( mItemAdapter . getAdapterItems ( ) . get ( position ) ) - mItemAdapter . getFastAdapter ( ) . getPreItemCount ( position ) , items ) ; publishResults ( mConstraint , performFiltering ( mConstraint ) ) ; return mItemAdapter ; } else { return mItemAdapter . addInternal ( position , items ) ; } |
public class SslCodec { /** * Forwards a close event upstream .
* @ param event
* the close event
* @ throws SSLException if an SSL related problem occurs
* @ throws InterruptedException if the execution was interrupted */
@ Handler public void onClose ( Close event , PlainChannel plainChannel ) throws InterruptedException , SSLException { } } | if ( plainChannel . hub ( ) != this ) { return ; } plainChannel . close ( event ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.