signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Parameters { /** * Overrides parameters with new values from specified Parameters and returns a * new Parameters object . * @ param parameters Parameters with parameters to override the current values . * @ param recursive ( optional ) true to perform deep copy , and false for shallow * copy . Default : false * @ return a new Parameters object . */ public Parameters override ( Parameters parameters , boolean recursive ) { } }
Parameters result = new Parameters ( ) ; if ( recursive ) { RecursiveObjectWriter . copyProperties ( result , this ) ; RecursiveObjectWriter . copyProperties ( result , parameters ) ; } else { ObjectWriter . setProperties ( result , this ) ; ObjectWriter . setProperties ( result , parameters ) ; } return result ;
public class JavaConnector { /** * called when the map extent changed by changing the center or zoom of the map . * @ param latMin * latitude of upper left corner * @ param lonMin * longitude of upper left corner * @ param latMax * latitude of lower right corner * @ param lonMax * longitude of lower right corner */ public void extentChanged ( double latMin , double lonMin , double latMax , double lonMax ) { } }
final Extent extent = Extent . forCoordinates ( new Coordinate ( latMin , lonMin ) , new Coordinate ( latMax , lonMax ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "JS reports extend change: {}" , extent ) ; } fireEvent ( new MapViewEvent ( MapViewEvent . MAP_BOUNDING_EXTENT , extent ) ) ;
public class CommerceShippingFixedOptionRelPersistenceImpl { /** * Returns the commerce shipping fixed option rel with the primary key or returns < code > null < / code > if it could not be found . * @ param primaryKey the primary key of the commerce shipping fixed option rel * @ return the commerce shipping fixed option rel , or < code > null < / code > if a commerce shipping fixed option rel with the primary key could not be found */ @ Override public CommerceShippingFixedOptionRel fetchByPrimaryKey ( Serializable primaryKey ) { } }
Serializable serializable = entityCache . getResult ( CommerceShippingFixedOptionRelModelImpl . ENTITY_CACHE_ENABLED , CommerceShippingFixedOptionRelImpl . class , primaryKey ) ; if ( serializable == nullModel ) { return null ; } CommerceShippingFixedOptionRel commerceShippingFixedOptionRel = ( CommerceShippingFixedOptionRel ) serializable ; if ( commerceShippingFixedOptionRel == null ) { Session session = null ; try { session = openSession ( ) ; commerceShippingFixedOptionRel = ( CommerceShippingFixedOptionRel ) session . get ( CommerceShippingFixedOptionRelImpl . class , primaryKey ) ; if ( commerceShippingFixedOptionRel != null ) { cacheResult ( commerceShippingFixedOptionRel ) ; } else { entityCache . putResult ( CommerceShippingFixedOptionRelModelImpl . ENTITY_CACHE_ENABLED , CommerceShippingFixedOptionRelImpl . class , primaryKey , nullModel ) ; } } catch ( Exception e ) { entityCache . removeResult ( CommerceShippingFixedOptionRelModelImpl . ENTITY_CACHE_ENABLED , CommerceShippingFixedOptionRelImpl . class , primaryKey ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return commerceShippingFixedOptionRel ;
public class FDBigInteger { /** * @ requires p5 > = 0 & & p2 > = 0; * @ assignable \ nothing ; * @ ensures \ result . value ( ) = = \ old ( UNSIGNED ( value ) * pow52 ( p5 , p2 ) ) ; */ public static FDBigInteger valueOfMulPow52 ( long value , int p5 , int p2 ) { } }
assert p5 >= 0 : p5 ; assert p2 >= 0 : p2 ; int v0 = ( int ) value ; int v1 = ( int ) ( value >>> 32 ) ; int wordcount = p2 >> 5 ; int bitcount = p2 & 0x1f ; if ( p5 != 0 ) { if ( p5 < SMALL_5_POW . length ) { long pow5 = SMALL_5_POW [ p5 ] & LONG_MASK ; long carry = ( v0 & LONG_MASK ) * pow5 ; v0 = ( int ) carry ; carry >>>= 32 ; carry = ( v1 & LONG_MASK ) * pow5 + carry ; v1 = ( int ) carry ; int v2 = ( int ) ( carry >>> 32 ) ; if ( bitcount == 0 ) { return new FDBigInteger ( new int [ ] { v0 , v1 , v2 } , wordcount ) ; } else { return new FDBigInteger ( new int [ ] { v0 << bitcount , ( v1 << bitcount ) | ( v0 >>> ( 32 - bitcount ) ) , ( v2 << bitcount ) | ( v1 >>> ( 32 - bitcount ) ) , v2 >>> ( 32 - bitcount ) } , wordcount ) ; } } else { FDBigInteger pow5 = big5pow ( p5 ) ; int [ ] r ; if ( v1 == 0 ) { r = new int [ pow5 . nWords + 1 + ( ( p2 != 0 ) ? 1 : 0 ) ] ; mult ( pow5 . data , pow5 . nWords , v0 , r ) ; } else { r = new int [ pow5 . nWords + 2 + ( ( p2 != 0 ) ? 1 : 0 ) ] ; mult ( pow5 . data , pow5 . nWords , v0 , v1 , r ) ; } return ( new FDBigInteger ( r , pow5 . offset ) ) . leftShift ( p2 ) ; } } else if ( p2 != 0 ) { if ( bitcount == 0 ) { return new FDBigInteger ( new int [ ] { v0 , v1 } , wordcount ) ; } else { return new FDBigInteger ( new int [ ] { v0 << bitcount , ( v1 << bitcount ) | ( v0 >>> ( 32 - bitcount ) ) , v1 >>> ( 32 - bitcount ) } , wordcount ) ; } } return new FDBigInteger ( new int [ ] { v0 , v1 } , 0 ) ;
public class API { /** * Gets ( and registers ) a new callback URL for the given implementor and site . * @ param impl the implementor that will handle the callback . * @ param site the site that will call the callback . * @ return the callback URL . * @ since 2.0.0 * @ see # removeCallBackUrl ( String ) * @ see # removeCallBackUrls ( ApiImplementor ) * @ see # removeApiImplementor ( ApiImplementor ) */ public String getCallBackUrl ( ApiImplementor impl , String site ) { } }
String url = site + CALL_BACK_URL + random . nextLong ( ) ; this . callBacks . put ( url , impl ) ; logger . debug ( "Callback " + url + " registered for " + impl . getClass ( ) . getCanonicalName ( ) ) ; return url ;
public class PrioritySerialTaskScheduler { /** * Gets the bookkeeping information for a job . If the specified job has * not been seen , a new < code > JobInfo < / code > is created for it . * @ param jobId The < code > UUID < / code > of the job for which to obtain the * corresponding < code > JobInfo < / code > . * @ return The < code > JobInfo < / code > for the specified job . */ private JobInfo getJob ( UUID jobId ) { } }
JobInfo job = jobs . get ( jobId ) ; if ( job == null ) { job = new JobInfo ( jobId ) ; jobs . put ( jobId , job ) ; jobQueue . add ( jobId ) ; } return job ;
public class UpdateCustomKeyStoreRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateCustomKeyStoreRequest updateCustomKeyStoreRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateCustomKeyStoreRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateCustomKeyStoreRequest . getCustomKeyStoreId ( ) , CUSTOMKEYSTOREID_BINDING ) ; protocolMarshaller . marshall ( updateCustomKeyStoreRequest . getNewCustomKeyStoreName ( ) , NEWCUSTOMKEYSTORENAME_BINDING ) ; protocolMarshaller . marshall ( updateCustomKeyStoreRequest . getKeyStorePassword ( ) , KEYSTOREPASSWORD_BINDING ) ; protocolMarshaller . marshall ( updateCustomKeyStoreRequest . getCloudHsmClusterId ( ) , CLOUDHSMCLUSTERID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class LineDataObjectPositionMigrationImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setTempOrient ( Integer newTempOrient ) { } }
Integer oldTempOrient = tempOrient ; tempOrient = newTempOrient ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . LINE_DATA_OBJECT_POSITION_MIGRATION__TEMP_ORIENT , oldTempOrient , tempOrient ) ) ;
public class Util { /** * Encodes an IPv6 address in canonical form according to RFC 5952. */ private static String inet6AddressToAscii ( byte [ ] address ) { } }
// Go through the address looking for the longest run of 0s . Each group is 2 - bytes . // A run must be longer than one group ( section 4.2.2 ) . // If there are multiple equal runs , the first one must be used ( section 4.2.3 ) . int longestRunOffset = - 1 ; int longestRunLength = 0 ; for ( int i = 0 ; i < address . length ; i += 2 ) { int currentRunOffset = i ; while ( i < 16 && address [ i ] == 0 && address [ i + 1 ] == 0 ) { i += 2 ; } int currentRunLength = i - currentRunOffset ; if ( currentRunLength > longestRunLength && currentRunLength >= 4 ) { longestRunOffset = currentRunOffset ; longestRunLength = currentRunLength ; } } // Emit each 2 - byte group in hex , separated by ' : ' . The longest run of zeroes is " : : " . Buffer result = new Buffer ( ) ; for ( int i = 0 ; i < address . length ; ) { if ( i == longestRunOffset ) { result . writeByte ( ':' ) ; i += longestRunLength ; if ( i == 16 ) result . writeByte ( ':' ) ; } else { if ( i > 0 ) result . writeByte ( ':' ) ; int group = ( address [ i ] & 0xff ) << 8 | address [ i + 1 ] & 0xff ; result . writeHexadecimalUnsignedLong ( group ) ; i += 2 ; } } return result . readUtf8 ( ) ;
public class SearchIndexResult { /** * The thing groups that match the search query . * @ param thingGroups * The thing groups that match the search query . */ public void setThingGroups ( java . util . Collection < ThingGroupDocument > thingGroups ) { } }
if ( thingGroups == null ) { this . thingGroups = null ; return ; } this . thingGroups = new java . util . ArrayList < ThingGroupDocument > ( thingGroups ) ;
public class AbstractDirector { /** * Logs a message with an exception . * @ param level the level of the message * @ param msg the message * @ param e the exception causing the message */ void log ( Level level , String msg , Exception e ) { } }
if ( e != null ) logger . log ( level , msg , e ) ;
public class PropertiesUtil { /** * Gets the named property as an integer . * @ param name the name of the property to look up * @ param defaultValue the default value to use if the property is undefined * @ return the parsed integer value of the property or { @ code defaultValue } if it was undefined or could not be * parsed . */ public int getIntegerProperty ( final String name , final int defaultValue ) { } }
final String prop = getStringProperty ( name ) ; if ( prop != null ) { try { return Integer . parseInt ( prop ) ; } catch ( final Exception ignored ) { return defaultValue ; } } return defaultValue ;
public class BindContentProviderBuilder { /** * Generate get type . * @ param schema * the schema */ private void generateGetType ( SQLiteDatabaseSchema schema ) { } }
MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "getType" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( String . class ) ; methodBuilder . addParameter ( Uri . class , "uri" ) ; methodBuilder . beginControlFlow ( "switch (sURIMatcher.match(uri))" ) ; for ( Entry < String , ContentEntry > item : uriSet . entrySet ( ) ) { methodBuilder . beginControlFlow ( "case $L:" , item . getValue ( ) . pathIndex ) ; methodBuilder . addStatement ( "return $S" , item . getValue ( ) . getContentType ( ) ) ; methodBuilder . endControlFlow ( ) ; } methodBuilder . endControlFlow ( ) ; methodBuilder . addStatement ( "throw new $T(\"Unknown URI for $L operation: \" + uri)" , IllegalArgumentException . class , "getType" ) ; classBuilder . addMethod ( methodBuilder . build ( ) ) ;
public class KeyboardUtils { /** * Hides keypad * @ param context * @ param view View holding keypad control */ public static void hideSoftKeyboard ( Context context , View view ) { } }
InputMethodManager imm = ( InputMethodManager ) context . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; imm . hideSoftInputFromWindow ( view . getWindowToken ( ) , 0 ) ;
public class Vector2i { /** * / * ( non - Javadoc ) * @ see org . joml . Vector2ic # sub ( org . joml . Vector2ic , org . joml . Vector2i ) */ public Vector2i sub ( Vector2ic v , Vector2i dest ) { } }
dest . x = x - v . x ( ) ; dest . y = y - v . y ( ) ; return dest ;
public class FactoryBinding { /** * Matches constructor parameters to method parameters for injection and * records remaining parameters as required keys . */ private String [ ] extractConstructorParameters ( Key < ? > factoryKey , TypeLiteral < ? > implementation , Constructor constructor , List < Key < ? > > methodParams , Errors errors , Set < Dependency > dependencyCollector ) throws ErrorsException { } }
// Get parameters with annotations . List < TypeLiteral < ? > > ctorParams = implementation . getParameterTypes ( constructor ) ; Annotation [ ] [ ] ctorParamAnnotations = constructor . getParameterAnnotations ( ) ; int p = 0 ; String [ ] parameterNames = new String [ ctorParams . size ( ) ] ; Set < Key < ? > > keySet = new LinkedHashSet < Key < ? > > ( ) ; for ( TypeLiteral < ? > ctorParam : ctorParams ) { Key < ? > ctorParamKey = getKey ( ctorParam , constructor , ctorParamAnnotations [ p ] , errors ) ; if ( ctorParamKey . getAnnotationType ( ) == Assisted . class ) { if ( ! keySet . add ( ctorParamKey ) ) { errors . addMessage ( PrettyPrinter . format ( "%s has more than one parameter of type %s annotated with @Assisted(\"%s\"). " + "Please specify a unique value with the annotation to avoid confusion." , implementation , ctorParamKey . getTypeLiteral ( ) . getType ( ) , ( ( Assisted ) ctorParamKey . getAnnotation ( ) ) . value ( ) ) ) ; } int location = methodParams . indexOf ( ctorParamKey ) ; // This should never happen since the constructor was already checked // in # [ inject ] constructorHasMatchingParams ( . . ) . Preconditions . checkState ( location != - 1 ) ; parameterNames [ p ] = ReflectUtil . formatParameterName ( location ) ; } else { dependencyCollector . add ( new Dependency ( factoryKey , ctorParamKey , false , true , constructor . toString ( ) ) ) ; } p ++ ; } return parameterNames ;
public class CmsDomUtil { /** * Returns the first direct child matching the given class name . < p > * @ param element the parent element * @ param className the class name to match * @ return the child element */ public static Element getFirstChildWithClass ( Element element , String className ) { } }
NodeList < Node > children = element . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { if ( children . getItem ( i ) . getNodeType ( ) == Node . ELEMENT_NODE ) { Element child = ( Element ) children . getItem ( i ) ; if ( child . hasClassName ( className ) ) { return child ; } } } return null ;
public class ReseedingSecureRandom { /** * Creates a pre - configured automatically reseeding SHA1PRNG instance , reseeding itself with 440 bits from the given seeder after generating 2 ^ 30 bytes , * thus satisfying recommendations by < a href = " http : / / dx . doi . org / 10.6028 / NIST . SP . 800-90Ar1 " > NIST SP 800-90A Rev 1 < / a > . * @ param seeder RNG for high - quality random numbers . E . g . < code > SecureRandom . getInstanceStrong ( ) < / code > in Java 8 + environments . * @ return An automatically reseeding SHA1PRNG suitable as CSPRNG for most applications . */ public static ReseedingSecureRandom create ( SecureRandom seeder ) { } }
try { return new ReseedingSecureRandom ( seeder , SecureRandom . getInstance ( "SHA1PRNG" ) , 1 << 30 , 55 ) ; } catch ( NoSuchAlgorithmException e ) { throw new IllegalStateException ( "SHA1PRNG must exist in every Java platform implementation." , e ) ; }
public class OtpOutputStream { /** * Write the low four bytes of a value to the stream in bif endian order , at * the specified position . If the position specified is beyond the end of * the stream , this method will have no effect . * Normally this method should be used in conjunction with { @ link # size ( ) * size ( ) } , when is is necessary to insert data into the stream before it is * known what the actual value should be . For example : * < pre > * int pos = s . size ( ) ; * s . write4BE ( 0 ) ; / / make space for length data , * / / but final value is not yet known * [ . . . more write statements . . . ] * / / later . . . when we know the length value * s . poke4BE ( pos , length ) ; * < / pre > * @ param offset * the position in the stream . * @ param n * the value to use . */ public void poke4BE ( final int offset , final long n ) { } }
if ( offset < super . count ) { buf [ offset + 0 ] = ( byte ) ( ( n & 0xff000000 ) >> 24 ) ; buf [ offset + 1 ] = ( byte ) ( ( n & 0xff0000 ) >> 16 ) ; buf [ offset + 2 ] = ( byte ) ( ( n & 0xff00 ) >> 8 ) ; buf [ offset + 3 ] = ( byte ) ( n & 0xff ) ; }
public class RecurrencePickerDialog { /** * TODO Test and update for Right - to - Left */ private void updateIntervalText ( ) { } }
if ( mIntervalResId == - 1 ) { return ; } final String INTERVAL_COUNT_MARKER = "%d" ; String intervalString = mResources . getQuantityString ( mIntervalResId , mModel . interval ) ; int markerStart = intervalString . indexOf ( INTERVAL_COUNT_MARKER ) ; if ( markerStart != - 1 ) { int postTextStart = markerStart + INTERVAL_COUNT_MARKER . length ( ) ; mIntervalPostText . setText ( intervalString . substring ( postTextStart , intervalString . length ( ) ) . trim ( ) ) ; mIntervalPreText . setText ( intervalString . substring ( 0 , markerStart ) . trim ( ) ) ; }
public class GetAppReplicationConfigurationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetAppReplicationConfigurationRequest getAppReplicationConfigurationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getAppReplicationConfigurationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getAppReplicationConfigurationRequest . getAppId ( ) , APPID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CSSDataURL { /** * Determine the charset from the passed MIME type . If no charset was found , * return the default charset . * @ param aMimeType * The MIME type to investigate . * @ return Never < code > null < / code > . */ @ Nonnull public static Charset getCharsetFromMimeTypeOrDefault ( @ Nullable final IMimeType aMimeType ) { } }
final Charset ret = MimeTypeHelper . getCharsetFromMimeType ( aMimeType ) ; return ret != null ? ret : CSSDataURLHelper . DEFAULT_CHARSET ;
public class U { /** * Documented , # groupBy */ public static < K , E > Map < K , List < E > > groupBy ( final Iterable < E > iterable , final Function < E , K > func ) { } }
final Map < K , List < E > > retVal = newLinkedHashMap ( ) ; for ( E e : iterable ) { final K key = func . apply ( e ) ; List < E > val ; if ( retVal . containsKey ( key ) ) { val = retVal . get ( key ) ; } else { val = newArrayList ( ) ; } val . add ( e ) ; retVal . put ( key , val ) ; } return retVal ;
public class RuntimeTypeAdapterFactory { /** * Registers { @ code type } identified by its { @ link Class # getSimpleName simple * name } . Labels are case sensitive . * @ throws IllegalArgumentException if either { @ code type } or its simple name * have already been registered on this type adapter . */ public RuntimeTypeAdapterFactory < T > registerSubtype ( Class < ? extends T > type ) { } }
return registerSubtype ( type , type . getSimpleName ( ) ) ;
public class OfferService { /** * Add a block to the pending received / deleted ACKs . * to inform the namenode that we have received a block . */ void notifyNamenodeReceivedBlock ( Block block , String delHint ) { } }
if ( block == null ) { throw new IllegalArgumentException ( "Block is null" ) ; } if ( delHint != null && ! delHint . isEmpty ( ) ) { block = new ReceivedBlockInfo ( block , delHint ) ; } synchronized ( receivedAndDeletedBlockList ) { receivedAndDeletedBlockList . add ( block ) ; pendingReceivedRequests ++ ; if ( ! shouldBackoff ) { receivedAndDeletedBlockList . notifyAll ( ) ; } }
public class GuiRenderer { /** * Draws itemStack to the GUI at the specified coordinates with a custom formatted label . < br > * Uses RenderItem . renderItemAndEffectIntoGUI ( ) and RenderItem . renderItemOverlayIntoGUI ( ) * @ param itemStack the item stack * @ param x the x * @ param y the y * @ param label the label to display , if null display the stack size * @ param format the format * @ param relative if true , coordinates are relative to current component */ public void drawItemStack ( ItemStack itemStack , int x , int y , String label , Style format , boolean relative ) { } }
// we want to be able to render itemStack with 0 size , so we can ' t check for isEmpty if ( itemStack == null || itemStack == ItemStack . EMPTY ) return ; float z = itemRenderer . zLevel ; if ( relative && currentComponent != null ) { x += currentComponent . screenPosition ( ) . x ( ) ; y += currentComponent . screenPosition ( ) . y ( ) ; itemRenderer . zLevel = currentComponent . getZIndex ( ) ; } FontRenderer fontRenderer = itemStack . getItem ( ) . getFontRenderer ( itemStack ) ; if ( fontRenderer == null ) fontRenderer = Minecraft . getMinecraft ( ) . fontRenderer ; String formatStr = format != null ? format . getFormattingCode ( ) : null ; if ( label == null && ( itemStack . getCount ( ) > 1 || ! Strings . isEmpty ( formatStr ) ) ) label = Integer . toString ( itemStack . getCount ( ) ) ; if ( label == null ) label = "" ; if ( ! Strings . isEmpty ( formatStr ) ) label = formatStr + label ; Tessellator . getInstance ( ) . draw ( ) ; // RenderHelper . disableStandardItemLighting ( ) ; RenderHelper . enableGUIStandardItemLighting ( ) ; IBakedModel model = itemRenderer . getItemModelWithOverrides ( itemStack , Utils . getClientWorld ( ) , Utils . getClientPlayer ( ) ) ; itemRenderer . renderItemModelIntoGUI ( itemStack , x , y , model ) ; itemRenderer . renderItemOverlayIntoGUI ( fontRenderer , itemStack , x , y , label ) ; RenderHelper . disableStandardItemLighting ( ) ; // GlStateManager . enableBlend ( ) ; / / Forge commented blend reenabling itemRenderer . zLevel = z ; currentTexture = null ; bindDefaultTexture ( ) ; startDrawing ( ) ;
public class CapBasedLoadManager { /** * Determine how many tasks of a given type we want to run on a TaskTracker . * This cap is chosen based on how many tasks of that type are outstanding in * total , so that when the cluster is used below capacity , tasks are spread * out uniformly across the nodes rather than being clumped up on whichever * machines sent out heartbeats earliest . */ int getCap ( int totalRunnableTasks , int localMaxTasks , int totalSlots ) { } }
double load = maxDiff + ( ( double ) totalRunnableTasks ) / totalSlots ; int cap = ( int ) Math . min ( localMaxTasks , Math . ceil ( load * localMaxTasks ) ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "load:" + load + " maxDiff:" + maxDiff + " totalRunnable:" + totalRunnableTasks + " totalSlots:" + totalSlots + " localMaxTasks:" + localMaxTasks + " cap:" + cap ) ; } return cap ;
public class FactoryProcessor { /** * Lookup { @ link javax . inject . Scope } annotated annotations to provide the name of the scope the { @ code typeElement } belongs to . * The method logs an error if the { @ code typeElement } has multiple scope annotations . * @ param typeElement the element for which a scope is to be found . * @ return the scope of this { @ code typeElement } or { @ code null } if it has no scope annotations . */ private String getScopeName ( TypeElement typeElement ) { } }
String scopeName = null ; for ( AnnotationMirror annotationMirror : typeElement . getAnnotationMirrors ( ) ) { TypeElement annotationTypeElement = ( TypeElement ) annotationMirror . getAnnotationType ( ) . asElement ( ) ; if ( annotationTypeElement . getAnnotation ( Scope . class ) != null ) { checkScopeAnnotationValidity ( annotationTypeElement ) ; if ( scopeName != null ) { error ( typeElement , "Only one @Scope qualified annotation is allowed : %s" , scopeName ) ; } scopeName = annotationTypeElement . getQualifiedName ( ) . toString ( ) ; } } return scopeName ;
public class MainActivity { /** * flow for subscription . */ public void onInfiniteGasButtonClicked ( View arg0 ) { } }
if ( setupDone == null ) { complain ( "Billing Setup is not completed yet" ) ; return ; } if ( ! setupDone ) { complain ( "Billing Setup failed" ) ; return ; } if ( ! mHelper . subscriptionsSupported ( ) ) { complain ( "Subscriptions not supported on your device yet. Sorry!" ) ; return ; } /* TODO : for security , generate your payload here for verification . See the comments on * verifyDeveloperPayload ( ) for more info . Since this is a SAMPLE , we just use * an empty string , but on a production app you should carefully generate this . */ String payload = "" ; setWaitScreen ( true ) ; Log . d ( TAG , "Launching purchase flow for infinite gas subscription." ) ; mHelper . launchPurchaseFlow ( this , InAppConfig . SKU_INFINITE_GAS , IabHelper . ITEM_TYPE_SUBS , RC_REQUEST , mPurchaseFinishedListener , payload ) ;
public class Utils { /** * Write a String as a VInt n , followed by n Bytes as in Text format . * @ param out * @ param s * @ throws IOException */ public static void writeString ( DataOutput out , String s ) throws IOException { } }
if ( s != null ) { Text text = new Text ( s ) ; byte [ ] buffer = text . getBytes ( ) ; int len = text . getLength ( ) ; writeVInt ( out , len ) ; out . write ( buffer , 0 , len ) ; } else { writeVInt ( out , - 1 ) ; }
public class TimerWaitActivity { /** * The resume method for this class is handling internal functions related to * events processing in addition to timer expiration , so it is not supposed to be overriden . The method * is therefore declared as final . To customize handling of events , please override * the method { @ link # processOtherMessage ( String ) } , and to customize * the activity so that it can reset timer and wait again , please override * the method { @ link # processTimerExpiration ( ) } . */ public final boolean resume ( InternalEvent event ) throws ActivityException { } }
if ( isOtherEvent ( event ) ) { String messageString = this . getMessageFromEventMessage ( event ) ; this . setReturnCode ( event . getCompletionCode ( ) ) ; processOtherMessage ( messageString ) ; handleEventCompletionCode ( ) ; return true ; } else { // timer expires int moreToWaitInSeconds = processTimerExpiration ( ) ; if ( moreToWaitInSeconds <= 0 ) super . deregisterEvents ( ) ; else sendDelayedResumeMessage ( moreToWaitInSeconds ) ; return moreToWaitInSeconds <= 0 ; }
public class ListAssociationsRequest { /** * One or more filters . Use a filter to return a more specific list of results . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setAssociationFilterList ( java . util . Collection ) } or * { @ link # withAssociationFilterList ( java . util . Collection ) } if you want to override the existing values . * @ param associationFilterList * One or more filters . Use a filter to return a more specific list of results . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListAssociationsRequest withAssociationFilterList ( AssociationFilter ... associationFilterList ) { } }
if ( this . associationFilterList == null ) { setAssociationFilterList ( new com . amazonaws . internal . SdkInternalList < AssociationFilter > ( associationFilterList . length ) ) ; } for ( AssociationFilter ele : associationFilterList ) { this . associationFilterList . add ( ele ) ; } return this ;
public class WebhooksInner { /** * Generates a Uri for use in creating a webhook . * @ param resourceGroupName Name of an Azure Resource group . * @ param automationAccountName The name of the automation account . * @ 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 < String > generateUriAsync ( String resourceGroupName , String automationAccountName , final ServiceCallback < String > serviceCallback ) { } }
return ServiceFuture . fromResponse ( generateUriWithServiceResponseAsync ( resourceGroupName , automationAccountName ) , serviceCallback ) ;
public class CmsSiteManagerImpl { /** * Returns the workplace server . < p > * @ return the workplace server */ public String getWorkplaceServer ( ) { } }
return m_workplaceServers . keySet ( ) . isEmpty ( ) ? null : m_workplaceServers . keySet ( ) . iterator ( ) . next ( ) ;
public class RolloutPlanCompleter { /** * / * ( non - Javadoc ) * @ see org . jboss . as . cli . CommandLineCompleter # complete ( org . jboss . as . cli . CommandContext , java . lang . String , int , java . util . List ) */ @ Override public int complete ( CommandContext ctx , String buffer , int cursor , List < String > candidates ) { } }
if ( ! ctx . isDomainMode ( ) ) { return - 1 ; } if ( buffer . isEmpty ( ) ) { candidates . add ( "{rollout" ) ; return 0 ; } try { parsedOp . parseOperation ( null , buffer , ctx ) ; } catch ( CommandFormatException e ) { return - 1 ; } if ( parsedOp . isRequestComplete ( ) ) { return - 1 ; } if ( parsedOp . endsOnHeaderListStart ( ) || parsedOp . endsOnHeaderSeparator ( ) ) { candidates . add ( "rollout" ) ; return parsedOp . getLastSeparatorIndex ( ) + 1 ; } if ( parsedOp . getLastHeader ( ) == null ) { if ( ctx . getParsedCommandLine ( ) . getOriginalLine ( ) . endsWith ( " " ) /* ' { rollout ' */ ) { final String originalLine = ctx . getParsedCommandLine ( ) . getOriginalLine ( ) ; int bufferIndex = originalLine . lastIndexOf ( buffer ) ; if ( bufferIndex == - 1 ) { // that ' s illegal state return - 1 ; } candidates . add ( "name=" ) ; candidates . addAll ( Util . getServerGroups ( ctx . getModelControllerClient ( ) ) ) ; return originalLine . length ( ) - bufferIndex ; } else if ( ctx . getParsedCommandLine ( ) . getOriginalLine ( ) . endsWith ( "rollout" ) ) { // In order to have the completion to be allowed to continue candidates . add ( " " ) ; } return buffer . length ( ) ; } final ParsedOperationRequestHeader lastHeader = parsedOp . getLastHeader ( ) ; if ( ! ( lastHeader instanceof ParsedRolloutPlanHeader ) ) { throw new IllegalStateException ( "Expected " + ParsedRolloutPlanHeader . class + " but got " + lastHeader . getName ( ) + " of " + lastHeader ) ; } final ParsedRolloutPlanHeader rollout = ( ParsedRolloutPlanHeader ) lastHeader ; if ( rollout . endsOnPlanIdValueSeparator ( ) ) { candidates . addAll ( Util . getNodeNames ( ctx . getModelControllerClient ( ) , address , Util . ROLLOUT_PLAN ) ) ; return rollout . getLastSeparatorIndex ( ) + 1 ; } final String planRef = rollout . getPlanRef ( ) ; if ( planRef != null ) { final List < String > nodeNames = Util . getNodeNames ( ctx . getModelControllerClient ( ) , address , Util . ROLLOUT_PLAN ) ; for ( String name : nodeNames ) { if ( name . startsWith ( planRef ) ) { candidates . add ( name ) ; } } return rollout . getLastChunkIndex ( ) ; } if ( rollout . hasProperties ( ) ) { final String lastName = rollout . getLastPropertyName ( ) ; if ( Util . ROLLBACK_ACROSS_GROUPS . equals ( lastName ) ) { if ( rollout . getLastPropertyValue ( ) != null ) { return - 1 ; } candidates . add ( "}" ) ; candidates . add ( ";" ) ; return rollout . getLastChunkIndex ( ) + lastName . length ( ) ; } if ( Util . ROLLBACK_ACROSS_GROUPS . startsWith ( lastName ) ) { candidates . add ( Util . ROLLBACK_ACROSS_GROUPS ) ; } return rollout . getLastChunkIndex ( ) ; } final List < String > serverGroups = Util . getServerGroups ( ctx . getModelControllerClient ( ) ) ; boolean containsAllGroups = true ; for ( String group : serverGroups ) { if ( ! rollout . containsGroup ( group ) ) { containsAllGroups = false ; break ; } } if ( rollout . endsOnGroupSeparator ( ) ) { if ( containsAllGroups ) { return - 1 ; } for ( String group : serverGroups ) { if ( ! rollout . containsGroup ( group ) ) { candidates . add ( group ) ; } } return buffer . length ( ) ; } final SingleRolloutPlanGroup lastGroup = rollout . getLastGroup ( ) ; if ( lastGroup == null ) { return - 1 ; } if ( lastGroup . endsOnPropertyListEnd ( ) ) { if ( ! containsAllGroups ) { candidates . add ( "^" ) ; candidates . add ( "," ) ; } else if ( Character . isWhitespace ( buffer . charAt ( buffer . length ( ) - 1 ) ) ) { candidates . add ( Util . ROLLBACK_ACROSS_GROUPS ) ; } else { candidates . add ( " " ) ; } return buffer . length ( ) ; } if ( lastGroup . endsOnPropertyListStart ( ) ) { candidates . add ( Util . MAX_FAILED_SERVERS ) ; candidates . add ( Util . MAX_FAILURE_PERCENTAGE ) ; candidates . add ( Util . ROLLING_TO_SERVERS ) ; candidates . add ( Util . NOT_OPERATOR ) ; return buffer . length ( ) ; } // Only return the set of boolean properties if ( lastGroup . endsOnNotOperator ( ) ) { candidates . add ( Util . ROLLING_TO_SERVERS ) ; return buffer . length ( ) ; } if ( lastGroup . hasProperties ( ) ) { // To propose the right end character boolean containsAll = lastGroup . hasProperty ( Util . MAX_FAILED_SERVERS ) && lastGroup . hasProperty ( Util . MAX_FAILURE_PERCENTAGE ) && lastGroup . hasProperty ( Util . ROLLING_TO_SERVERS ) ; final String propValue = lastGroup . getLastPropertyValue ( ) ; if ( propValue != null ) { if ( Util . TRUE . startsWith ( propValue ) ) { candidates . add ( Util . TRUE ) ; } else if ( Util . FALSE . startsWith ( propValue ) ) { candidates . add ( Util . FALSE ) ; } else { candidates . add ( containsAll ? ")" : "," ) ; return buffer . length ( ) ; } } else if ( lastGroup . endsOnPropertyValueSeparator ( ) ) { if ( Util . ROLLING_TO_SERVERS . equals ( lastGroup . getLastPropertyName ( ) ) ) { candidates . add ( Util . FALSE ) ; candidates . add ( containsAll ? ")" : "," ) ; } return buffer . length ( ) ; } else if ( lastGroup . endsOnPropertySeparator ( ) ) { if ( ! lastGroup . hasProperty ( Util . MAX_FAILED_SERVERS ) ) { candidates . add ( Util . MAX_FAILED_SERVERS ) ; } if ( ! lastGroup . hasProperty ( Util . MAX_FAILURE_PERCENTAGE ) ) { candidates . add ( Util . MAX_FAILURE_PERCENTAGE ) ; } if ( ! lastGroup . hasProperty ( Util . ROLLING_TO_SERVERS ) ) { candidates . add ( Util . ROLLING_TO_SERVERS ) ; candidates . add ( Util . NOT_OPERATOR ) ; } return lastGroup . getLastSeparatorIndex ( ) + 1 ; } else { final String propName = lastGroup . getLastPropertyName ( ) ; if ( Util . MAX_FAILED_SERVERS . startsWith ( propName ) ) { candidates . add ( Util . MAX_FAILED_SERVERS + '=' ) ; } if ( Util . MAX_FAILURE_PERCENTAGE . startsWith ( propName ) ) { candidates . add ( Util . MAX_FAILURE_PERCENTAGE + '=' ) ; } else if ( Util . ROLLING_TO_SERVERS . equals ( propName ) ) { if ( lastGroup . isLastPropertyNegated ( ) && ! containsAll ) { candidates . add ( Util . ROLLING_TO_SERVERS + "," ) ; } else { candidates . add ( "=" + Util . FALSE ) ; if ( ! containsAll ) { candidates . add ( "," ) ; } else { candidates . add ( ")" ) ; } } } else if ( Util . ROLLING_TO_SERVERS . startsWith ( propName ) ) { candidates . add ( Util . ROLLING_TO_SERVERS ) ; } } if ( candidates . isEmpty ( ) && containsAll ) { candidates . add ( ")" ) ; } return lastGroup . getLastChunkIndex ( ) ; } if ( Character . isWhitespace ( buffer . charAt ( buffer . length ( ) - 1 ) ) ) { candidates . add ( Util . ROLLBACK_ACROSS_GROUPS ) ; return buffer . length ( ) ; } int result = lastGroup . getLastChunkIndex ( ) ; final String groupName = lastGroup . getGroupName ( ) ; boolean isLastGroup = false ; for ( String group : serverGroups ) { if ( group . equals ( groupName ) ) { isLastGroup = true ; } if ( ! isLastGroup && group . startsWith ( groupName ) ) { candidates . add ( group ) ; } } if ( Util . NAME . startsWith ( groupName ) ) { candidates . add ( "name=" ) ; } else { if ( candidates . isEmpty ( ) ) { if ( isLastGroup ) { candidates . add ( "(" ) ; if ( containsAllGroups ) { candidates . add ( Util . ROLLBACK_ACROSS_GROUPS ) ; } else { candidates . add ( "," ) ; candidates . add ( "^" ) ; } } } } return result ;
public class CertificateUtil { /** * JGLOBUS - 91 */ public static CertPath getCertPath ( X509Certificate [ ] certs ) throws CertificateException { } }
CertificateFactory factory = CertificateFactory . getInstance ( "X.509" ) ; return factory . generateCertPath ( Arrays . asList ( certs ) ) ;
public class BootstrapConnector { /** * Disconnects from an OOo server using the connection string from the * previous connect . * If there has been no previous connect , the disconnects does nothing . * If there has been a previous connect , disconnect tries to terminate * the OOo server and kills the OOo server process the connect started . */ public void disconnect ( ) { } }
if ( oooConnectionString == null ) return ; // call office to terminate itself try { // get local context XComponentContext xLocalContext = getLocalContext ( ) ; // create a URL resolver XUnoUrlResolver xUrlResolver = UnoUrlResolver . create ( xLocalContext ) ; // get remote context XComponentContext xRemoteContext = getRemoteContext ( xUrlResolver ) ; // get desktop to terminate office Object desktop = xRemoteContext . getServiceManager ( ) . createInstanceWithContext ( "com.sun.star.frame.Desktop" , xRemoteContext ) ; XDesktop xDesktop = ( XDesktop ) UnoRuntime . queryInterface ( XDesktop . class , desktop ) ; xDesktop . terminate ( ) ; } catch ( Exception e ) { // Bad luck , unable to terminate office } oooServer . kill ( ) ; oooConnectionString = null ;
public class MpxjQuery { /** * This method displays the resource assignments for each task . This time * rather than just iterating through the list of all assignments in * the file , we extract the assignments on a task - by - task basis . * @ param file MPX file */ private static void listAssignmentsByTask ( ProjectFile file ) { } }
for ( Task task : file . getTasks ( ) ) { System . out . println ( "Assignments for task " + task . getName ( ) + ":" ) ; for ( ResourceAssignment assignment : task . getResourceAssignments ( ) ) { Resource resource = assignment . getResource ( ) ; String resourceName ; if ( resource == null ) { resourceName = "(null resource)" ; } else { resourceName = resource . getName ( ) ; } System . out . println ( " " + resourceName ) ; } } System . out . println ( ) ;
public class NestedClassWriterImpl { /** * { @ inheritDoc } */ protected Content getDeprecatedLink ( ProgramElementDoc member ) { } }
return writer . getQualifiedClassLink ( LinkInfoImpl . Kind . MEMBER , ( ClassDoc ) member ) ;
public class BurlapSkeleton { /** * Invoke the object with the request from the input stream . * @ param in the Burlap input stream * @ param out the Burlap output stream */ public void invoke ( BurlapInput in , BurlapOutput out ) throws Exception { } }
invoke ( _service , in , out ) ;
public class OpenWatcomCompiler { /** * Get define switch . * @ param buffer * StringBuffer buffer * @ param define * String preprocessor macro * @ param value * String value , may be null . */ @ Override protected final void getDefineSwitch ( final StringBuffer buffer , final String define , final String value ) { } }
OpenWatcomProcessor . getDefineSwitch ( buffer , define , value ) ;
public class SibRaConnection { /** * Returns the current container transaction , if any . * @ return the current container transaction * @ throws SIResourceException * if lazy association or lazy enlistment fails */ private SITransaction getContainerTransaction ( ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getContainerTransaction" ) ; } final SITransaction containerTransaction ; try { // Ensure the connection is associate with a managed connection final SibRaManagedConnection managedConnection = getAssociatedManagedConnection ( ) ; // Obtain the current container transaction from the managed // connection . The connection manager is required to perform lazy // enlistment . containerTransaction = managedConnection . getContainerTransaction ( _connectionFactory . getConnectionManager ( ) ) ; } catch ( ResourceException exception ) { // No FFDC code needed if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw new SIResourceException ( NLS . getFormattedMessage ( "CONTAINER_TRAN_CWSIV0157" , new Object [ ] { exception } , null ) , exception ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "getContainerTransaction" , containerTransaction ) ; } return containerTransaction ;
public class AttributeEditorUtil { /** * creates a single EditorField for the given attribute */ public static AbstractField < ? > createEditorField ( String id , IModel < String > model , final AttributeDefinition attribute , boolean editable ) { } }
if ( attribute . isBoolean ( ) ) { return new CheckboxField ( id , model , attribute , new BooleanFieldValidator ( attribute ) ) ; } StringFieldValidator validator = new StringFieldValidator ( attribute ) ; if ( ! attribute . getOptions ( ) . isEmpty ( ) ) { return new DropdownField ( id , model , attribute , validator ) ; } else if ( attribute . isPassword ( ) ) { return new PasswordField ( id , model , attribute , validator ) ; } else if ( attribute . isOAuth ( ) ) { return new OAuthField ( id , model , attribute , validator ) ; } else { return new InputField ( id , model , attribute , validator , editable ) ; }
public class NumberUtils { /** * Returns whether the first { @ link BigInteger } is bigger than or equal * to the second . * @ param big1 The first { @ link BigInteger } to compare . * @ param big2 The second { @ link BigInteger } to compare . * @ return < code > true < / code > if the first { @ link BigInteger } is bigger * than or equal to the second , otherwise < code > false < / code > . */ public static boolean isBiggerOrEqual ( final BigInteger big1 , final BigInteger big2 ) { } }
final int compared = big1 . compareTo ( big2 ) ; if ( compared >= 0 ) { return true ; } return false ;
public class NonBlockingBufferedOutputStream { /** * Writes the specified byte to this buffered output stream . * @ param b * the byte to be written . * @ exception IOException * if an I / O error occurs . */ @ Override public void write ( final int b ) throws IOException { } }
if ( m_nCount >= m_aBuf . length ) _flushBuffer ( ) ; m_aBuf [ m_nCount ++ ] = ( byte ) b ;
public class RetryableResource { /** * Recovers an exchange using the { @ code channelSupplier } . */ void recoverExchange ( String exchangeName , ResourceDeclaration exchangeDeclaration ) throws Exception { } }
try { log . info ( "Recovering exchange {} via {}" , exchangeName , this ) ; exchangeDeclaration . invoke ( getRecoveryChannel ( ) ) ; } catch ( Exception e ) { log . error ( "Failed to recover exchange {} via {}" , exchangeName , this , e ) ; if ( throwOnRecoveryFailure ( ) || Exceptions . isCausedByConnectionClosure ( e ) ) throw e ; }
public class ExampleTemplateMatching { /** * Demonstrates how to search for matches of a template inside an image * @ param image Image being searched * @ param template Template being looked for * @ param mask Mask which determines the weight of each template pixel in the match score * @ param expectedMatches Number of expected matches it hopes to find * @ return List of match location and scores */ private static List < Match > findMatches ( GrayF32 image , GrayF32 template , GrayF32 mask , int expectedMatches ) { } }
// create template matcher . TemplateMatching < GrayF32 > matcher = FactoryTemplateMatching . createMatcher ( TemplateScoreType . SUM_DIFF_SQ , GrayF32 . class ) ; // Find the points which match the template the best matcher . setImage ( image ) ; matcher . setTemplate ( template , mask , expectedMatches ) ; matcher . process ( ) ; return matcher . getResults ( ) . toList ( ) ;
public class ByteRangeRandomizer { /** * Create a new { @ link ByteRangeRandomizer } . * @ param min min value * @ param max max value * @ param seed initial seed * @ return a new { @ link ByteRangeRandomizer } . */ public static ByteRangeRandomizer aNewByteRangeRandomizer ( final Byte min , final Byte max , final long seed ) { } }
return new ByteRangeRandomizer ( min , max , seed ) ;
public class DenseVectorSupportMethods { /** * WARNING : only returns the right answer for vectors of length < MAX _ SMALL _ DOT _ PRODUCT _ LENGTH * @ param a * @ param b * @ param length * @ return */ public static float smallDotProduct_Float ( float [ ] a , float [ ] b , int length ) { } }
float sumA = 0.0f ; float sumB = 0.0f ; switch ( length ) { case 7 : sumA = a [ 6 ] * b [ 6 ] ; case 6 : sumB = a [ 5 ] * b [ 5 ] ; case 5 : sumA += a [ 4 ] * b [ 4 ] ; case 4 : sumB += a [ 3 ] * b [ 3 ] ; case 3 : sumA += a [ 2 ] * b [ 2 ] ; case 2 : sumB += a [ 1 ] * b [ 1 ] ; case 1 : sumA += a [ 0 ] * b [ 0 ] ; case 0 : default : return sumA + sumB ; }
public class DataTableTools { /** * Inserts a flat list as a tree in a TableCollectionManager . It does * insert data in the right order for the creation of the tree ( parents * must be inserted first ) * @ param list * @ param mng * @ param parentIdGetter */ public static < T extends IHasIntegerId > void insertFlatList ( List < T > list , TableCollectionManager < T > mng , Func1 < T , Integer > parentIdGetter ) { } }
HashSet < Integer > inserted = new HashSet < > ( ) ; List < T > toInsert = new ArrayList < > ( list ) ; List < T > postPoned = new ArrayList < > ( ) ; List < T > inOrder = new ArrayList < > ( ) ; int nbInserted ; while ( ! toInsert . isEmpty ( ) ) { nbInserted = 0 ; while ( ! toInsert . isEmpty ( ) ) { T a = toInsert . remove ( 0 ) ; Integer parentId = parentIdGetter . exec ( a ) ; if ( parentId == null || parentId <= 0 || inserted . contains ( parentId ) || mng . getRowForRecordId ( parentId ) != null ) { inOrder . add ( a ) ; inserted . add ( a . getId ( ) ) ; nbInserted ++ ; } else { postPoned . add ( a ) ; } } toInsert = postPoned ; postPoned = new ArrayList < > ( ) ; if ( nbInserted == 0 && ! toInsert . isEmpty ( ) ) { GWT . log ( "Cannot construct full tree !" ) ; throw new RuntimeException ( "Cannot construct full tree !" ) ; } } for ( T t : inOrder ) mng . getDataPlug ( ) . updated ( t ) ;
public class HttpClientNIOResourceAdaptor { /** * ( non - Javadoc ) * @ see * javax . slee . resource . ResourceAdaptor # getActivityHandle ( java . lang . Object ) */ public ActivityHandle getActivityHandle ( Object arg0 ) { } }
if ( arg0 instanceof HttpClientNIORequestActivityImpl ) { HttpClientNIORequestActivityHandle handle = new HttpClientNIORequestActivityHandle ( ( ( HttpClientNIORequestActivityImpl ) arg0 ) . getId ( ) ) ; if ( activities . containsKey ( handle ) ) { return handle ; } } return null ;
public class RequestParam { /** * Returns a request parameter as enum value . * @ param < T > Enum type * @ param request Request . * @ param param Parameter name . * @ param enumClass Enum class * @ return Parameter value or null if it is not set or an invalid enum value . */ public static < T extends Enum > @ Nullable T getEnum ( @ NotNull ServletRequest request , @ NotNull String param , @ NotNull Class < T > enumClass ) { } }
return getEnum ( request , param , enumClass , null ) ;
public class ReportMaker { /** * Make an html bootstrap tag with our custom css class . */ static void tag ( StringBuilder sb , String color , String text ) { } }
sb . append ( "<span class='label label" ) ; if ( color != null ) { sb . append ( "-" ) . append ( color ) ; } String classText = text . replace ( ' ' , '_' ) ; sb . append ( " l-" ) . append ( classText ) . append ( "'>" ) . append ( text ) . append ( "</span>" ) ;
public class FileUtil { /** * Gets the extension part of the specified file name . * @ param fileName The name of the file to get the extension of . * @ return The extension of the file name . */ public static String getExtension ( String fileName ) { } }
int pos = fileName . lastIndexOf ( '.' ) ; if ( pos < 0 ) { return "" ; } return fileName . substring ( pos + 1 ) ;
public class TextBlock { /** * Creates a canvas image large enough to accommodate this text block and renders the lines into * it . The image will include padding around the edge to ensure that antialiasing has a bit of * extra space to do its work . */ public Canvas toCanvas ( Graphics gfx , Align align , int fillColor ) { } }
float pad = 1 / gfx . scale ( ) . factor ; Canvas canvas = gfx . createCanvas ( bounds . width ( ) + 2 * pad , bounds . height ( ) + 2 * pad ) ; canvas . setFillColor ( fillColor ) ; fill ( canvas , align , pad , pad ) ; return canvas ;
public class TelescopeFileProvider { /** * Calls { @ link # getUriForFile ( Context , String , File ) } using the correct authority for Telescope * screenshots . */ public static Uri getUriForFile ( Context context , File file ) { } }
return getUriForFile ( context , context . getPackageName ( ) + ".telescope.fileprovider" , file ) ;
public class MemoryRemoteTable { /** * Update the current record . * @ param The data to update . * @ exception Exception File exception . */ public void set ( Object data , int iOpenMode ) throws DBException , RemoteException { } }
if ( m_objCurrentKey == null ) throw new DBException ( Constants . INVALID_RECORD ) ; Object key = this . getKey ( data ) ; if ( ! key . equals ( m_objCurrentKey ) ) m_mDataMap . remove ( key ) ; m_mDataMap . put ( key , data ) ; // Replace the data at this position m_objCurrentKey = null ;
public class MigrationResource { /** * < p > migrateView . < / p > * @ param uuid a { @ link java . lang . String } object . * @ return a { @ link javax . ws . rs . core . Response } object . */ @ GET @ Path ( "{uuid}" ) // uuid or dbName public Response migrateView ( @ PathParam ( "uuid" ) String uuid ) { } }
try { MigrationFeature . checkMigrationId ( uuid ) ; } catch ( NotFoundException e ) { Flyway flyway = locator . getService ( Flyway . class , uuid ) ; if ( flyway == null ) throw new NotFoundException ( ) ; return Response . ok ( flyway . info ( ) . all ( ) ) . build ( ) ; } Map < String , Migration > migrations = getMigrations ( ) ; Map < String , String > model = buildPageModel ( MigrationType . MIGRATE , uuid ) ; String desc = model . get ( "description" ) . concat ( "&nbsp; - &nbsp;<input name=\"description\" placeholder=\"" + Messages . get ( "view.app.database.migrate.description.placeholder" ) + "\">" ) ; model . put ( "description" , desc ) ; StringBuilder tabs = new StringBuilder ( ) ; StringBuilder diffs = new StringBuilder ( ) ; StrSubstitutor sub = new StrSubstitutor ( model ) ; int i = 0 ; for ( String dbName : migrations . keySet ( ) ) { Migration migration = migrations . get ( dbName ) ; ScriptInfo info = migration . generate ( ) ; Flyway flyway = locator . getService ( Flyway . class , dbName ) ; boolean hasTable ; try ( Connection connection = flyway . getDataSource ( ) . getConnection ( ) ) { hasTable = connection . getMetaData ( ) . getTables ( null , null , flyway . getTable ( ) , null ) . next ( ) ; } catch ( SQLException e ) { throw new AmebaException ( e ) ; } tabs . append ( "<li i=\"" ) . append ( i ) . append ( "\" class=\"db-name\">" ) . append ( dbName ) . append ( "</li>" ) ; diffs . append ( "<div class=\"diff\"><h2>" ) ; if ( hasTable ) { diffs . append ( Messages . get ( "view.app.database.migrate.subTitle" ) ) ; } else { diffs . append ( Messages . get ( "view.app.database.migrate.baseline.subTitle" ) ) ; } diffs . append ( "</h2><pre>" ) . append ( info . getApplyDdl ( ) ) . append ( "</pre></div>" ) ; i ++ ; } model . put ( "dbNames" , tabs . toString ( ) ) ; model . put ( "diffs" , diffs . toString ( ) ) ; return Response . ok ( sub . replace ( MIGRATION_HTML ) ) . type ( MediaType . TEXT_HTML_TYPE ) . build ( ) ;
public class JwtEndpointServices { /** * End OSGi - related fields and methods */ protected void handleEndpointRequest ( HttpServletRequest request , HttpServletResponse response , ServletContext servletContext ) throws IOException { } }
JwtRequest jwtRequest = getJwtRequest ( request , response ) ; if ( jwtRequest == null ) { // Error redirect already taken care of return ; } String jwtConfigId = jwtRequest . getJwtConfigId ( ) ; JwtConfig jwtConfig = getJwtConfig ( response , jwtConfigId ) ; if ( jwtConfig == null ) { // Error redirect already taken care of return ; } EndpointType endpointType = jwtRequest . getType ( ) ; handleJwtRequest ( request , response , servletContext , jwtConfig , endpointType ) ;
public class RestClient { /** * Utility method to get the charset from a url connection ' s content type * @ return The charset name */ public static String getCharset ( final String contentType ) { } }
// Default to UTF - 8 String charset = "UTF-8" ; try { // Content type is in the form : // Content - Type : text / html ; charset = utf - 8 // Where they can be lots of params separated by ; characters if ( contentType != null && ! contentType . isEmpty ( ) ) { if ( contentType . contains ( ";" ) ) { String [ ] params = contentType . substring ( contentType . indexOf ( ";" ) ) . split ( ";" ) ; for ( String param : params ) { param = param . trim ( ) ; if ( param . indexOf ( "=" ) > 0 ) { String paramName = param . substring ( 0 , param . indexOf ( "=" ) ) . trim ( ) ; if ( "charset" . equals ( paramName ) && param . length ( ) > ( param . indexOf ( "=" ) + 1 ) ) { String paramValue = param . substring ( param . indexOf ( "=" ) + 1 ) . trim ( ) ; if ( paramValue != null && ! paramValue . isEmpty ( ) && Charset . isSupported ( paramValue ) ) { charset = paramValue ; break ; } } } } } } } catch ( Throwable t ) { // Ignore , we really don ' t want this util killing anything ! } return charset ;
public class RolloutStatusCache { /** * Retrieves cached list of { @ link TotalTargetCountActionStatus } of * { @ link Rollout } s . * @ param rolloutId * to retrieve cache entries for * @ return map of cached entries */ public List < TotalTargetCountActionStatus > getRolloutStatus ( final Long rolloutId ) { } }
final Cache cache = cacheManager . getCache ( CACHE_RO_NAME ) ; return retrieveFromCache ( rolloutId , cache ) ;
public class Inflater { /** * Uncompresses bytes into specified buffer . Returns actual number * of bytes uncompressed . A return value of 0 indicates that * needsInput ( ) or needsDictionary ( ) should be called in order to * determine if more input data or a preset dictionary is required . * In the latter case , getAdler ( ) can be used to get the Adler - 32 * value of the dictionary required . * @ param b the buffer for the uncompressed data * @ param off the start offset of the data * @ param len the maximum number of uncompressed bytes * @ return the actual number of uncompressed bytes * @ exception DataFormatException if the compressed data format is invalid * @ see Inflater # needsInput * @ see Inflater # needsDictionary */ public int inflate ( byte [ ] b , int off , int len ) throws DataFormatException { } }
if ( b == null ) { throw new NullPointerException ( ) ; } if ( off < 0 || len < 0 || off > b . length - len ) { throw new ArrayIndexOutOfBoundsException ( ) ; } synchronized ( zsRef ) { ensureOpen ( ) ; int thisLen = this . len ; int n = inflateBytes ( zsRef . address ( ) , b , off , len ) ; bytesWritten += n ; bytesRead += ( thisLen - this . len ) ; return n ; }
public class CoroutineWriter { /** * Deconstructs a { @ link CoroutineRunner } object to a serializable state . * @ param runner coroutine runner to deconstruct * @ return deconstructed representation of { @ link CoroutineRunner } * @ throws NullPointerException if any argument is { @ code null } * @ throws IllegalArgumentException if failed to deconstruct */ public SerializedState deconstruct ( CoroutineRunner runner ) { } }
if ( runner == null ) { throw new NullPointerException ( ) ; } Coroutine coroutine = runner . getCoroutine ( ) ; Continuation cn = runner . getContinuation ( ) ; int size = cn . getSize ( ) ; VersionedFrame [ ] frames = new VersionedFrame [ size ] ; MethodState currentMethodState = cn . getSaved ( 0 ) ; int idx = 0 ; while ( currentMethodState != null ) { // Pull out information from MethoState . We should never modify MethodState values , they will be copied by the Data // constructor before being passed to the user for further modification . String className = currentMethodState . getClassName ( ) ; int methodId = currentMethodState . getMethodId ( ) ; int continuationPoint = currentMethodState . getContinuationPoint ( ) ; LockState monitors = currentMethodState . getLockState ( ) ; int [ ] intVars = ( ( int [ ] ) currentMethodState . getData ( ) [ 0 ] ) ; float [ ] floatVars = ( ( float [ ] ) currentMethodState . getData ( ) [ 1 ] ) ; long [ ] longVars = ( ( long [ ] ) currentMethodState . getData ( ) [ 2 ] ) ; double [ ] doubleVars = ( ( double [ ] ) currentMethodState . getData ( ) [ 3 ] ) ; Object [ ] objectVars = ( ( Object [ ] ) currentMethodState . getData ( ) [ 4 ] ) ; int [ ] intOperands = ( ( int [ ] ) currentMethodState . getData ( ) [ 5 ] ) ; float [ ] floatOperands = ( ( float [ ] ) currentMethodState . getData ( ) [ 6 ] ) ; long [ ] longOperands = ( ( long [ ] ) currentMethodState . getData ( ) [ 7 ] ) ; double [ ] doubleOperands = ( ( double [ ] ) currentMethodState . getData ( ) [ 8 ] ) ; Object [ ] objectOperands = ( ( Object [ ] ) currentMethodState . getData ( ) [ 9 ] ) ; // Clone the object [ ] buffers because we need to remove references to the Continuation object for this coroutine . objectVars = objectVars == null ? new Object [ 0 ] : ( Object [ ] ) objectVars . clone ( ) ; int [ ] continuationPositionsInObjectVars = clearContinuationReferences ( objectVars , cn ) ; objectOperands = objectOperands == null ? new Object [ 0 ] : ( Object [ ] ) objectOperands . clone ( ) ; int [ ] continuationPositionsInObjectOperands = clearContinuationReferences ( objectOperands , cn ) ; // Create the frame , making sure we create empty arrays for any null references ( remember that MethodState var / operand arrays // that don ' t contain any data are set to null due to an optimization ) . Frame serializedFrame = new Frame ( className , methodId , continuationPoint , monitors == null ? new Object [ 0 ] : monitors . toArray ( ) , new Data ( intVars == null ? new int [ 0 ] : intVars , floatVars == null ? new float [ 0 ] : floatVars , longVars == null ? new long [ 0 ] : longVars , doubleVars == null ? new double [ 0 ] : doubleVars , objectVars , continuationPositionsInObjectVars ) , new Data ( intOperands == null ? new int [ 0 ] : intOperands , floatOperands == null ? new float [ 0 ] : floatOperands , longOperands == null ? new long [ 0 ] : longOperands , doubleOperands == null ? new double [ 0 ] : doubleOperands , objectOperands , continuationPositionsInObjectOperands ) ) ; // Add all possible down - versions for frame into a versionedframe object and add it VersionedFrame versionedFrame = SerializationUtils . calculateAllPossibleFrameVersions ( null , updatersMap , interceptersMap , serializedFrame ) ; frames [ idx ] = versionedFrame ; idx ++ ; currentMethodState = currentMethodState . getNext ( ) ; } Object context = cn . getContext ( ) ; return new SerializedState ( coroutine , context , frames ) ;
public class CSVUtil { /** * Imports the data from CSV to database . * @ param file * @ param offset * @ param count * @ param skipTitle * @ param filter * @ param stmt the column order in the sql must be consistent with the column order in the CSV file . * @ param batchSize * @ param batchInterval * @ param columnTypeList set the column type to null to skip the column in CSV . * @ return */ @ SuppressWarnings ( "rawtypes" ) public static < E extends Exception > long importCSV ( final File file , final long offset , final long count , final boolean skipTitle , final Try . Predicate < String [ ] , E > filter , final PreparedStatement stmt , final int batchSize , final int batchInterval , final List < ? extends Type > columnTypeList ) throws UncheckedSQLException , UncheckedIOException , E { } }
Reader reader = null ; try { reader = new FileReader ( file ) ; return importCSV ( reader , offset , count , skipTitle , filter , stmt , batchSize , batchInterval , columnTypeList ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } finally { IOUtil . close ( reader ) ; }
public class Database { public void put_device_attribute_property ( String devname , DbAttribute [ ] attr ) throws DevFailed { } }
databaseDAO . put_device_attribute_property ( this , devname , attr ) ;
public class GrouperEntityGroupStoreFactory { /** * returns the instance of GrouperEntityGroupStore . * @ return The instance . * @ throws GroupsException if there is an error * @ see IEntityGroupStoreFactory # newGroupStore ( ) */ public static synchronized IEntityGroupStore getGroupStore ( ) { } }
if ( groupStore == null ) { groupStore = new GrouperEntityGroupStore ( ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "returning IEntityGroupStore: " + groupStore ) ; } return groupStore ;
public class TiffReader { /** * Parses a Tiff File and create an internal model representation . * @ param filename the Tiff filename * @ return Error code ( 0 : successful , - 1 : file not found , - 2 : IO exception ) */ public int readFile ( String filename , boolean validate ) { } }
int result = 0 ; try { if ( Files . exists ( Paths . get ( filename ) ) ) { data = new TiffInputStream ( new File ( filename ) ) ; tiffModel = new TiffDocument ( ) ; validation = new ValidationResult ( validate ) ; tiffModel . setSize ( data . size ( ) ) ; boolean correctHeader = readHeader ( ) ; if ( correctHeader ) { if ( tiffModel . getMagicNumber ( ) < 42 ) { validation . addError ( "Incorrect tiff magic number" , "Header" , tiffModel . getMagicNumber ( ) ) ; } else if ( tiffModel . getMagicNumber ( ) == 43 ) { validation . addErrorLoc ( "Big tiff file not yet supported" , "Header" ) ; } else if ( validation . isCorrect ( ) ) { readIFDs ( ) ; if ( validate ) { BaselineProfile bp = new BaselineProfile ( tiffModel ) ; bp . validate ( ) ; getBaselineValidation ( ) . add ( bp . getValidation ( ) ) ; } } } if ( getBaselineValidation ( ) . getFatalError ( ) ) { tiffModel . setFatalError ( true , getBaselineValidation ( ) . getFatalErrorMessage ( ) ) ; } data . close ( ) ; } else { // File not found result = - 1 ; tiffModel . setFatalError ( true , "File not found" ) ; } } catch ( Exception ex ) { // IO exception result = - 2 ; tiffModel . setFatalError ( true , "IO Exception" ) ; } return result ;
import java . util . * ; class SwitchPositions { /** * This method switches the position of every nth value with ( n + 1 ) th value in a given list . * Examples : * switchPositions ( Arrays . asList ( 0 , 1 , 2 , 3 , 4 , 5 ) ) - > [ 1 , 0 , 3 , 2 , 5 , 4] * switchPositions ( Arrays . asList ( 5 , 6 , 7 , 8 , 9 , 10 ) ) - > [ 6 , 5 , 8 , 7 , 10 , 9] * switchPositions ( Arrays . asList ( 25 , 35 , 45 , 55 , 75 , 95 ) ) - > [ 35 , 25 , 55 , 45 , 95 , 75] * Args : * elems : A list . * Returns : * A list where each nth element has been swapped with the ( n + 1 ) th element . */ public static List < Integer > switchPositions ( List < Integer > elems ) { } }
for ( int i = 0 ; i < elems . size ( ) - 1 ; i += 2 ) { int temp = elems . get ( i ) ; elems . set ( i , elems . get ( i + 1 ) ) ; elems . set ( i + 1 , temp ) ; } return elems ;
public class RequestDesc { /** * calculate the unique key of that request */ private String _getUniqueKey ( ) { } }
StringBuilder b = new StringBuilder ( ) ; b . append ( service ) ; b . append ( "#" ) ; b . append ( method ) ; if ( params != null ) { b . append ( "#" ) ; b . append ( params . toString ( ) ) ; } return b . toString ( ) ;
public class RandomUtils { /** * 获取随机颜色 * @ param opacity 不透明度 * @ return { @ link SimpleColor } */ public static SimpleColor getRandomColor ( double opacity ) { } }
Random ran = new Random ( ) ; int b = ran . nextInt ( 255 ) ; int r = 255 - b ; return new SimpleColor ( b + ran . nextInt ( r ) , b + ran . nextInt ( r ) , b + ran . nextInt ( r ) , opacity ) ;
public class PropPatchResponseEntity { /** * Removes the property . * @ param node node * @ param property property * @ return status */ private String removeProperty ( Node node , HierarchicalProperty property ) { } }
try { node . getProperty ( property . getStringName ( ) ) . remove ( ) ; node . save ( ) ; return WebDavConst . getStatusDescription ( HTTPStatus . OK ) ; } catch ( AccessDeniedException e ) { return WebDavConst . getStatusDescription ( HTTPStatus . FORBIDDEN ) ; } catch ( ItemNotFoundException e ) { return WebDavConst . getStatusDescription ( HTTPStatus . NOT_FOUND ) ; } catch ( PathNotFoundException e ) { return WebDavConst . getStatusDescription ( HTTPStatus . NOT_FOUND ) ; } catch ( RepositoryException e ) { return WebDavConst . getStatusDescription ( HTTPStatus . CONFLICT ) ; }
public class ColumnBlob { /** * Writes the blob column to the journal . Large blobs are written to the * page store and the reference is written to the journal . */ @ Override void writeJournal ( OutputStream os , byte [ ] buffer , int offset , BlobOutputStream blob ) throws IOException { } }
if ( blob == null ) { BitsUtil . writeInt16 ( os , 0 ) ; return ; } if ( blob . isLargeBlob ( ) ) { blob . flushBlob ( ) ; BitsUtil . writeInt16 ( os , LARGE_BLOB_MASK | 4 ) ; BitsUtil . writeInt ( os , blob . getBlobId ( ) ) ; return ; } int len = blob . getSize ( ) ; if ( len >= 32 * 1024 ) { throw new IllegalStateException ( "TOO_BIG: " + len ) ; } BitsUtil . writeInt16 ( os , len ) ; blob . writeToStream ( os ) ;
public class JsonWriter { /** * Inserts any necessary separators and whitespace before a literal value , * inline array , or inline object . Also adjusts the stack to expect either a * closing bracket or another element . * @ param root true if the value is a new array or object , the two values * permitted as top - level elements . */ private void beforeValue ( boolean root ) throws IOException { } }
switch ( peek ( ) ) { case EMPTY_DOCUMENT : // first in document if ( ! lenient && ! root ) { throw new IllegalStateException ( "JSON must start with an array or an object." ) ; } replaceTop ( JsonScope . NONEMPTY_DOCUMENT ) ; break ; case EMPTY_ARRAY : // first in array replaceTop ( JsonScope . NONEMPTY_ARRAY ) ; newline ( ) ; break ; case NONEMPTY_ARRAY : // another in array out . append ( ',' ) ; newline ( ) ; break ; case DANGLING_NAME : // value for name out . append ( separator ) ; replaceTop ( JsonScope . NONEMPTY_OBJECT ) ; break ; case NONEMPTY_DOCUMENT : throw new IllegalStateException ( "JSON must have only one top-level value." ) ; default : throw new IllegalStateException ( "Nesting problem: " + stack ) ; }
public class PackratParser { /** * This class reads all hidden and ignored tokens from the text and puts them * into the node as children . * This is the recursive part of the procedure . * Attention : This method is package private for testing purposes ! * @ param node * @ param position * @ return * @ throws TreeException * @ throws ParserException */ MemoEntry processIgnoredTokens ( ParseTreeNode node , int position , int line ) throws TreeException , ParserException { } }
MemoEntry progress = MemoEntry . success ( 0 , 0 , node ) ; MemoEntry newProgress = MemoEntry . success ( 0 , 0 , null ) ; do { for ( TokenDefinition tokenDefinition : hiddenAndIgnoredTokens ) { newProgress = processTokenDefinition ( node , tokenDefinition , position + progress . getDeltaPosition ( ) , line + progress . getDeltaLine ( ) ) ; if ( ! newProgress . getAnswer ( ) . equals ( Status . FAILED ) ) { progress . add ( newProgress ) ; break ; } } } while ( newProgress . getDeltaPosition ( ) > 0 ) ; return progress ;
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public FontDescriptorSpecificationFtDsFlags createFontDescriptorSpecificationFtDsFlagsFromString ( EDataType eDataType , String initialValue ) { } }
FontDescriptorSpecificationFtDsFlags result = FontDescriptorSpecificationFtDsFlags . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class PRAcroForm { /** * Given the title ( / T ) of a reference , return the associated reference * @ param name a string containing the path * @ return a reference to the field , or null */ public PRIndirectReference getRefByName ( String name ) { } }
FieldInformation fi = ( FieldInformation ) fieldByName . get ( name ) ; if ( fi == null ) return null ; return fi . getRef ( ) ;
public class ChartConfiguration { /** * Sets the label x . * @ param label * the new label x * @ return ChartConfiguration */ public ChartConfiguration < T > setLabelX ( String label ) { } }
if ( label != null ) { axesInstance ( ) . xAxisInstance ( ) . setLabel ( label ) ; } return this ;
public class Arguments { /** * Sets an argument to the collection of arguments . This guarantees only one value will be assigned to the * argument key . * @ param argument the argument to add */ public void set ( final Argument argument ) { } }
if ( argument != null ) { map . put ( argument . getKey ( ) , Collections . singleton ( argument ) ) ; }
public class ThreeDHashMap { /** * Fetch the outermost Hashmap as a TwoDHashMap . * @ param firstKey * first key * @ return the the innermost hashmap */ public TwoDHashMap < K2 , K3 , V > getAs2d ( final K1 firstKey ) { } }
final HashMap < K2 , HashMap < K3 , V > > innerMap1 = map . get ( firstKey ) ; if ( innerMap1 != null ) { return new TwoDHashMap < K2 , K3 , V > ( innerMap1 ) ; } else { return new TwoDHashMap < K2 , K3 , V > ( ) ; }
public class ParadataManager { /** * Return all submissions using the specified verb from the specified submitter for the resource * @ param submitter * @ param resourceUrl * @ return * @ throws Exception */ public List < ISubmission > getSubmissionsForSubmitter ( ISubmitter submitter , String resourceUrl , String verb ) throws Exception { } }
return new SubmitterSubmissionsFilter ( ) . include ( new NormalizingFilter ( IRating . VERB ) . filter ( getSubmissions ( resourceUrl ) ) , submitter ) ;
public class HTODDependencyTable { /** * This removes the specified entry from the specified dependency . * @ param dependency The dependency . * @ param result */ public Result removeEntry ( Object dependency , Object entry ) { } }
Result result = this . htod . getFromResultPool ( ) ; ValueSet valueSet = ( ValueSet ) dependencyToEntryTable . get ( dependency ) ; if ( valueSet == null ) { return result ; } result . bExist = HTODDynacache . EXIST ; valueSet . remove ( entry ) ; dependencyNotUpdatedTable . remove ( dependency ) ; if ( valueSet . isEmpty ( ) ) { dependencyToEntryTable . remove ( dependency ) ; if ( this . type == DEP_ID_TABLE ) { result . returnCode = this . htod . delValueSet ( HTODDynacache . DEP_ID_DATA , dependency ) ; } else { result . returnCode = this . htod . delValueSet ( HTODDynacache . TEMPLATE_ID_DATA , dependency ) ; } } return result ;
public class ItemsAuxiliary { /** * Assuming that there are n items in the true stream , this asks what * item would appear in position 0 & le ; pos & lt ; n of a hypothetical sorted * version of that stream . * < p > Note that since that since the true stream is unavailable , * we don ' t actually answer the question for that stream , but rather for * a < i > different < / i > stream of the same length , that could hypothetically * be reconstructed from the weighted samples in our sketch . * @ param pos position * @ return approximate answer */ @ SuppressWarnings ( "unchecked" ) private T approximatelyAnswerPositionalQuery ( final long pos ) { } }
assert 0 <= pos ; assert pos < auxN_ ; final int index = QuantilesHelper . chunkContainingPos ( auxCumWtsArr_ , pos ) ; return ( T ) this . auxSamplesArr_ [ index ] ;
public class BlockPlacementPolicy { /** * Get an instance of the configured Block Placement Policy based on the * value of the configuration paramater dfs . block . replicator . classname . * @ param conf the configuration to be used * @ param stats an object thatis used to retrieve the load on the cluster * @ param clusterMap the network topology of the cluster * @ param namesystem the FSNamesystem * @ return an instance of BlockPlacementPolicy */ public static BlockPlacementPolicy getInstance ( Configuration conf , FSClusterStats stats , NetworkTopology clusterMap , HostsFileReader hostsReader , DNSToSwitchMapping dnsToSwitchMapping , FSNamesystem namesystem ) { } }
Class < ? extends BlockPlacementPolicy > replicatorClass = conf . getClass ( "dfs.block.replicator.classname" , BlockPlacementPolicyDefault . class , BlockPlacementPolicy . class ) ; BlockPlacementPolicy replicator = ( BlockPlacementPolicy ) ReflectionUtils . newInstance ( replicatorClass , conf ) ; replicator . initialize ( conf , stats , clusterMap , hostsReader , dnsToSwitchMapping , namesystem ) ; return replicator ;
public class RemoteHttpServiceImpl { /** * { @ inheritDoc } */ public String buildGetRequest ( String remoteHost , OperationType operationType , LinkedHashMap < String , String > arguments ) { } }
String moduleName = operationType . getModuleName ( ) ; String operationName = operationType . getOperationName ( ) ; String urlGet = new StringBuffer ( "http://" ) . append ( remoteHost ) . append ( ":" ) . append ( Constants . DAVIDBOX_PORT ) . append ( "/" ) . append ( moduleName ) . append ( "?arg0=" ) . append ( operationName ) . append ( buildEncodedParameters ( arguments ) ) . toString ( ) ; return urlGet ;
public class ProcessCommonJSModules { /** * UMD modules are often wrapped in an IIFE for cases where they are used as scripts instead of * modules . Remove the wrapper . * @ return Whether an IIFE wrapper was found and removed . */ private boolean removeIIFEWrapper ( Node root ) { } }
checkState ( root . isScript ( ) ) ; Node n = root . getFirstChild ( ) ; // Sometimes scripts start with a semicolon for easy concatenation . // Skip any empty statements from those while ( n != null && n . isEmpty ( ) ) { n = n . getNext ( ) ; } // An IIFE wrapper must be the only non - empty statement in the script , // and it must be an expression statement . if ( n == null || ! n . isExprResult ( ) || n . getNext ( ) != null ) { return false ; } // Function expression can be forced with ! , just skip ! // TODO ( ChadKillingsworth ) : // Expression could also be forced with : + - ~ void // ! ~ void can be repeated any number of times if ( n != null && n . getFirstChild ( ) != null && n . getFirstChild ( ) . isNot ( ) ) { n = n . getFirstChild ( ) ; } Node call = n . getFirstChild ( ) ; if ( call == null || ! call . isCall ( ) ) { return false ; } // Find the IIFE call and function nodes Node fnc ; if ( call . getFirstChild ( ) . isFunction ( ) ) { fnc = n . getFirstFirstChild ( ) ; } else if ( call . getFirstChild ( ) . isGetProp ( ) && call . getFirstFirstChild ( ) . isFunction ( ) && call . getFirstFirstChild ( ) . getNext ( ) . isString ( ) && call . getFirstFirstChild ( ) . getNext ( ) . getString ( ) . equals ( "call" ) ) { fnc = call . getFirstFirstChild ( ) ; // We only support explicitly binding " this " to the parent " this " or " exports " if ( ! ( call . getSecondChild ( ) != null && ( call . getSecondChild ( ) . isThis ( ) || call . getSecondChild ( ) . matchesQualifiedName ( EXPORTS ) ) ) ) { return false ; } } else { return false ; } if ( NodeUtil . doesFunctionReferenceOwnArgumentsObject ( fnc ) ) { return false ; } CompilerInput ci = compiler . getInput ( root . getInputId ( ) ) ; ModulePath modulePath = ci . getPath ( ) ; if ( modulePath == null ) { return false ; } String iifeLabel = getModuleName ( modulePath ) + "_iifeWrapper" ; FunctionToBlockMutator mutator = new FunctionToBlockMutator ( compiler , compiler . getUniqueNameIdSupplier ( ) ) ; Node block = mutator . mutateWithoutRenaming ( iifeLabel , fnc , call , null , false , false ) ; root . removeChildren ( ) ; root . addChildrenToFront ( block . removeChildren ( ) ) ; reportNestedScopesDeleted ( fnc ) ; compiler . reportChangeToEnclosingScope ( root ) ; return true ;
public class Task { /** * Construct a task from { @ code Properties } . This method is used on the * receiving side . That is , it is used to construct a { @ code Task } from an * HttpRequest sent from the App Engine task queue . { @ code properties } must * contain a property named { @ link # TASK _ TYPE _ PARAMETER } . In addition it must * contain the properties specified by the concrete subclass of this class * corresponding to the task type . */ public static Task fromProperties ( String taskName , Properties properties ) { } }
String taskTypeString = properties . getProperty ( TASK_TYPE_PARAMETER ) ; if ( null == taskTypeString ) { throw new IllegalArgumentException ( TASK_TYPE_PARAMETER + " property is missing: " + properties . toString ( ) ) ; } Type type = Type . valueOf ( taskTypeString ) ; return type . createInstance ( taskName , properties ) ;
public class HelperBase { /** * First character to lower case . */ public String toFirstLower ( String name ) { } }
if ( name . length ( ) == 0 ) { return name ; } else { return name . substring ( 0 , 1 ) . toLowerCase ( ) + name . substring ( 1 ) ; }
public class ACpuClassDefinitionAssistantInterpreter { /** * Will redeploy the object and all object transitive referenced by this to the supplied cpu . Redeploy means that * the transitive reference to and from our creator is no longer needed , and will be removed . This only applies to * this object , as it is on the top of the hierarchy , all children will be updated with the * < tt > updateCPUandChildrenCPUs < / tt > method which recursively updates all transitive references with the new CPU , * but without removing the parent - child relation . * @ param the * object value to deploy * @ param the * target CPU of the redeploy */ private void redeploy ( ObjectValue obj , CPUValue cpu ) { } }
updateCPUandChildCPUs ( obj , cpu ) ; // if we are moving to a new CPU , we are no longer a part of the transitive // references from our creator , so let us remove ourself . This will prevent // us from being updated if our creator is migrating in the // future . obj . removeCreator ( ) ;
public class CryptoHash { /** * Calculate a SHA - 1 hash code . * @ param data the byte array to be hashed * @ return the hash code as an array of 5 int ' s */ private static int [ ] calculate ( byte [ ] data ) { } }
int A = 0x67452301 ; int B = 0xEFCDAB89 ; int C = 0x98BADCFE ; int D = 0x10325476 ; int E = 0xC3D2E1F0 ; int [ ] W = new int [ 80 ] ; // working buffer int len = data . length ; int off = 0 ; int X , i , n = len / 4 ; boolean done = false ; boolean padded = false ; while ( ! done ) { // Fill W array for ( i = 0 ; ( i < 16 ) && ( n > 0 ) ; n -- , off += 4 ) W [ i ++ ] = ( data [ off + 3 ] & 0xFF ) | ( ( data [ off + 2 ] & 0xFF ) << 8 ) | ( ( data [ off + 1 ] & 0xFF ) << 16 ) | ( ( data [ off ] & 0xFF ) << 24 ) ; if ( i < 16 ) { // pad if ( ! padded ) { // first time past end of data X = len % 4 ; int pad1 = 0 ; for ( int j = 0 ; j < X ; ++ j ) { pad1 |= ( ( int ) ( data [ off + j ] & 0xFF ) ) << ( 24 - 8 * j ) ; } W [ i ++ ] = pad1 | ( 1 << ( 31 - X * 8 ) ) ; // W [ i + + ] = ( X ! = 0 ) ? ( ( ( int ) msbf ( data , off , X ) < < ( ( 4 - X ) * 8 ) ) | ( 1 < < ( 31 - X * 8 ) ) ) : ( 1 < < 31 ) ; if ( i == 15 ) W [ 15 ] = 0 ; // 64 bit length of data as bits can ' t fit padded = true ; // don ' t pad again if there is another iteration } if ( i <= 14 ) { // last iteration while ( i < 14 ) W [ i ++ ] = 0 ; // bit count = len * 8 W [ 14 ] = len >>> 29 ; W [ 15 ] = len << 3 ; done = true ; } i = 16 ; } do { W [ i ] = ( ( X = W [ i - 3 ] ^ W [ i - 8 ] ^ W [ i - 14 ] ^ W [ i - 16 ] ) << 1 ) | ( X >>> 31 ) ; } while ( ++ i < 80 ) ; // Transform int A0 = A ; int B0 = B ; int C0 = C ; int D0 = D ; int E0 = E ; i = 0 ; do { X = ( ( A << 5 ) | ( A >>> 27 ) ) + ( ( B & C ) | ( ~ B & D ) ) + E + W [ i ] + 0x5A827999 ; E = D ; D = C ; C = ( B << 30 ) | ( B >>> 2 ) ; B = A ; A = X ; } while ( ++ i < 20 ) ; do { X = ( ( A << 5 ) | ( A >>> 27 ) ) + ( B ^ C ^ D ) + E + W [ i ] + 0x6ED9EBA1 ; E = D ; D = C ; C = ( B << 30 ) | ( B >>> 2 ) ; B = A ; A = X ; } while ( ++ i < 40 ) ; do { X = ( ( A << 5 ) | ( A >>> 27 ) ) + ( ( B & C ) | ( B & D ) | ( C & D ) ) + E + W [ i ] + 0x8F1BBCDC ; E = D ; D = C ; C = ( B << 30 ) | ( B >>> 2 ) ; B = A ; A = X ; } while ( ++ i < 60 ) ; do { X = ( ( A << 5 ) | ( A >>> 27 ) ) + ( B ^ C ^ D ) + E + W [ i ] + 0xCA62C1D6 ; E = D ; D = C ; C = ( B << 30 ) | ( B >>> 2 ) ; B = A ; A = X ; } while ( ++ i < 80 ) ; A += A0 ; B += B0 ; C += C0 ; D += D0 ; E += E0 ; } int [ ] result = { A , B , C , D , E } ; return result ;
public class Calendar { /** * Sets the time zone with the given time zone value . * @ param value the given time zone . */ public void setTimeZone ( TimeZone value ) { } }
zone = value ; sharedZone = false ; /* Recompute the fields from the time using the new zone . This also * works if isTimeSet is false ( after a call to set ( ) ) . In that case * the time will be computed from the fields using the new zone , then * the fields will get recomputed from that . Consider the sequence of * calls : cal . setTimeZone ( EST ) ; cal . set ( HOUR , 1 ) ; cal . setTimeZone ( PST ) . * Is cal set to 1 o ' clock EST or 1 o ' clock PST ? Answer : PST . More * generally , a call to setTimeZone ( ) affects calls to set ( ) BEFORE AND * AFTER it up to the next call to complete ( ) . */ areAllFieldsSet = areFieldsSet = false ;
public class ManagedLinkedList { /** * Returns an array of non null elements from the source array . * @ param tArray the source array * @ return the array */ public T [ ] toArray ( T [ ] tArray ) { } }
List < T > array = new ArrayList < T > ( 100 ) ; for ( Iterator < T > it = iterator ( ) ; it . hasNext ( ) ; ) { T val = it . next ( ) ; if ( val != null ) array . add ( val ) ; } return array . toArray ( tArray ) ;
public class PortletAppTypeImpl { /** * Returns all < code > event - definition < / code > elements * @ return list of < code > event - definition < / code > */ public List < EventDefinitionType < PortletAppType < T > > > getAllEventDefinition ( ) { } }
List < EventDefinitionType < PortletAppType < T > > > list = new ArrayList < EventDefinitionType < PortletAppType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "event-definition" ) ; for ( Node node : nodeList ) { EventDefinitionType < PortletAppType < T > > type = new EventDefinitionTypeImpl < PortletAppType < T > > ( this , "event-definition" , childNode , node ) ; list . add ( type ) ; } return list ;
public class RequiredRuleNameComputer { /** * Returns true if the given candidate is a group that is filtered due to rule parameters in the current call graph . */ protected boolean isFiltered ( AbstractElement canddiate , Param param ) { } }
if ( canddiate instanceof Group ) { Group group = ( Group ) canddiate ; if ( group . getGuardCondition ( ) != null ) { Set < Parameter > context = param . getAssignedParametes ( ) ; ConditionEvaluator evaluator = new ConditionEvaluator ( context ) ; if ( ! evaluator . evaluate ( group . getGuardCondition ( ) ) ) { return true ; } } } return false ;
public class StreamEx { /** * Returns a new { @ code StreamEx } which is a concatenation of supplied value * and this stream . * This is a < a href = " package - summary . html # StreamOps " > quasi - intermediate * operation < / a > with < a href = " package - summary . html # TSO " > tail - stream * optimization < / a > . * @ param value the value to prepend to the stream * @ return the new stream * @ since 0.5.4 */ public StreamEx < T > prepend ( T value ) { } }
return new StreamEx < > ( new PrependSpliterator < > ( spliterator ( ) , value ) , context ) ;
public class NodeUtil { /** * Custom update new QName node with source info from another node . * < p > This is very similar to { @ link Node # useSourceInfoIfMissingFromForTree ( Node ) } , but it avoids * overwriting the length field of the nodes . * TODO ( bradfordcsmith ) : Eliminate the need for this custom method . */ private static void useSourceInfoForNewQName ( Node newQName , Node basisNode ) { } }
if ( newQName . getStaticSourceFile ( ) == null ) { newQName . setStaticSourceFileFrom ( basisNode ) ; newQName . setSourceEncodedPosition ( basisNode . getSourcePosition ( ) ) ; } if ( newQName . getOriginalName ( ) == null ) { newQName . putProp ( Node . ORIGINALNAME_PROP , basisNode . getOriginalName ( ) ) ; } for ( Node child = newQName . getFirstChild ( ) ; child != null ; child = child . getNext ( ) ) { useSourceInfoForNewQName ( child , basisNode ) ; }
public class ArtistActivity { /** * Used to display crouton toast . * @ param message text to be displayed . */ private void toast ( @ StringRes int message ) { } }
if ( mCrouton != null ) { mCrouton . cancel ( ) ; mCrouton = null ; } mCroutonView = new CroutonView ( this , getString ( message ) ) ; mCrouton = Crouton . make ( this , mCroutonView , R . id . activity_artist_main_container ) ; mCrouton . show ( ) ;
public class MetaDescriptor { /** * Tries to load the first " Implementation - Version " manifest entry it can find in the given * classloader . * @ param classLoader The classloader to load manifests from * @ return a version string * @ throws IOException */ private static String loadVersion ( ClassLoader classLoader ) throws IOException { } }
try { Enumeration < URL > resources = classLoader . getResources ( "META-INF/MANIFEST.MF" ) ; while ( resources . hasMoreElements ( ) ) { final URL url = resources . nextElement ( ) ; final Manifest manifest = new Manifest ( url . openStream ( ) ) ; final Attributes mainAttributes = manifest . getMainAttributes ( ) ; final String value = mainAttributes . getValue ( IMPL_VERSION ) ; if ( value != null ) { return value ; } } } catch ( IOException e ) { LOG . error ( "Failed to read manifest" , e ) ; throw new IOException ( "Failed to find manifest" , e ) ; } return null ;
public class Ladder { /** * Encodes and adds the AMO constraint to the given solver . * @ param s the solver * @ param lits the literals for the constraint */ public void encode ( final MiniSatStyleSolver s , final LNGIntVector lits ) { } }
assert lits . size ( ) != 0 ; if ( lits . size ( ) == 1 ) addUnitClause ( s , lits . get ( 0 ) ) ; else { final LNGIntVector seqAuxiliary = new LNGIntVector ( ) ; for ( int i = 0 ; i < lits . size ( ) - 1 ; i ++ ) { seqAuxiliary . push ( mkLit ( s . nVars ( ) , false ) ) ; MaxSAT . newSATVariable ( s ) ; } for ( int i = 0 ; i < lits . size ( ) ; i ++ ) { if ( i == 0 ) { addBinaryClause ( s , lits . get ( i ) , not ( seqAuxiliary . get ( i ) ) ) ; addBinaryClause ( s , not ( lits . get ( i ) ) , seqAuxiliary . get ( i ) ) ; } else if ( i == lits . size ( ) - 1 ) { addBinaryClause ( s , lits . get ( i ) , seqAuxiliary . get ( i - 1 ) ) ; addBinaryClause ( s , not ( lits . get ( i ) ) , not ( seqAuxiliary . get ( i - 1 ) ) ) ; } else { addBinaryClause ( s , not ( seqAuxiliary . get ( i - 1 ) ) , seqAuxiliary . get ( i ) ) ; addTernaryClause ( s , lits . get ( i ) , not ( seqAuxiliary . get ( i ) ) , seqAuxiliary . get ( i - 1 ) ) ; addBinaryClause ( s , not ( lits . get ( i ) ) , seqAuxiliary . get ( i ) ) ; addBinaryClause ( s , not ( lits . get ( i ) ) , not ( seqAuxiliary . get ( i - 1 ) ) ) ; } } }
public class PlaceManager { /** * Called by the place registry after creating this place manager . */ public void init ( PlaceRegistry registry , InvocationManager invmgr , RootDObjectManager omgr , BodyLocator locator , PlaceConfig config ) { } }
_registry = registry ; _invmgr = invmgr ; _omgr = omgr ; _locator = locator ; _config = config ; // initialize our delegates applyToDelegates ( new DelegateOp ( PlaceManagerDelegate . class ) { @ Override public void apply ( PlaceManagerDelegate delegate ) { delegate . init ( PlaceManager . this , _omgr , _invmgr ) ; } } ) ; // let derived classes do initialization stuff try { didInit ( ) ; } catch ( Throwable t ) { log . warning ( "Manager choked in didInit()" , "where" , where ( ) , t ) ; }
public class MnoHttpClient { /** * Perform a request to the remote endpoint * @ param < V > * @ param url * the remote endpoint to contact * @ param method * such as ' GET ' , ' PUT ' , ' POST ' or ' DELETE ' * @ param header * values * @ param payload * data to send * @ return response body * @ throws AuthenticationException * @ throws ApiException */ protected < V > String performRequest ( String url , String method , Map < String , V > params , Map < String , String > header , String payload ) throws AuthenticationException , ApiException { } }
// Prepare header if ( header == null ) { header = new HashMap < String , String > ( ) ; } // Set method header . put ( "method" , method . toUpperCase ( ) ) ; // Set ' User - Agent ' if ( header . get ( "User-Agent" ) == null || header . get ( "User-Agent" ) . isEmpty ( ) ) { header . put ( "User-Agent" , defaultUserAgent ) ; } // Set ' Authorization ' if ( this . basicAuthHash != null && ! this . basicAuthHash . isEmpty ( ) ) { if ( header . get ( "Authorization" ) == null || header . get ( "Authorization" ) . isEmpty ( ) ) { header . put ( "Authorization" , basicAuthHash ) ; } } // Set ' Content - Type ' if ( header . get ( "Content-Type" ) == null || header . get ( "Content-Type" ) . isEmpty ( ) ) { header . put ( "Content-Type" , defaultContentType ) ; } // Set ' Accept ' if ( header . get ( "Accept" ) == null || header . get ( "Accept" ) . isEmpty ( ) ) { header . put ( "Accept" , defaultAccept ) ; } // Prepare url String realUrl = url ; if ( params != null && ! params . isEmpty ( ) ) { realUrl += "?" ; boolean isFirst = true ; for ( Map . Entry < String , V > param : params . entrySet ( ) ) { String key ; try { key = URLEncoder . encode ( param . getKey ( ) , "UTF-8" ) ; String realParam = GSON . fromJson ( GSON . toJson ( param . getValue ( ) ) , String . class ) ; String val = URLEncoder . encode ( realParam , "UTF-8" ) ; if ( ! isFirst ) realUrl += "&" ; realUrl += key + "=" + val ; isFirst = false ; } catch ( UnsupportedEncodingException e ) { throw new ApiException ( "Wrong query parameter encoding for pair: " + param . getKey ( ) + " = " + param . getValue ( ) , e ) ; } } } // Get connection HttpURLConnection conn = openConnection ( header , realUrl ) ; // Send Data if PUT / POST if ( payload != null ) { if ( method . equalsIgnoreCase ( "PUT" ) || method . equalsIgnoreCase ( "POST" ) ) { OutputStream output = null ; try { OutputStream outputStream = conn . getOutputStream ( ) ; IOUtils . write ( payload , outputStream ) ; } catch ( IOException e ) { throw new ApiException ( "Unable to send data to server" , e ) ; } finally { IOUtils . closeQuietly ( output ) ; } } } // Check Response code int responseCode ; try { responseCode = conn . getResponseCode ( ) ; } catch ( IOException e ) { throw new ApiException ( "Unable to read response code" , e ) ; } switch ( responseCode ) { case HttpURLConnection . HTTP_UNAUTHORIZED : throw new AuthenticationException ( "Invalid API credentials" ) ; case HttpURLConnection . HTTP_BAD_REQUEST : InputStream errorStream = conn . getErrorStream ( ) ; if ( errorStream != null ) { String error = readInputStream ( errorStream ) ; throw new ApiException ( "Connection could not be made. Bad Request: " + error ) ; } else { throw new ApiException ( "Connection could not be made. Bad Request" ) ; } } // Parse response InputStream inputStream = null ; try { inputStream = conn . getInputStream ( ) ; return readInputStream ( inputStream ) ; } catch ( IOException e ) { throw new ApiException ( "Unable to read response from server" , e ) ; } finally { IOUtils . closeQuietly ( inputStream ) ; }