signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class Traverson { /** * Follow the { @ link Link } s of the current resource , selected by its link - relation type and returns a { @ link Stream }
* containing the returned { @ link HalRepresentation HalRepresentations } .
* The EmbeddedTypeInfo is used to define the specific type of embedded items .
* Templated links are expanded to URIs using the specified template variables .
* If the current node has { @ link Embedded embedded } items with the specified { @ code rel } ,
* these items are used instead of resolving the associated { @ link Link } .
* @ param type the specific type of the returned HalRepresentations
* @ param embeddedTypeInfo specification of the type of embedded items
* @ param < T > type of the returned HalRepresentations
* @ return this
* @ throws IOException if a low - level I / O problem ( unexpected end - of - input , network error ) occurs .
* @ throws JsonParseException if the json document can not be parsed by Jackson ' s ObjectMapper
* @ throws JsonMappingException if the input JSON structure can not be mapped to the specified HalRepresentation type
* @ since 1.0.0 */
@ SuppressWarnings ( "unchecked" ) public < T extends HalRepresentation > Stream < T > streamAs ( final Class < T > type , final List < EmbeddedTypeInfo > embeddedTypeInfo ) throws IOException { } } | checkState ( ) ; try { if ( startWith != null ) { lastResult = traverseInitialResource ( type , embeddedTypeInfo , true ) ; } else if ( ! hops . isEmpty ( ) ) { lastResult = traverseHop ( lastResult . get ( 0 ) , type , embeddedTypeInfo , true ) ; } return ( Stream < T > ) lastResult . stream ( ) ; } catch ( final Exception e ) { LOG . error ( e . getMessage ( ) , e ) ; throw e ; } |
public class FloatingPointBitsConverterUtil { /** * Converts a sortable long to double .
* @ see # sortableLongToDouble ( long ) */
public static double sortableLongToDouble ( long value ) { } } | value = value ^ ( value >> 63 ) & Long . MAX_VALUE ; return Double . longBitsToDouble ( value ) ; |
public class AbstractExtraLanguageGenerator { /** * Compute the expected type of the given expression .
* @ param expr the expression .
* @ return the expected type of the argument . */
protected LightweightTypeReference getExpectedType ( XExpression expr ) { } } | final IResolvedTypes resolvedTypes = getTypeResolver ( ) . resolveTypes ( expr ) ; final LightweightTypeReference actualType = resolvedTypes . getActualType ( expr ) ; return actualType ; |
public class DownloadDataProcess { /** * Move this file . */
public void moveThisFile ( String strURL , String strName ) { } } | try { URL url = new URL ( strURL ) ; InputStream inputStream = url . openStream ( ) ; InputStreamReader inStream = new InputStreamReader ( inputStream ) ; LineNumberReader reader = new LineNumberReader ( inStream ) ; String strDir = strName . substring ( 0 , strName . lastIndexOf ( '/' ) ) ; File fileDirDest = new File ( strDir ) ; fileDirDest . mkdirs ( ) ; File fileDest = new File ( strName ) ; fileDest . createNewFile ( ) ; FileOutputStream fileOut = new FileOutputStream ( fileDest ) ; PrintWriter dataOut = new PrintWriter ( fileOut ) ; String string ; while ( ( string = reader . readLine ( ) ) != null ) { string = this . convertString ( string ) ; dataOut . write ( string ) ; dataOut . println ( ) ; } dataOut . close ( ) ; fileOut . close ( ) ; reader . close ( ) ; inStream . close ( ) ; // ? url . close ( ) ;
} catch ( FileNotFoundException ex ) { ex . printStackTrace ( ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } |
public class RTMPProtocolDecoder { /** * Checks if the passed action is a reserved stream method .
* @ param action
* Action to check
* @ return true if passed action is a reserved stream method , false otherwise */
@ SuppressWarnings ( "unused" ) private boolean isStreamCommand ( String action ) { } } | switch ( StreamAction . getEnum ( action ) ) { case CREATE_STREAM : case DELETE_STREAM : case RELEASE_STREAM : case PUBLISH : case PLAY : case PLAY2 : case SEEK : case PAUSE : case PAUSE_RAW : case CLOSE_STREAM : case RECEIVE_VIDEO : case RECEIVE_AUDIO : return true ; default : log . debug ( "Stream action {} is not a recognized command" , action ) ; return false ; } |
public class IntAVLTree { /** * Update < code > node < / code > with the current data . */
public void update ( int node ) { } } | final int prev = prev ( node ) ; final int next = next ( node ) ; if ( ( prev == NIL || compare ( prev ) > 0 ) && ( next == NIL || compare ( next ) < 0 ) ) { // Update can be done in - place
copy ( node ) ; for ( int n = node ; n != NIL ; n = parent ( n ) ) { fixAggregates ( n ) ; } } else { // TODO : it should be possible to find the new node position without
// starting from scratch
remove ( node ) ; add ( ) ; } |
public class JobScheduleOperations { /** * Updates the specified job schedule .
* This method performs a full replace of all the updatable properties of the job schedule . For example , if the schedule parameter is null , then the Batch service removes the job schedule ’ s existing schedule and replaces it with the default schedule .
* @ param jobScheduleId The ID of the job schedule .
* @ param schedule The schedule according to which jobs will be created . If null , it is equivalent to passing the default schedule : that is , a single job scheduled to run immediately .
* @ param jobSpecification The details of the jobs to be created on this schedule . Updates affect only jobs that are started after the update has taken place . Any currently active job continues with the older specification .
* @ throws BatchErrorException Exception thrown when an error response is received from the Batch service .
* @ throws IOException Exception thrown when there is an error in serialization / deserialization of data sent to / received from the Batch service . */
public void updateJobSchedule ( String jobScheduleId , Schedule schedule , JobSpecification jobSpecification ) throws BatchErrorException , IOException { } } | updateJobSchedule ( jobScheduleId , schedule , jobSpecification , null , null ) ; |
public class EntityJsonParser { /** * Parse a single StructuredObject instance from the given URL .
* Callers may prefer to catch EntityJSONException and treat all failures in the same way .
* @ param instanceUrl A URL pointing to the JSON representation of a StructuredObject instance .
* @ return A StructuredObject instance .
* @ throws SchemaValidationException If the given instance does not meet the general EntityJSON schema .
* @ throws InvalidInstanceException If the given instance is structurally invalid . */
public StructuredObject parseStructuredObject ( URL instanceUrl ) throws SchemaValidationException , InvalidInstanceException { } } | try { return new StructuredObject ( validate ( STRUCTURED_OBJECT_SCHEMA_URL , instanceUrl ) ) ; } catch ( NoSchemaException | InvalidSchemaException e ) { // In theory this cannot happen
throw new RuntimeException ( e ) ; } |
public class UIData { /** * < p > If " name " is something other than " value " , " var " , or " rowIndex " , rely
* on the superclass conversion from < code > ValueBinding < / code > to
* < code > ValueExpression < / code > . < / p >
* @ param name Name of the attribute or property for which to set a
* { @ link ValueBinding }
* @ param binding The { @ link ValueBinding } to set , or < code > null < / code > to
* remove any currently set { @ link ValueBinding }
* @ throws IllegalArgumentException if < code > name < / code > is one of
* < code > id < / code > , < code > parent < / code > ,
* < code > var < / code > , or < code > rowIndex < / code >
* @ throws NullPointerException if < code > name < / code > is < code > null < / code >
* @ deprecated This has been replaced by { @ link # setValueExpression ( java . lang . String ,
* javax . el . ValueExpression ) } . */
public void setValueBinding ( String name , ValueBinding binding ) { } } | if ( "value" . equals ( name ) ) { setDataModel ( null ) ; } else if ( "var" . equals ( name ) || "rowIndex" . equals ( name ) ) { throw new IllegalArgumentException ( ) ; } super . setValueBinding ( name , binding ) ; |
public class Files { /** * Reads all bytes from a file into a byte array .
* @ param file the file to read from
* @ return a byte array containing all the bytes from file
* @ throws IllegalArgumentException if the file is bigger than the largest
* possible byte array ( 2 ^ 31 - 1)
* @ throws IOException if an I / O error occurs */
public static byte [ ] toByteArray ( File file ) throws IOException { } } | FileInputStream in = null ; try { in = new FileInputStream ( file ) ; return readFile ( in , in . getChannel ( ) . size ( ) ) ; } finally { if ( in != null ) { in . close ( ) ; } } |
public class JulLogger { /** * { @ inheritDoc }
* @ see Level # SEVERE
* @ see Logger # log ( Level , String , Throwable ) */
@ Override public void error ( Throwable t ) { } } | log . log ( Level . SEVERE , t . getMessage ( ) , t ) ; |
public class AcceptChargingStationJsonCommandHandler { /** * { @ inheritDoc } */
@ Override public void handle ( String chargingStationId , JsonObject commandObject , IdentityContext identityContext ) throws UserIdentityUnauthorizedException { } } | ChargingStation chargingStation = repository . findOne ( chargingStationId ) ; ChargingStationId csId = new ChargingStationId ( chargingStationId ) ; if ( chargingStation == null ) { // charging station doesn ' t exist yet , check if the user identity is allowed to create / maintain charging stations
if ( ! userIdentitiesWithAllPermissions . contains ( identityContext . getUserIdentity ( ) ) ) { throw new UserIdentityUnauthorizedException ( chargingStationId , identityContext . getUserIdentity ( ) , CreateAndAcceptChargingStationCommand . class ) ; } commandGateway . send ( new CreateAndAcceptChargingStationCommand ( csId , userIdentitiesWithAllPermissions , identityContext ) ) ; } else if ( ! chargingStation . isAccepted ( ) ) { if ( ! commandAuthorizationService . isAuthorized ( csId , identityContext . getUserIdentity ( ) , AcceptChargingStationCommand . class ) ) { throw new UserIdentityUnauthorizedException ( chargingStationId , identityContext . getUserIdentity ( ) , AcceptChargingStationCommand . class ) ; } commandGateway . send ( new AcceptChargingStationCommand ( csId , identityContext ) ) ; } else { throw new IllegalStateException ( String . format ( "Charging station { %s } is already in accepted state, you can't register this station" , chargingStationId ) ) ; } |
public class JobValidator { /** * Validate the Job ' s network mode .
* @ param job The Job to check .
* @ return A set of error Strings */
private Set < String > validateJobNetworkMode ( final Job job ) { } } | final String networkMode = job . getNetworkMode ( ) ; if ( networkMode == null ) { return emptySet ( ) ; } final Set < String > errors = Sets . newHashSet ( ) ; if ( ! VALID_NETWORK_MODES . contains ( networkMode ) && ! networkMode . startsWith ( "container:" ) ) { errors . add ( String . format ( "A Docker container's network mode must be %s, or container:<name|id>." , Joiner . on ( ", " ) . join ( VALID_NETWORK_MODES ) ) ) ; } return errors ; |
public class URLEncodedUtils { /** * Emcode / escape a portion of a URL , to use with the query part ensure { @ code plusAsBlank } is true .
* @ param content the portion to decode
* @ param charset the charset to use
* @ param blankAsPlus if { @ code true } , then convert space to ' + ' ( e . g . for www - url - form - encoded content ) , otherwise leave as is .
* @ return */
private static String urlencode ( final String content , final Charset charset , final BitSet safechars , final boolean blankAsPlus ) { } } | if ( content == null ) { return null ; } StringBuilder buf = new StringBuilder ( ) ; ByteBuffer bb = charset . encode ( content ) ; while ( bb . hasRemaining ( ) ) { int b = bb . get ( ) & 0xff ; if ( safechars . get ( b ) ) { buf . append ( ( char ) b ) ; } else if ( blankAsPlus && b == ' ' ) { buf . append ( '+' ) ; } else { buf . append ( "%" ) ; char hex1 = Character . toUpperCase ( Character . forDigit ( ( b >> 4 ) & 0xF , RADIX ) ) ; char hex2 = Character . toUpperCase ( Character . forDigit ( b & 0xF , RADIX ) ) ; buf . append ( hex1 ) ; buf . append ( hex2 ) ; } } return buf . toString ( ) ; |
public class Entry { /** * If the entry carries information about a suppressed exception , clear it . */
public void resetSuppressedLoadExceptionInformation ( ) { } } | LoadExceptionPiggyBack inf = getPiggyBack ( LoadExceptionPiggyBack . class ) ; if ( inf != null ) { inf . info = null ; } |
public class SelectorNode { /** * Evaluate this node as a number */
public final Number evaluateNumeric ( Message message ) throws JMSException { } } | Object value = evaluate ( message ) ; if ( value == null ) return null ; if ( value instanceof Number ) return ArithmeticUtils . normalize ( ( Number ) value ) ; throw new FFMQException ( "Expected a numeric but got : " + value . toString ( ) , "INVALID_SELECTOR_EXPRESSION" ) ; |
public class SubStringOperation { /** * Get the ' to ' parameter from the parameters . If the parameter is not set the defaultValue is taken instead . */
private Integer getToParameter ( Map < String , String > parameters , Integer defaultValue ) throws TransformationOperationException { } } | return getSubStringParameter ( parameters , toParam , defaultValue ) ; |
public class SupplierBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */
@ Nonnull public static < T > SupplierBuilder < T > supplier ( Consumer < Supplier < T > > consumer ) { } } | return new SupplierBuilder ( consumer ) ; |
public class MorkMapper { /** * Read input . Wraps mapper . read with Mork - specific error handling .
* Return type depends on the mapper actually used .
* @ return null if an error has been reported */
private Object invokeMapper ( File source ) throws IOException { } } | Object [ ] results ; String name ; Reader src ; name = source . getPath ( ) ; mork . output . verbose ( "mapping " + name ) ; results = run ( name ) ; mork . output . verbose ( "finished mapping " + name ) ; if ( results == null ) { return null ; } else { return results [ 0 ] ; } |
public class DefaultLoaderService { /** * ( non - Javadoc )
* @ see
* org . javamoney . moneta . spi . LoaderService # registerData ( java . lang . String ,
* org . javamoney . moneta . spi . LoaderService . UpdatePolicy , java . util . Map ,
* java . net . URL , java . net . URL [ ] ) */
@ Override public void registerData ( LoadDataInformation loadDataInformation ) { } } | if ( resources . containsKey ( loadDataInformation . getResourceId ( ) ) ) { throw new IllegalArgumentException ( "Resource : " + loadDataInformation . getResourceId ( ) + " already registered." ) ; } LoadableResource resource = new LoadableResourceBuilder ( ) . withCache ( CACHE ) . withLoadDataInformation ( loadDataInformation ) . build ( ) ; this . resources . put ( loadDataInformation . getResourceId ( ) , resource ) ; if ( loadDataInformation . getLoaderListener ( ) != null ) { this . addLoaderListener ( loadDataInformation . getLoaderListener ( ) , loadDataInformation . getResourceId ( ) ) ; } if ( loadDataInformation . isStartRemote ( ) ) { defaultLoaderServiceFacade . loadDataRemote ( loadDataInformation . getResourceId ( ) , resources ) ; } switch ( loadDataInformation . getUpdatePolicy ( ) ) { case NEVER : loadDataLocal ( loadDataInformation . getResourceId ( ) ) ; break ; case ONSTARTUP : loadDataAsync ( loadDataInformation . getResourceId ( ) ) ; break ; case SCHEDULED : defaultLoaderServiceFacade . scheduledData ( resource ) ; break ; case LAZY : default : break ; } |
public class VForDefinition { /** * Init the key variable and add it to the parser context
* @ param name Name of the variable
* @ param context Context of the template parser */
private void initKeyVariable ( String name , TemplateParserContext context ) { } } | this . keyVariableInfo = context . addLocalVariable ( "String" , name . trim ( ) ) ; |
public class SignatureUtils { /** * @ param className
* the name of the class
* @ return the class name , discarding any anonymous component */
public static String getNonAnonymousPortion ( String className ) { } } | String [ ] components = CLASS_COMPONENT_DELIMITER . split ( className ) ; StringBuilder buffer = new StringBuilder ( className . length ( ) ) . append ( components [ 0 ] ) ; for ( int i = 1 ; ( i < components . length ) && ! ANONYMOUS_COMPONENT . matcher ( components [ i ] ) . matches ( ) ; i ++ ) { buffer . append ( Values . INNER_CLASS_SEPARATOR ) . append ( components [ i ] ) ; } return buffer . toString ( ) ; |
public class AbstractEJBRuntime { /** * d744887 */
public void sendMDBBindingMessage ( BeanMetaData bmd ) { } } | // Currently , an information message is only logged for message endpoints
// that use a JCA resource adapter , not a message listener port .
if ( bmd . ivActivationSpecJndiName != null ) { Tr . info ( tc , "MDB_ACTIVATION_SPEC_INFO_CNTR0180I" , new Object [ ] { bmd . j2eeName . getComponent ( ) , bmd . j2eeName . getModule ( ) , bmd . j2eeName . getApplication ( ) , bmd . ivActivationSpecJndiName } ) ; } |
public class OptionalHeader { /** * Returns the optional data directory entry for the given key or absent if
* entry doesn ' t exist .
* @ param key
* @ return the data directory entry for the given key or absent if entry
* doesn ' t exist . */
public Optional < DataDirEntry > maybeGetDataDirEntry ( DataDirectoryKey key ) { } } | return Optional . fromNullable ( dataDirectory . get ( key ) ) ; |
public class ExpandableRecyclerAdapter { /** * Notify any registered observers that the { @ code itemCount } parents starting
* at { @ code parentPositionStart } have changed . This will also trigger an item changed
* for children of the parent list specified .
* This is an item change event , not a structural change event . It indicates that any
* reflection of the data in the given position range is out of date and should be updated .
* The parents in the given range retain the same identity . This means that the number of
* children must stay the same .
* @ param parentPositionStart Position of the item that has changed
* @ param itemCount Number of parents changed in the data set */
@ UiThread public void notifyParentRangeChanged ( int parentPositionStart , int itemCount ) { } } | int flatParentPositionStart = getFlatParentPosition ( parentPositionStart ) ; int flatParentPosition = flatParentPositionStart ; int sizeChanged = 0 ; int changed ; P parent ; for ( int j = 0 ; j < itemCount ; j ++ ) { parent = mParentList . get ( parentPositionStart ) ; changed = changeParentWrapper ( flatParentPosition , parent ) ; sizeChanged += changed ; flatParentPosition += changed ; parentPositionStart ++ ; } notifyItemRangeChanged ( flatParentPositionStart , sizeChanged ) ; |
public class ListFlowsResult { /** * A list of flow summaries .
* @ param flows
* A list of flow summaries . */
public void setFlows ( java . util . Collection < ListedFlow > flows ) { } } | if ( flows == null ) { this . flows = null ; return ; } this . flows = new java . util . ArrayList < ListedFlow > ( flows ) ; |
public class ApiConfigHandler { /** * < pre >
* Path to the script from the application root directory .
* < / pre >
* < code > string script = 3 ; < / code > */
public com . google . protobuf . ByteString getScriptBytes ( ) { } } | java . lang . Object ref = script_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; script_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class Strings { /** * Return a string composed of the given array .
* @ param buff Buffer used to construct string value ( not reset ) .
* @ param array Array of objects .
* @ param prefix String prefix .
* @ param separator Element sepearator .
* @ param suffix String suffix .
* @ return String in the format of : prefix + n ( + separator + n + i ) * + suffix . */
public static String join ( final StringBuffer buff , final Object [ ] array , final String prefix , final String separator , final String suffix ) { } } | buff . append ( prefix ) ; join ( buff , array , separator ) ; buff . append ( suffix ) ; return buff . toString ( ) ; |
public class DatumWriterGenerator { /** * Generates a { @ link DatumWriter } class for encoding data of the given output type with the given schema .
* @ param outputType Type information of the output data type .
* @ param schema Schema of the output data type .
* @ return A { @ link co . cask . tigon . internal . asm . ClassDefinition } that contains generated class information . */
ClassDefinition generate ( TypeToken < ? > outputType , Schema schema ) { } } | classWriter = new ClassWriter ( ClassWriter . COMPUTE_FRAMES ) ; TypeToken < ? > interfaceType = getInterfaceType ( outputType ) ; // Generate the class
String className = getClassName ( interfaceType , schema ) ; classType = Type . getObjectType ( className ) ; classWriter . visit ( Opcodes . V1_6 , Opcodes . ACC_PUBLIC + Opcodes . ACC_FINAL , className , Signatures . getClassSignature ( interfaceType ) , Type . getInternalName ( Object . class ) , new String [ ] { Type . getInternalName ( interfaceType . getRawType ( ) ) } ) ; // Static schema hash field , for verification
classWriter . visitField ( Opcodes . ACC_PRIVATE + Opcodes . ACC_STATIC + Opcodes . ACC_FINAL , "SCHEMA_HASH" , Type . getDescriptor ( String . class ) , null , schema . getSchemaHash ( ) . toString ( ) ) . visitEnd ( ) ; // Schema field
classWriter . visitField ( Opcodes . ACC_PRIVATE + Opcodes . ACC_FINAL , "schema" , Type . getDescriptor ( Schema . class ) , null , null ) . visitEnd ( ) ; // Encode method
generateEncode ( outputType , schema ) ; // Constructor
generateConstructor ( ) ; ClassDefinition classDefinition = new ClassDefinition ( classWriter . toByteArray ( ) , className ) ; // DEBUG block . Uncomment for debug
// co . cask . tigon . internal . asm . Debugs . debugByteCode ( classDefinition , new java . io . PrintWriter ( System . out ) ) ;
// End DEBUG block
return classDefinition ; |
public class PrivateZonesInner { /** * Deletes a Private DNS zone . WARNING : All DNS records in the zone will also be deleted . This operation cannot be undone . Private DNS zone cannot be deleted unless all virtual network links to it are removed .
* @ param resourceGroupName The name of the resource group .
* @ param privateZoneName The name of the Private DNS zone ( without a terminating dot ) .
* @ param ifMatch The ETag of the Private DNS zone . Omit this value to always delete the current zone . Specify the last - seen ETag value to prevent accidentally deleting any concurrent changes .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void delete ( String resourceGroupName , String privateZoneName , String ifMatch ) { } } | deleteWithServiceResponseAsync ( resourceGroupName , privateZoneName , ifMatch ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class ImplementationLoader { /** * Returns the implementation for a given class .
* @ return the implementation for the given class . */
public static < E > E get ( Class < E > type ) { } } | ServiceLoader < E > loader = ServiceLoader . load ( type ) ; Iterator < E > iterator = loader . iterator ( ) ; if ( iterator . hasNext ( ) ) { return iterator . next ( ) ; // only one is expected
} try { // loads the default implementation
return ( E ) Class . forName ( getDefaultImplementationName ( type ) ) . newInstance ( ) ; } catch ( Exception e ) { throw new TruggerException ( e ) ; } |
public class EntityFinder { /** * Returns the ProteinSequence or null if one can ' t be created
* @ param str
* @ return */
private static ProteinSequence getProteinSequence ( String str ) { } } | try { ProteinSequence s = new ProteinSequence ( str ) ; return s ; } catch ( CompoundNotFoundException e ) { logger . error ( "Unexpected error when creating ProteinSequence" , e ) ; } return null ; |
public class Vector3f { /** * / * ( non - Javadoc )
* @ see org . joml . Vector3fc # rotateX ( float , org . joml . Vector3f ) */
public Vector3f rotateX ( float angle , Vector3f dest ) { } } | float sin = ( float ) Math . sin ( angle ) , cos = ( float ) Math . cosFromSin ( sin , angle ) ; float y = this . y * cos - this . z * sin ; float z = this . y * sin + this . z * cos ; dest . x = this . x ; dest . y = y ; dest . z = z ; return dest ; |
public class WsEncoder { /** * Encodes string for binary transparency over SOAP . */
public static String encode ( String value ) { } } | if ( value == null ) return null ; StringBuilder encoded = null ; int len = value . length ( ) ; for ( int c = 0 ; c < len ; c ++ ) { char ch = value . charAt ( c ) ; if ( ( ch < ' ' && ch != '\n' && ch != '\r' ) || ch == '\\' ) { if ( encoded == null ) { encoded = new StringBuilder ( ) ; if ( c > 0 ) encoded . append ( value , 0 , c ) ; } if ( ch == '\\' ) encoded . append ( "\\\\" ) ; else if ( ch == '\b' ) encoded . append ( "\\b" ) ; else if ( ch == '\f' ) encoded . append ( "\\f" ) ; else if ( ch == '\t' ) encoded . append ( "\\t" ) ; else { int ich = ch ; encoded . append ( "\\u" ) . append ( hexChars [ ( ich >>> 12 ) & 15 ] ) . append ( hexChars [ ( ich >>> 8 ) & 15 ] ) . append ( hexChars [ ( ich >>> 4 ) & 15 ] ) . append ( hexChars [ ich & 15 ] ) ; } } else { if ( encoded != null ) encoded . append ( ch ) ; } } return encoded == null ? value : encoded . toString ( ) ; |
public class RRBudgetV1_1Generator { /** * This method gets BudgetYear1DataType details like
* BudgetPeriodStartDate , BudgetPeriodEndDate , BudgetPeriod
* KeyPersons , OtherPersonnel , TotalCompensation , Equipment , ParticipantTraineeSupportCosts , Travel , OtherDirectCosts
* DirectCosts , IndirectCosts , CognizantFederalAgency , TotalCosts
* @ param periodInfo
* ( BudgetPeriodInfo ) budget summary entry .
* @ return BudgetYear1DataType corresponding to the BudgetSummaryInfo
* object . */
private BudgetYear1DataType getBudgetYear1DataType ( BudgetPeriodDto periodInfo ) { } } | BudgetYear1DataType budgetYear = BudgetYear1DataType . Factory . newInstance ( ) ; if ( periodInfo != null ) { budgetYear . setBudgetPeriodStartDate ( s2SDateTimeService . convertDateToCalendar ( periodInfo . getStartDate ( ) ) ) ; budgetYear . setBudgetPeriodEndDate ( s2SDateTimeService . convertDateToCalendar ( periodInfo . getEndDate ( ) ) ) ; BudgetPeriod . Enum budgetPeriod = BudgetPeriod . Enum . forInt ( periodInfo . getBudgetPeriod ( ) ) ; budgetYear . setBudgetPeriod ( budgetPeriod ) ; budgetYear . setKeyPersons ( getKeyPersons ( periodInfo ) ) ; budgetYear . setOtherPersonnel ( getOtherPersonnel ( periodInfo ) ) ; if ( periodInfo . getTotalCompensation ( ) != null ) { budgetYear . setTotalCompensation ( periodInfo . getTotalCompensation ( ) . bigDecimalValue ( ) ) ; } budgetYear . setEquipment ( getEquipment ( periodInfo ) ) ; budgetYear . setTravel ( getTravel ( periodInfo ) ) ; budgetYear . setParticipantTraineeSupportCosts ( getParticipantTraineeSupportCosts ( periodInfo ) ) ; budgetYear . setOtherDirectCosts ( getOtherDirectCosts ( periodInfo ) ) ; budgetYear . setDirectCosts ( periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) ) ; IndirectCosts indirectCosts = getIndirectCosts ( periodInfo ) ; if ( indirectCosts != null ) { budgetYear . setIndirectCosts ( indirectCosts ) ; budgetYear . setTotalCosts ( periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) . add ( indirectCosts . getTotalIndirectCosts ( ) ) ) ; } else { budgetYear . setTotalCosts ( periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) ) ; } budgetYear . setCognizantFederalAgency ( periodInfo . getCognizantFedAgency ( ) ) ; } return budgetYear ; |
public class LookupLocation { /** * Helper function to format a string for parent locations .
* @ param parents List of parent locations .
* @ return Formatted string representing parent locations . */
public static String getParentLocationString ( Location [ ] parents ) { } } | StringBuilder sb = new StringBuilder ( ) ; if ( parents != null ) { for ( Location parent : parents ) { if ( sb . length ( ) > 0 ) { sb . append ( ", " ) ; } sb . append ( String . format ( "%s (%s)" , parent . getLocationName ( ) , parent . getDisplayType ( ) ) ) ; } } else { sb . append ( "N/A" ) ; } return sb . toString ( ) ; |
public class DefaultAndroidDeferredManager { /** * Return a { @ link Promise } for the { @ link DeferredAsyncTask } .
* This can also automatically execute the task in background depending on
* { @ link DeferredAsyncTask # getStartPolicy ( ) } and / or { @ link DefaultDeferredManager # isAutoSubmit ( ) } .
* Prior to Android Honeycomb ( API 11 ) , { @ link AsyncTask # execute ( Object . . . ) } would be
* executed in the background concurrently in a thread pool , but starting with Honeycomb ,
* { @ link AsyncTask # execute ( Object . . . ) } will execute the background task serially . To achieve
* older behavior , developer need to use { @ link AsyncTask # executeOnExecutor ( java . util . concurrent . Executor , Object . . . ) } .
* This method will always execute task in background concurrently if the task should be executed / submitted automatically .
* Hence , when using this method on Android API prior to Honeycomb , the task will be executed
* using { @ link AsyncTask # execute ( Object . . . ) } . On Android API version starting from Honeycomb ,
* this method will execute with @ see { @ link AsyncTask # executeOnExecutor ( java . util . concurrent . Executor , Object . . . ) }
* using { @ link Executor } from { @ link # getExecutorService ( ) }
* @ param task { @ link DeferredAsyncTask } to run in the background
* @ return { @ link DeferredAsyncTask # promise ( ) }
* @ see { @ link AsyncTask # execute ( Object . . . ) }
* @ see { @ link AsyncTask # executeOnExecutor ( java . util . concurrent . Executor , Object . . . ) } */
@ SuppressLint ( "NewApi" ) public < Progress , Result > Promise < Result , Throwable , Progress > when ( DeferredAsyncTask < Void , Progress , Result > task ) { } } | if ( task . getStartPolicy ( ) == StartPolicy . AUTO || ( task . getStartPolicy ( ) == StartPolicy . DEFAULT && isAutoSubmit ( ) ) ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { task . executeOnExecutor ( getExecutorService ( ) , EMPTY_PARAMS ) ; } else { task . execute ( EMPTY_PARAMS ) ; } } return task . promise ( ) ; |
public class VoltDDLElementTracker { /** * Add a table / column partition mapping for a PARTITION / REPLICATE statements .
* Validate input data and reject duplicates .
* @ param tableName table name
* @ param colName column name */
void addPartition ( String tableName , String colName ) { } } | if ( m_partitionMap . containsKey ( tableName . toLowerCase ( ) ) ) { m_compiler . addInfo ( String . format ( "Replacing partition column %s on table %s with column %s\n" , m_partitionMap . get ( tableName . toLowerCase ( ) ) , tableName , colName ) ) ; } m_partitionMap . put ( tableName . toLowerCase ( ) , colName . toLowerCase ( ) ) ; |
public class SourceFeatureQualifierCheck { /** * ENA - 2825 */
private void checkMetagenomeSource ( Origin origin , SourceFeature source ) { } } | List < Qualifier > metagenomeSourceQual = source . getQualifiers ( Qualifier . METAGENOME_SOURCE_QUALIFIER_NAME ) ; if ( metagenomeSourceQual != null && ! metagenomeSourceQual . isEmpty ( ) ) { Qualifier envSample = source . getSingleQualifier ( Qualifier . ENVIRONMENTAL_SAMPLE_QUALIFIER_NAME ) ; if ( envSample == null ) { reportError ( origin , ENV_SAMPLE_REQUIRED ) ; } if ( metagenomeSourceQual . size ( ) > 1 ) { reportError ( origin , MORE_THAN_ONE_METAGENOME_SOURCE ) ; } String metegenomeSource = metagenomeSourceQual . get ( 0 ) . getValue ( ) ; if ( metegenomeSource == null || ( ! metegenomeSource . contains ( "metagenome" ) && metegenomeSource . contains ( "Metagenome" ) ) ) { reportError ( origin , INVALID_METAGENOME_SOURCE , metegenomeSource ) ; } List < Taxon > taxon = getEmblEntryValidationPlanProperty ( ) . taxonHelper . get ( ) . getTaxonsByScientificName ( metegenomeSource ) ; if ( taxon == null || taxon . isEmpty ( ) || taxon . get ( 0 ) . getTaxId ( ) == 408169L || ! getEmblEntryValidationPlanProperty ( ) . taxonHelper . get ( ) . isOrganismMetagenome ( metegenomeSource ) ) { reportError ( origin , INVALID_METAGENOME_SOURCE , metegenomeSource ) ; } } |
public class MessageFormat { /** * Sets the format to use for the format element with the given
* format element index within the previously set pattern string .
* The format element index is the zero - based number of the format
* element counting from the start of the pattern string .
* Since the order of format elements in a pattern string often
* changes during localization , it is generally better to use the
* { @ link # setFormatByArgumentIndex setFormatByArgumentIndex }
* method , which accesses format elements based on the argument
* index they specify .
* @ param formatElementIndex the index of a format element within the pattern
* @ param newFormat the format to use for the specified format element
* @ exception ArrayIndexOutOfBoundsException if { @ code formatElementIndex } is equal to or
* larger than the number of format elements in the pattern string */
public void setFormat ( int formatElementIndex , Format newFormat ) { } } | if ( formatElementIndex > maxOffset ) { throw new ArrayIndexOutOfBoundsException ( maxOffset , formatElementIndex ) ; } formats [ formatElementIndex ] = newFormat ; |
public class OntopProtegeReasoner { /** * Replaces the owl connection with a new one
* Called when the user cancels a query . Easier to get a new connection , than waiting for the cancel
* @ return The old connection : The caller must close this connection */
public OWLConnection replaceConnection ( ) throws OntopConnectionException { } } | OWLConnection oldconn = this . owlConnection ; owlConnection = reasoner . getConnection ( ) ; return oldconn ; |
public class BioPAXIOHandlerAdapter { /** * Paxtools maps BioPAX : comment ( L3 ) and BioPAX : COMMENT ( L2 ) to rdf : comment . This method handles that .
* @ param bpe to be bound .
* @ return a property editor responsible for editing comments . */
protected StringPropertyEditor getRDFCommentEditor ( BioPAXElement bpe ) { } } | StringPropertyEditor editor ; Class < ? extends BioPAXElement > inter = bpe . getModelInterface ( ) ; if ( this . getLevel ( ) . equals ( BioPAXLevel . L3 ) ) { editor = ( StringPropertyEditor ) this . getEditorMap ( ) . getEditorForProperty ( "comment" , inter ) ; } else { editor = ( StringPropertyEditor ) this . getEditorMap ( ) . getEditorForProperty ( "COMMENT" , inter ) ; } return editor ; |
public class VariantSet { /** * Returns true of the variantSet passed in parameter has the same default
* value
* @ param obj
* the variantSet to test
* @ return true of the variantSet passed in parameter has the same default
* value */
public boolean hasSameDefaultVariant ( VariantSet obj ) { } } | return ( this . defaultVariant == null && obj . defaultVariant == null ) || ( this . defaultVariant != null && this . defaultVariant . equals ( obj . defaultVariant ) ) ; |
public class EfficientCacheView { /** * Look for a child view of the parent view id with the given id . If this view has the given
* id , return this view .
* The method is more efficient than a " normal " " findViewById " : the second time you will
* called this method with the same argument , the view return will come from the cache .
* @ param id The id to search for .
* @ return The view that has the given id in the hierarchy or null */
public < T extends View > T findViewByIdEfficient ( int parentId , int id ) { } } | View viewRetrieve = retrieveFromCache ( parentId , id ) ; if ( viewRetrieve == null ) { viewRetrieve = findViewById ( parentId , id ) ; if ( viewRetrieve != null ) { storeView ( parentId , id , viewRetrieve ) ; } } return castView ( viewRetrieve ) ; |
public class MiscUtils { /** * Serialize and then deserialize an invocation so that it has serializedParams set for command logging if the
* invocation is sent to a local site .
* @ return The round - tripped version of the invocation
* @ throws IOException */
public static StoredProcedureInvocation roundTripForCL ( StoredProcedureInvocation invocation ) throws IOException { } } | if ( invocation . getSerializedParams ( ) != null ) { return invocation ; } ByteBuffer buf = ByteBuffer . allocate ( invocation . getSerializedSize ( ) ) ; invocation . flattenToBuffer ( buf ) ; buf . flip ( ) ; StoredProcedureInvocation rti = new StoredProcedureInvocation ( ) ; rti . initFromBuffer ( buf ) ; return rti ; |
public class PortletDefinitionRegistryImpl { /** * / * ( non - Javadoc )
* @ see org . apereo . portal . portlet . registry . IPortletDefinitionRegistry # savePortletDefinition ( org . apereo . portal . portlet . om . IPortletDefinition ) */
@ Override public IPortletDefinition savePortletDefinition ( IPortletDefinition portletDefinition ) { } } | Validate . notNull ( portletDefinition , "portletDefinition can not be null" ) ; return this . portletDefinitionDao . savePortletDefinition ( portletDefinition ) ; |
public class VpnSitesInner { /** * Retrieves the details of a VPNsite .
* @ param resourceGroupName The resource group name of the VpnSite .
* @ param vpnSiteName The name of the VpnSite being retrieved .
* @ 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 < VpnSiteInner > getByResourceGroupAsync ( String resourceGroupName , String vpnSiteName , final ServiceCallback < VpnSiteInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getByResourceGroupWithServiceResponseAsync ( resourceGroupName , vpnSiteName ) , serviceCallback ) ; |
public class UserAccessDecisionVoter { /** * This method returns userId argument of the target method invocation . */
private Long getUserIdArg ( Object [ ] arguments ) { } } | if ( arguments . length <= USER_ID_INDEX ) { log . error ( "Illegal number of args: " + arguments . length ) ; } return ( Long ) arguments [ USER_ID_INDEX ] ; |
public class MetadataTemplate { /** * Deletes the schema of an existing metadata template .
* @ param api the API connection to be used
* @ param scope the scope of the object
* @ param template Unique identifier of the template */
public static void deleteMetadataTemplate ( BoxAPIConnection api , String scope , String template ) { } } | URL url = METADATA_TEMPLATE_URL_TEMPLATE . build ( api . getBaseURL ( ) , scope , template ) ; BoxJSONRequest request = new BoxJSONRequest ( api , url , "DELETE" ) ; request . send ( ) ; |
public class LeaderService { /** * Wait for the specified amount of time or until this service is stopped , whichever comes first . */
private synchronized void sleep ( long waitNanos ) throws InterruptedException { } } | while ( waitNanos > 0 && isRunning ( ) ) { long start = System . nanoTime ( ) ; TimeUnit . NANOSECONDS . timedWait ( this , waitNanos ) ; waitNanos -= System . nanoTime ( ) - start ; } |
public class HtmlAdaptorServlet { /** * Update the writable attributes of a MBean
* @ param request The HTTP request
* @ param response The HTTP response
* @ exception ServletException Thrown if an error occurs
* @ exception IOException Thrown if an I / O error occurs */
private void updateAttributes ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { } } | String name = request . getParameter ( "name" ) ; if ( trace ) log . trace ( "updateAttributes, name=" + name ) ; Enumeration paramNames = request . getParameterNames ( ) ; HashMap < String , String > attributes = new HashMap < String , String > ( ) ; while ( paramNames . hasMoreElements ( ) ) { String param = ( String ) paramNames . nextElement ( ) ; if ( param . equals ( "name" ) || param . equals ( "action" ) ) continue ; String value = request . getParameter ( param ) ; if ( trace ) log . trace ( "name=" + param + ", value='" + value + "'" ) ; // Ignore null values , these are empty write - only fields
if ( value == null || value . length ( ) == 0 ) continue ; attributes . put ( param , value ) ; } try { AttributeList newAttributes = setAttributes ( name , attributes ) ; MBeanData data = getMBeanData ( name ) ; request . setAttribute ( "mbeanData" , data ) ; RequestDispatcher rd = this . getServletContext ( ) . getRequestDispatcher ( "/inspectmbean.jsp" ) ; rd . forward ( request , response ) ; } catch ( Exception e ) { throw new ServletException ( "Failed to update attributes" , e ) ; } |
public class ViewSet { /** * Creates a container view , where the scope of the view is the specified software system .
* @ param softwareSystem the SoftwareSystem object representing the scope of the view
* @ param key the key for the view ( must be unique )
* @ param description a description of the view
* @ return a ContainerView object
* @ throws IllegalArgumentException if the software system is null or the key is not unique */
public ContainerView createContainerView ( SoftwareSystem softwareSystem , String key , String description ) { } } | assertThatTheSoftwareSystemIsNotNull ( softwareSystem ) ; assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; ContainerView view = new ContainerView ( softwareSystem , key , description ) ; view . setViewSet ( this ) ; containerViews . add ( view ) ; return view ; |
public class MuzeiArtProvider { /** * Callback when the user wishes to see more information about the given artwork . The default
* implementation opens the { @ link ProviderContract . Artwork # WEB _ URI web uri } of the artwork .
* @ param artwork The artwork the user wants to see more information about .
* @ return True if the artwork info was successfully opened . */
protected boolean openArtworkInfo ( @ NonNull Artwork artwork ) { } } | if ( artwork . getWebUri ( ) != null && getContext ( ) != null ) { try { Intent intent = new Intent ( Intent . ACTION_VIEW , artwork . getWebUri ( ) ) ; intent . addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK ) ; getContext ( ) . startActivity ( intent ) ; return true ; } catch ( ActivityNotFoundException e ) { Log . w ( TAG , "Could not open " + artwork . getWebUri ( ) + ", artwork info for " + ContentUris . withAppendedId ( contentUri , artwork . getId ( ) ) , e ) ; } } return false ; |
public class CommandRunner { /** * Run the command and wait for completion . */
public void run ( List < String > command , @ Nullable Path workingDirectory , @ Nullable Map < String , String > environment , ConsoleListener consoleListener ) throws InterruptedException , CommandExitException , CommandExecutionException { } } | ProcessExecutor processExecutor = processExecutorFactory . newProcessExecutor ( ) ; try { int exitCode = processExecutor . run ( command , workingDirectory , environment , streamHandlerFactory . newHandler ( consoleListener ) , streamHandlerFactory . newHandler ( consoleListener ) ) ; if ( exitCode != 0 ) { throw new CommandExitException ( exitCode ) ; } } catch ( IOException ex ) { throw new CommandExecutionException ( ex ) ; } |
public class DefaultWardenService { /** * Create a warden alert which will annotate the corresponding warden metric with suspension events .
* @ param user The user for which the notification should be created . Cannot be null .
* @ param counter The policy counter for which the notification should be created . Cannot be null .
* @ return The warden alert . */
private Alert _constructWardenAlertForUser ( PrincipalUser user , PolicyCounter counter ) { } } | String metricExp = _constructWardenMetricExpression ( "-1h" , user , counter ) ; Alert alert = new Alert ( _adminUser , _adminUser , _constructWardenAlertName ( user , counter ) , metricExp , "*/5 * * * *" ) ; List < Trigger > triggers = new ArrayList < > ( ) ; EntityManager em = emf . get ( ) ; double limit = PolicyLimit . getLimitByUserAndCounter ( em , user , counter ) ; Trigger trigger = new Trigger ( alert , counter . getTriggerType ( ) , "counter-value-" + counter . getTriggerType ( ) . toString ( ) + "-policy-limit" , limit , 0.0 , 0L ) ; triggers . add ( trigger ) ; List < Notification > notifications = new ArrayList < > ( ) ; Notification notification = new Notification ( NOTIFICATION_NAME , alert , _getWardenNotifierClass ( counter ) , new ArrayList < String > ( ) , 3600000 ) ; List < String > metricAnnotationList = new ArrayList < String > ( ) ; String wardenMetricAnnotation = MessageFormat . format ( "{0}:{1}'{'user={2}'}':sum" , Counter . WARDEN_TRIGGERS . getScope ( ) , Counter . WARDEN_TRIGGERS . getMetric ( ) , user . getUserName ( ) ) ; metricAnnotationList . add ( wardenMetricAnnotation ) ; notification . setMetricsToAnnotate ( metricAnnotationList ) ; notification . setTriggers ( triggers ) ; notifications . add ( notification ) ; alert . setTriggers ( triggers ) ; alert . setNotifications ( notifications ) ; return alert ; |
public class SrvAccSettings { /** * < p > Save acc - settings into DB . < / p >
* @ param pAddParam additional param
* @ param pEntity entity
* @ throws Exception - an exception */
@ Override public final synchronized void saveAccSettings ( final Map < String , Object > pAddParam , final AccSettings pEntity ) throws Exception { } } | if ( pEntity . getIsNew ( ) ) { throw new ExceptionWithCode ( ExceptionWithCode . FORBIDDEN , "Attempt to insert accounting settings by " + pAddParam . get ( "user" ) ) ; } else { if ( pEntity . getCostPrecision ( ) < 0 || pEntity . getCostPrecision ( ) > 4 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "precision_must_be_from_0_to_4" ) ; } if ( pEntity . getPricePrecision ( ) < 0 || pEntity . getPricePrecision ( ) > 4 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "precision_must_be_from_0_to_4" ) ; } if ( pEntity . getQuantityPrecision ( ) < 0 || pEntity . getQuantityPrecision ( ) > 4 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "precision_must_be_from_0_to_4" ) ; } if ( pEntity . getBalancePrecision ( ) < 0 || pEntity . getBalancePrecision ( ) > 4 ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "precision_must_be_from_0_to_4" ) ; } getSrvOrm ( ) . updateEntity ( pAddParam , pEntity ) ; retrieveAccSettings ( pAddParam ) ; } |
public class AjaxRadioPanel { /** * Factory method for create the new { @ link RadioGroup } . This method is invoked in the
* constructor from the derived classes and can be overridden so users can provide their own
* version of a new { @ link RadioGroup } .
* @ param id
* the id
* @ param model
* the model
* @ return the new { @ link RadioGroup } */
protected RadioGroup < T > newRadioGroup ( final String id , final IModel < T > model ) { } } | return ComponentFactory . newRadioGroup ( id , model ) ; |
public class TimerNpRunnable { /** * Executes the timer work with configured retries .
* The EJB 3.1 spec , section 18.4.3 says , " If the transaction fails or
* is rolled back , the container must retry the timeout at least once . "
* We allow the user to configure a retry count of 0 , which will cause
* NO retries to be performed . If the retry count is not set , we will
* retry once immediately , then every retryInterval , indefinitely . */
@ Override public void run ( ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) // F743-425 . CodRev
Tr . entry ( tc , "run: " + ivTimer . ivTaskId ) ; // F743-425 . CodRev
if ( serverStopping ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "Server shutting down; aborting" ) ; return ; } if ( ivRetries == 0 ) // This is the first try
{ // F743-7591 - Calculate the next expiration before calling the timeout
// method . This ensures that Timer . getNextTimeout will properly throw
// NoMoreTimeoutsException .
ivTimer . calculateNextExpiration ( ) ; } // Log a warning if this timer is starting late
ivTimer . checkLateTimerThreshold ( ) ; try // F743-425 . CodRev
{ // Call the timeout method ; last chance effort to abort if cancelled
if ( ! ivTimer . isIvDestroyed ( ) ) { doWork ( ) ; } else { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "Timer has been cancelled; aborting" ) ; return ; } ivRetries = 0 ; // re - schedule the alarm to go off again if it needs to ,
// and if timer had not been canceled
ivTimer . scheduleNext ( ) ; // RTC107334
} catch ( Throwable ex ) // F743-425 . CodRev
{ // Do not FFDC . . . that has already been done when the method failed
// All exceptions from timeout methods are system exceptions . . .
// indicating the timeout method failed , and should be retried . d667153
if ( isTraceOn && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "NP Timer failed : " + ex . getClass ( ) . getName ( ) + ":" + ex . getMessage ( ) , ex ) ; } if ( ( ivRetryLimit != - 1 ) && // not configured to retry indefinitely
( ivRetries >= ivRetryLimit ) ) // and retry limit reached
{ // Note : ivRetryLimit = = 0 means no retries at all
ivTimer . calculateNextExpiration ( ) ; ivTimer . scheduleNext ( ) ; ivRetries = 0 ; Tr . warning ( tc , "NP_TIMER_RETRY_LIMIT_REACHED_CNTR0179W" , ivRetryLimit ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "Timer retry limit has been reached; aborting" ) ; return ; } ivRetries ++ ; // begin 597753
if ( ivRetries == 1 ) { // do first retry immediately , by re - entering this method
run ( ) ; } else { // re - schedule the alarm to go off after the retry interval
// ( if timer had not been canceled )
ivTimer . scheduleRetry ( ivRetryInterval ) ; // RTC107334
} } if ( isTraceOn && tc . isEntryEnabled ( ) ) // F743-425 . CodRev
Tr . exit ( tc , "run" ) ; // F743-425 . CodRev |
public class SignalUtil { /** * Logs a warning message . If the elapsed time is greater than
* { @ link # SIGNAL _ LOG _ QUIESCE _ TIMEOUT _ MINUTES } then the log message will indicate that wait
* logging for the thread is being quiesced , and a value of true is returned . Otherwise , false
* is returned .
* This is a convenience method to call
* { @ link # logWaiting ( Logger , String , String , Object , long , Object . . . ) } with the default logger .
* @ param callerClass
* the class name of the caller
* @ param callerMethod
* the method name of the caller
* @ param waitObj
* the object that is being waited on
* @ param start
* the time that the wait began
* @ param extraArgs
* caller provided extra arguments
* @ return true if the elapsed time is greater than { @ link # SIGNAL _ LOG _ QUIESCE _ TIMEOUT _ MINUTES } */
static boolean logWaiting ( String callerClass , String callerMethod , Object waitObj , long start , Object ... extraArgs ) { } } | return logWaiting ( log , callerClass , callerMethod , waitObj , start , extraArgs ) ; |
public class BlockLeaf { /** * Fill the entry set from the tree map . */
void fillDeltaEntries ( Set < PageLeafEntry > entries , Row row , int tail ) { } } | int rowOffset = _rowHead ; byte [ ] buffer = _buffer ; while ( rowOffset < tail ) { int code = buffer [ rowOffset ] & CODE_MASK ; int len = getLength ( code , row ) ; if ( code == INSERT || code == REMOVE ) { PageLeafEntry entry = new PageLeafEntry ( this , row , rowOffset , len , code ) ; entries . add ( entry ) ; } rowOffset += len ; } |
public class Snappy { /** * Computes the CRC32C checksum of the supplied data and performs the " mask " operation
* on the computed checksum
* @ param data The input data to calculate the CRC32C checksum of */
static int calculateChecksum ( ByteBuf data , int offset , int length ) { } } | Crc32c crc32 = new Crc32c ( ) ; try { crc32 . update ( data , offset , length ) ; return maskChecksum ( ( int ) crc32 . getValue ( ) ) ; } finally { crc32 . reset ( ) ; } |
public class Batch { /** * Get body parameters
* @ return Values of body parameters ( name of parameter : value of the parameter ) */
@ Override public Map < String , Object > getBodyParameters ( ) { } } | ArrayList < Map < String , Object > > requestMaps = new ArrayList < Map < String , Object > > ( ) ; for ( Request r : this . requests ) requestMaps . add ( requestToBatchMap ( r ) ) ; HashMap < String , Object > result = new HashMap < String , Object > ( ) ; result . put ( "requests" , requestMaps ) ; result . put ( "distinctRecomms" , this . distinctRecomms ) ; return result ; |
public class LoggerModule { /** * Log processor for level TRACE
* { @ sample . xml . . / . . / . . / doc / soitoolkit - connector . xml . sample soitoolkit : log - trace }
* @ param message Log - message to be processed
* @ param integrationScenario Optional name of the integration scenario or business process
* @ param messageType Optional name of the message type , e . g . a XML Schema namespace for a XML payload
* @ param contractId Optional name of the contract in use
* @ param correlationId Optional correlation identity of the message
* @ param extraInfo Optional extra info
* @ return The incoming payload */
@ Processor public Object logTrace ( @ Optional @ FriendlyName ( "Log Message" ) String message , @ Optional String integrationScenario , @ Optional String messageType , @ Optional String contractId , @ Optional String correlationId , @ Optional @ FriendlyName ( "Extra Info" ) Map < String , String > extraInfo ) { } } | return doLog ( LogLevelType . TRACE , message , integrationScenario , contractId , correlationId , extraInfo ) ; |
public class KbState { /** * Returns { @ code true } if this state is consistent { @ code other } .
* Two states are consistent if every assigned function value is
* equal .
* @ param other
* @ return */
public boolean isConsistentWith ( KbState other ) { } } | // Both states need to have the same functions in the same order .
// Don ' t check the names specifically though , because it ' s expensive .
Preconditions . checkArgument ( other . functionNames . size ( ) == functionNames . size ( ) ) ; List < FunctionAssignment > otherAssignments = other . getAssignments ( ) ; for ( int i = 0 ; i < functionAssignments . size ( ) ; i ++ ) { FunctionAssignment a1 = functionAssignments . get ( i ) ; FunctionAssignment a2 = otherAssignments . get ( i ) ; if ( ! a1 . isConsistentWith ( a2 ) ) { return false ; } } return true ; |
public class MatchmakingConfiguration { /** * Amazon Resource Name ( < a href = " https : / / docs . aws . amazon . com / AmazonS3 / latest / dev / s3 - arn - format . html " > ARN < / a > ) that
* is assigned to a game session queue and uniquely identifies it . Format is
* < code > arn : aws : gamelift : & lt ; region & gt ; : : fleet / fleet - a1234567 - b8c9-0d1e - 2fa3 - b45c6d7e8912 < / code > . These queues are
* used when placing game sessions for matches that are created with this matchmaking configuration . Queues can be
* located in any region .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setGameSessionQueueArns ( java . util . Collection ) } or { @ link # withGameSessionQueueArns ( java . util . Collection ) }
* if you want to override the existing values .
* @ param gameSessionQueueArns
* Amazon Resource Name ( < a
* href = " https : / / docs . aws . amazon . com / AmazonS3 / latest / dev / s3 - arn - format . html " > ARN < / a > ) that is assigned to a
* game session queue and uniquely identifies it . Format is
* < code > arn : aws : gamelift : & lt ; region & gt ; : : fleet / fleet - a1234567 - b8c9-0d1e - 2fa3 - b45c6d7e8912 < / code > . These
* queues are used when placing game sessions for matches that are created with this matchmaking
* configuration . Queues can be located in any region .
* @ return Returns a reference to this object so that method calls can be chained together . */
public MatchmakingConfiguration withGameSessionQueueArns ( String ... gameSessionQueueArns ) { } } | if ( this . gameSessionQueueArns == null ) { setGameSessionQueueArns ( new java . util . ArrayList < String > ( gameSessionQueueArns . length ) ) ; } for ( String ele : gameSessionQueueArns ) { this . gameSessionQueueArns . add ( ele ) ; } return this ; |
public class ResourceManager { /** * Gets the String associated with < code > key < / code > after having resolved
* any nested keys ( { @ link # resolve ( String ) } ) and applied a formatter using
* the given < code > args < / code > .
* @ param key the key to lookup
* @ param args the arguments to pass to the formatter
* @ return the String associated with < code > key < / code > */
public String getString ( String key , Object [ ] args ) { } } | String value = getString ( key ) ; return MessageFormat . format ( value , args ) ; |
public class JndiUtils { /** * Lookup object in JNDI
* @ param name object name
* @ param < T > object class parameter type
* @ return object */
public static < T > T lookup ( String name ) { } } | InitialContext initialContext = initialContext ( ) ; try { @ SuppressWarnings ( "unchecked" ) T object = ( T ) initialContext . lookup ( name ) ; if ( object == null ) { throw new NameNotFoundException ( name + " was found but is null" ) ; } return object ; } catch ( NameNotFoundException e ) { throw new IllegalArgumentException ( name + " was not found in JNDI" , e ) ; } catch ( NamingException e ) { throw new IllegalArgumentException ( "JNDI lookup failed" , e ) ; } finally { closeContext ( initialContext ) ; } |
public class DataStream { /** * Initiates a Project transformation on a { @ link Tuple } { @ link DataStream } . < br >
* < b > Note : Only Tuple DataStreams can be projected . < / b >
* < p > The transformation projects each Tuple of the DataSet onto a ( sub ) set of
* fields .
* @ param fieldIndexes
* The field indexes of the input tuples that are retained . The
* order of fields in the output tuple corresponds to the order
* of field indexes .
* @ return The projected DataStream
* @ see Tuple
* @ see DataStream */
@ PublicEvolving public < R extends Tuple > SingleOutputStreamOperator < R > project ( int ... fieldIndexes ) { } } | return new StreamProjection < > ( this , fieldIndexes ) . projectTupleX ( ) ; |
public class TransactionManager { /** * Same as { @ link # callInTransaction ( ConnectionSource , Callable ) } except this has a table - name .
* WARNING : it is up to you to properly synchronize around this method if multiple threads are using a
* connection - source which works gives out a single - connection . The reason why this is necessary is that multiple
* operations are performed on the connection and race - conditions will exist with multiple threads working on the
* same connection . */
public static < T > T callInTransaction ( String tableName , final ConnectionSource connectionSource , final Callable < T > callable ) throws SQLException { } } | DatabaseConnection connection = connectionSource . getReadWriteConnection ( tableName ) ; try { boolean saved = connectionSource . saveSpecialConnection ( connection ) ; return callInTransaction ( connection , saved , connectionSource . getDatabaseType ( ) , callable ) ; } finally { // we should clear aggressively
connectionSource . clearSpecialConnection ( connection ) ; connectionSource . releaseConnection ( connection ) ; } |
public class RouteFilterRulesInner { /** * Gets all RouteFilterRules in a route filter .
* @ param resourceGroupName The name of the resource group .
* @ param routeFilterName The name of the route filter .
* @ 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 < List < RouteFilterRuleInner > > listByRouteFilterAsync ( final String resourceGroupName , final String routeFilterName , final ListOperationCallback < RouteFilterRuleInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listByRouteFilterSinglePageAsync ( resourceGroupName , routeFilterName ) , new Func1 < String , Observable < ServiceResponse < Page < RouteFilterRuleInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < RouteFilterRuleInner > > > call ( String nextPageLink ) { return listByRouteFilterNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class UtilIO { /** * Constructs the path for a source code file residing in the examples or demonstrations directory
* In the case of the file not being in either directory , an empty string is returned
* The expected parameters are class . getPackage ( ) . getName ( ) , class . getSimpleName ( )
* @ param pkg package containing the class
* @ param app simple class name
* @ return */
public static String getSourcePath ( String pkg , String app ) { } } | String path = "" ; if ( pkg == null || app == null ) return path ; String pathToBase = getPathToBase ( ) ; if ( pathToBase != null ) { if ( pkg . contains ( "examples" ) ) path = new File ( pathToBase , "examples/src/main/java/" ) . getAbsolutePath ( ) ; else if ( pkg . contains ( "demonstrations" ) ) path = new File ( pathToBase , "demonstrations/src/main/java/" ) . getAbsolutePath ( ) ; else { System . err . println ( "pkg must be to examples or demonstrations. " + pkg ) ; return path ; } String pathToCode = pkg . replace ( '.' , '/' ) + "/" + app + ".java" ; return new File ( path , pathToCode ) . getPath ( ) ; } else { // probably running inside a jar
String pathToCode = pkg . replace ( '.' , '/' ) + "/" + app + ".java" ; URL url = UtilIO . class . getClassLoader ( ) . getResource ( pathToCode ) ; if ( url != null ) return url . toString ( ) ; else return pathToCode ; } |
public class IvyOverSLF4JLogger { /** * Logs depending on the < code > _ level < / code > given < code > _ message < / code > .
* @ param _ message message to log
* @ param _ level level to log */
public void log ( final String _message , final int _level ) { } } | switch ( _level ) { case 4 : if ( IvyOverSLF4JLogger . LOG . isDebugEnabled ( ) ) { IvyOverSLF4JLogger . LOG . debug ( _message ) ; } break ; case 3 : if ( IvyOverSLF4JLogger . LOG . isWarnEnabled ( ) ) { IvyOverSLF4JLogger . LOG . warn ( _message ) ; } break ; case 2 : if ( IvyOverSLF4JLogger . LOG . isInfoEnabled ( ) ) { IvyOverSLF4JLogger . LOG . info ( _message ) ; } break ; case 1 : if ( IvyOverSLF4JLogger . LOG . isErrorEnabled ( ) ) { IvyOverSLF4JLogger . LOG . error ( _message ) ; } break ; default : IvyOverSLF4JLogger . LOG . error ( "unknown log level " + _level ) ; IvyOverSLF4JLogger . LOG . error ( _message ) ; } |
public class ApiOvhMe { /** * Alter this object properties
* REST : PUT / me / paymentMean / paypal / { id }
* @ param body [ required ] New object properties
* @ param id [ required ] Id of the object */
public void paymentMean_paypal_id_PUT ( Long id , OvhPaypal body ) throws IOException { } } | String qPath = "/me/paymentMean/paypal/{id}" ; StringBuilder sb = path ( qPath , id ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class StopRunRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( StopRunRequest stopRunRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( stopRunRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( stopRunRequest . getArn ( ) , ARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GitlabAPI { /** * Return Merge Request .
* @ param projectId The id of the project
* @ param mergeRequestIid The internal id of the merge request
* @ return the Gitlab Merge Request
* @ throws IOException on gitlab api call error */
public GitlabMergeRequest getMergeRequestByIid ( Serializable projectId , Integer mergeRequestIid ) throws IOException { } } | String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) + GitlabMergeRequest . URL + "/" + mergeRequestIid ; return retrieve ( ) . to ( tailUrl , GitlabMergeRequest . class ) ; |
public class MTRandom { /** * This method resets the state of this instance using the 64
* bits of seed data provided . Note that if the same seed data
* is passed to two different instances of MTRandom ( both of
* which share the same compatibility state ) then the sequence
* of numbers generated by both instances will be identical .
* If this instance was initialised in ' compatibility ' mode then
* this method will only use the lower 32 bits of any seed value
* passed in and will match the behaviour of the original C code
* exactly with respect to state initialisation .
* @ param seed The 64 bit value used to initialise the random
* number generator state . */
public final synchronized void setSeed ( long seed ) { } } | if ( compat ) { setSeed ( ( int ) seed ) ; } else { // Annoying runtime check for initialisation of internal data
// caused by java . util . Random invoking setSeed ( ) during init .
// This is unavoidable because no fields in our instance will
// have been initialised at this point , not even if the code
// were placed at the declaration of the member variable .
if ( ibuf == null ) ibuf = new int [ 2 ] ; ibuf [ 0 ] = ( int ) seed ; ibuf [ 1 ] = ( int ) ( seed >>> 32 ) ; setSeed ( ibuf ) ; } |
public class JSModuleGraph { /** * Returns the transitive dependencies of the module . */
private Set < JSModule > getTransitiveDeps ( JSModule m ) { } } | Set < JSModule > deps = dependencyMap . computeIfAbsent ( m , JSModule :: getAllDependencies ) ; return deps ; |
public class ColumnMapper { /** * Returns { @ code true } if the specified Cassandra type / marshaller is supported , { @ code false } otherwise .
* @ param type A Cassandra type / marshaller .
* @ return { @ code true } if the specified Cassandra type / marshaller is supported , { @ code false } otherwise . */
public boolean supports ( final AbstractType < ? > type ) { } } | AbstractType < ? > checkedType = type ; if ( type . isCollection ( ) ) { if ( type instanceof MapType < ? , ? > ) { checkedType = ( ( MapType < ? , ? > ) type ) . getValuesType ( ) ; } else if ( type instanceof ListType < ? > ) { checkedType = ( ( ListType < ? > ) type ) . getElementsType ( ) ; } else if ( type instanceof SetType ) { checkedType = ( ( SetType < ? > ) type ) . getElementsType ( ) ; } } if ( type instanceof ReversedType ) { ReversedType reversedType = ( ReversedType ) type ; checkedType = reversedType . baseType ; } for ( AbstractType < ? > n : supportedTypes ) { if ( checkedType . getClass ( ) == n . getClass ( ) ) { return true ; } } return false ; |
public class OlapAggregate { /** * Check required parameters and set default values . */
private void checkDefaults ( ) { } } | Utils . require ( m_shards != null || m_shardsRange != null , "shards or range parameter is not set" ) ; Utils . require ( m_shards == null || m_shardsRange == null , "shards and range parameters cannot be both set" ) ; Utils . require ( m_xshards == null || m_xshardsRange == null , "xshards and xrange parameters cannot be both set" ) ; if ( m_xshards == null && m_xshardsRange == null ) { m_xshards = m_shards ; m_xshardsRange = m_shardsRange ; } if ( m_query == null ) m_query = "*" ; if ( m_metrics == null ) m_metrics = "COUNT(*)" ; |
public class CmsInternalLinkValidationDialog { /** * Creates the list of widgets for this dialog . < p > */
@ Override protected void defineWidgets ( ) { } } | // initialize the project object to use for the dialog
initSessionObject ( ) ; setKeyPrefix ( KEY_PREFIX ) ; // widgets to display
addWidget ( new CmsWidgetDialogParameter ( this , "resources" , "/" , PAGES [ 0 ] , new CmsVfsFileWidget ( false , null ) , 1 , CmsWidgetDialogParameter . MAX_OCCURENCES ) ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link VerticalDatumRefType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link VerticalDatumRefType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "usesVerticalDatum" ) public JAXBElement < VerticalDatumRefType > createUsesVerticalDatum ( VerticalDatumRefType value ) { } } | return new JAXBElement < VerticalDatumRefType > ( _UsesVerticalDatum_QNAME , VerticalDatumRefType . class , null , value ) ; |
public class XmlUtil { /** * Dump a { @ link Document } or { @ link Node } - compatible object to the given { @ link OutputStream } ( e . g . System . out ) .
* @ param _ docOrNode { @ link Document } or { @ link Node } object
* @ param _ outStream { @ link OutputStream } to print on
* @ throws IOException on error */
public static void printDocument ( Node _docOrNode , OutputStream _outStream ) throws IOException { } } | if ( _docOrNode == null || _outStream == null ) { throw new IOException ( "Cannot print (on) 'null' object" ) ; } TransformerFactory tf = TransformerFactory . newInstance ( ) ; Transformer transformer ; try { transformer = tf . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , "no" ) ; transformer . setOutputProperty ( OutputKeys . METHOD , "xml" ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , "UTF-8" ) ; transformer . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , "4" ) ; transformer . transform ( new DOMSource ( _docOrNode ) , new StreamResult ( new OutputStreamWriter ( _outStream , "UTF-8" ) ) ) ; } catch ( UnsupportedEncodingException | TransformerException _ex ) { throw new IOException ( "Could not print Document or Node." , _ex ) ; } |
public class CommerceTierPriceEntryPersistenceImpl { /** * Returns the first commerce tier price entry in the ordered set where commercePriceEntryId = & # 63 ; and minQuantity & le ; & # 63 ; .
* @ param commercePriceEntryId the commerce price entry ID
* @ param minQuantity the min quantity
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce tier price entry
* @ throws NoSuchTierPriceEntryException if a matching commerce tier price entry could not be found */
@ Override public CommerceTierPriceEntry findByC_LtM_First ( long commercePriceEntryId , int minQuantity , OrderByComparator < CommerceTierPriceEntry > orderByComparator ) throws NoSuchTierPriceEntryException { } } | CommerceTierPriceEntry commerceTierPriceEntry = fetchByC_LtM_First ( commercePriceEntryId , minQuantity , orderByComparator ) ; if ( commerceTierPriceEntry != null ) { return commerceTierPriceEntry ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commercePriceEntryId=" ) ; msg . append ( commercePriceEntryId ) ; msg . append ( ", minQuantity=" ) ; msg . append ( minQuantity ) ; msg . append ( "}" ) ; throw new NoSuchTierPriceEntryException ( msg . toString ( ) ) ; |
public class LogLevelMapping { /** * Converts the JDK level to a name supported by Selenium .
* @ param level log level to get the string name of
* @ return string name representation of the level selenium supports */
public static String getName ( Level level ) { } } | Level normalized = normalize ( level ) ; return normalized == Level . FINE ? DEBUG : normalized . getName ( ) ; |
public class JdbcTemplateJdbcHelper { /** * { @ inheritDoc } */
@ Override public int execute ( Connection conn , String sql , Object ... bindValues ) { } } | long timestampStart = System . currentTimeMillis ( ) ; try { JdbcTemplate jdbcTemplate = jdbcTemplate ( conn ) ; return bindValues != null && bindValues . length > 0 ? jdbcTemplate . update ( sql , bindValues ) : jdbcTemplate . update ( sql ) ; } catch ( DataAccessException dae ) { throw translateSQLException ( dae ) ; } finally { BaseDao . addProfiling ( timestampStart , sql , System . currentTimeMillis ( ) - timestampStart ) ; } |
public class ThreadDelegatedScope { /** * Returns the context ( the set of objects bound to the scope ) for the current thread .
* A context may be shared by multiple threads . */
public ThreadDelegatedContext getContext ( ) { } } | ThreadDelegatedContext context = threadLocal . get ( ) ; if ( context == null ) { context = new ThreadDelegatedContext ( ) ; threadLocal . set ( context ) ; } return context ; |
public class NetworkManager { /** * Deploys all network components . */
private void deployComponents ( Collection < ComponentContext < ? > > components , final CountingCompletionHandler < Void > counter ) { } } | for ( final ComponentContext < ? > component : components ) { deployComponent ( component , new Handler < AsyncResult < Void > > ( ) { @ Override public void handle ( AsyncResult < Void > result ) { if ( result . failed ( ) ) { counter . fail ( result . cause ( ) ) ; } else { data . put ( component . address ( ) , Contexts . serialize ( component ) . encode ( ) , new Handler < AsyncResult < String > > ( ) { @ Override public void handle ( AsyncResult < String > result ) { if ( result . failed ( ) ) { counter . fail ( result . cause ( ) ) ; } else { counter . succeed ( ) ; } } } ) ; } } } ) ; } |
public class AstNode { /** * Remove the child node from this node , and replace that child with its first child ( if there is one ) .
* @ param child the child to be extracted ; may not be null and must have at most 1 child
* @ see # extractFromParent ( ) */
public void extractChild ( AstNode child ) { } } | if ( child . getChildCount ( ) == 0 ) { removeChild ( child ) ; } else { AstNode grandChild = child . getFirstChild ( ) ; replaceChild ( child , grandChild ) ; } |
public class ClassFieldsScreen { /** * Set up all the screen fields . */
public void setupSFields ( ) { } } | this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_FIELDS_TYPE ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_FIELD_CLASS ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_FIELD_NAME ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_FIELD_SEQUENCE ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_FIELD_DESC ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_FIELD_PROTECT ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_FIELD_INITIAL ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_INFO_CLASS_NAME ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . CLASS_FIELD_INITIAL_VALUE ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; this . getRecord ( ClassFields . CLASS_FIELDS_FILE ) . getField ( ClassFields . INCLUDE_SCOPE ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; |
public class Templater { /** * Builds the project and stores it at the specified { @ code projectRoot } .
* You need to have specified at least the main class name for the project
* to be built .
* @ param projectRoot
* @ throws NullPointerException if { @ code projectRoot = = null } .
* @ throws IllegalArgumentException if no main class had been specified . */
public void buildProject ( File projectRoot ) { } } | if ( projectRoot == null ) { throw new NullPointerException ( "projectRoot" ) ; } if ( mainClass == null ) { throw new IllegalArgumentException ( "No main class specified" ) ; } mainClassName = mainClass . substring ( mainClass . lastIndexOf ( '.' ) + 1 ) ; if ( executable == null || executable . length ( ) == 0 ) { executable = mainClassName ; } if ( appName == null || appName . length ( ) == 0 ) { appName = mainClassName ; } if ( packageName == null || packageName . length ( ) == 0 ) { int index = mainClass . lastIndexOf ( '.' ) ; if ( index == - 1 ) { packageName = "" ; } else { packageName = mainClass . substring ( 0 , index ) ; } } packageDirName = packageName . replace ( '.' , '/' ) ; if ( appId == null || appId . length ( ) == 0 ) { appId = packageName ; if ( appId == null || appId . length ( ) == 0 ) { appId = mainClassName ; } } try { File targetFile = new File ( projectRoot , FilenameUtils . getBaseName ( templateURL . getPath ( ) ) ) ; FileUtils . copyURLToFile ( templateURL , targetFile ) ; extractArchive ( targetFile , targetFile . getParentFile ( ) ) ; targetFile . delete ( ) ; } catch ( IOException e ) { throw new Error ( e ) ; } |
public class FileClassManager { /** * Moves a class definition from the specified directory tree to another
* specified directory tree .
* @ param fromDirectory The root of the directory tree from which to move
* the class definition .
* @ param name The fully qualified name of the class to move .
* @ param toDirectory The root of the directory tree to move the class
* definition to . */
private void moveClass ( File fromDirectory , String name , File toDirectory ) { } } | String baseName = getBaseFileName ( name ) ; File fromClassFile = new File ( fromDirectory , baseName + CLASS_EXTENSION ) ; File toClassFile = new File ( toDirectory , baseName + CLASS_EXTENSION ) ; File fromDigestFile = new File ( fromDirectory , baseName + DIGEST_EXTENSION ) ; File toDigestFile = new File ( toDirectory , baseName + DIGEST_EXTENSION ) ; File toClassDirectory = toClassFile . getParentFile ( ) ; toClassDirectory . mkdirs ( ) ; fromClassFile . renameTo ( toClassFile ) ; fromDigestFile . renameTo ( toDigestFile ) ; |
public class XMLSerializer { /** * Private methods - - - - - */
private void processStartElement ( ) throws SAXException { } } | if ( openStartElement ) { final QName qName = elementStack . getFirst ( ) ; // peek
for ( final NamespaceMapping p : qName . mappings ) { if ( p . newMapping ) { transformer . startPrefixMapping ( p . prefix , p . uri ) ; } } final Attributes atts = openAttributes != null ? openAttributes : EMPTY_ATTS ; transformer . startElement ( qName . uri , qName . localName , qName . qName , atts ) ; openStartElement = false ; openAttributes = null ; } |
public class Unobfuscated { /** * Return un - obfuscated data as byte array .
* @ return un - obfuscated data */
public byte [ ] asByteArray ( ) { } } | Objects . requireNonNull ( data ) ; byte [ ] ret = Arrays . copyOf ( data , data . length ) ; Arrays . fill ( data , ( byte ) 0 ) ; data = null ; return ret ; |
public class Rectangle { /** * Sets all the values .
* @ param x The x coordinate of the position
* @ param y The y coordinate of the position
* @ param width The width
* @ param height The height */
public void set ( int x , int y , int width , int height ) { } } | setPosition ( x , y ) ; setSize ( width , height ) ; |
public class CommonSuffixExtractor { /** * 此方法认为后缀一定是整个的词语 , 所以length是以词语为单位的
* @ param length
* @ param size
* @ param extend
* @ return */
public List < String > extractSuffixByWords ( int length , int size , boolean extend ) { } } | TFDictionary suffixTreeSet = new TFDictionary ( ) ; for ( String key : tfDictionary . keySet ( ) ) { List < Term > termList = StandardTokenizer . segment ( key ) ; if ( termList . size ( ) > length ) { suffixTreeSet . add ( combine ( termList . subList ( termList . size ( ) - length , termList . size ( ) ) ) ) ; if ( extend ) { for ( int l = 1 ; l < length ; ++ l ) { suffixTreeSet . add ( combine ( termList . subList ( termList . size ( ) - l , termList . size ( ) ) ) ) ; } } } } return extract ( suffixTreeSet , size ) ; |
public class RandomVariableLowMemory { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariableInterface # addRatio ( net . finmath . stochastic . RandomVariableInterface , net . finmath . stochastic . RandomVariableInterface ) */
public RandomVariableInterface addRatio ( RandomVariableInterface numerator , RandomVariableInterface denominator ) { } } | // Set time of this random variable to maximum of time with respect to which measurability is known .
double newTime = Math . max ( Math . max ( time , numerator . getFiltrationTime ( ) ) , denominator . getFiltrationTime ( ) ) ; if ( isDeterministic ( ) && numerator . isDeterministic ( ) && denominator . isDeterministic ( ) ) { double newValueIfNonStochastic = valueIfNonStochastic + ( numerator . get ( 0 ) / denominator . get ( 0 ) ) ; return new RandomVariableLowMemory ( newTime , newValueIfNonStochastic ) ; } else { double [ ] newRealizations = new double [ Math . max ( Math . max ( size ( ) , numerator . size ( ) ) , denominator . size ( ) ) ] ; for ( int i = 0 ; i < newRealizations . length ; i ++ ) { newRealizations [ i ] = get ( i ) + numerator . get ( i ) / denominator . get ( i ) ; } return new RandomVariableLowMemory ( newTime , newRealizations ) ; } |
public class QueryRequest { /** * This is a legacy parameter . Use < code > KeyConditionExpression < / code > instead . For more information , see < a href =
* " https : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / LegacyConditionalParameters . KeyConditions . html "
* > KeyConditions < / a > in the < i > Amazon DynamoDB Developer Guide < / i > .
* @ param keyConditions
* This is a legacy parameter . Use < code > KeyConditionExpression < / code > instead . For more information , see < a
* href =
* " https : / / docs . aws . amazon . com / amazondynamodb / latest / developerguide / LegacyConditionalParameters . KeyConditions . html "
* > KeyConditions < / a > in the < i > Amazon DynamoDB Developer Guide < / i > .
* @ return Returns a reference to this object so that method calls can be chained together . */
public QueryRequest withKeyConditions ( java . util . Map < String , Condition > keyConditions ) { } } | setKeyConditions ( keyConditions ) ; return this ; |
public class Model { /** * This is a convenience method to create a model instance already initialized with values .
* Example :
* < pre >
* Person p = Person . create ( " name " , " Sam " , " last _ name " , " Margulis " , " dob " , " 2001-01-07 " ) ;
* < / pre >
* The first ( index 0 ) and every other element in the array is an attribute name , while the second ( index 1 ) and every
* other is a corresponding value .
* This allows for better readability of code . If you just read this aloud , it will become clear .
* @ param namesAndValues names and values . elements at indexes 0 , 2 , 4 , 8 . . . are attribute names , and elements at
* indexes 1 , 3 , 5 . . . are values . Element at index 1 is a value for attribute at index 0 and so on .
* @ return newly instantiated model . */
public static < T extends Model > T create ( Object ... namesAndValues ) { } } | return ModelDelegate . create ( Model . < T > modelClass ( ) , namesAndValues ) ; |
public class CDL { /** * Produce a comma delimited text row from a JSONArray . Values containing
* the comma character will be quoted . < p >
* @ param ja A JSONArray of strings
* @ return A string ending in NEWLINE */
public static String rowToString ( JSONArray ja ) { } } | StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < ja . length ( ) ; i += 1 ) { if ( i > 0 ) { sb . append ( ',' ) ; } Object o = ja . opt ( i ) ; if ( o != null ) { String s = o . toString ( ) ; if ( s . indexOf ( ',' ) >= 0 ) { if ( s . indexOf ( '"' ) >= 0 ) { sb . append ( '\'' ) ; sb . append ( s ) ; sb . append ( '\'' ) ; } else { sb . append ( '"' ) ; sb . append ( s ) ; sb . append ( '"' ) ; } } else { sb . append ( s ) ; } } } sb . append ( '\n' ) ; return sb . toString ( ) ; |
public class sms_profile { /** * < pre >
* Use this operation to modify sms profile . .
* < / pre > */
public static sms_profile update ( nitro_service client , sms_profile resource ) throws Exception { } } | resource . validate ( "modify" ) ; return ( ( sms_profile [ ] ) resource . update_resource ( client ) ) [ 0 ] ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.