signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SystemServlet { /** * setup of the servlet operation set for this servlet instance */ @ Override public void init ( ) throws ServletException { } }
super . init ( ) ; // GET operations . setOperation ( ServletOperationSet . Method . GET , Extension . json , Operation . propertyTypes , new GetPropertyTypes ( ) ) ; operations . setOperation ( ServletOperationSet . Method . GET , Extension . json , Operation . primaryTypes , new GetPrimaryTypes ( ) ) ; operations . setOperation ( ServletOperationSet . Method . GET , Extension . json , Operation . mixinTypes , new GetMixinTypes ( ) ) ; operations . setOperation ( ServletOperationSet . Method . GET , Extension . json , Operation . typeahead , new JsonTypeahead ( ) ) ;
public class ApptentiveNestedScrollView { /** * < p > Scrolls the view to make the area defined by < code > top < / code > and * < code > bottom < / code > visible . This method attempts to give the focus * to a component visible in this area . If no component can be focused in * the new visible area , the focus is reclaimed by this ScrollView . < / p > * @ param direction the scroll direction : { @ link android . view . View # FOCUS _ UP } * to go upward , { @ link android . view . View # FOCUS _ DOWN } to downward * @ param top the top offset of the new area to be made visible * @ param bottom the bottom offset of the new area to be made visible * @ return true if the key event is consumed by this method , false otherwise */ private boolean scrollAndFocus ( int direction , int top , int bottom ) { } }
boolean handled = true ; int height = getHeight ( ) ; int containerTop = getScrollY ( ) ; int containerBottom = containerTop + height ; boolean up = direction == View . FOCUS_UP ; View newFocused = findFocusableViewInBounds ( up , top , bottom ) ; if ( newFocused == null ) { newFocused = this ; } if ( top >= containerTop && bottom <= containerBottom ) { handled = false ; } else { int delta = up ? ( top - containerTop ) : ( bottom - containerBottom ) ; doScrollY ( delta ) ; } if ( newFocused != findFocus ( ) ) newFocused . requestFocus ( direction ) ; return handled ;
public class ServiceValidationViewFactory { /** * Register view . * @ param ownerClass the owner class * @ param view the view */ public void registerView ( final Class ownerClass , final Pair < View , View > view ) { } }
registerView ( ownerClass . getSimpleName ( ) , view ) ;
public class DefaultApplicationObjectConfigurer { /** * Sets the image of the given object . The image is loaded from this * instance ' s { @ link ImageSource } using a key in the format * < pre > * & lt ; objectName & gt ; . image * < / pre > * If the image source cannot find an image under that key , the object ' s * image will be set to null . * @ param configurable The object to be configured . Must not be null . * @ param objectName The name of the configurable object , unique within the * application . Must not be null . * @ throws IllegalArgumentException if either argument is null . */ protected void configureImage ( ImageConfigurable configurable , String objectName ) { } }
Assert . notNull ( configurable , "configurable" ) ; Assert . notNull ( objectName , "objectName" ) ; Image image = loadImage ( objectName , IMAGE_KEY ) ; if ( image != null ) { configurable . setImage ( image ) ; }
public class BooleanUtils { /** * < p > Performs an xor on a set of booleans . < / p > * < pre > * BooleanUtils . xor ( true , true ) = false * BooleanUtils . xor ( false , false ) = false * BooleanUtils . xor ( true , false ) = true * < / pre > * @ param array an array of { @ code boolean } s * @ return { @ code true } if the xor is successful . * @ throws IllegalArgumentException if { @ code array } is { @ code null } * @ throws IllegalArgumentException if { @ code array } is empty . */ public static boolean xor ( final boolean ... array ) { } }
// Validates input if ( array == null ) { throw new IllegalArgumentException ( "The Array must not be null" ) ; } if ( array . length == 0 ) { throw new IllegalArgumentException ( "Array is empty" ) ; } // false if the neutral element of the xor operator boolean result = false ; for ( final boolean element : array ) { result ^= element ; } return result ;
public class Validate { /** * Checks if the given String is NOT a negative double value . < br > * This method tries to parse a double value and then checks if it is bigger or equal to 0. * @ param value The String value to validate . * @ return The parsed double value * @ throws ParameterException if the given String value cannot be parsed as double or its value is smaller than 0. */ public static Double notNegativeDouble ( String value ) { } }
Double doubleValue = Validate . isDouble ( value ) ; notNegative ( doubleValue ) ; return doubleValue ;
public class Options { /** * Populates data in this Options from the character stream . * @ param in The Reader * @ throws IOException If there is a problem reading data */ public void readData ( BufferedReader in ) throws IOException { } }
String line , value ; // skip old variables if still present lexOptions . readData ( in ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; try { tlpParams = ( TreebankLangParserParams ) Class . forName ( value ) . newInstance ( ) ; } catch ( Exception e ) { IOException ioe = new IOException ( "Problem instantiating parserParams: " + line ) ; ioe . initCause ( e ) ; throw ioe ; } line = in . readLine ( ) ; // ensure backwards compatibility if ( line . matches ( "^forceCNF.*" ) ) { value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; forceCNF = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; } value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; doPCFG = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; doDep = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; freeDependencies = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; directional = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; genStop = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; distance = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; coarseDistance = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; dcTags = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; if ( ! line . matches ( "^nPrune.*" ) ) { throw new RuntimeException ( "Expected nPrune, found: " + line ) ; } value = line . substring ( line . indexOf ( ' ' ) + 1 ) ; nodePrune = Boolean . parseBoolean ( value ) ; line = in . readLine ( ) ; // get rid of last line if ( line . length ( ) != 0 ) { throw new RuntimeException ( "Expected blank line, found: " + line ) ; }
public class DifferenceEngine { /** * Tests whether a Node has children , taking ignoreComments * setting into account . */ private Boolean hasChildNodes ( Node n ) { } }
boolean flag = n . hasChildNodes ( ) ; if ( flag && XMLUnit . getIgnoreComments ( ) ) { List nl = nodeList2List ( n . getChildNodes ( ) ) ; flag = ! nl . isEmpty ( ) ; } return flag ? Boolean . TRUE : Boolean . FALSE ;
public class AbstractHttpTransport { /** * Returns the has conditions specified in the request as a base64 encoded * trit map of feature values where each trit ( three state value - 0 , 1 and * don ' t care ) represents the state of a feature in the list of * deendentFeatures that was sent to the client in the featureMap JavaScript * resource served by * { @ link AbstractHttpTransport . FeatureListResourceFactory } . * Each byte from the base64 decoded byte array encodes 5 trits ( 3 * * 5 = 243 * states out of the 256 possible states ) . * @ param request * The http request object * @ param defaultFeatures * The default features from the config * @ return the decoded feature list as a string , or null * @ throws IOException */ protected Features getFeaturesFromRequestEncoded ( HttpServletRequest request , Features defaultFeatures ) throws IOException { } }
final String methodName = "getFeaturesFromRequestEncoded" ; // $ NON - NLS - 1 $ boolean traceLogging = log . isLoggable ( Level . FINER ) ; if ( traceLogging ) { log . entering ( sourceClass , methodName , new Object [ ] { request } ) ; } if ( depsInitialized == null ) { if ( traceLogging ) { log . finer ( "No initialization semphore" ) ; // $ NON - NLS - 1 $ log . exiting ( sourceClass , methodName ) ; } return null ; } String encoded = request . getParameter ( ENCODED_FEATURE_MAP_REQPARAM ) ; if ( encoded == null ) { if ( traceLogging ) { log . finer ( ENCODED_FEATURE_MAP_REQPARAM + " param not specified in request" ) ; // $ NON - NLS - 1 $ log . exiting ( sourceClass , methodName ) ; } return null ; } if ( traceLogging ) { log . finer ( ENCODED_FEATURE_MAP_REQPARAM + " param = " + encoded ) ; // $ NON - NLS - 1 $ } byte [ ] decoded = Base64 . decodeBase64 ( encoded ) ; int len = dependentFeatures . size ( ) ; ByteArrayOutputStream bos = new ByteArrayOutputStream ( len ) ; // Validate the input - first two bytes specify length of feature list on the client if ( len != ( decoded [ 0 ] & 0xFF ) + ( ( decoded [ 1 ] & 0xFF ) << 8 ) || decoded . length != len / 5 + ( len % 5 == 0 ? 0 : 1 ) + 2 ) { if ( log . isLoggable ( Level . FINER ) ) { log . finer ( "Invalid encoded feature list. Expected feature list length = " + len ) ; // $ NON - NLS - 1 $ } throw new BadRequestException ( "Invalid encoded feature list" ) ; // $ NON - NLS - 1 $ } // Now decode the trit map for ( int i = 2 ; i < decoded . length ; i ++ ) { int q = decoded [ i ] & 0xFF ; for ( int j = 0 ; j < 5 && ( i - 2 ) * 5 + j < len ; j ++ ) { bos . write ( q % 3 ) ; q = q / 3 ; } } Features result = new Features ( defaultFeatures ) ; int i = 0 ; for ( byte b : bos . toByteArray ( ) ) { if ( b < 2 ) { result . put ( dependentFeatures . get ( i ) , b == 1 ) ; } i ++ ; } if ( traceLogging ) { log . exiting ( sourceClass , methodName , result ) ; } return result ;
public class FlowTypeCheck { /** * Check a given set of variable declarations are not " empty " . That is , their * declared type is not equivalent to void . * @ param decls */ private void checkNonEmpty ( Tuple < Decl . Variable > decls , LifetimeRelation lifetimes ) { } }
for ( int i = 0 ; i != decls . size ( ) ; ++ i ) { checkNonEmpty ( decls . get ( i ) , lifetimes ) ; }
public class CharacterClass { /** * / * Mmm . . what is it ? * static String stringValueC ( boolean [ ] categories ) { * StringBuffer sb = new StringBuffer ( ) ; * for ( int i = 0 ; i < categories . length ; i + + ) { * if ( ! categories [ i ] ) continue ; * String name = ( String ) unicodeCategoryNames . get ( new Integer ( i ) ) ; * sb . append ( ' { ' ) ; * sb . append ( name ) ; * sb . append ( ' } ' ) ; * return sb . toString ( ) ; */ static String stringValue2 ( IntBitSet [ ] arr ) { } }
b2 . setLength ( 0 ) ; int c = 0 ; loop : for ( ; ; ) { boolean marked = false ; for ( ; ; ) { IntBitSet marks = arr [ c >> 8 ] ; if ( marks != null && marks . get ( c & 255 ) ) break ; c ++ ; if ( c > 0xffff ) break loop ; } int first = c ; for ( ; c <= 0xffff ; ) { IntBitSet marks = arr [ c >> 8 ] ; if ( marks == null || ! marks . get ( c & 255 ) ) break ; c ++ ; } int last = c - 1 ; if ( last == first ) b2 . append ( stringValue ( last ) ) ; else { b2 . append ( stringValue ( first ) ) ; b2 . append ( '-' ) ; b2 . append ( stringValue ( last ) ) ; } if ( c > 0xffff ) break ; } return b2 . toString ( ) ;
public class CassandraDataHandlerBase { /** * To index thrift row . * @ param e * the e * @ param m * the m * @ param columnFamily * the column family * @ return the list */ public List < ThriftRow > toIndexThriftRow ( Object e , EntityMetadata m , String columnFamily ) { } }
List < ThriftRow > indexThriftRows = new ArrayList < ThriftRow > ( ) ; byte [ ] rowKey = getThriftColumnValue ( e , m . getIdAttribute ( ) ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; // Add thrift rows for embeddables Map < String , EmbeddableType > embeddables = metaModel . getEmbeddables ( m . getEntityClazz ( ) ) ; EntityType entityType = metaModel . entity ( m . getEntityClazz ( ) ) ; for ( String embeddedFieldName : embeddables . keySet ( ) ) { EmbeddableType embeddedColumn = embeddables . get ( embeddedFieldName ) ; // Index embeddable only when specified by user Field embeddedField = ( Field ) entityType . getAttribute ( embeddedFieldName ) . getJavaMember ( ) ; if ( ! MetadataUtils . isEmbeddedAtributeIndexable ( embeddedField ) ) { continue ; } Object embeddedObject = PropertyAccessorHelper . getObject ( e , ( Field ) entityType . getAttribute ( embeddedFieldName ) . getJavaMember ( ) ) ; if ( embeddedObject == null ) { continue ; } if ( embeddedObject instanceof Collection ) { ElementCollectionCacheManager ecCacheHandler = ElementCollectionCacheManager . getInstance ( ) ; for ( Object obj : ( Collection ) embeddedObject ) { for ( Object column : embeddedColumn . getAttributes ( ) ) { Attribute columnAttribute = ( Attribute ) column ; String columnName = columnAttribute . getName ( ) ; if ( ! MetadataUtils . isColumnInEmbeddableIndexable ( embeddedField , columnName ) ) { continue ; } // Column Value String id = ( String ) CassandraDataTranslator . decompose ( ( ( AbstractAttribute ) m . getIdAttribute ( ) ) . getBindableJavaType ( ) , rowKey , false ) ; String superColumnName = ecCacheHandler . getElementCollectionObjectName ( id , obj ) ; ThriftRow tr = constructIndexTableThriftRow ( columnFamily , embeddedFieldName , obj , columnAttribute , rowKey , superColumnName ) ; if ( tr != null ) { indexThriftRows . add ( tr ) ; } } } } else { for ( Object column : embeddedColumn . getAttributes ( ) ) { Attribute columnAttribute = ( Attribute ) column ; String columnName = columnAttribute . getName ( ) ; Class < ? > columnClass = ( ( AbstractAttribute ) columnAttribute ) . getBindableJavaType ( ) ; if ( ! MetadataUtils . isColumnInEmbeddableIndexable ( embeddedField , columnName ) || columnClass . equals ( byte [ ] . class ) ) { continue ; } // No EC Name ThriftRow tr = constructIndexTableThriftRow ( columnFamily , embeddedFieldName , embeddedObject , ( Attribute ) column , rowKey , "" ) ; if ( tr != null ) { indexThriftRows . add ( tr ) ; } } } } return indexThriftRows ;
public class AbstractSettings { /** * / * ( non - Javadoc ) * @ see nyla . solutions . core . util . Settings # getPropertyInteger ( java . lang . String ) */ @ Override public Integer getPropertyInteger ( String key ) { } }
Integer iVal = null ; String sVal = getProperty ( key ) ; if ( ( sVal != null ) && ( sVal . length ( ) > 0 ) ) { iVal = Integer . valueOf ( sVal ) ; } return iVal ;
public class DiscontinuousAnnotation { /** * setter for value - sets Annotations to be chained . * @ generated * @ param v value to set into the feature */ public void setValue ( FSArray v ) { } }
if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value , jcasType . ll_cas . ll_getFSRef ( v ) ) ;
public class BundleMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Bundle bundle , ProtocolMarshaller protocolMarshaller ) { } }
if ( bundle == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( bundle . getPrice ( ) , PRICE_BINDING ) ; protocolMarshaller . marshall ( bundle . getCpuCount ( ) , CPUCOUNT_BINDING ) ; protocolMarshaller . marshall ( bundle . getDiskSizeInGb ( ) , DISKSIZEINGB_BINDING ) ; protocolMarshaller . marshall ( bundle . getBundleId ( ) , BUNDLEID_BINDING ) ; protocolMarshaller . marshall ( bundle . getInstanceType ( ) , INSTANCETYPE_BINDING ) ; protocolMarshaller . marshall ( bundle . getIsActive ( ) , ISACTIVE_BINDING ) ; protocolMarshaller . marshall ( bundle . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( bundle . getPower ( ) , POWER_BINDING ) ; protocolMarshaller . marshall ( bundle . getRamSizeInGb ( ) , RAMSIZEINGB_BINDING ) ; protocolMarshaller . marshall ( bundle . getTransferPerMonthInGb ( ) , TRANSFERPERMONTHINGB_BINDING ) ; protocolMarshaller . marshall ( bundle . getSupportedPlatforms ( ) , SUPPORTEDPLATFORMS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class EvaluatorIdlenessThreadPool { /** * Shutdown the thread pool of idleness checkers . */ @ Override public void close ( ) { } }
LOG . log ( Level . FINE , "EvaluatorIdlenessThreadPool shutdown: begin" ) ; this . executor . shutdown ( ) ; boolean isTerminated = false ; try { isTerminated = this . executor . awaitTermination ( this . waitInMillis , TimeUnit . MILLISECONDS ) ; } catch ( final InterruptedException ex ) { LOG . log ( Level . WARNING , "EvaluatorIdlenessThreadPool shutdown: Interrupted" , ex ) ; } if ( isTerminated ) { LOG . log ( Level . FINE , "EvaluatorIdlenessThreadPool shutdown: Terminated successfully" ) ; } else { final List < Runnable > pendingJobs = this . executor . shutdownNow ( ) ; LOG . log ( Level . SEVERE , "EvaluatorIdlenessThreadPool shutdown: {0} jobs after timeout" , pendingJobs . size ( ) ) ; LOG . log ( Level . FINE , "EvaluatorIdlenessThreadPool shutdown: pending jobs: {0}" , pendingJobs ) ; }
public class SchemaColumn { /** * Return a copy of this SchemaColumn , but with the input expression * replaced by an appropriate TupleValueExpression . * @ param colIndex */ public SchemaColumn copyAndReplaceWithTVE ( int colIndex ) { } }
TupleValueExpression newTve ; if ( m_expression instanceof TupleValueExpression ) { newTve = ( TupleValueExpression ) m_expression . clone ( ) ; newTve . setColumnIndex ( colIndex ) ; } else { newTve = new TupleValueExpression ( m_tableName , m_tableAlias , m_columnName , m_columnAlias , m_expression , colIndex ) ; } return new SchemaColumn ( m_tableName , m_tableAlias , m_columnName , m_columnAlias , newTve , m_differentiator ) ;
public class MatFileInputStream { /** * Reads the data into a < code > { @ link ByteBuffer } < / code > . This method is * only supported for arrays with backing ByteBuffer ( < code > { @ link ByteStorageSupport } < / code > ) . * @ param dest * the destination < code > { @ link ByteBuffer } < / code > * @ param elements * the number of elements to read into a buffer * @ param storage * the backing < code > { @ link ByteStorageSupport } < / code > that * gives information how data should be interpreted * @ return reference to the destination < code > { @ link ByteBuffer } < / code > * @ throws IOException * if buffer is under - fed , or another IO problem occurs */ public ByteBuffer readToByteBuffer ( ByteBuffer dest , int elements , ByteStorageSupport < ? > storage ) throws IOException { } }
int bytesAllocated = storage . getBytesAllocated ( ) ; int size = elements * storage . getBytesAllocated ( ) ; // direct buffer copy if ( MatDataTypes . sizeOf ( type ) == bytesAllocated && buf . order ( ) . equals ( dest . order ( ) ) ) { int bufMaxSize = 1024 ; int bufSize = Math . min ( buf . remaining ( ) , bufMaxSize ) ; int bufPos = buf . position ( ) ; byte [ ] tmp = new byte [ bufSize ] ; while ( dest . remaining ( ) > 0 ) { int length = Math . min ( dest . remaining ( ) , tmp . length ) ; buf . get ( tmp , 0 , length ) ; dest . put ( tmp , 0 , length ) ; } buf . position ( bufPos + size ) ; } else { // because Matlab writes data not respectively to the declared // matrix type , the reading is not straight forward ( as above ) Class < ? > clazz = storage . getStorageClazz ( ) ; while ( dest . remaining ( ) > 0 ) { if ( clazz . equals ( Double . class ) ) { dest . putDouble ( readDouble ( ) ) ; } else if ( clazz . equals ( Byte . class ) ) { dest . put ( readByte ( ) ) ; } else if ( clazz . equals ( Integer . class ) ) { dest . putInt ( readInt ( ) ) ; } else if ( clazz . equals ( Long . class ) ) { dest . putLong ( readLong ( ) ) ; } else if ( clazz . equals ( Float . class ) ) { dest . putFloat ( readFloat ( ) ) ; } else if ( clazz . equals ( Short . class ) ) { dest . putShort ( readShort ( ) ) ; } else { throw new RuntimeException ( "Not supported buffer reader for " + clazz ) ; } } } dest . rewind ( ) ; return dest ;
public class GalleryImagesInner { /** * Modify properties of gallery images . * @ param resourceGroupName The name of the resource group . * @ param labAccountName The name of the lab Account . * @ param galleryImageName The name of the gallery Image . * @ param galleryImage Represents an image from the Azure Marketplace * @ 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 < GalleryImageInner > updateAsync ( String resourceGroupName , String labAccountName , String galleryImageName , GalleryImageFragment galleryImage , final ServiceCallback < GalleryImageInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , labAccountName , galleryImageName , galleryImage ) , serviceCallback ) ;
public class DOM2DTM { /** * Return an DOM node for the given node . * @ param nodeHandle The node ID . * @ return A node representation of the DTM node . */ public Node getNode ( int nodeHandle ) { } }
int identity = makeNodeIdentity ( nodeHandle ) ; return ( Node ) m_nodes . elementAt ( identity ) ;
public class XAbstractAttributeMapBufferedImpl { /** * / * ( non - Javadoc ) * @ see java . util . Map # put ( java . lang . Object , java . lang . Object ) */ public synchronized XAttribute put ( String key , XAttribute value ) { } }
try { XAttributeMap map = deserialize ( ) ; map . put ( key , value ) ; serialize ( map ) ; return value ; } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; }
public class PaginatedList { /** * Attempts to load the next batch of results , if there are any , into the * nextResults buffer . Returns whether there were any results to load . A * return value of true guarantees that nextResults had items added to it . */ private synchronized boolean loadNextResults ( ) { } }
if ( atEndOfResults ( ) ) return false ; do { nextResults . addAll ( fetchNextPage ( ) ) ; } while ( ! atEndOfResults ( ) && nextResults . isEmpty ( ) ) ; return ! nextResults . isEmpty ( ) ;
public class FieldSupport { /** * Returns this element ' s annotation for the specified type if such an * annotation is present , else null . < br > * Simply invokes { @ link Field # getAnnotation ( Class ) } * @ param annoCls the Class object corresponding to the annotation type * @ return this element ' s annotation for the specified annotation type * if present on this element , else null * @ see Field # getAnnotation ( Class ) */ public < A extends Annotation > A annotation ( Class < A > annoCls ) { } }
return f . getAnnotation ( annoCls ) ;
public class AWSWAFRegionalClient { /** * Creates a < code > WebACL < / code > , which contains the < code > Rules < / code > that identify the CloudFront web requests * that you want to allow , block , or count . AWS WAF evaluates < code > Rules < / code > in order based on the value of * < code > Priority < / code > for each < code > Rule < / code > . * You also specify a default action , either < code > ALLOW < / code > or < code > BLOCK < / code > . If a web request doesn ' t * match any of the < code > Rules < / code > in a < code > WebACL < / code > , AWS WAF responds to the request with the default * action . * To create and configure a < code > WebACL < / code > , perform the following steps : * < ol > * < li > * Create and update the < code > ByteMatchSet < / code > objects and other predicates that you want to include in * < code > Rules < / code > . For more information , see < a > CreateByteMatchSet < / a > , < a > UpdateByteMatchSet < / a > , * < a > CreateIPSet < / a > , < a > UpdateIPSet < / a > , < a > CreateSqlInjectionMatchSet < / a > , and < a > UpdateSqlInjectionMatchSet < / a > . * < / li > * < li > * Create and update the < code > Rules < / code > that you want to include in the < code > WebACL < / code > . For more * information , see < a > CreateRule < / a > and < a > UpdateRule < / a > . * < / li > * < li > * Use < a > GetChangeToken < / a > to get the change token that you provide in the < code > ChangeToken < / code > parameter of a * < code > CreateWebACL < / code > request . * < / li > * < li > * Submit a < code > CreateWebACL < / code > request . * < / li > * < li > * Use < code > GetChangeToken < / code > to get the change token that you provide in the < code > ChangeToken < / code > * parameter of an < a > UpdateWebACL < / a > request . * < / li > * < li > * Submit an < a > UpdateWebACL < / a > request to specify the < code > Rules < / code > that you want to include in the * < code > WebACL < / code > , to specify the default action , and to associate the < code > WebACL < / code > with a CloudFront * distribution . * < / li > * < / ol > * For more information about how to use the AWS WAF API , see the < a * href = " https : / / docs . aws . amazon . com / waf / latest / developerguide / " > AWS WAF Developer Guide < / a > . * @ param createWebACLRequest * @ return Result of the CreateWebACL operation returned by the service . * @ throws WAFStaleDataException * The operation failed because you tried to create , update , or delete an object by using a change token * that has already been used . * @ throws WAFInternalErrorException * The operation failed because of a system problem , even though the request was valid . Retry your request . * @ throws WAFInvalidAccountException * The operation failed because you tried to create , update , or delete an object by using an invalid account * identifier . * @ throws WAFDisallowedNameException * The name specified is invalid . * @ throws WAFInvalidParameterException * The operation failed because AWS WAF didn ' t recognize a parameter in the request . For example : < / p > * < ul > * < li > * You specified an invalid parameter name . * < / li > * < li > * You specified an invalid value . * < / li > * < li > * You tried to update an object ( < code > ByteMatchSet < / code > , < code > IPSet < / code > , < code > Rule < / code > , or * < code > WebACL < / code > ) using an action other than < code > INSERT < / code > or < code > DELETE < / code > . * < / li > * < li > * You tried to create a < code > WebACL < / code > with a < code > DefaultAction < / code > < code > Type < / code > other than * < code > ALLOW < / code > , < code > BLOCK < / code > , or < code > COUNT < / code > . * < / li > * < li > * You tried to create a < code > RateBasedRule < / code > with a < code > RateKey < / code > value other than * < code > IP < / code > . * < / li > * < li > * You tried to update a < code > WebACL < / code > with a < code > WafAction < / code > < code > Type < / code > other than * < code > ALLOW < / code > , < code > BLOCK < / code > , or < code > COUNT < / code > . * < / li > * < li > * You tried to update a < code > ByteMatchSet < / code > with a < code > FieldToMatch < / code > < code > Type < / code > other * than HEADER , METHOD , QUERY _ STRING , URI , or BODY . * < / li > * < li > * You tried to update a < code > ByteMatchSet < / code > with a < code > Field < / code > of < code > HEADER < / code > but no * value for < code > Data < / code > . * < / li > * < li > * Your request references an ARN that is malformed , or corresponds to a resource with which a web ACL * cannot be associated . * < / li > * @ throws WAFLimitsExceededException * The operation exceeds a resource limit , for example , the maximum number of < code > WebACL < / code > objects * that you can create for an AWS account . For more information , see < a * href = " https : / / docs . aws . amazon . com / waf / latest / developerguide / limits . html " > Limits < / a > in the < i > AWS WAF * Developer Guide < / i > . * @ sample AWSWAFRegional . CreateWebACL * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / waf - regional - 2016-11-28 / CreateWebACL " target = " _ top " > AWS API * Documentation < / a > */ @ Override public CreateWebACLResult createWebACL ( CreateWebACLRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeCreateWebACL ( request ) ;
public class AbstractMongoSessionConverter { /** * Method ensures that there is a TTL index on { @ literal expireAt } field . It ' s has { @ literal expireAfterSeconds } set * to zero seconds , so the expiration time is controlled by the application . It can be extended in custom converters * when there is a need for creating additional custom indexes . * @ param sessionCollectionIndexes { @ link IndexOperations } to use */ protected void ensureIndexes ( IndexOperations sessionCollectionIndexes ) { } }
for ( IndexInfo info : sessionCollectionIndexes . getIndexInfo ( ) ) { if ( EXPIRE_AT_FIELD_NAME . equals ( info . getName ( ) ) ) { LOG . debug ( "TTL index on field " + EXPIRE_AT_FIELD_NAME + " already exists" ) ; return ; } } LOG . info ( "Creating TTL index on field " + EXPIRE_AT_FIELD_NAME ) ; sessionCollectionIndexes . ensureIndex ( new Index ( EXPIRE_AT_FIELD_NAME , Sort . Direction . ASC ) . named ( EXPIRE_AT_FIELD_NAME ) . expire ( 0 ) ) ;
public class GenericInMemoryCatalog { /** * - - - - - partitions - - - - - */ @ Override public void createPartition ( ObjectPath tablePath , CatalogPartitionSpec partitionSpec , CatalogPartition partition , boolean ignoreIfExists ) throws TableNotExistException , TableNotPartitionedException , PartitionSpecInvalidException , PartitionAlreadyExistsException , CatalogException { } }
validatePartitionSpec ( tablePath , partitionSpec ) ; if ( partitionExists ( tablePath , partitionSpec ) ) { if ( ! ignoreIfExists ) { throw new PartitionAlreadyExistsException ( catalogName , tablePath , partitionSpec ) ; } } else { partitions . get ( tablePath ) . put ( partitionSpec , partition . copy ( ) ) ; }
public class mps_network_config { /** * < pre > * Converts API response of bulk operation into object and returns the object array in case of get request . * < / pre > */ protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } }
mps_network_config_responses result = ( mps_network_config_responses ) service . get_payload_formatter ( ) . string_to_resource ( mps_network_config_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . mps_network_config_response_array ) ; } mps_network_config [ ] result_mps_network_config = new mps_network_config [ result . mps_network_config_response_array . length ] ; for ( int i = 0 ; i < result . mps_network_config_response_array . length ; i ++ ) { result_mps_network_config [ i ] = result . mps_network_config_response_array [ i ] . mps_network_config [ 0 ] ; } return result_mps_network_config ;
public class SQLExpressions { /** * PERCENTILE _ DISC is an inverse distribution function that assumes a discrete distribution model . * It takes a percentile value and a sort specification and returns an element from the set . * Nulls are ignored in the calculation . * < p > This function takes as an argument any numeric datatype or any nonnumeric datatype that can be * implicitly converted to a numeric datatype . The function returns the same datatype as the numeric * datatype of the argument . < / p > * @ param arg argument * @ return percentile _ disc ( arg ) */ public static < T extends Number > WithinGroup < T > percentileDisc ( Expression < T > arg ) { } }
return new WithinGroup < T > ( arg . getType ( ) , SQLOps . PERCENTILEDISC , arg ) ;
public class CmsGitToolOptionsPanel { /** * Updates the options panel for a special configuration . * @ param gitConfig the git configuration . */ protected void updateForNewConfiguration ( CmsGitConfiguration gitConfig ) { } }
if ( ! m_checkinBean . setCurrentConfiguration ( gitConfig ) ) { Notification . show ( CmsVaadinUtils . getMessageText ( Messages . GUI_GIT_CONFIGURATION_SWITCH_FAILED_0 ) , CmsVaadinUtils . getMessageText ( Messages . GUI_GIT_CONFIGURATION_SWITCH_FAILED_DESC_0 ) , Type . ERROR_MESSAGE ) ; m_configurationSelector . select ( m_checkinBean . getCurrentConfiguration ( ) ) ; return ; } resetSelectableModules ( ) ; for ( final String moduleName : gitConfig . getConfiguredModules ( ) ) { addSelectableModule ( moduleName ) ; } updateNewModuleSelector ( ) ; m_pullFirst . setValue ( Boolean . valueOf ( gitConfig . getDefaultAutoPullBefore ( ) ) ) ; m_pullAfterCommit . setValue ( Boolean . valueOf ( gitConfig . getDefaultAutoPullAfter ( ) ) ) ; m_addAndCommit . setValue ( Boolean . valueOf ( gitConfig . getDefaultAutoCommit ( ) ) ) ; m_pushAutomatically . setValue ( Boolean . valueOf ( gitConfig . getDefaultAutoPush ( ) ) ) ; m_commitMessage . setValue ( Strings . nullToEmpty ( gitConfig . getDefaultCommitMessage ( ) ) ) ; m_copyAndUnzip . setValue ( Boolean . valueOf ( gitConfig . getDefaultCopyAndUnzip ( ) ) ) ; m_excludeLib . setValue ( Boolean . valueOf ( gitConfig . getDefaultExcludeLibs ( ) ) ) ; m_ignoreUnclean . setValue ( Boolean . valueOf ( gitConfig . getDefaultIngoreUnclean ( ) ) ) ; m_userField . setValue ( Strings . nullToEmpty ( gitConfig . getDefaultGitUserName ( ) ) ) ; m_emailField . setValue ( Strings . nullToEmpty ( gitConfig . getDefaultGitUserEmail ( ) ) ) ;
public class SmartFixManager { public static boolean isCaseParseIssue ( IParseIssue parseIssue ) { } }
boolean caseIssue = parseIssue . getMessageKey ( ) == Res . MSG_VAR_CASE_MISMATCH || parseIssue . getMessageKey ( ) == Res . MSG_PROPERTY_CASE_MISMATCH || parseIssue . getMessageKey ( ) == Res . MSG_TYPE_CASE_MISMATCH || parseIssue . getMessageKey ( ) == Res . MSG_FUNCTION_CASE_MISMATCH ; IParsedElement sourceOfIssue = parseIssue . getSource ( ) ; boolean fixableElement = sourceOfIssue instanceof IIdentifierExpression || sourceOfIssue instanceof IBeanMethodCallExpression || sourceOfIssue instanceof ITypeLiteralExpression || sourceOfIssue instanceof ISynthesizedMemberAccessExpression || sourceOfIssue instanceof IFieldAccessExpression ; return caseIssue && fixableElement ;
public class Download { /** * Downloads the content into an ` OutputStream ` with the specified content type . * @ param config the ` HttpConfig ` instance * @ param ostream the ` OutputStream ` to contain the content . * @ param contentType the content type */ public static void toStream ( final HttpConfig config , final String contentType , final OutputStream ostream ) { } }
config . context ( contentType , ID , ostream ) ; config . getResponse ( ) . parser ( contentType , Download :: streamParser ) ;
public class Equation { /** * Goes through the token lists and adds all the variables which can be used to define a sub - matrix . If anything * else is found an excpetion is thrown */ private void addSubMatrixVariables ( List < TokenList . Token > inputs , List < Variable > variables ) { } }
for ( int i = 0 ; i < inputs . size ( ) ; i ++ ) { TokenList . Token t = inputs . get ( i ) ; if ( t . getType ( ) != Type . VARIABLE ) throw new ParseError ( "Expected variables only in sub-matrix input, not " + t . getType ( ) ) ; Variable v = t . getVariable ( ) ; if ( v . getType ( ) == VariableType . INTEGER_SEQUENCE || isVariableInteger ( t ) ) { variables . add ( v ) ; } else { throw new ParseError ( "Expected an integer, integer sequence, or array range to define a submatrix" ) ; } }
public class Ocpp12RequestHandler { /** * { @ inheritDoc } */ @ Override public void handle ( HardResetChargingStationRequestedEvent event , CorrelationToken correlationToken ) { } }
LOG . info ( "OCPP 1.2 HardResetChargingStationRequestedEvent" ) ; chargingStationOcpp12Client . hardReset ( event . getChargingStationId ( ) ) ;
public class ServiceBroker { /** * Set global JSON writer API ( Jackson , Gson , Boon , FastJson , etc . ) */ protected void initJsonWriter ( ) { } }
String writerList = config . getJsonWriters ( ) ; if ( writerList != null ) { String [ ] writers = writerList . split ( "," ) ; Set < String > supportedWriters = TreeWriterRegistry . getWritersByFormat ( "json" ) ; TreeWriter selectedWriter = null ; for ( String writer : writers ) { writer = writer . trim ( ) . toLowerCase ( ) ; if ( ! writer . isEmpty ( ) ) { for ( String supportedWriter : supportedWriters ) { int i = supportedWriter . lastIndexOf ( '.' ) ; if ( i > - 1 ) { supportedWriter = supportedWriter . substring ( i + 1 ) ; } if ( supportedWriter . toLowerCase ( ) . contains ( writer ) ) { selectedWriter = TreeWriterRegistry . getWriter ( supportedWriter ) ; logger . info ( "Default JSON serializer/writer is \"" + selectedWriter . getClass ( ) + "\"." ) ; TreeWriterRegistry . setWriter ( "json" , selectedWriter ) ; break ; } } if ( selectedWriter != null ) { break ; } } } }
public class RestClient { /** * Updates an asset in Massive . The { @ link Asset # get _ id ( ) } must return the * correct ID for this asset . Note that Massive will set some fields ( such * as last update date ) so it is important to switch to the returned object * after calling this method . * @ param asset * The asset to add , it will not be modified by this method * @ return The asset with information added by Massive * @ throws IOException * @ throws RequestFailureException */ @ Override public Asset updateAsset ( final Asset asset ) throws IOException , BadVersionException , RequestFailureException { } }
HttpURLConnection connection = createHttpURLConnectionToMassive ( "/assets/" + asset . get_id ( ) ) ; connection . setRequestMethod ( "PUT" ) ; connection . setRequestProperty ( "Content-Type" , "application/json" ) ; connection . setDoOutput ( true ) ; JSONAssetConverter . writeValue ( connection . getOutputStream ( ) , asset ) ; /* * Force the PUT to take place by getting the response code and making sure it is ok */ testResponseCode ( connection , true ) ; /* * PUTs don ' t return an ( they just return " 1 " - not sure what that * means ) so go and grab it so we have an updated one with the right * last update date in case they use it for optimistic locking */ return getAsset ( asset . get_id ( ) ) ;
public class WorldState { /** * Returns a collection containing the same Identifier Strings as this WorldState * object . Modifications to the returned Collection do not impact this * WorldState . * @ return a collection containing the same Identifier Strings as this WorldState . */ public Collection < String > getIdentifiers ( ) { } }
List < String > keys = new LinkedList < String > ( ) ; keys . addAll ( this . stateMap . keySet ( ) ) ; return keys ;
public class YamlProvider { /** * Source from a stream * @ param identity identity * @ param content yaml string * @ param modified date the content was last modified , for caching purposes * @ return source */ public static CacheableYamlSource sourceFromString ( final String identity , final String content , final Date modified , final ValidationSet validation ) { } }
return new CacheableYamlSource ( ) { @ Override public boolean isValid ( ) { return true ; } @ Override public Date getLastModified ( ) { return modified ; } @ Override public String getIdentity ( ) { return identity ; } @ Override public Iterable < ACLPolicyDoc > loadAll ( final Yaml yaml ) throws IOException { return YamlParsePolicy . documentIterable ( yaml . loadAll ( content ) . iterator ( ) , validation , identity ) ; } @ Override public ValidationSet getValidationSet ( ) { return validation ; } @ Override public void close ( ) throws IOException { } } ;
public class PresentationManager { /** * Creates a new session with the given id . If null is used , an automatic * session id will be generated * @ param sessionId The new session id . Must be unique . * @ throws PMException on already defined session * @ return New session */ public PMSession registerSession ( String sessionId ) { } }
synchronized ( sessions ) { if ( sessionId != null ) { if ( ! sessions . containsKey ( sessionId ) ) { sessions . put ( sessionId , new PMSession ( sessionId ) ) ; } return getSession ( sessionId ) ; } else { return registerSession ( newSessionId ( ) ) ; } }
public class Singles { /** * Select the first Future to return with a successful result * < pre > * { @ code * Single < Integer > ft = Single . empty ( ) ; * Single < Integer > result = Singles . firstSuccess ( Single . deferred ( ( ) - > 1 ) , ft ) ; * ft . complete ( 10 ) ; * result . get ( ) / / 1 * < / pre > * @ param fts Singles to race * @ return First Single to return with a result */ @ SafeVarargs public static < T > Single < T > firstSuccess ( Single < T > ... fts ) { } }
return Single . fromPublisher ( Future . firstSuccess ( futures ( fts ) ) ) ;
public class Trees { /** * Builds the parents of node up to and including the root node , where the * original node is the last element in the returned array . The length of * the returned array gives the node ' s depth in the tree . * @ param node the node to get the path for * @ param depth an int giving the number of steps already taken towards * the root ( on recursive calls ) , used to size the returned array * @ return an array of nodes giving the path from the root to the specified * node */ static < V , T extends Tree < V , T > > MSeq < T > pathToRoot ( final T node , final int depth ) { } }
final MSeq < T > path ; if ( node == null ) { path = MSeq . ofLength ( depth ) ; } else { path = pathToRoot ( node . getParent ( ) . orElse ( null ) , depth + 1 ) ; path . set ( path . length ( ) - depth - 1 , node ) ; } return path ;
public class CheckNonEmptyMsgNodesPass { /** * If the only children are empty raw text nodes , then the node is empty . * < p > Empty raw text nodes are inserted by the parser to keep track of trimmed whitespace for the * html parser and removed later in the compiler . */ private static boolean isEmpty ( MsgNode msg ) { } }
for ( SoyNode child : msg . getChildren ( ) ) { if ( child instanceof RawTextNode && ( ( RawTextNode ) child ) . getRawText ( ) . isEmpty ( ) ) { continue ; } return false ; } return true ;
public class AbstractManagedConnectionPool { /** * Destroy and remove a connection listener * @ param cl The connection listener * @ param listeners The listeners */ protected void destroyAndRemoveConnectionListener ( ConnectionListener cl , Collection < ConnectionListener > listeners ) { } }
try { pool . destroyConnectionListener ( cl ) ; } catch ( ResourceException e ) { // TODO : cl . setState ( ZOMBIE ) ; } finally { listeners . remove ( cl ) ; }
public class MapFileReader { /** * It a single record from the map file for the given index * @ param index Index , between 0 and numRecords ( ) - 1 * @ return Value from the MapFile * @ throws IOException If an error occurs during reading */ public V getRecord ( long index ) throws IOException { } }
// First : determine which reader to read from . . . int readerIdx = - 1 ; for ( int i = 0 ; i < recordIndexesEachReader . size ( ) ; i ++ ) { Pair < Long , Long > p = recordIndexesEachReader . get ( i ) ; if ( index >= p . getFirst ( ) && index <= p . getSecond ( ) ) { readerIdx = i ; break ; } } if ( readerIdx == - 1 ) { throw new IllegalStateException ( "Index not found in any reader: " + index ) ; } WritableComparable key = indexToKey . getKeyForIndex ( index ) ; Writable value = ReflectionUtils . newInstance ( recordClass , null ) ; V v = ( V ) readers [ readerIdx ] . get ( key , value ) ; return v ;
public class FileAppendWriter { /** * 追加写入字符串 * @ param content */ public FileAppendWriter write ( String content ) { } }
try { writer . write ( content ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return this ;
public class CommandListCreator { /** * Creates the list with command necessary to remove a mapping from a map . * @ param mapId * the map where the mapping should be removed . * @ param key * the key of the mapping that should be removed . * @ return the list with the commands . */ public List < Command > removeFromMap ( final UUID mapId , final Object key ) { } }
final State state = createCommandList ( new WithCommandType ( ) { @ Override public void invoke ( final State state ) { createObservableObject ( key , state ) ; } } , false ) ; final boolean keyIsObservableObject = state . lastObjectWasObservable ; final RemoveFromMap msg = new RemoveFromMap ( ) ; msg . setMapId ( mapId ) ; msg . setKey ( valueMapper . map ( key , keyIsObservableObject ) ) ; state . commands . add ( state . commands . size ( ) - 1 , msg ) ; return state . commands ;
public class IntArrayList { /** * 在数组尾部新增一个元素 * @ param element */ public void append ( int element ) { } }
if ( this . size == this . data . length ) { expand ( ) ; } this . data [ this . size ] = element ; this . size += 1 ;
public class Validators { /** * Creates and returns a validator , which allows to validate texts to ensure , that they * represent valid IRIs . IRIs are internationalized URLs according to RFC 3987 , which are for * example used as internet addresses . Empty texts are also accepted . * @ param context * The context , which should be used to retrieve the error message , as an instance of * the class { @ link Context } . fhe context may not be null * @ return The validator , which has been created , as an instance of the type { @ link Validator } */ public static Validator < CharSequence > iri ( @ NonNull final Context context ) { } }
return new IRIValidator ( context , R . string . default_error_message ) ;
public class Context { /** * Gets the child nodes of the given site node . * @ param siteNode the site node that will be used , must not be { @ code null } * @ return a { @ code List } with the child nodes , never { @ code null } */ private List < SiteNode > getChildren ( SiteNode siteNode ) { } }
int childCount = siteNode . getChildCount ( ) ; if ( childCount == 0 ) { return Collections . emptyList ( ) ; } List < SiteNode > children = new ArrayList < > ( childCount ) ; for ( int i = 0 ; i < childCount ; i ++ ) { children . add ( ( SiteNode ) siteNode . getChildAt ( i ) ) ; } return children ;
public class InheritanceTransformer { /** * Convenience method to reuse the super constructor . * @ param extendedComponent * @ return a non - null collection */ static Collection < AbstractType > asList ( Component extendedComponent ) { } }
Collection < AbstractType > result ; if ( extendedComponent == null ) { result = new ArrayList < AbstractType > ( 0 ) ; } else { result = new ArrayList < AbstractType > ( 1 ) ; result . add ( extendedComponent ) ; } return result ;
public class FailedRemediationBatchMarshaller { /** * Marshall the given parameter object . */ public void marshall ( FailedRemediationBatch failedRemediationBatch , ProtocolMarshaller protocolMarshaller ) { } }
if ( failedRemediationBatch == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( failedRemediationBatch . getFailureMessage ( ) , FAILUREMESSAGE_BINDING ) ; protocolMarshaller . marshall ( failedRemediationBatch . getFailedItems ( ) , FAILEDITEMS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class MongoPersister { /** * Set the current State . This method will ensure that the state in the db matches the expected current state . * If not , it will throw a StateStateException * @ param stateful Stateful Entity * @ param current Expected current State * @ param next The value of the next State * @ throws StaleStateException thrown if the value of the State does not equal to the provided current State */ @ Override public void setCurrent ( T stateful , State < T > current , State < T > next ) throws StaleStateException { } }
try { // Has this Entity been persisted to Mongo ? StateDocumentImpl stateDoc = this . getStateDocument ( stateful ) ; if ( stateDoc != null && stateDoc . isPersisted ( ) ) { // Update state in the DB updateStateInDB ( stateful , current , next , stateDoc ) ; } else { // The Entity hasn ' t been persisted to Mongo - so it exists only // this Application memory . So , serialize the qualified update to prevent // concurrency conflicts updateInMemory ( stateful , stateDoc , current . getName ( ) , next . getName ( ) ) ; } } catch ( NoSuchFieldException e ) { throw new RuntimeException ( e ) ; } catch ( SecurityException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; }
public class StackFinder { /** * Return the class if the given classname is found on the stack . * @ param fragment * @ return boolean */ @ SuppressWarnings ( "unchecked" ) public Class < Object > matchCaller ( String className ) { } }
// Walk the stack backwards to find the calling class : don ' t // want to use Class . forName , because we want the class as loaded // by it ' s original classloader Class < Object > stack [ ] = ( Class < Object > [ ] ) this . getClassContext ( ) ; for ( Class < Object > bClass : stack ) { // See if any class in the stack contains the following string if ( bClass . getName ( ) . equals ( className ) ) return bClass ; } return null ;
public class Parser { /** * Parses response into { @ link List } * @ param jsonData * @ param maxResults * @ param parseAddressComponents * @ return { @ link Address } { @ link List } * @ throws GeocoderException if error occurs */ @ NonNull static List < Address > parseJson ( final byte [ ] jsonData , final int maxResults , final boolean parseAddressComponents ) throws GeocoderException { } }
try { final String jsonString = new String ( jsonData , Charset . forName ( "UTF-8" ) ) ; final JSONObject jsonObject = new JSONObject ( jsonString ) ; if ( ! jsonObject . has ( STATUS ) ) { throw new GeocoderException ( new JSONException ( "No \"status\" field" ) ) ; } final Status status = Status . fromString ( jsonObject . getString ( STATUS ) ) ; switch ( status ) { case OK : if ( jsonObject . has ( RESULTS ) ) { return parseResults ( maxResults , parseAddressComponents , jsonObject ) ; } return new ArrayList < > ( ) ; case ZERO_RESULTS : return new ArrayList < > ( ) ; default : final GeocoderException e = GeocoderException . forStatus ( status ) ; try { if ( jsonObject . has ( ERROR_MESSAGE ) ) { e . setErrorMessage ( jsonObject . getString ( ERROR_MESSAGE ) ) ; } } catch ( JSONException ignored ) { } throw e ; } } catch ( JSONException e ) { throw new GeocoderException ( e ) ; }
public class AbstractSerialDataWriter { /** * < p > Sends an array of characters to the serial port / device identified by the given file descriptor . < / p > * @ param charset * The character set to use for encoding / decoding bytes to / from text characters * @ param data * An array of chars to be decoded into bytes and transmitted . * @ param offset * The starting index ( inclusive ) in the array to send from . * @ param length * The number of characters from the char array to transmit to the serial port . */ public void write ( Charset charset , char [ ] data , int offset , int length ) throws IllegalStateException , IOException { } }
write ( charset , CharBuffer . wrap ( data , offset , length ) ) ;
public class TypeUtils { /** * < p > Tries to determine the type arguments of a class / interface based on a * super parameterized type ' s type arguments . This method is the inverse of * { @ link # getTypeArguments ( Type , Class ) } which gets a class / interface ' s * type arguments based on a subtype . It is far more limited in determining * the type arguments for the subject class ' s type variables in that it can * only determine those parameters that map from the subject { @ link Class } * object to the supertype . < / p > < p > Example : { @ link java . util . TreeSet * TreeSet } sets its parameter as the parameter for * { @ link java . util . NavigableSet NavigableSet } , which in turn sets the * parameter of { @ link java . util . SortedSet } , which in turn sets the * parameter of { @ link Set } , which in turn sets the parameter of * { @ link java . util . Collection } , which in turn sets the parameter of * { @ link java . lang . Iterable } . Since { @ code TreeSet } ' s parameter maps * ( indirectly ) to { @ code Iterable } ' s parameter , it will be able to * determine that based on the super type { @ code Iterable < ? extends * Map < Integer , ? extends Collection < ? > > > } , the parameter of * { @ code TreeSet } is { @ code ? extends Map < Integer , ? extends * Collection < ? > > } . < / p > * @ param cls the class whose type parameters are to be determined , not { @ code null } * @ param superType the super type from which { @ code cls } ' s type * arguments are to be determined , not { @ code null } * @ return a { @ code Map } of the type assignments that could be determined * for the type variables in each type in the inheritance hierarchy from * { @ code type } to { @ code toClass } inclusive . */ public static Map < TypeVariable < ? > , Type > determineTypeArguments ( final Class < ? > cls , final ParameterizedType superType ) { } }
Validate . notNull ( cls , "cls is null" ) ; Validate . notNull ( superType , "superType is null" ) ; final Class < ? > superClass = getRawType ( superType ) ; // compatibility check if ( ! isAssignable ( cls , superClass ) ) { return null ; } if ( cls . equals ( superClass ) ) { return getTypeArguments ( superType , superClass , null ) ; } // get the next class in the inheritance hierarchy final Type midType = getClosestParentType ( cls , superClass ) ; // can only be a class or a parameterized type if ( midType instanceof Class < ? > ) { return determineTypeArguments ( ( Class < ? > ) midType , superType ) ; } final ParameterizedType midParameterizedType = ( ParameterizedType ) midType ; final Class < ? > midClass = getRawType ( midParameterizedType ) ; // get the type variables of the mid class that map to the type // arguments of the super class final Map < TypeVariable < ? > , Type > typeVarAssigns = determineTypeArguments ( midClass , superType ) ; // map the arguments of the mid type to the class type variables mapTypeVariablesToArguments ( cls , midParameterizedType , typeVarAssigns ) ; return typeVarAssigns ;
public class ListStreamsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListStreamsRequest listStreamsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listStreamsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listStreamsRequest . getLimit ( ) , LIMIT_BINDING ) ; protocolMarshaller . marshall ( listStreamsRequest . getExclusiveStartStreamName ( ) , EXCLUSIVESTARTSTREAMNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class WorkspacePersistentDataManager { /** * Check if same - name sibling exists in persistence . */ private void checkPersistedSNS ( NodeData node , WorkspaceStorageConnection acon ) throws RepositoryException { } }
NodeData parent = ( NodeData ) acon . getItemData ( node . getParentIdentifier ( ) ) ; QPathEntry myName = node . getQPath ( ) . getEntries ( ) [ node . getQPath ( ) . getEntries ( ) . length - 1 ] ; ItemData sibling = acon . getItemData ( parent , new QPathEntry ( myName . getNamespace ( ) , myName . getName ( ) , myName . getIndex ( ) - 1 ) , ItemType . NODE ) ; if ( sibling == null || ! sibling . isNode ( ) ) { throw new InvalidItemStateException ( "Node can't be saved " + node . getQPath ( ) . getAsString ( ) + ". No same-name sibling exists with index " + ( myName . getIndex ( ) - 1 ) + "." ) ; }
public class U { /** * Documented , # all */ public static < E > boolean all ( final Iterable < E > iterable , final Predicate < E > pred ) { } }
return every ( iterable , pred ) ;
public class BeanDefinitionParser { /** * Validate that the specified bean name and aliases have not been used * already . * @ param beanName a { @ link java . lang . String } object . * @ param aliases a { @ link java . util . List } object . * @ param beanElement a { @ link org . w3c . dom . Element } object . */ protected void checkNameUniqueness ( String beanName , List < String > aliases , Element beanElement ) { } }
String foundName = null ; if ( StringUtils . hasText ( beanName ) && this . usedNames . contains ( beanName ) ) foundName = beanName ; if ( foundName == null ) foundName = ( String ) CollectionUtils . findFirstMatch ( this . usedNames , aliases ) ; if ( foundName != null ) error ( "Bean name '" + foundName + "' is already used in this file" , beanElement ) ; this . usedNames . add ( beanName ) ; this . usedNames . addAll ( aliases ) ;
public class PinyinTokenFilter { /** * TODO refactor , merge code */ @ Override public final boolean incrementToken ( ) throws IOException { } }
if ( ! done ) { if ( readTerm ( ) ) return true ; } if ( done ) { resetVariable ( ) ; if ( ! input . incrementToken ( ) ) { return false ; } done = false ; } readTerm ( ) ; return true ;
public class ThrowsTaglet { /** * { @ inheritDoc } */ public Content getTagletOutput ( Element holder , TagletWriter writer ) { } }
Utils utils = writer . configuration ( ) . utils ; ExecutableElement execHolder = ( ExecutableElement ) holder ; Map < List < ? extends DocTree > , ExecutableElement > tagsMap = new LinkedHashMap < > ( ) ; tagsMap . put ( utils . getThrowsTrees ( execHolder ) , execHolder ) ; Content result = writer . getOutputInstance ( ) ; HashSet < String > alreadyDocumented = new HashSet < > ( ) ; if ( ! tagsMap . isEmpty ( ) ) { result . addContent ( throwsTagsOutput ( tagsMap , writer , alreadyDocumented , true ) ) ; } result . addContent ( inheritThrowsDocumentation ( holder , execHolder . getThrownTypes ( ) , alreadyDocumented , writer ) ) ; result . addContent ( linkToUndocumentedDeclaredExceptions ( execHolder . getThrownTypes ( ) , alreadyDocumented , writer ) ) ; return result ;
public class CombineRetentionPolicy { /** * Returns the most specific common superclass for the { @ link # versionClass } of each embedded policy . */ @ SuppressWarnings ( "unchecked" ) @ Override public Class < T > versionClass ( ) { } }
if ( this . retentionPolicies . size ( ) == 1 ) { return ( Class < T > ) this . retentionPolicies . get ( 0 ) . versionClass ( ) ; } Class < T > klazz = ( Class < T > ) this . retentionPolicies . get ( 0 ) . versionClass ( ) ; for ( RetentionPolicy < T > policy : this . retentionPolicies ) { klazz = commonSuperclass ( klazz , ( Class < T > ) policy . versionClass ( ) ) ; } return klazz ;
public class MimeTypeDetectors { /** * Returns a new mime type detector implementation based on * the repository { @ link org . modeshape . jcr . RepositoryConfiguration . FieldName # MIMETYPE _ DETECTION } configuration * @ param mimeTypeDetectionConfig a { @ code String } , may not be null * @ param environment an { @ link Environment } instance specific to a repository * @ return a { @ link MimeTypeDetector } instance */ public static MimeTypeDetector createDetectorFor ( String mimeTypeDetectionConfig , Environment environment ) { } }
switch ( mimeTypeDetectionConfig . toLowerCase ( ) ) { case RepositoryConfiguration . FieldValue . MIMETYPE_DETECTION_CONTENT : { return TIKA_AVAILABLE ? new TikaContentDetector ( environment ) : new DefaultMimeTypeDetector ( ) ; } case RepositoryConfiguration . FieldValue . MIMETYPE_DETECTION_NAME : { return TIKA_AVAILABLE ? new TikaNameOnlyDetector ( environment ) : new DefaultMimeTypeDetector ( ) ; } case RepositoryConfiguration . FieldValue . MIMETYPE_DETECTION_NONE : { return NullMimeTypeDetector . INSTANCE ; } default : { throw new IllegalArgumentException ( "Unknown mime-type detector setting: " + mimeTypeDetectionConfig ) ; } }
public class VonNeumannIntTupleIterator { /** * Increment the current value starting at the given index , * and return whether this was possible * @ param index The index * @ return Whether the value could be incremented */ private boolean increment ( int index ) { } }
if ( index == - 1 ) { return false ; } int value = current . get ( index ) ; if ( value < max . get ( index ) ) { current . set ( index , value + 1 ) ; updateMinMax ( index + 1 ) ; return true ; } boolean hasNext = increment ( index - 1 ) ; if ( hasNext ) { current . set ( index , min . get ( index ) ) ; } return hasNext ;
public class SteamNetworking { /** * Read incoming packet data into a direct { @ link ByteBuffer } . * On success , returns the number of bytes received , and the < code > steamIDRemote < / code > parameter contains the * sender ' s ID . */ public int readP2PPacket ( SteamID steamIDRemote , ByteBuffer dest , int channel ) throws SteamException { } }
if ( ! dest . isDirect ( ) ) { throw new SteamException ( "Direct buffer required!" ) ; } if ( readP2PPacket ( pointer , dest , dest . position ( ) , dest . remaining ( ) , tmpIntResult , tmpLongResult , channel ) ) { steamIDRemote . handle = tmpLongResult [ 0 ] ; return tmpIntResult [ 0 ] ; } return 0 ;
public class transformpolicy_lbvserver_binding { /** * Use this API to fetch transformpolicy _ lbvserver _ binding resources of given name . */ public static transformpolicy_lbvserver_binding [ ] get ( nitro_service service , String name ) throws Exception { } }
transformpolicy_lbvserver_binding obj = new transformpolicy_lbvserver_binding ( ) ; obj . set_name ( name ) ; transformpolicy_lbvserver_binding response [ ] = ( transformpolicy_lbvserver_binding [ ] ) obj . get_resources ( service ) ; return response ;
public class CSSColorHelper { /** * Check if the passed String is valid CSS hex color value . Example value : * < code > # ff0000 < / code > * @ param sValue * The value to check . May be < code > null < / code > . * @ return < code > true < / code > if it is a CSS hex color value , * < code > false < / code > if not */ public static boolean isHexColorValue ( @ Nullable final String sValue ) { } }
final String sRealValue = StringHelper . trim ( sValue ) ; return StringHelper . hasText ( sRealValue ) && sRealValue . charAt ( 0 ) == CCSSValue . PREFIX_HEX && RegExHelper . stringMatchesPattern ( PATTERN_HEX , sRealValue ) ;
public class GlobalTransformerRegistry { /** * Discard an operation . * @ param address the operation handler address * @ param major the major version * @ param minor the minor version * @ param operationName the operation name */ public void discardOperation ( final PathAddress address , int major , int minor , final String operationName ) { } }
registerTransformer ( address . iterator ( ) , ModelVersion . create ( major , minor ) , operationName , OperationTransformerRegistry . DISCARD ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "orderBy" , scope = GetChildren . class ) public JAXBElement < String > createGetChildrenOrderBy ( String value ) { } }
return new JAXBElement < String > ( _GetChildrenOrderBy_QNAME , String . class , GetChildren . class , value ) ;
public class DateUtil { /** * 计算arg0 - arg1的时间差 * @ param arg0 arg0 * @ param arg1 arg1 * @ param dateUnit 返回结果的单位 * @ return arg0 - arg1的时间差 , 精确到指定的单位 ( field ) */ public static long calc ( Date arg0 , Date arg1 , DateUnit dateUnit ) { } }
return calc ( arg0 . toInstant ( ) , arg1 . toInstant ( ) , dateUnit ) ;
public class ProviderList { /** * Construct a special ProviderList for JAR verification . It consists * of the providers specified via jarClassNames , which must be on the * bootclasspath and cannot be in signed JAR files . This is to avoid * possible recursion and deadlock during verification . */ ProviderList getJarList ( String [ ] jarClassNames ) { } }
List < ProviderConfig > newConfigs = new ArrayList < > ( ) ; for ( String className : jarClassNames ) { ProviderConfig newConfig = new ProviderConfig ( className ) ; for ( ProviderConfig config : configs ) { // if the equivalent object is present in this provider list , // use the old object rather than the new object . // this ensures that when the provider is loaded in the // new thread local list , it will also become available // in this provider list if ( config . equals ( newConfig ) ) { newConfig = config ; break ; } } newConfigs . add ( newConfig ) ; } ProviderConfig [ ] configArray = newConfigs . toArray ( PC0 ) ; return new ProviderList ( configArray , false ) ;
public class CommercePriceEntryUtil { /** * Returns the commerce price entry where uuid = & # 63 ; and groupId = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache . * @ param uuid the uuid * @ param groupId the group ID * @ param retrieveFromCache whether to retrieve from the finder cache * @ return the matching commerce price entry , or < code > null < / code > if a matching commerce price entry could not be found */ public static CommercePriceEntry fetchByUUID_G ( String uuid , long groupId , boolean retrieveFromCache ) { } }
return getPersistence ( ) . fetchByUUID_G ( uuid , groupId , retrieveFromCache ) ;
public class WindowManager { /** * Tracks a window event * @ param windowEvent the window event to track */ public void add ( Event < T > windowEvent ) { } }
// watermark events are not added to the queue . if ( windowEvent . isWatermark ( ) ) { LOG . fine ( String . format ( "Got watermark event with ts %d" , windowEvent . getTimestamp ( ) ) ) ; } else { queue . add ( windowEvent ) ; } track ( windowEvent ) ; compactWindow ( ) ;
public class PhoneUtils { /** * Checks to see if the user has rotation enabled / disabled in their phone settings . * @ param context The current Context or Activity that this method is called from * @ return true if rotation is enabled , otherwise false . */ public static boolean isRotationEnabled ( Context context ) { } }
return android . provider . Settings . System . getInt ( context . getContentResolver ( ) , Settings . System . ACCELEROMETER_ROTATION , 0 ) == 1 ;
public class CmsAutoGrowingTextAreaConnector { /** * Resize the text area . < p > */ protected void handle ( ) { } }
Element e = m_widget . getElement ( ) ; if ( e instanceof TextAreaElement ) { TextAreaElement elem = ( TextAreaElement ) e ; int scrollHeight = elem . getScrollHeight ( ) ; // allow text area to shrink if ( m_lastValue . length ( ) > elem . getValue ( ) . length ( ) ) { elem . setRows ( getState ( ) . getMinRows ( ) ) ; } int currentRows = elem . getRows ( ) ; if ( m_lineHeight == 0 ) { elem . setRows ( 2 ) ; int heightTwo = elem . getClientHeight ( ) ; elem . setRows ( 1 ) ; int heightOne = elem . getClientHeight ( ) ; m_lineHeight = heightTwo - heightOne ; m_paddingHeight = heightOne - m_lineHeight ; elem . setRows ( currentRows ) ; } if ( m_lineHeight > 0 ) { int totalHeight = scrollHeight - m_paddingHeight ; int requiredRows = ( ( scrollHeight - m_paddingHeight ) / m_lineHeight ) ; if ( ( totalHeight % m_lineHeight ) > 0 ) { requiredRows ++ ; } int minRows = getState ( ) . getMinRows ( ) ; int maxRows = getState ( ) . getMaxRows ( ) ; if ( ( requiredRows <= minRows ) && ( currentRows != minRows ) ) { elem . setRows ( minRows ) ; } else if ( ( requiredRows >= maxRows ) && ( currentRows != maxRows ) ) { elem . setRows ( maxRows ) ; } else if ( requiredRows != currentRows ) { elem . setRows ( requiredRows ) ; } } }
public class LineSegmentPath { /** * Populate the path with the path nodes that lead the pathable from its starting position to * the given destination coordinates following the given list of screen coordinates . */ protected void createPath ( List < Point > points ) { } }
Point last = null ; int size = points . size ( ) ; for ( int ii = 0 ; ii < size ; ii ++ ) { Point p = points . get ( ii ) ; int dir = ( ii == 0 ) ? NORTH : DirectionUtil . getDirection ( last , p ) ; addNode ( p . x , p . y , dir ) ; last = p ; }
public class Detector { /** * Gets the color of a segment * @ return 1 if segment more than 90 % black , - 1 if segment is more than 90 % white , 0 else */ private int getColor ( Point p1 , Point p2 ) { } }
float d = distance ( p1 , p2 ) ; float dx = ( p2 . getX ( ) - p1 . getX ( ) ) / d ; float dy = ( p2 . getY ( ) - p1 . getY ( ) ) / d ; int error = 0 ; float px = p1 . getX ( ) ; float py = p1 . getY ( ) ; boolean colorModel = image . get ( p1 . getX ( ) , p1 . getY ( ) ) ; int iMax = ( int ) Math . ceil ( d ) ; for ( int i = 0 ; i < iMax ; i ++ ) { px += dx ; py += dy ; if ( image . get ( MathUtils . round ( px ) , MathUtils . round ( py ) ) != colorModel ) { error ++ ; } } float errRatio = error / d ; if ( errRatio > 0.1f && errRatio < 0.9f ) { return 0 ; } return ( errRatio <= 0.1f ) == colorModel ? 1 : - 1 ;
public class CheckArg { /** * Check that the object is an instance of the specified Class * @ param argument Value * @ param expectedClass Class * @ param name The name of the argument * @ throws IllegalArgumentException If value is null */ public static void isInstanceOf ( Object argument , Class < ? > expectedClass , String name ) { } }
isNotNull ( argument , name ) ; if ( ! expectedClass . isInstance ( argument ) ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeInstanceOf . text ( name , argument . getClass ( ) , expectedClass . getName ( ) ) ) ; }
public class ChatMessage { /** * Update status list with a new status . * @ param status New message status details . */ @ SuppressLint ( "UseSparseArrays" ) public void addStatusUpdate ( ChatMessageStatus status ) { } }
int unique = ( status . getMessageId ( ) + status . getProfileId ( ) + status . getMessageStatus ( ) . name ( ) ) . hashCode ( ) ; if ( statusUpdates == null ) { statusUpdates = new HashMap < > ( ) ; } statusUpdates . put ( unique , status ) ;
public class SharedStateRegistry { /** * Register given shared states in the registry . * @ param stateHandles The shared states to register . */ public void registerAll ( Iterable < ? extends CompositeStateHandle > stateHandles ) { } }
if ( stateHandles == null ) { return ; } synchronized ( registeredStates ) { for ( CompositeStateHandle stateHandle : stateHandles ) { stateHandle . registerSharedStates ( this ) ; } }
public class Postcard { /** * Inserts a CharSequence array value into the mapping of this Bundle , replacing * any existing value for the given key . Either key or value may be null . * @ param key a String , or null * @ param value a CharSequence array object , or null * @ return current */ public Postcard withCharSequenceArray ( @ Nullable String key , @ Nullable CharSequence [ ] value ) { } }
mBundle . putCharSequenceArray ( key , value ) ; return this ;
public class MBeanServerHandler { /** * Lookup all registered detectors + a default detector */ public static List < ServerDetector > lookupDetectors ( ) { } }
List < ServerDetector > detectors = ServiceObjectFactory . createServiceObjects ( "META-INF/detectors-default" , "META-INF/detectors" ) ; // An detector at the end of the chain in order to get a default handle detectors . add ( new FallbackServerDetector ( ) ) ; return detectors ;
public class RemoveUnusedCode { /** * Get the right { @ link VarInfo } object to use for the given { @ link Var } . * < p > This method is responsible for managing the entries in { @ link # varInfoMap } . * < p > Note : Several { @ link Var } s may share the same { @ link VarInfo } when they should be treated * the same way . */ private VarInfo getVarInfo ( Var var ) { } }
checkNotNull ( var ) ; boolean isGlobal = var . isGlobal ( ) ; if ( var . isExtern ( ) ) { return canonicalUnremovableVarInfo ; } else if ( isGlobal && ! removeGlobals ) { return canonicalUnremovableVarInfo ; } else if ( ! isGlobal && ! removeLocalVars ) { return canonicalUnremovableVarInfo ; } else if ( codingConvention . isExported ( var . getName ( ) , ! isGlobal ) ) { return canonicalUnremovableVarInfo ; } else if ( var . isArguments ( ) ) { return canonicalUnremovableVarInfo ; } else { VarInfo varInfo = varInfoMap . get ( var ) ; if ( varInfo == null ) { varInfo = new VarInfo ( ) ; if ( var . getParentNode ( ) . isParamList ( ) ) { varInfo . hasNonLocalOrNonLiteralValue = true ; } varInfoMap . put ( var , varInfo ) ; } return varInfo ; }
public class MultiNote { /** * Returns < TT > true < / TT > if this multi note some accidentals ( for at least one * of its note ) . * @ return < TT > true < / TT > if this multi note some accidentals ( for at least one * of its note ) , < TT > false < / TT > otherwise . * @ see Note # hasAccidental ( ) */ public boolean hasAccidental ( ) { } }
for ( int i = 1 ; i < m_notes . size ( ) ; i ++ ) if ( ( ( Note ) ( m_notes . elementAt ( i ) ) ) . hasAccidental ( ) ) return true ; return false ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcWallTypeEnum ( ) { } }
if ( ifcWallTypeEnumEEnum == null ) { ifcWallTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 927 ) ; } return ifcWallTypeEnumEEnum ;
public class WorkEvent { /** * Read object * @ param ois The object input stream * @ exception ClassNotFoundException If a class can not be found * @ exception IOException Thrown if an error occurs */ private void readObject ( ObjectInputStream ois ) throws ClassNotFoundException , IOException { } }
ObjectInputStream . GetField fields = ois . readFields ( ) ; String name = serialPersistentFields [ TYPE_IDX ] . getName ( ) ; this . type = fields . get ( name , 0 ) ; name = serialPersistentFields [ WORK_IDX ] . getName ( ) ; this . work = ( Work ) fields . get ( name , null ) ; name = serialPersistentFields [ EXCPEPTION_IDX ] . getName ( ) ; this . e = ( WorkException ) fields . get ( name , null ) ; name = serialPersistentFields [ DURATION_IDX ] . getName ( ) ; this . startDuration = fields . get ( name , 0L ) ;
public class CounterConfigurationManager { /** * Validates the counter ' s configuration . * @ param configuration the { @ link CounterConfiguration } to be validated . */ private void validateConfiguration ( CounterConfiguration configuration ) { } }
storage . validatePersistence ( configuration ) ; switch ( configuration . type ( ) ) { case BOUNDED_STRONG : validateStrongCounterBounds ( configuration . lowerBound ( ) , configuration . initialValue ( ) , configuration . upperBound ( ) ) ; break ; case WEAK : if ( configuration . concurrencyLevel ( ) < 1 ) { throw log . invalidConcurrencyLevel ( configuration . concurrencyLevel ( ) ) ; } break ; }
public class IOUtils { /** * < p > write . < / p > * @ param in a { @ link java . io . InputStream } object . * @ param path a { @ link java . nio . file . Path } object . */ public static void write ( InputStream in , Path path ) { } }
write ( in , path , StandardCopyOption . REPLACE_EXISTING ) ;
public class BranchDeleteTask { /** * Sets the branches to delete ( comma - separated list ) * @ param branches comma - separated list of branches to delete */ public void setBranches ( String branches ) { } }
if ( ! GitTaskUtils . isNullOrBlankString ( branches ) ) { this . branchNames = branches . split ( "," ) ; } else { throw new GitBuildException ( "Cannot delete unspecified branches." ) ; }
public class PathNormalizer { /** * Normalizes two paths and joins them as a single path . * @ param prefix * @ param path * @ return the joined path */ public static String joinPaths ( String prefix , String path , boolean generatedPath ) { } }
String result = null ; if ( generatedPath ) { result = joinDomainToPath ( prefix , path ) ; } else { result = joinPaths ( prefix , path ) ; } return result ;
public class NewConnectionInitialReadCallback { /** * Tests if the request has space in its buffer ( s ) or not . * @ param req * @ return boolean */ private boolean requestFull ( TCPReadRequestContext req ) { } }
WsByteBuffer wsBuffArray [ ] = req . getBuffers ( ) ; boolean rc = ! wsBuffArray [ wsBuffArray . length - 1 ] . hasRemaining ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "requestFull: " + rc ) ; } return rc ;
public class FluentWait { /** * Repeatedly applies this instance ' s input value to the given function until one of the following * occurs : * < ol > * < li > the function returns neither null nor false < / li > * < li > the function throws an unignored exception < / li > * < li > the timeout expires < / li > * < li > the current thread is interrupted < / li > * < / ol > * @ param isTrue the parameter to pass to the { @ link ExpectedCondition } * @ param < V > The function ' s expected return type . * @ return The function ' s return value if the function returned something different * from null or false before the timeout expired . * @ throws TimeoutException If the timeout expires . */ @ Override public < V > V until ( Function < ? super T , V > isTrue ) { } }
Instant end = clock . instant ( ) . plus ( timeout ) ; Throwable lastException ; while ( true ) { try { V value = isTrue . apply ( input ) ; if ( value != null && ( Boolean . class != value . getClass ( ) || Boolean . TRUE . equals ( value ) ) ) { return value ; } // Clear the last exception ; if another retry or timeout exception would // be caused by a false or null value , the last exception is not the // cause of the timeout . lastException = null ; } catch ( Throwable e ) { lastException = propagateIfNotIgnored ( e ) ; } // Check the timeout after evaluating the function to ensure conditions // with a zero timeout can succeed . if ( end . isBefore ( clock . instant ( ) ) ) { String message = messageSupplier != null ? messageSupplier . get ( ) : null ; String timeoutMessage = String . format ( "Expected condition failed: %s (tried for %d second(s) with %d milliseconds interval)" , message == null ? "waiting for " + isTrue : message , timeout . getSeconds ( ) , interval . toMillis ( ) ) ; throw timeoutException ( timeoutMessage , lastException ) ; } try { sleeper . sleep ( interval ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new WebDriverException ( e ) ; } }
public class CDocumentReconstructor { /** * return the itext security flags for encryption * @ param properties * the converter properties * @ return the itext security flags */ private static final int getSecurityFlags ( final Map properties ) { } }
int securityType = 0 ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_PRINTING ) ) ? ( securityType | PdfWriter . ALLOW_PRINTING ) : securityType ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_MODIFY_CONTENTS ) ) ? ( securityType | PdfWriter . ALLOW_MODIFY_CONTENTS ) : securityType ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_COPY ) ) ? ( securityType | PdfWriter . ALLOW_COPY ) : securityType ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_MODIFT_ANNOTATIONS ) ) ? ( securityType | PdfWriter . ALLOW_MODIFY_ANNOTATIONS ) : securityType ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_FILLIN ) ) ? ( securityType | PdfWriter . ALLOW_FILL_IN ) : securityType ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_SCREEN_READERS ) ) ? ( securityType | PdfWriter . ALLOW_SCREENREADERS ) : securityType ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_ASSEMBLY ) ) ? ( securityType | PdfWriter . ALLOW_ASSEMBLY ) : securityType ; securityType = "true" . equals ( properties . get ( IHtmlToPdfTransformer . PDF_ALLOW_DEGRADED_PRINTING ) ) ? ( securityType | PdfWriter . ALLOW_DEGRADED_PRINTING ) : securityType ; return securityType ;
public class AbstractDataSource { /** * Builds the task list . * @ param previousVersion * the previous version * @ param currentVersion * the current version * @ return the list */ protected List < SQLiteUpdateTask > buildTaskList ( int previousVersion , int currentVersion ) { } }
List < SQLiteUpdateTask > result = new ArrayList < > ( ) ; for ( Pair < Integer , ? extends SQLiteUpdateTask > item : this . options . updateTasks ) { if ( item . value0 - 1 == previousVersion ) { result . add ( item . value1 ) ; previousVersion = item . value0 ; } if ( previousVersion == currentVersion ) break ; } if ( previousVersion != currentVersion ) { Logger . warn ( String . format ( "Can not find version update task from version %s to version %s" , previousVersion , currentVersion ) ) ; } return result ;
public class MapRandomizer { /** * Create a new { @ link MapRandomizer } with a random number of entries . * @ param keyRandomizer the randomizer for keys * @ param valueRandomizer the randomizer for values * @ param < K > the type of key elements * @ param < V > the type of value elements * @ return a new { @ link MapRandomizer } */ public static < K , V > MapRandomizer < K , V > aNewMapRandomizer ( final Randomizer < K > keyRandomizer , final Randomizer < V > valueRandomizer ) { } }
return new MapRandomizer < > ( keyRandomizer , valueRandomizer , getRandomSize ( ) ) ;
public class IfcPortImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcRelConnectsPortToElement > getContainedIn ( ) { } }
return ( EList < IfcRelConnectsPortToElement > ) eGet ( Ifc4Package . Literals . IFC_PORT__CONTAINED_IN , true ) ;
public class AverageBondLengthCalculator { /** * Calculate the average bond length for the bonds in a molecule set . * @ param moleculeSet the molecule set to use * @ return the average bond length */ public static double calculateAverageBondLength ( IAtomContainerSet moleculeSet ) { } }
double averageBondModelLength = 0.0 ; for ( IAtomContainer atomContainer : moleculeSet . atomContainers ( ) ) { averageBondModelLength += GeometryUtil . getBondLengthAverage ( atomContainer ) ; } return averageBondModelLength / moleculeSet . getAtomContainerCount ( ) ;
public class ShapeGenerator { /** * Return a path for a simple bullet . * @ param x the X coordinate of the upper - left corner of the bullet * @ param y the Y coordinate of the upper - left corner of the bullet * @ param diameter the diameter of the bullet * @ return a path representing the shape . */ public Shape createBullet ( int x , int y , int diameter ) { } }
return createEllipseInternal ( x , y , diameter , diameter ) ;
public class OperationCodeImpl { /** * ( non - Javadoc ) * @ see org . restcomm . protocols . ss7 . tcap . asn . Encodable # encode ( org . mobicents . protocols . asn . AsnOutputStream ) */ public void encode ( AsnOutputStream aos ) throws EncodeException { } }
if ( this . nationalOperationCode == null && this . privateOperationCode == null ) throw new EncodeException ( "Operation code: No Operation code set!" ) ; try { if ( this . type == OperationCodeType . National && this . nationalOperationCode != null ) { aos . writeInteger ( Tag . CLASS_PRIVATE , OperationCode . _TAG_NATIONAL , this . nationalOperationCode ) ; } else if ( this . type == OperationCodeType . Private && this . privateOperationCode != null ) { aos . writeInteger ( Tag . CLASS_PRIVATE , OperationCode . _TAG_PRIVATE , this . privateOperationCode ) ; } else { throw new EncodeException ( "Operation code: No Operation code set!" ) ; } } catch ( IOException e ) { throw new EncodeException ( "IOException while encoding OperationCode: " + e . getMessage ( ) , e ) ; } catch ( AsnException e ) { throw new EncodeException ( "AsnException while encoding OperationCode: " + e . getMessage ( ) , e ) ; }
public class CompressedArray { /** * Decompress the byte array previously returned by compress */ public static byte [ ] decompress ( byte [ ] value ) throws DataFormatException { } }
// Create an expandable byte array to hold the decompressed data ByteArrayOutputStream bos = new ByteArrayOutputStream ( value . length ) ; Inflater decompressor = new Inflater ( ) ; try { decompressor . setInput ( value ) ; final byte [ ] buf = new byte [ 1024 ] ; while ( ! decompressor . finished ( ) ) { int count = decompressor . inflate ( buf ) ; bos . write ( buf , 0 , count ) ; } } finally { decompressor . end ( ) ; } return bos . toByteArray ( ) ;