signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class WeekFields { /** * Obtains an instance of { @ code WeekFields } from the first day - of - week and minimal days .
* The first day - of - week defines the ISO { @ code DayOfWeek } that is day 1 of the week .
* The minimal number of days in the first week defines how many days must be present
* in a month or year , starting from the first day - of - week , before the week is counted
* as the first week . A value of 1 will count the first day of the month or year as part
* of the first week , whereas a value of 7 will require the whole seven days to be in
* the new month or year .
* WeekFields instances are singletons ; for each unique combination
* of { @ code firstDayOfWeek } and { @ code minimalDaysInFirstWeek } the
* the same instance will be returned .
* @ param firstDayOfWeek the first day of the week , not null
* @ param minimalDaysInFirstWeek the minimal number of days in the first week , from 1 to 7
* @ return the week - definition , not null
* @ throws IllegalArgumentException if the minimal days value is less than one
* or greater than 7 */
public static WeekFields of ( DayOfWeek firstDayOfWeek , int minimalDaysInFirstWeek ) { } } | String key = firstDayOfWeek . toString ( ) + minimalDaysInFirstWeek ; WeekFields rules = CACHE . get ( key ) ; if ( rules == null ) { rules = new WeekFields ( firstDayOfWeek , minimalDaysInFirstWeek ) ; CACHE . putIfAbsent ( key , rules ) ; rules = CACHE . get ( key ) ; } return rules ; |
public class HikariPool { /** * Set a metrics registry to be used when registering metrics collectors . The HikariDataSource prevents this
* method from being called more than once .
* @ param metricRegistry the metrics registry instance to use */
public void setMetricRegistry ( Object metricRegistry ) { } } | if ( metricRegistry != null && safeIsAssignableFrom ( metricRegistry , "com.codahale.metrics.MetricRegistry" ) ) { setMetricsTrackerFactory ( new CodahaleMetricsTrackerFactory ( ( MetricRegistry ) metricRegistry ) ) ; } else if ( metricRegistry != null && safeIsAssignableFrom ( metricRegistry , "io.micrometer.core.instrument.MeterRegistry" ) ) { setMetricsTrackerFactory ( new MicrometerMetricsTrackerFactory ( ( MeterRegistry ) metricRegistry ) ) ; } else { setMetricsTrackerFactory ( null ) ; } |
public class SiftScaleSpace { /** * Computes all the scale images in an octave . This includes DoG images . */
private void computeOctaveScales ( ) { } } | octaveImages [ 0 ] = tempImage0 ; for ( int i = 1 ; i < numScales + 3 ; i ++ ) { octaveImages [ i ] . reshape ( tempImage0 . width , tempImage0 . height ) ; applyGaussian ( octaveImages [ i - 1 ] , octaveImages [ i ] , kernelSigmaToK [ i - 1 ] ) ; } for ( int i = 1 ; i < numScales + 3 ; i ++ ) { differenceOfGaussian [ i - 1 ] . reshape ( tempImage0 . width , tempImage0 . height ) ; PixelMath . subtract ( octaveImages [ i ] , octaveImages [ i - 1 ] , differenceOfGaussian [ i - 1 ] ) ; } |
public class AbstractCommandBuilder { /** * Adds a properties file to be passed to the server . Note that the file must exist .
* @ param file the file to add
* @ return the builder
* @ throws java . lang . IllegalArgumentException if the file does not exist or is not a regular file */
public T addPropertiesFile ( final String file ) { } } | if ( file != null ) { addPropertiesFile ( Paths . get ( file ) ) ; } return getThis ( ) ; |
public class PeriodDuration { /** * Obtains an instance based on a period .
* The duration will be zero .
* @ param period the period , not null
* @ return the combined period - duration , not null */
public static PeriodDuration of ( Period period ) { } } | Objects . requireNonNull ( period , "The period must not be null" ) ; return new PeriodDuration ( period , Duration . ZERO ) ; |
public class AnyValueMap { /** * Gets the value stored in this map element without any conversions
* @ return the value of the map element . */
public Object getAsObject ( ) { } } | Map < String , Object > result = new HashMap < String , Object > ( ) ; for ( Map . Entry < String , Object > entry : this . entrySet ( ) ) result . put ( entry . getKey ( ) , entry . getValue ( ) ) ; return result ; |
public class JsonWriter { /** * This methods write @ odata . type of complex type .
* If complex type has root - level , @ odata . type won ' t be written .
* @ param structuredType structuredType */
private void writeODataType ( StructuredType structuredType ) throws IOException { } } | if ( entitySet != null ) { String typeName = entitySet . getTypeName ( ) ; String type = typeName . substring ( typeName . lastIndexOf ( "." ) + 1 , typeName . length ( ) ) ; if ( ! type . equals ( structuredType . getName ( ) ) ) { jsonGenerator . writeStringField ( TYPE , String . format ( "#%s.%s" , structuredType . getNamespace ( ) , structuredType . getName ( ) ) ) ; } else { LOG . trace ( "{} has root level. {} won't be written here" , entitySet . getName ( ) , TYPE ) ; } } |
public class BaseActivity { /** * when some views can ' t be clicked at same time or too fast , use this
* method . should override { @ link # setViewsEnability ( boolean ) } */
public void delayEnableViews ( ) { } } | Message msg = Message . obtain ( mHandler , MSG_ENABLE_VIEWS , 1 , 0 ) ; if ( msg != null ) msg . sendToTarget ( ) ; msg = Message . obtain ( mHandler , MSG_ENABLE_VIEWS , 0 , 0 ) ; if ( msg != null ) mHandler . sendMessageDelayed ( msg , DEFAULT_DELAY_TIME ) ; |
public class PeriodFormat { private static PeriodFormatter buildWordBased ( Locale locale ) { } } | ResourceBundle b = ResourceBundle . getBundle ( BUNDLE_NAME , locale ) ; if ( containsKey ( b , "PeriodFormat.regex.separator" ) ) { return buildRegExFormatter ( b , locale ) ; } else { return buildNonRegExFormatter ( b , locale ) ; } |
public class ComputeSpecs { /** * Returns true if field corresponding to fieldID is set ( has been assigned a value ) and false otherwise */
public boolean isSet ( _Fields field ) { } } | if ( field == null ) { throw new IllegalArgumentException ( ) ; } switch ( field ) { case NUM_CPUS : return isSetNumCpus ( ) ; case NETWORK_MBPS : return isSetNetworkMBps ( ) ; case MEMORY_MB : return isSetMemoryMB ( ) ; case DISK_GB : return isSetDiskGB ( ) ; } throw new IllegalStateException ( ) ; |
public class CmsJspImageBean { /** * Returns the ratio height percentage of an image based on width and height . < p >
* @ param width width to calculate percentage from
* @ param height height to calculate percentage from
* @ return the ratio height percentage of an image based on width and height */
protected String calcRatioHeightPercentage ( double width , double height ) { } } | double p = Math . round ( ( height / width ) * 10000000.0 ) / 100000.0 ; return String . valueOf ( p ) + "%" ; |
public class ContentUriChecker { /** * Replace internal from uri .
* @ param input the input
* @ param replace the replace
* @ param rewriterListener the rewriter listener
* @ return the string */
private String replaceInternalFromUri ( String input , final List < Triple < Token , Token , String > > replace , UriBaseListener rewriterListener ) { } } | Pair < ParserRuleContext , CommonTokenStream > parser = prepareUri ( input ) ; pathSegmentIndex = - 1 ; walker . walk ( rewriterListener , parser . value0 ) ; TokenStreamRewriter rewriter = new TokenStreamRewriter ( parser . value1 ) ; for ( Triple < Token , Token , String > item : replace ) { rewriter . replace ( item . value0 , item . value1 , item . value2 ) ; } return rewriter . getText ( ) ; |
public class DeleteRoomSkillParameterRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteRoomSkillParameterRequest deleteRoomSkillParameterRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteRoomSkillParameterRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteRoomSkillParameterRequest . getRoomArn ( ) , ROOMARN_BINDING ) ; protocolMarshaller . marshall ( deleteRoomSkillParameterRequest . getSkillId ( ) , SKILLID_BINDING ) ; protocolMarshaller . marshall ( deleteRoomSkillParameterRequest . getParameterKey ( ) , PARAMETERKEY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SpringBootAdminServletApplication { /** * tag : : customization - instance - exchange - filter - function [ ] */
@ Bean public InstanceExchangeFilterFunction auditLog ( ) { } } | return ( instance , request , next ) -> { if ( HttpMethod . DELETE . equals ( request . method ( ) ) || HttpMethod . POST . equals ( request . method ( ) ) ) { log . info ( "{} for {} on {}" , request . method ( ) , instance . getId ( ) , request . url ( ) ) ; } return next . exchange ( request ) ; } ; |
public class BusNetwork { /** * Replies the nearest bus hub to the given point .
* @ param x x coordinate .
* @ param y y coordinate .
* @ return the nearest bus hub or < code > null < / code > if none was found . */
@ Pure public BusHub getNearestBusHub ( double x , double y ) { } } | double distance = Double . POSITIVE_INFINITY ; BusHub bestHub = null ; double dist ; for ( final BusHub hub : this . validBusHubs ) { dist = hub . distance ( x , y ) ; if ( dist < distance ) { distance = dist ; bestHub = hub ; } } return bestHub ; |
public class AbstractWSelectList { /** * Set the complete list of options available for selection for this users session .
* @ param aArray the list of options available to the user . */
public void setOptions ( final Object [ ] aArray ) { } } | setOptions ( aArray == null ? null : Arrays . asList ( aArray ) ) ; |
public class HtmlExceptionFormatter { /** * Format an exception into XHTML .
* Optionally include a message and the stack trace .
* The formatted exception will have line breaks replaced with XHTML line breaks for display
* in HTML . The String message of the cause will be included , and the stack trace of the
* cause is optionally included given the value of < code > includeStackTrace < / code >
* @ param message the message to include with the formatted exception . This is in addition to the message in the stack trace .
* @ param t a Throwable exception to format
* @ param includeStackTrace a boolean that determines whether to include the stack trace in the formatted output
* @ return the formatted error message , optionally including the stack trace . */
public static String format ( String message , Throwable t , boolean includeStackTrace ) { } } | InternalStringBuilder buf = new InternalStringBuilder ( ) ; if ( message != null ) { buf . append ( message ) ; Throwable cause = discoverRootCause ( t ) ; if ( cause != null ) { buf . append ( HTML_LINE_BREAK ) ; buf . append ( CAUSED_BY ) ; buf . append ( ": " ) ; buf . append ( cause . toString ( ) ) ; } } if ( includeStackTrace ) { if ( message != null ) buf . append ( HTML_LINE_BREAK ) ; String st = addStackTrace ( t ) ; buf . append ( st ) ; Throwable rootCause = null ; Throwable tmp = t ; while ( hasRootCause ( tmp ) && ( rootCause = discoverRootCause ( tmp ) ) != null ) { st = addStackTrace ( rootCause ) ; buf . append ( HTML_LINE_BREAK ) ; buf . append ( st ) ; tmp = rootCause ; } } return buf . toString ( ) . replaceAll ( LINE_BREAK , HTML_LINE_BREAK ) ; |
public class Hashes { /** * Preprocesses a bit vector so that MurmurHash3 can be computed in constant
* time on all prefixes .
* < strong > Warning < / strong > : this code is still experimental .
* @ param bv
* a bit vector .
* @ param seed
* a seed for the hash .
* @ return an array of four component arrays containing the state of the
* variables < code > h1 < / code > , < code > h2 < / code > , < code > c1 < / code > and
* < code > c2 < / code > during the hash computation ; these vector must be
* passed to
* { @ link # murmur3 ( BitVector , long , long [ ] , long [ ] , long [ ] , long [ ] ) }
* ( and analogous methods ) in this order .
* @ see # murmur3 ( BitVector , long ) */
public static long [ ] [ ] preprocessMurmur3 ( final BitVector bv , final long seed ) { } } | long from = 0 ; final long length = bv . length ( ) ; long h1 = 0x9368e53c2f6af274L ^ seed ; long h2 = 0x586dcd208f7cd3fdL ^ seed ; long c1 = 0x87c37b91114253d5L ; long c2 = 0x4cf5ad432745937fL ; final int wordLength = ( int ) ( length / ( 2 * Long . SIZE ) ) ; final long state [ ] [ ] = new long [ 4 ] [ wordLength + 1 ] ; long k1 , k2 ; int i = 0 ; state [ 0 ] [ i ] = h1 ; state [ 1 ] [ i ] = h2 ; state [ 2 ] [ i ] = c1 ; state [ 3 ] [ i ] = c2 ; for ( i ++ ; length - from >= Long . SIZE * 2 ; i ++ ) { k1 = bv . getLong ( from , from + Long . SIZE ) ; k2 = bv . getLong ( from + Long . SIZE , from += 2 * Long . SIZE ) ; k1 *= c1 ; k1 = Long . rotateLeft ( k1 , 23 ) ; k1 *= c2 ; h1 ^= k1 ; h1 += h2 ; h2 = Long . rotateLeft ( h2 , 41 ) ; k2 *= c2 ; k2 = Long . rotateLeft ( k2 , 23 ) ; k2 *= c1 ; h2 ^= k2 ; h2 += h1 ; h1 = h1 * 3 + 0x52dce729 ; h2 = h2 * 3 + 0x38495ab5 ; c1 = c1 * 5 + 0x7b7d159c ; c2 = c2 * 5 + 0x6bce6396 ; state [ 0 ] [ i ] = h1 ; state [ 1 ] [ i ] = h2 ; state [ 2 ] [ i ] = c1 ; state [ 3 ] [ i ] = c2 ; } return state ; |
public class CPMeasurementUnitLocalServiceWrapper { /** * Returns the cp measurement unit matching the UUID and group .
* @ param uuid the cp measurement unit ' s UUID
* @ param groupId the primary key of the group
* @ return the matching cp measurement unit
* @ throws PortalException if a matching cp measurement unit could not be found */
@ Override public com . liferay . commerce . product . model . CPMeasurementUnit getCPMeasurementUnitByUuidAndGroupId ( String uuid , long groupId ) throws com . liferay . portal . kernel . exception . PortalException { } } | return _cpMeasurementUnitLocalService . getCPMeasurementUnitByUuidAndGroupId ( uuid , groupId ) ; |
public class XTypeLiteralImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case XbasePackage . XTYPE_LITERAL__TYPE : setType ( ( JvmType ) null ) ; return ; case XbasePackage . XTYPE_LITERAL__ARRAY_DIMENSIONS : getArrayDimensions ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ; |
public class Processor { /** * Set input document .
* @ param input input document file
* @ return this Process object */
public Processor setInput ( final File input ) { } } | if ( ! input . isAbsolute ( ) ) { throw new IllegalArgumentException ( "Input file path must be absolute: " + input ) ; } if ( ! input . isFile ( ) ) { throw new IllegalArgumentException ( "Input file is not a file: " + input ) ; } setInput ( input . toURI ( ) ) ; return this ; |
public class RecordSetsInner { /** * Updates a record set within a Private DNS zone .
* @ param resourceGroupName The name of the resource group .
* @ param privateZoneName The name of the Private DNS zone ( without a terminating dot ) .
* @ param recordType The type of DNS record in this record set . Possible values include : ' A ' , ' AAAA ' , ' CNAME ' , ' MX ' , ' PTR ' , ' SOA ' , ' SRV ' , ' TXT '
* @ param relativeRecordSetName The name of the record set , relative to the name of the zone .
* @ param parameters Parameters supplied to the Update operation .
* @ 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 < RecordSetInner > updateAsync ( String resourceGroupName , String privateZoneName , RecordType recordType , String relativeRecordSetName , RecordSetInner parameters , final ServiceCallback < RecordSetInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateWithServiceResponseAsync ( resourceGroupName , privateZoneName , recordType , relativeRecordSetName , parameters ) , serviceCallback ) ; |
public class ArrayUtils { /** * Swaps the keys and values at { @ code i } with those at { @ code j }
* @ param keys
* @ param values
* @ param i
* @ param j */
private static final void swap ( int [ ] keys , Object [ ] [ ] values , int i , int j ) { } } | int keySwap = keys [ i ] ; keys [ i ] = keys [ j ] ; keys [ j ] = keySwap ; Object swapValue ; for ( int k = 0 ; k < values . length ; k ++ ) { swapValue = values [ k ] [ i ] ; values [ k ] [ i ] = values [ k ] [ j ] ; values [ k ] [ j ] = swapValue ; } |
public class EncryptKit { /** * Hmac加密模板
* @ param data 数据
* @ param key 秘钥
* @ param algorithm 加密算法
* @ return 密文字节数组 */
private static byte [ ] hmacTemplate ( byte [ ] data , byte [ ] key , String algorithm ) { } } | if ( data == null || data . length == 0 || key == null || key . length == 0 ) return null ; try { SecretKeySpec secretKey = new SecretKeySpec ( key , algorithm ) ; Mac mac = Mac . getInstance ( algorithm ) ; mac . init ( secretKey ) ; return mac . doFinal ( data ) ; } catch ( InvalidKeyException | NoSuchAlgorithmException e ) { e . printStackTrace ( ) ; return null ; } |
public class GVRPhysicsAvatar { /** * Load physics information for the current avatar
* @ param filename name of physics file
* @ param scene scene the avatar is part of
* @ throws IOException if physics file cannot be parsed */
public void loadPhysics ( String filename , GVRScene scene ) throws IOException { } } | GVRPhysicsLoader . loadPhysicsFile ( getGVRContext ( ) , filename , true , scene ) ; |
public class DescribeDBClusterParameterGroupsResult { /** * A list of DB cluster parameter groups .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setDBClusterParameterGroups ( java . util . Collection ) } or
* { @ link # withDBClusterParameterGroups ( java . util . Collection ) } if you want to override the existing values .
* @ param dBClusterParameterGroups
* A list of DB cluster parameter groups .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeDBClusterParameterGroupsResult withDBClusterParameterGroups ( DBClusterParameterGroup ... dBClusterParameterGroups ) { } } | if ( this . dBClusterParameterGroups == null ) { setDBClusterParameterGroups ( new java . util . ArrayList < DBClusterParameterGroup > ( dBClusterParameterGroups . length ) ) ; } for ( DBClusterParameterGroup ele : dBClusterParameterGroups ) { this . dBClusterParameterGroups . add ( ele ) ; } return this ; |
public class QueryRecord { /** * Get this field in the record .
* This is a little different for a query record , because I have to look through multiple records .
* @ param strFieldName The field in the query to retrive .
* @ return The field at this location . */
public BaseField getField ( String strFieldName ) // Lookup this field
{ } } | for ( int i = 0 ; i < this . getRecordlistCount ( ) ; i ++ ) { Record record = this . getRecordlistAt ( i ) ; BaseField field = record . getField ( strFieldName ) ; if ( field != null ) return field ; } return null ; // Not found |
public class Sentence { /** * Create an ArrayList as a list of < code > TaggedWord < / code > from two
* lists of < code > String < / code > , one for the words , and the second for
* the tags .
* @ param lex a list whose items are of type < code > String < / code > and
* are the words
* @ param tags a list whose items are of type < code > String < / code > and
* are the tags
* @ return The Sentence */
public static ArrayList < TaggedWord > toTaggedList ( List < String > lex , List < String > tags ) { } } | ArrayList < TaggedWord > sent = new ArrayList < TaggedWord > ( ) ; int ls = lex . size ( ) ; int ts = tags . size ( ) ; if ( ls != ts ) { throw new IllegalArgumentException ( "Sentence.toSentence: lengths differ" ) ; } for ( int i = 0 ; i < ls ; i ++ ) { sent . add ( new TaggedWord ( lex . get ( i ) , tags . get ( i ) ) ) ; } return sent ; |
public class Util { /** * Selects first only the classes that are assignable from the target , and then returns the most
* specific matching classes .
* @ param target the Class to match
* @ param availableClasses classes to search
* @ return Set of only the most specific classes that match the target . */
static Set < Class < ? > > findBestMatches ( final Class < ? > target , final Set < Class < ? > > availableClasses ) { } } | final Set < Class < ? > > matches = new HashSet < > ( ) ; if ( availableClasses . contains ( target ) ) { return ImmutableSet . < Class < ? > > of ( target ) ; } else { for ( final Class < ? > clazz : availableClasses ) { if ( clazz . isAssignableFrom ( target ) ) { matches . add ( clazz ) ; } } } final Predicate < Class < ? > > moreSpecificClassPredicate = createMostSpecificMatchPredicate ( matches , Functions . < Class < ? > > identity ( ) ) ; return Sets . filter ( matches , moreSpecificClassPredicate ) ; |
public class VEvent { /** * Sets the physical location of the event .
* @ param location the location ( e . g . " Room 101 " ) or null to remove
* @ return the property that was created
* @ see < a href = " http : / / tools . ietf . org / html / rfc5545 # page - 87 " > RFC 5545
* p . 87-8 < / a >
* @ see < a href = " http : / / tools . ietf . org / html / rfc2445 # page - 84 " > RFC 2445
* p . 84 < / a >
* @ see < a href = " http : / / www . imc . org / pdi / vcal - 10 . doc " > vCal 1.0 p . 32 < / a > */
public Location setLocation ( String location ) { } } | Location prop = ( location == null ) ? null : new Location ( location ) ; setLocation ( prop ) ; return prop ; |
public class Long { /** * Returns the unsigned quotient of dividing the first argument by
* the second where each argument and the result is interpreted as
* an unsigned value .
* < p > Note that in two ' s complement arithmetic , the three other
* basic arithmetic operations of add , subtract , and multiply are
* bit - wise identical if the two operands are regarded as both
* being signed or both being unsigned . Therefore separate { @ code
* addUnsigned } , etc . methods are not provided .
* @ param dividend the value to be divided
* @ param divisor the value doing the dividing
* @ return the unsigned quotient of the first argument divided by
* the second argument
* @ see # remainderUnsigned
* @ since 1.8 */
public static long divideUnsigned ( long dividend , long divisor ) { } } | if ( divisor < 0L ) { // signed comparison
// Answer must be 0 or 1 depending on relative magnitude
// of dividend and divisor .
return ( compareUnsigned ( dividend , divisor ) ) < 0 ? 0L : 1L ; } if ( dividend > 0 ) // Both inputs non - negative
return dividend / divisor ; else { /* * For simple code , leveraging BigInteger . Longer and faster
* code written directly in terms of operations on longs is
* possible ; see " Hacker ' s Delight " for divide and remainder
* algorithms . */
return toUnsignedBigInteger ( dividend ) . divide ( toUnsignedBigInteger ( divisor ) ) . longValue ( ) ; } |
public class DataConverterRegistry { /** * Converts " FROM " object to " TO " format / class .
* @ param < TO >
* target class to convert the source object
* @ param < FROM >
* source class
* @ param to
* target type
* @ param from
* source object
* @ return converted value in " TO " format / class */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) public static final < TO , FROM > TO convert ( Class < TO > to , FROM from ) { // Convert null value
if ( from == null || to == null ) { return null ; } // Convert " null " String to null
if ( "null" . equals ( from ) ) { return null ; } // Class is same
if ( to == Object . class || from . getClass ( ) == to ) { return ( TO ) from ; } // BSON conversion
boolean isFromMap = from != null && from instanceof Map ; if ( isFromMap ) { Object subValue = getSubValue ( ( Map ) from ) ; if ( subValue != null ) { return convert ( to , subValue ) ; } } // Convert FROM - > TO
DataConverterKey < TO , FROM > key = new DataConverterKey < TO , FROM > ( to , ( Class < FROM > ) from . getClass ( ) ) ; DataConverter < TO , FROM > converter = ( DataConverter < TO , FROM > ) converters . get ( key ) ; if ( converter != null ) { return converter . convert ( from ) ; } // Convert any - > TO
converter = ( DataConverter < TO , FROM > ) defaultConverters . get ( to ) ; if ( converter != null ) { return converter . convert ( from ) ; } // Converter not found
throw new IllegalArgumentException ( "Unable to convert " + from . getClass ( ) + " to " + to + ", converter not found in DataConverterRegistry!" ) ; |
public class CaseForEqBuilder { /** * Boolean */
public Cases < Boolean , BooleanExpression > then ( Boolean then ) { } } | return thenBoolean ( ConstantImpl . create ( then ) ) ; |
public class View { /** * Invoked after previous view is hidden and this view is about to show . Might be called when the view is being
* reloaded . Clears previous stage actors and adds managed actor to stage . If overridden , call super . */
@ Override public void show ( ) { } } | final Stage stage = getStage ( ) ; stage . getRoot ( ) . clearChildren ( ) ; LmlUtilities . appendActorsToStage ( stage , actors ) ; |
public class ConfigurationItem { /** * A list of related AWS resources .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setRelationships ( java . util . Collection ) } or { @ link # withRelationships ( java . util . Collection ) } if you want
* to override the existing values .
* @ param relationships
* A list of related AWS resources .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ConfigurationItem withRelationships ( Relationship ... relationships ) { } } | if ( this . relationships == null ) { setRelationships ( new com . amazonaws . internal . SdkInternalList < Relationship > ( relationships . length ) ) ; } for ( Relationship ele : relationships ) { this . relationships . add ( ele ) ; } return this ; |
public class LookupManagerImpl { /** * { @ inheritDoc } */
@ Override public ServiceInstance getInstance ( String serviceName , String instanceId ) throws ServiceException { } } | if ( ! isStarted ) { ServiceDirectoryError error = new ServiceDirectoryError ( ErrorCode . SERVICE_DIRECTORY_MANAGER_FACTORY_CLOSED ) ; throw new ServiceException ( error ) ; } if ( instanceId == null || instanceId . isEmpty ( ) ) { return null ; } ModelService service = getLookupService ( ) . getModelService ( serviceName ) ; if ( service != null && service . getServiceInstances ( ) != null && service . getServiceInstances ( ) . size ( ) > 0 ) { for ( ModelServiceInstance instance : service . getServiceInstances ( ) ) { if ( instance . getInstanceId ( ) . equals ( instanceId ) ) { return ServiceInstanceUtils . transferFromModelServiceInstance ( instance ) ; } } } return null ; |
public class PartitionedDataWriter { /** * Serialize partitions info to { @ link # state } if they are any */
private void serializePartitionInfoToState ( ) { } } | List < PartitionDescriptor > descriptors = new ArrayList < > ( ) ; for ( DataWriter writer : partitionWriters . asMap ( ) . values ( ) ) { Descriptor descriptor = writer . getDataDescriptor ( ) ; if ( null == descriptor ) { log . warn ( "Drop partition info as writer {} returns a null PartitionDescriptor" , writer . toString ( ) ) ; continue ; } if ( ! ( descriptor instanceof PartitionDescriptor ) ) { log . warn ( "Drop partition info as writer {} does not return a PartitionDescriptor" , writer . toString ( ) ) ; continue ; } descriptors . add ( ( PartitionDescriptor ) descriptor ) ; } if ( descriptors . size ( ) > 0 ) { state . setProp ( getPartitionsKey ( branchId ) , PartitionDescriptor . toPartitionJsonList ( descriptors ) ) ; } else { log . info ( "Partitions info not available. Will not serialize partitions" ) ; } |
public class StructureAlignmentDisplay { /** * Display an AFPChain alignment
* @ param afpChain
* @ param ca1
* @ param ca2
* @ return a StructureAlignmentJmol instance
* @ throws StructureException */
public static StructureAlignmentJmol display ( AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) throws StructureException { } } | if ( ca1 . length < 1 || ca2 . length < 1 ) { throw new StructureException ( "length of atoms arrays is too short! " + ca1 . length + "," + ca2 . length ) ; } Group [ ] twistedGroups = AlignmentTools . prepareGroupsForDisplay ( afpChain , ca1 , ca2 ) ; List < Group > hetatms = StructureTools . getUnalignedGroups ( ca1 ) ; List < Group > hetatms2 = StructureTools . getUnalignedGroups ( ca2 ) ; return DisplayAFP . display ( afpChain , twistedGroups , ca1 , ca2 , hetatms , hetatms2 ) ; |
public class BugInstance { /** * Format a string describing this bug instance .
* @ return the description */
@ Nonnull public String getMessageWithoutPrefix ( ) { } } | BugPattern bugPattern = getBugPattern ( ) ; String pattern , shortPattern ; pattern = getLongDescription ( ) ; shortPattern = bugPattern . getShortDescription ( ) ; try { FindBugsMessageFormat format = new FindBugsMessageFormat ( pattern ) ; return format . format ( annotationList . toArray ( new BugAnnotation [ annotationList . size ( ) ] ) , getPrimaryClass ( ) ) ; } catch ( RuntimeException e ) { AnalysisContext . logError ( "Error generating bug msg " , e ) ; return shortPattern + " [Error generating customized description]" ; } |
public class Policy { /** * < pre >
* Associates a list of ` members ` to a ` role ` .
* Multiple ` bindings ` must not be specified for the same ` role ` .
* ` bindings ` with no members will result in an error .
* < / pre >
* < code > repeated . google . iam . v1 . Binding bindings = 4 ; < / code > */
public java . util . List < ? extends com . google . iam . v1 . BindingOrBuilder > getBindingsOrBuilderList ( ) { } } | return bindings_ ; |
public class SqlResultSetMappingImpl { /** * Returns all < code > constructor - result < / code > elements
* @ return list of < code > constructor - result < / code > */
public List < ConstructorResult < SqlResultSetMapping < T > > > getAllConstructorResult ( ) { } } | List < ConstructorResult < SqlResultSetMapping < T > > > list = new ArrayList < ConstructorResult < SqlResultSetMapping < T > > > ( ) ; List < Node > nodeList = childNode . get ( "constructor-result" ) ; for ( Node node : nodeList ) { ConstructorResult < SqlResultSetMapping < T > > type = new ConstructorResultImpl < SqlResultSetMapping < T > > ( this , "constructor-result" , childNode , node ) ; list . add ( type ) ; } return list ; |
public class LirsPolicy { /** * Prints out the internal state of the policy . */
private void printLirs ( ) { } } | System . out . println ( "** LIRS stack TOP **" ) ; for ( Node n = headS . nextS ; n != headS ; n = n . nextS ) { checkState ( n . isInS ) ; if ( n . status == Status . HIR_NON_RESIDENT ) { System . out . println ( "<NR> " + n . key ) ; } else if ( n . status == Status . HIR_RESIDENT ) { System . out . println ( "<RH> " + n . key ) ; } else { System . out . println ( "<RL> " + n . key ) ; } } System . out . println ( "** LIRS stack BOTTOM **" ) ; System . out . println ( "\n** LIRS queue END **" ) ; for ( Node n = headQ . nextQ ; n != headQ ; n = n . nextQ ) { checkState ( n . isInQ ) ; System . out . println ( n . key ) ; } System . out . println ( "** LIRS queue front **" ) ; System . out . println ( "\nLIRS EVICTED PAGE sequence:" ) ; for ( int i = 0 ; i < evicted . size ( ) ; i ++ ) { System . out . println ( "<" + i + "> " + evicted . get ( i ) ) ; } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcLinearDimension ( ) { } } | if ( ifcLinearDimensionEClass == null ) { ifcLinearDimensionEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 300 ) ; } return ifcLinearDimensionEClass ; |
public class Array { /** * Note : All the objects with same value will be replaced with first element with the same value .
* @ param a */
static void bucketSort ( final Object [ ] a ) { } } | if ( N . isNullOrEmpty ( a ) ) { return ; } bucketSort ( a , 0 , a . length ) ; |
public class AirlineItineraryTemplateBuilder { /** * Adds a { @ link PriceInfo } object to this template . This field is optional .
* There can be at most 4 price info objects per template .
* @ param title
* the price info title . It can ' t be empty .
* @ param amount
* the price amount .
* @ return this builder . */
public AirlineItineraryTemplateBuilder addPriceInfo ( String title , BigDecimal amount ) { } } | PriceInfo priceInfo = new PriceInfo ( title , amount ) ; this . payload . addPriceInfo ( priceInfo ) ; return this ; |
public class ResourceParametersImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setAvailability ( Parameter newAvailability ) { } } | if ( newAvailability != availability ) { NotificationChain msgs = null ; if ( availability != null ) msgs = ( ( InternalEObject ) availability ) . eInverseRemove ( this , EOPPOSITE_FEATURE_BASE - BpsimPackage . RESOURCE_PARAMETERS__AVAILABILITY , null , msgs ) ; if ( newAvailability != null ) msgs = ( ( InternalEObject ) newAvailability ) . eInverseAdd ( this , EOPPOSITE_FEATURE_BASE - BpsimPackage . RESOURCE_PARAMETERS__AVAILABILITY , null , msgs ) ; msgs = basicSetAvailability ( newAvailability , msgs ) ; if ( msgs != null ) msgs . dispatch ( ) ; } else if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , BpsimPackage . RESOURCE_PARAMETERS__AVAILABILITY , newAvailability , newAvailability ) ) ; |
public class FilterViewUI { /** * check if * any * of items in selectedListItems is present in distinctFacetValues
* @ param selectedListItems
* @ param distinctFacetValues
* @ return */
protected boolean isSubsetContainedIn ( Set < String > selectedListItems , Set < String > distinctFacetValues ) { } } | boolean isPresent = false ; for ( String selectedListItem : selectedListItems ) { isPresent = distinctFacetValues . contains ( selectedListItem ) ; } return isPresent ; |
public class StreamBlockQueue { /** * Wrapper around the common operation of pulling an element out of the persistent deque .
* The behavior is complicated ( and might change ) since the persistent deque can throw an IOException .
* The poll always removes the element from the persistent queue
* ( although not necessarily removing the file backing , that happens at deleteContents ) and will add
* a reference to the block to the in memory deque unless actuallyPoll is true .
* @ param actuallyPoll
* @ return */
private StreamBlock pollPersistentDeque ( boolean actuallyPoll ) { } } | BBContainer cont = null ; BBContainer schemaCont = null ; try { // Start to read a new segment
if ( m_reader . isStartOfSegment ( ) ) { schemaCont = m_reader . getExtraHeader ( - 1 ) ; } cont = m_reader . poll ( PersistentBinaryDeque . UNSAFE_CONTAINER_FACTORY ) ; } catch ( IOException e ) { exportLog . error ( "Failed to poll from persistent binary deque:" + e ) ; } if ( cont == null ) { if ( schemaCont != null ) { schemaCont . discard ( ) ; } return null ; } else { long segmentIndex = m_reader . getSegmentIndex ( ) ; cont . b ( ) . order ( ByteOrder . LITTLE_ENDIAN ) ; // If the container is not null , unpack it .
final BBContainer fcont = cont ; long seqNo = cont . b ( ) . getLong ( StreamBlock . SEQUENCE_NUMBER_OFFSET ) ; long committedSeqNo = cont . b ( ) . getLong ( StreamBlock . COMMIT_SEQUENCE_NUMBER_OFFSET ) ; int tupleCount = cont . b ( ) . getInt ( StreamBlock . ROW_NUMBER_OFFSET ) ; long uniqueId = cont . b ( ) . getLong ( StreamBlock . UNIQUE_ID_OFFSET ) ; // Pass the stream block a subset of the bytes , provide
// a container that discards the original returned by the persistent deque
StreamBlock block = new StreamBlock ( fcont , schemaCont , seqNo , committedSeqNo , tupleCount , uniqueId , segmentIndex , true ) ; // Optionally store a reference to the block in the in memory deque
if ( ! actuallyPoll ) { m_memoryDeque . offer ( block ) ; } return block ; } |
public class CmsChacc { /** * Builds a StringBuffer with HTML code for the access control entries of a resource . < p >
* @ param entries all access control entries for the resource
* @ return StringBuffer with HTML code for all entries */
private StringBuffer buildResourceList ( ArrayList < CmsAccessControlEntry > entries ) { } } | StringBuffer result = new StringBuffer ( 256 ) ; Iterator < CmsAccessControlEntry > i = entries . iterator ( ) ; boolean hasEntries = i . hasNext ( ) ; if ( hasEntries || ! getInheritOption ( ) ) { // create headline for resource entries
result . append ( dialogSubheadline ( key ( Messages . GUI_PERMISSION_TITLE_0 ) ) ) ; } // create the internal form
result . append ( buildInternalForm ( ) ) ; if ( hasEntries ) { // only create output if entries are present
result . append ( dialogSpacer ( ) ) ; // open white box
result . append ( dialogWhiteBox ( HTML_START ) ) ; // list all entries
while ( i . hasNext ( ) ) { CmsAccessControlEntry curEntry = i . next ( ) ; result . append ( buildPermissionEntryForm ( curEntry , getEditable ( ) , false , null ) ) ; if ( i . hasNext ( ) ) { result . append ( dialogSeparator ( ) ) ; } } // close white box
result . append ( dialogWhiteBox ( HTML_END ) ) ; } return result ; |
public class ApplicationsInner { /** * Lists all of the applications for the HDInsight cluster .
* @ param resourceGroupName The name of the resource group .
* @ param clusterName The name of the cluster .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ApplicationInner & gt ; object */
public Observable < ServiceResponse < Page < ApplicationInner > > > listByClusterWithServiceResponseAsync ( final String resourceGroupName , final String clusterName ) { } } | return listByClusterSinglePageAsync ( resourceGroupName , clusterName ) . concatMap ( new Func1 < ServiceResponse < Page < ApplicationInner > > , Observable < ServiceResponse < Page < ApplicationInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < ApplicationInner > > > call ( ServiceResponse < Page < ApplicationInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listByClusterNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IfcStairFlightTypeEnum createIfcStairFlightTypeEnumFromString ( EDataType eDataType , String initialValue ) { } } | IfcStairFlightTypeEnum result = IfcStairFlightTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class NoiseInstance { /** * Compute 3 - dimensional Perlin noise .
* @ param x the x coordinate
* @ param y the y coordinate
* @ param y the y coordinate
* @ return noise value at ( x , y , z ) */
public float noise3 ( float x , float y , float z ) { } } | int bx0 , bx1 , by0 , by1 , bz0 , bz1 , b00 , b10 , b01 , b11 ; float rx0 , rx1 , ry0 , ry1 , rz0 , rz1 , q [ ] , sy , sz , a , b , c , d , t , u , v ; int i , j ; if ( start ) { start = false ; init ( ) ; } t = x + N ; bx0 = ( ( int ) t ) & BM ; bx1 = ( bx0 + 1 ) & BM ; rx0 = t - ( int ) t ; rx1 = rx0 - 1.0f ; t = y + N ; by0 = ( ( int ) t ) & BM ; by1 = ( by0 + 1 ) & BM ; ry0 = t - ( int ) t ; ry1 = ry0 - 1.0f ; t = z + N ; bz0 = ( ( int ) t ) & BM ; bz1 = ( bz0 + 1 ) & BM ; rz0 = t - ( int ) t ; rz1 = rz0 - 1.0f ; i = p [ bx0 ] ; j = p [ bx1 ] ; b00 = p [ i + by0 ] ; b10 = p [ j + by0 ] ; b01 = p [ i + by1 ] ; b11 = p [ j + by1 ] ; t = sCurve ( rx0 ) ; sy = sCurve ( ry0 ) ; sz = sCurve ( rz0 ) ; q = g3 [ b00 + bz0 ] ; u = rx0 * q [ 0 ] + ry0 * q [ 1 ] + rz0 * q [ 2 ] ; q = g3 [ b10 + bz0 ] ; v = rx1 * q [ 0 ] + ry0 * q [ 1 ] + rz0 * q [ 2 ] ; a = lerp ( t , u , v ) ; q = g3 [ b01 + bz0 ] ; u = rx0 * q [ 0 ] + ry1 * q [ 1 ] + rz0 * q [ 2 ] ; q = g3 [ b11 + bz0 ] ; v = rx1 * q [ 0 ] + ry1 * q [ 1 ] + rz0 * q [ 2 ] ; b = lerp ( t , u , v ) ; c = lerp ( sy , a , b ) ; q = g3 [ b00 + bz1 ] ; u = rx0 * q [ 0 ] + ry0 * q [ 1 ] + rz1 * q [ 2 ] ; q = g3 [ b10 + bz1 ] ; v = rx1 * q [ 0 ] + ry0 * q [ 1 ] + rz1 * q [ 2 ] ; a = lerp ( t , u , v ) ; q = g3 [ b01 + bz1 ] ; u = rx0 * q [ 0 ] + ry1 * q [ 1 ] + rz1 * q [ 2 ] ; q = g3 [ b11 + bz1 ] ; v = rx1 * q [ 0 ] + ry1 * q [ 1 ] + rz1 * q [ 2 ] ; b = lerp ( t , u , v ) ; d = lerp ( sy , a , b ) ; return 1.5f * lerp ( sz , c , d ) ; |
public class ImporterLifeCycleManager { /** * This will be called for every importer configuration section for this importer type .
* @ param props Properties defined in a configuration section for this importer */
public final void configure ( Properties props , FormatterBuilder formatterBuilder ) { } } | Map < URI , ImporterConfig > configs = m_factory . createImporterConfigurations ( props , formatterBuilder ) ; m_configs = new ImmutableMap . Builder < URI , ImporterConfig > ( ) . putAll ( configs ) . putAll ( Maps . filterKeys ( m_configs , not ( in ( configs . keySet ( ) ) ) ) ) . build ( ) ; |
public class TargetStreamControl { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . SIMPDeliveryStreamReceiverControllable # getReliability */
public Reliability getReliability ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getReliability" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getReliability" , _targetStreamReliability ) ; return _targetStreamReliability ; |
public class SimpleHandler { /** * 解码 : 将接受到的ByteBuffer对象解码成我们可是识别的业务包
* 总的消息结构 : 消息头 + 消息体
* 消息头结构 : 4个字节 , 消息体的长度
* 消息体结构 : 数据json串的byte [ ]
* @ param buffer
* @ param channelContext
* @ return
* @ throws AioDecodeException */
public Packet decode ( ByteBuffer buffer , int limit , int position , int readableLength , ChannelContext channelContext ) throws AioDecodeException { } } | int realableLength = limit - position ; // 收到的数据组不了业务包 , 则返回null以告诉框架数据不够
if ( realableLength < SimplePacket . HEADER_LENGTH ) { return null ; } // 读取消息体的长度
int bodyLength = buffer . getInt ( ) ; if ( bodyLength < 0 ) { throw new AioDecodeException ( "bodyLength [" + bodyLength + "] is not right, remote:" + channelContext . getClientNode ( ) ) ; } // 计算本次需要的数据长度
int needLength = SimplePacket . HEADER_LENGTH + bodyLength ; // 收到的数据是否足够组包
int isDateEnough = realableLength - needLength ; if ( isDateEnough < 0 ) { return null ; } else { // 组包成功
SimplePacket pack = new SimplePacket ( ) ; if ( bodyLength > 0 ) { byte [ ] dist = new byte [ bodyLength ] ; buffer . get ( dist ) ; pack . setBody ( dist ) ; } return pack ; } |
public class BuilderDefaults { /** * Returns an empty list if the newValue is null
* @ param newValue - a list
* @ param < T > - any type
* @ return non - null list */
public static < T > List < T > nullToEmptyList ( Collection < T > newValue ) { } } | if ( newValue == null ) { return new ArrayList < > ( ) ; } return new ArrayList < > ( newValue ) ; |
public class MetadataServiceListUnmarshaller { /** * { @ inheritDoc } */
protected void processChildElement ( XMLObject parentObject , XMLObject childObject ) throws UnmarshallingException { } } | MetadataServiceList mdsl = ( MetadataServiceList ) parentObject ; if ( childObject instanceof SchemeInformation ) { mdsl . setSchemeInformation ( ( SchemeInformation ) childObject ) ; } else if ( childObject instanceof MetadataList ) { mdsl . getMetadataLists ( ) . add ( ( MetadataList ) childObject ) ; } else if ( childObject instanceof DistributionPoints ) { mdsl . setDistributionPoints ( ( DistributionPoints ) childObject ) ; } else if ( childObject instanceof Signature ) { mdsl . setSignature ( ( Signature ) childObject ) ; } else { super . processChildElement ( parentObject , childObject ) ; } |
public class Traverser { /** * Traverse the object graph referenced by the passed in root .
* @ param root Any Java object .
* @ param skip Set of classes to skip ( ignore ) . Allowed to be null . */
public void walk ( Object root , Class [ ] skip , Visitor visitor ) { } } | Deque stack = new LinkedList ( ) ; stack . add ( root ) ; while ( ! stack . isEmpty ( ) ) { Object current = stack . removeFirst ( ) ; if ( current == null || _objVisited . containsKey ( current ) ) { continue ; } final Class clazz = current . getClass ( ) ; ClassInfo classInfo = getClassInfo ( clazz , skip ) ; if ( classInfo . _skip ) { // Do not process any classes that are assignableFrom the skip classes list .
continue ; } _objVisited . put ( current , null ) ; visitor . process ( current ) ; if ( clazz . isArray ( ) ) { int len = Array . getLength ( current ) ; Class compType = clazz . getComponentType ( ) ; if ( ! compType . isPrimitive ( ) ) { // Speed up : do not walk primitives
ClassInfo info = getClassInfo ( compType , skip ) ; if ( ! info . _skip ) { // Do not walk array elements of a class type that is to be skipped .
for ( int i = 0 ; i < len ; i ++ ) { Object element = Array . get ( current , i ) ; if ( element != null ) { // Skip processing null array elements
stack . add ( Array . get ( current , i ) ) ; } } } } } else { // Process fields of an object instance
if ( current instanceof Collection ) { walkCollection ( stack , ( Collection ) current ) ; } else if ( current instanceof Map ) { walkMap ( stack , ( Map ) current ) ; } else { walkFields ( stack , current , skip ) ; } } } |
public class AbstractChunkTopicParser { /** * Set up the class .
* @ param changeTable changeTable
* @ param conflictTable conflictTable
* @ param rootTopicref chunking topicref */
public void setup ( final LinkedHashMap < URI , URI > changeTable , final Map < URI , URI > conflictTable , final Element rootTopicref , final ChunkFilenameGenerator chunkFilenameGenerator ) { } } | this . changeTable = changeTable ; this . rootTopicref = rootTopicref ; this . conflictTable = conflictTable ; this . chunkFilenameGenerator = chunkFilenameGenerator ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link OLBStatus } { @ code > } } */
@ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "OLBStatus" ) public JAXBElement < OLBStatus > createOLBStatus ( OLBStatus value ) { } } | return new JAXBElement < OLBStatus > ( _OLBStatus_QNAME , OLBStatus . class , null , value ) ; |
public class Opcode { /** * Reverses the condition for an " if " opcode . i . e . IFEQ is changed to
* IFNE . */
public final static byte reverseIfOpcode ( byte opcode ) { } } | // Actually , because the numbers assigned to the " if " opcodes
// were so cleverly chosen , all I really need to do is toggle
// bit 0 . I ' m not going to do that because I still need to check if
// an invalid opcode was passed in .
switch ( opcode ) { case IF_ACMPEQ : return IF_ACMPNE ; case IF_ACMPNE : return IF_ACMPEQ ; case IF_ICMPEQ : return IF_ICMPNE ; case IF_ICMPNE : return IF_ICMPEQ ; case IF_ICMPLT : return IF_ICMPGE ; case IF_ICMPGE : return IF_ICMPLT ; case IF_ICMPGT : return IF_ICMPLE ; case IF_ICMPLE : return IF_ICMPGT ; case IFEQ : return IFNE ; case IFNE : return IFEQ ; case IFLT : return IFGE ; case IFGE : return IFLT ; case IFGT : return IFLE ; case IFLE : return IFGT ; case IFNONNULL : return IFNULL ; case IFNULL : return IFNONNULL ; default : throw new IllegalArgumentException ( "Opcode not an if instruction: " + getMnemonic ( opcode ) ) ; } |
public class AbstractFourierTransformProduct { /** * / * ( non - Javadoc )
* @ see net . finmath . fouriermethod . products . FourierTransformProduct # getValues ( double , net . finmath . modelling . Model ) */
@ Override public Map < String , Object > getValues ( double evaluationTime , Model model ) { } } | Map < String , Object > result = new HashMap < > ( ) ; try { double value = getValue ( ( CharacteristicFunctionModel ) model ) ; result . put ( "value" , value ) ; } catch ( CalculationException e ) { result . put ( "exception" , e ) ; } return result ; |
public class SourceMapGeneratorV3 { /** * Assigns sequential ids to used mappings , and returns the last line mapped . */
private int prepMappings ( ) throws IOException { } } | // Mark any unused mappings .
( new MappingTraversal ( ) ) . traverse ( new UsedMappingCheck ( ) ) ; // Renumber used mappings and keep track of the last line .
int id = 0 ; int maxLine = 0 ; for ( Mapping m : mappings ) { if ( m . used ) { m . id = id ++ ; int endPositionLine = m . endPosition . getLine ( ) ; maxLine = Math . max ( maxLine , endPositionLine ) ; } } // Adjust for the prefix .
return maxLine + prefixPosition . getLine ( ) ; |
public class RoLocalSessionDataFactory { /** * / * ( non - Javadoc )
* @ see org . jdiameter . common . api . app . IAppSessionDataFactory # getAppSessionData ( java . lang . Class , java . lang . String ) */
@ Override public IRoSessionData getAppSessionData ( Class < ? extends AppSession > clazz , String sessionId ) { } } | if ( clazz . equals ( ClientRoSession . class ) ) { ClientRoSessionDataLocalImpl data = new ClientRoSessionDataLocalImpl ( ) ; data . setSessionId ( sessionId ) ; return data ; } else if ( clazz . equals ( ServerRoSession . class ) ) { ServerRoSessionDataLocalImpl data = new ServerRoSessionDataLocalImpl ( ) ; data . setSessionId ( sessionId ) ; return data ; } throw new IllegalArgumentException ( clazz . toString ( ) ) ; |
public class AbstractCommunicationHandler { /** * Use gzip to compress the input stream .
* We do copying here , but I ' m not sure whether there is a way around it anyway ,
* because we need to know the number of bytes to send out , before we can
* start sending them . ( no chunked encoding )
* @ param is
* @ return
* @ throws IOException if something goes wrong while working on
* the { @ link InputStream } instances . */
private InputStream compressInputStream ( InputStream is ) throws IOException { } } | int next = - 1 ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; OutputStream os = new GZIPOutputStream ( baos ) ; while ( ( next = is . read ( ) ) >= 0 ) { os . write ( next ) ; } baos . close ( ) ; os . close ( ) ; is . close ( ) ; return new ByteArrayInputStream ( baos . toByteArray ( ) ) ; |
public class SingleThreadEventExecutor { /** * Returns the absolute point in time ( relative to { @ link # nanoTime ( ) } ) at which the the next
* closest scheduled task should run . */
@ UnstableApi protected long deadlineNanos ( ) { } } | ScheduledFutureTask < ? > scheduledTask = peekScheduledTask ( ) ; if ( scheduledTask == null ) { return nanoTime ( ) + SCHEDULE_PURGE_INTERVAL ; } return scheduledTask . deadlineNanos ( ) ; |
public class CreateWSDL20 { /** * AddSchema Method . */
public void addSchema ( String version , TypesType typesType , MessageInfo recMessageInfo ) { } } | String name = this . fixName ( recMessageInfo . getField ( MessageInfo . DESCRIPTION ) . toString ( ) ) ; Import importel = schemaFactory . createImport ( ) ; typesType . getAny ( ) . add ( importel ) ; String code = recMessageInfo . getField ( MessageInfo . CODE ) . toString ( ) ; if ( code == null ) code = name ; String namespace = ( ( PropertiesField ) recMessageInfo . getField ( MessageInfo . MESSAGE_PROPERTIES ) ) . getProperty ( MessageInfo . NAMESPACE ) ; String element = ( ( PropertiesField ) recMessageInfo . getField ( MessageInfo . MESSAGE_PROPERTIES ) ) . getProperty ( MessageInfo . ELEMENT ) ; String schemaLocation = ( ( PropertiesField ) recMessageInfo . getField ( MessageInfo . MESSAGE_PROPERTIES ) ) . getProperty ( MessageInfo . SCHEMA_LOCATION ) ; if ( namespace == null ) namespace = this . getMessageControl ( ) . getNamespaceFromVersion ( version ) ; if ( element == null ) if ( code != null ) element = code ; if ( schemaLocation == null ) if ( code != null ) schemaLocation = code + ".xsd" ; schemaLocation = this . getMessageControl ( ) . getSchemaLocation ( version , schemaLocation ) ; if ( namespace != null ) importel . setNamespace ( namespace ) ; importel . setSchemaLocation ( schemaLocation ) ; |
public class ToIntBiFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static < T1 , T2 > ToIntBiFunction < T1 , T2 > toIntBiFunctionFrom ( Consumer < ToIntBiFunctionBuilder < T1 , T2 > > buildingFunction ) { } } | ToIntBiFunctionBuilder builder = new ToIntBiFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class SentryException { /** * Transforms a { @ link Throwable } into a Queue of { @ link SentryException } .
* Exceptions are stored in the queue from the most recent one to the oldest one .
* @ param throwable throwable to transform in a queue of exceptions .
* @ return a queue of exception with StackTrace . */
public static Deque < SentryException > extractExceptionQueue ( Throwable throwable ) { } } | Deque < SentryException > exceptions = new ArrayDeque < > ( ) ; Set < Throwable > circularityDetector = new HashSet < > ( ) ; StackTraceElement [ ] childExceptionStackTrace = new StackTraceElement [ 0 ] ; // Stack the exceptions to send them in the reverse order
while ( throwable != null && circularityDetector . add ( throwable ) ) { exceptions . add ( new SentryException ( throwable , childExceptionStackTrace ) ) ; childExceptionStackTrace = throwable . getStackTrace ( ) ; throwable = throwable . getCause ( ) ; } return exceptions ; |
public class Levenshtein { /** * Returns a new Longest Common Subsequence edit distance instance with compare target string
* @ see LongestCommonSubsequence
* @ param baseTarget
* @ param compareTarget
* @ return */
@ SuppressWarnings ( "unchecked" ) public static < T extends Levenshtein > T longestCommonSubsequence ( String baseTarget , String compareTarget ) { } } | return ( T ) new LongestCommonSubsequence ( baseTarget ) . update ( compareTarget ) ; |
public class AutoScalingGroup { /** * The suspended processes associated with the group .
* @ return The suspended processes associated with the group . */
public java . util . List < SuspendedProcess > getSuspendedProcesses ( ) { } } | if ( suspendedProcesses == null ) { suspendedProcesses = new com . amazonaws . internal . SdkInternalList < SuspendedProcess > ( ) ; } return suspendedProcesses ; |
public class SkinnyUUIDSerializer { /** * { @ inheritDoc } */
@ Override public SkinnyUUID deserialize ( SerializerInput in ) throws IOException , ClassNotFoundException { } } | return new SkinnyUUID ( in . readLong ( ) , in . readLong ( ) ) ; |
public class AbstractExtraLanguageValidator { /** * Generate an error for the extra - language .
* < p > This function generates an error , a warning , or an information depending on the extra - language generation ' s
* configuration .
* @ param message the error message .
* @ param source the source of the error .
* @ param feature the structural feature . */
protected void error ( String message , EObject source , EStructuralFeature feature ) { } } | getContext ( ) . getMessageAcceptor ( ) . acceptError ( MessageFormat . format ( getErrorMessageFormat ( ) , message ) , source , feature , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , IssueCodes . INVALID_EXTRA_LANGUAGE_GENERATION ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcCurveStyleFont ( ) { } } | if ( ifcCurveStyleFontEClass == null ) { ifcCurveStyleFontEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 165 ) ; } return ifcCurveStyleFontEClass ; |
public class Client { /** * Retrieve the request History based on the specified filters .
* If no filter is specified , return the default size history .
* @ param filters filters to be applied
* @ return array of History items
* @ throws Exception exception */
public History [ ] filterHistory ( String ... filters ) throws Exception { } } | BasicNameValuePair [ ] params ; if ( filters . length > 0 ) { params = new BasicNameValuePair [ filters . length ] ; for ( int i = 0 ; i < filters . length ; i ++ ) { params [ i ] = new BasicNameValuePair ( "source_uri[]" , filters [ i ] ) ; } } else { return refreshHistory ( ) ; } return constructHistory ( params ) ; |
public class CPDefinitionOptionValueRelUtil { /** * Returns the first cp definition option value rel in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; .
* @ param uuid the uuid
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching cp definition option value rel
* @ throws NoSuchCPDefinitionOptionValueRelException if a matching cp definition option value rel could not be found */
public static CPDefinitionOptionValueRel findByUuid_C_First ( String uuid , long companyId , OrderByComparator < CPDefinitionOptionValueRel > orderByComparator ) throws com . liferay . commerce . product . exception . NoSuchCPDefinitionOptionValueRelException { } } | return getPersistence ( ) . findByUuid_C_First ( uuid , companyId , orderByComparator ) ; |
public class PagerDuty { /** * Create a new instance using the specified API key and configured { @ link Retrofit } . */
public static PagerDuty create ( String apiKey , Retrofit retrofit ) { } } | checkStringArgument ( apiKey , "apiKey" ) ; checkNotNull ( retrofit , "retrofit" ) ; return realPagerDuty ( apiKey , retrofit . create ( EventService . class ) ) ; |
public class OperationsClient { /** * Starts asynchronous cancellation on a long - running operation . The server makes a best effort to
* cancel the operation , but success is not guaranteed . If the server doesn ' t support this method ,
* it returns ` google . rpc . Code . UNIMPLEMENTED ` . Clients can use
* [ Operations . GetOperation ] [ google . longrunning . Operations . GetOperation ] or other methods to check
* whether the cancellation succeeded or whether the operation completed despite cancellation . On
* successful cancellation , the operation is not deleted ; instead , it becomes an operation with an
* [ Operation . error ] [ google . longrunning . Operation . error ] value with a
* [ google . rpc . Status . code ] [ google . rpc . Status . code ] of 1 , corresponding to ` Code . CANCELLED ` .
* < p > Sample code :
* < pre > < code >
* try ( OperationsClient operationsClient = OperationsClient . create ( ) ) {
* String name = " " ;
* operationsClient . cancelOperation ( name ) ;
* < / code > < / pre >
* @ param name The name of the operation resource to be cancelled .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final void cancelOperation ( String name ) { } } | CancelOperationRequest request = CancelOperationRequest . newBuilder ( ) . setName ( name ) . build ( ) ; cancelOperation ( request ) ; |
public class A_CmsSearchFieldConfiguration { /** * Adds a field to this search field configuration . < p >
* @ param field the field to add */
public void addField ( CmsSearchField field ) { } } | if ( ( field != null ) && ( field . getName ( ) != null ) ) { m_fields . put ( field . getName ( ) , field ) ; } |
public class nsmemory_stats { /** * Use this API to fetch statistics of nsmemory _ stats resource of given name . */
public static nsmemory_stats get ( nitro_service service , String pool ) throws Exception { } } | nsmemory_stats obj = new nsmemory_stats ( ) ; obj . set_pool ( pool ) ; nsmemory_stats response = ( nsmemory_stats ) obj . stat_resource ( service ) ; return response ; |
public class UserResourceHeaderScreen { /** * SetupSFields Method . */
public void setupSFields ( ) { } } | this . getRecord ( UserResource . USER_RESOURCE_FILE ) . getField ( UserResource . DESCRIPTION ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ; |
public class ScopeEcmascriptDebugger { /** * TODO needs retry approach ? */
public List < Integer > examineObjects ( Integer id ) { } } | ObjectList list = getObjectList ( id ) ; List < Integer > ids = Lists . newArrayList ( ) ; List < Property > properties = list . getObjectList ( 0 ) . getPropertyListList ( ) ; for ( Property property : properties ) { if ( property . getType ( ) . equals ( "object" ) ) { ids . add ( property . getObjectValue ( ) . getObjectID ( ) ) ; } } return ids ; |
public class BigMoney { /** * Returns a copy of this monetary value with the specified scale ,
* using the specified rounding mode if necessary .
* The returned instance will have this currency and the new scaled amount .
* For example , scaling ' USD 43.271 ' to a scale of 1 with HALF _ EVEN rounding
* will yield ' USD 43.3 ' .
* A negative scale may be passed in , but the result will have a minimum scale of zero .
* This instance is immutable and unaffected by this method .
* @ param scale the scale to use
* @ param roundingMode the rounding mode to use , not null
* @ return the new instance with the input amount set , never null
* @ throws ArithmeticException if the rounding fails */
public BigMoney withScale ( int scale , RoundingMode roundingMode ) { } } | MoneyUtils . checkNotNull ( roundingMode , "RoundingMode must not be null" ) ; if ( scale == amount . scale ( ) ) { return this ; } return BigMoney . of ( currency , amount . setScale ( scale , roundingMode ) ) ; |
public class Controller { /** * Convenience method , takes in a map of values to flash .
* @ see # flash ( String , String )
* @ param values values to flash . */
protected void flash ( Map < String , String > values ) { } } | for ( Object key : values . keySet ( ) ) { flash ( key . toString ( ) , values . get ( key ) ) ; } |
public class GreenPepperServerServiceImpl { /** * { @ inheritDoc } */
public Execution runSpecification ( SystemUnderTest systemUnderTest , Specification specification , boolean implementedVersion , String locale ) throws GreenPepperServerException { } } | try { sessionService . startSession ( ) ; sessionService . beginTransaction ( ) ; Repository repository = loadRepository ( specification . getRepository ( ) . getUid ( ) ) ; Execution exe = documentDao . runSpecification ( systemUnderTest , specification , implementedVersion , locale ) ; log . debug ( "Runned Specification: " + specification . getName ( ) + " ON System: " + systemUnderTest . getName ( ) ) ; sessionService . commitTransaction ( ) ; return exe ; } catch ( Exception ex ) { sessionService . rollbackTransaction ( ) ; throw handleException ( SPECIFICATION_RUN_FAILED , ex ) ; } finally { sessionService . closeSession ( ) ; } |
public class SpringIOUtils { /** * Copy the contents of the given byte array to the given output File .
* @ param in the byte array to copy from
* @ param out the file to copy to
* @ throws IOException in case of I / O errors */
public static void copy ( byte [ ] in , File out ) throws IOException { } } | assert in != null : "No input byte array specified" ; assert out != null : "No output File specified" ; ByteArrayInputStream inStream = new ByteArrayInputStream ( in ) ; OutputStream outStream = new BufferedOutputStream ( Files . newOutputStream ( out . toPath ( ) ) ) ; copy ( inStream , outStream ) ; |
public class GlstringBuilder { /** * Return this GL String builder configured with the specified allele . Calls to this method must
* be interspersed by calls to operator methods ( { @ link # allelicAmbiguity ( ) } , { @ link # inPhase ( ) } ,
* { @ link # plus ( ) } , { @ link # genotypicAmbiguity ( ) } , and { @ link # locus ( String ) } ) .
* @ param glstring allele in GL String format , must not be null
* @ return this GL String builder configured with the specified allele
* @ throws IllegalStateException if successive calls to this method are made without an interspersed
* call to an operator method ( { @ link # allelicAmbiguity ( ) } , { @ link # inPhase ( ) } , { @ link # plus ( ) } ,
* { @ link # genotypicAmbiguity ( ) } , and { @ link # locus ( String ) } ) */
public GlstringBuilder allele ( final String glstring ) { } } | Node node = new Node ( ) ; node . value = glstring ; if ( tree . isEmpty ( ) ) { tree . root = node ; } else { if ( ! tree . root . isOperator ( ) ) { throw new IllegalStateException ( "must provide an operator(allelicAmbiguity, inPhase, plus, genotypicAmbiguity, locus) between successive calls to allele(glstring)" ) ; } if ( tree . root . left == null ) { tree . root . left = node ; } else if ( tree . root . right == null ) { tree . root . right = node ; } else { // todo : is this ever reached ?
throw new IllegalStateException ( "must provide an operator(allelicAmbiguity, inPhase, plus, genotypicAmbiguity, locus) between successive calls to allele(glstring)" ) ; } } return this ; |
public class LIBSVMLoader { /** * Loads a new classification data set from a LIBSVM file , assuming the
* label is a nominal target value
* @ param reader the input stream for the file to load
* @ param sparseRatio the fraction of non zero values to qualify a data
* point as sparse
* @ param vectorLength the pre - determined length of each vector . If given a
* negative value , the largest non - zero index observed in the data will be
* used as the length .
* @ param store the type of store to use for the data
* @ return a classification data set
* @ throws IOException if an error occurred reading the input stream */
public static ClassificationDataSet loadC ( Reader reader , double sparseRatio , int vectorLength ) throws IOException { } } | return loadC ( reader , sparseRatio , vectorLength , DataStore . DEFAULT_STORE ) ; |
public class CommerceAccountUserRelWrapper { /** * Sets the primary key of this commerce account user rel .
* @ param primaryKey the primary key of this commerce account user rel */
@ Override public void setPrimaryKey ( com . liferay . commerce . account . service . persistence . CommerceAccountUserRelPK primaryKey ) { } } | _commerceAccountUserRel . setPrimaryKey ( primaryKey ) ; |
public class DescribeScalingPlanResourcesResult { /** * Information about the scalable resources .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setScalingPlanResources ( java . util . Collection ) } or { @ link # withScalingPlanResources ( java . util . Collection ) }
* if you want to override the existing values .
* @ param scalingPlanResources
* Information about the scalable resources .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeScalingPlanResourcesResult withScalingPlanResources ( ScalingPlanResource ... scalingPlanResources ) { } } | if ( this . scalingPlanResources == null ) { setScalingPlanResources ( new java . util . ArrayList < ScalingPlanResource > ( scalingPlanResources . length ) ) ; } for ( ScalingPlanResource ele : scalingPlanResources ) { this . scalingPlanResources . add ( ele ) ; } return this ; |
public class MtasBasicParser { /** * Adds the and encode .
* @ param originalValue the original value
* @ param newType the new type
* @ param newValue the new value
* @ param encode the encode
* @ return the string */
private String addAndEncode ( String originalValue , String newType , String newValue , boolean encode ) { } } | if ( newValue == null ) { return originalValue ; } else { String finalNewValue ; if ( encode ) { if ( newType == null ) { finalNewValue = new String ( enc . encode ( newValue . getBytes ( StandardCharsets . UTF_8 ) ) , StandardCharsets . UTF_8 ) ; } else { finalNewValue = new String ( enc . encode ( newType . getBytes ( StandardCharsets . UTF_8 ) ) , StandardCharsets . UTF_8 ) + ":" + new String ( enc . encode ( newValue . getBytes ( StandardCharsets . UTF_8 ) ) , StandardCharsets . UTF_8 ) ; } } else { finalNewValue = newValue ; } if ( originalValue == null || originalValue . isEmpty ( ) ) { return finalNewValue ; } else { return originalValue + ( encode ? " " : "" ) + finalNewValue ; } } |
public class EventBus { /** * Register the subscriber with the specified < code > eventId < / code > and < code > threadMode < / code > .
* If the same register has been registered before , it be over - written with the new specified < code > eventId < / code > and < code > threadMode < / code > .
* @ param subscriber
* @ param eventId
* @ param threadMode
* @ return itself */
public EventBus register ( final Object subscriber , final String eventId , ThreadMode threadMode ) { } } | if ( ! isSupportedThreadMode ( threadMode ) ) { throw new RuntimeException ( "Unsupported thread mode: " + threadMode ) ; } if ( logger . isInfoEnabled ( ) ) { logger . info ( "Registering subscriber: " + subscriber + " with eventId: " + eventId + " and thread mode: " + threadMode ) ; } final Class < ? > cls = subscriber . getClass ( ) ; final List < SubIdentifier > subList = getClassSubList ( cls ) ; if ( N . isNullOrEmpty ( subList ) ) { throw new RuntimeException ( "No subscriber method found in class: " + ClassUtil . getCanonicalClassName ( cls ) ) ; } final List < SubIdentifier > eventSubList = new ArrayList < > ( subList . size ( ) ) ; for ( SubIdentifier sub : subList ) { if ( sub . isPossibleLambdaSubscriber && N . isNullOrEmpty ( eventId ) ) { throw new RuntimeException ( "General subscriber (type is {@code Subscriber} and parameter type is Object, mostly created by lambda) only can be registered with event id" ) ; } eventSubList . add ( new SubIdentifier ( sub , subscriber , eventId , threadMode ) ) ; } synchronized ( registeredSubMap ) { registeredSubMap . put ( subscriber , eventSubList ) ; listOfSubEventSubs = null ; } if ( N . isNullOrEmpty ( eventId ) ) { synchronized ( registeredEventIdSubMap ) { for ( SubIdentifier sub : eventSubList ) { if ( N . isNullOrEmpty ( sub . eventId ) ) { continue ; } final Set < SubIdentifier > eventSubs = registeredEventIdSubMap . get ( sub . eventId ) ; if ( eventSubs == null ) { registeredEventIdSubMap . put ( sub . eventId , N . asLinkedHashSet ( sub ) ) ; } else { eventSubs . add ( sub ) ; } listOfEventIdSubMap . remove ( sub . eventId ) ; } } } else { synchronized ( registeredEventIdSubMap ) { final Set < SubIdentifier > eventSubs = registeredEventIdSubMap . get ( eventId ) ; if ( eventSubs == null ) { registeredEventIdSubMap . put ( eventId , new LinkedHashSet < > ( eventSubList ) ) ; } else { eventSubs . addAll ( eventSubList ) ; } listOfEventIdSubMap . remove ( eventId ) ; } } Map < Object , String > mapOfStickyEvent = this . mapOfStickyEvent ; for ( SubIdentifier sub : eventSubList ) { if ( sub . sticky ) { if ( mapOfStickyEvent == null ) { synchronized ( stickyEventMap ) { mapOfStickyEvent = new IdentityHashMap < > ( stickyEventMap ) ; this . mapOfStickyEvent = mapOfStickyEvent ; } } for ( Map . Entry < Object , String > entry : mapOfStickyEvent . entrySet ( ) ) { if ( sub . isMyEvent ( entry . getKey ( ) . getClass ( ) , entry . getValue ( ) ) ) { try { dispatch ( sub , entry . getKey ( ) ) ; } catch ( Exception e ) { logger . error ( "Failed to post sticky event: " + N . toString ( entry . getValue ( ) ) + " to subscriber: " + N . toString ( sub ) , e ) ; } } } } } return this ; |
public class DeleteUserRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteUserRequest deleteUserRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteUserRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteUserRequest . getAccessToken ( ) , ACCESSTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AWSKMSClient { /** * Invoke the request using the http client . Assumes credentials ( or lack thereof ) have been configured in the
* ExecutionContext beforehand . */
private < X , Y extends AmazonWebServiceRequest > Response < X > doInvoke ( Request < Y > request , HttpResponseHandler < AmazonWebServiceResponse < X > > responseHandler , ExecutionContext executionContext ) { } } | request . setEndpoint ( endpoint ) ; request . setTimeOffset ( timeOffset ) ; HttpResponseHandler < AmazonServiceException > errorResponseHandler = protocolFactory . createErrorResponseHandler ( new JsonErrorResponseMetadata ( ) ) ; return client . execute ( request , responseHandler , errorResponseHandler , executionContext ) ; |
public class JsonRpcHttpAsyncClient { /** * Reads a JSON - PRC response from the server . This blocks until a response
* is received .
* @ param returnType the expected return type
* @ param ips the { @ link InputStream } to read from
* @ return the object returned by the JSON - RPC response
* @ throws Throwable on error */
private < T > T readResponse ( Type returnType , InputStream ips ) throws Throwable { } } | JsonNode response = mapper . readTree ( new NoCloseInputStream ( ips ) ) ; logger . debug ( "JSON-PRC Response: {}" , response ) ; if ( ! response . isObject ( ) ) { throw new JsonRpcClientException ( 0 , "Invalid JSON-RPC response" , response ) ; } ObjectNode jsonObject = ObjectNode . class . cast ( response ) ; if ( jsonObject . has ( ERROR ) && jsonObject . get ( ERROR ) != null && ! jsonObject . get ( ERROR ) . isNull ( ) ) { throw exceptionResolver . resolveException ( jsonObject ) ; } if ( jsonObject . has ( RESULT ) && ! jsonObject . get ( RESULT ) . isNull ( ) && jsonObject . get ( RESULT ) != null ) { JsonParser returnJsonParser = mapper . treeAsTokens ( jsonObject . get ( RESULT ) ) ; JavaType returnJavaType = mapper . getTypeFactory ( ) . constructType ( returnType ) ; return mapper . readValue ( returnJsonParser , returnJavaType ) ; } return null ; |
public class Function { /** * Get a parameter / argument by its position .
* @ param n position
* @ return the parameter */
private String getNth ( int n , List < String > list , String typeName ) { } } | if ( n < 0 ) { throw new FuzzerException ( name + ": " + n + ": " + typeName + " reference must be positive" ) ; } if ( n >= list . size ( ) ) { throw new FuzzerException ( name + ": " + n + " illegal " + typeName + " position" ) ; } return list . get ( n ) ; |
public class ByteBuf { /** * Sets { @ link # tail } if this { @ code ByteBuf } is not recycled .
* @ param pos the value which will be assigned to the { @ link # tail } .
* Must be bigger or equal to { @ link # head }
* and smaller than length of the { @ link # array } */
public void tail ( int pos ) { } } | assert ! isRecycled ( ) : "Attempt to use recycled bytebuf" ; assert pos >= head && pos <= array . length ; tail = pos ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getBPG ( ) { } } | if ( bpgEClass == null ) { bpgEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 217 ) ; } return bpgEClass ; |
public class DeepLearning { /** * Return a query link to this page
* @ param k Model Key
* @ param content Link text
* @ param cp Key to checkpoint to continue training with ( optional )
* @ param response Response
* @ param val Validation data set key
* @ return HTML Link */
public static String link ( Key k , String content , Key cp , String response , Key val ) { } } | DeepLearning req = new DeepLearning ( ) ; RString rs = new RString ( "<a href='" + req . href ( ) + ".query?source=%$key" + ( cp == null ? "" : "&checkpoint=%$cp" ) + ( response == null ? "" : "&response=%$resp" ) + ( val == null ? "" : "&validation=%$valkey" ) + "'>%content</a>" ) ; rs . replace ( "key" , k . toString ( ) ) ; rs . replace ( "content" , content ) ; if ( cp != null ) rs . replace ( "cp" , cp . toString ( ) ) ; if ( response != null ) rs . replace ( "resp" , response ) ; if ( val != null ) rs . replace ( "valkey" , val ) ; return rs . toString ( ) ; |
public class SipFactoryImpl { /** * ( non - Javadoc )
* @ see javax . servlet . sip . SipFactory # createRequest ( javax . servlet . sip . SipServletRequest ,
* boolean ) */
public SipServletRequest createRequest ( SipServletRequest origRequest , boolean sameCallId ) { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Creating SipServletRequest from original request[" + origRequest + "] with same call id[" + sameCallId + "]" ) ; } final SipServletRequestImpl origRequestImpl = ( SipServletRequestImpl ) origRequest ; final MobicentsSipApplicationSession originalAppSession = ( MobicentsSipApplicationSession ) origRequestImpl . getSipApplicationSession ( false ) ; if ( originalAppSession == null ) { throw new IllegalStateException ( "original request's app session does not exists" ) ; } final MobicentsSipSession originalSession = origRequestImpl . getSipSession ( ) ; final Request newRequest = ( Request ) origRequestImpl . message . clone ( ) ; ( ( MessageExt ) newRequest ) . setApplicationData ( null ) ; // removing the via header from original request
newRequest . removeHeader ( ViaHeader . NAME ) ; // cater to http : / / code . google . com / p / sipservlets / issues / detail ? id = 31 to be able to set the rport in applications
final SipApplicationDispatcher sipApplicationDispatcher = getSipApplicationDispatcher ( ) ; final String branch = JainSipUtils . createBranch ( originalAppSession . getKey ( ) . getId ( ) , sipApplicationDispatcher . getHashFromApplicationName ( originalAppSession . getKey ( ) . getApplicationName ( ) ) ) ; ViaHeader viaHeader = JainSipUtils . createViaHeader ( getSipNetworkInterfaceManager ( ) , newRequest , branch , null ) ; newRequest . addHeader ( viaHeader ) ; final FromHeader newFromHeader = ( FromHeader ) newRequest . getHeader ( FromHeader . NAME ) ; // assign a new from tag
newFromHeader . removeParameter ( "tag" ) ; // remove the to tag
( ( ToHeader ) newRequest . getHeader ( ToHeader . NAME ) ) . removeParameter ( "tag" ) ; // Remove the route header ( will point to us ) .
// commented as per issue 649
// newRequest . removeHeader ( RouteHeader . NAME ) ;
// Remove the record route headers . This is a new call leg .
newRequest . removeHeader ( RecordRouteHeader . NAME ) ; // For non - REGISTER requests , the Contact header field is not copied
// but is populated by the container as usual
if ( ! Request . REGISTER . equalsIgnoreCase ( newRequest . getMethod ( ) ) ) { try { // For non - REGISTER requests , the Contact header field is not copied
// but is populated by the container as usual
if ( ! Request . REGISTER . equalsIgnoreCase ( newRequest . getMethod ( ) ) ) { // Adding default contact header for specific methods only
if ( JainSipUtils . CONTACT_HEADER_METHODS . contains ( newRequest . getMethod ( ) ) ) { String fromName = null ; String displayName = ( ( MessageExt ) newRequest ) . getFromHeader ( ) . getAddress ( ) . getDisplayName ( ) ; if ( newRequest . getHeader ( ContactHeader . NAME ) != null && ( ( ContactHeader ) newRequest . getHeader ( ContactHeader . NAME ) ) . getAddress ( ) . getURI ( ) instanceof javax . sip . address . SipURI ) { fromName = ( ( javax . sip . address . SipURI ) ( ( MessageExt ) newRequest ) . getFromHeader ( ) . getAddress ( ) . getURI ( ) ) . getUser ( ) ; } // Create the contact name address .
ContactHeader contactHeader = null ; // if a sip load balancer is present in front of the server , the contact header is the one from the sip lb
// so that the subsequent requests can be failed over
if ( fromName != null ) { if ( useLoadBalancer ) { javax . sip . address . SipURI sipURI = addressFactory . createSipURI ( fromName , loadBalancerToUse . getAddress ( ) . getHostAddress ( ) ) ; sipURI . setHost ( loadBalancerToUse . getAddress ( ) . getHostAddress ( ) ) ; sipURI . setPort ( loadBalancerToUse . getSipPort ( ) ) ; sipURI . setTransportParam ( JainSipUtils . findTransport ( newRequest ) ) ; javax . sip . address . Address contactAddress = addressFactory . createAddress ( sipURI ) ; if ( displayName != null && displayName . length ( ) > 0 ) { contactAddress . setDisplayName ( displayName ) ; } contactHeader = headerFactory . createContactHeader ( contactAddress ) ; } else { contactHeader = JainSipUtils . createContactHeader ( getSipNetworkInterfaceManager ( ) , newRequest , displayName , fromName , null ) ; } } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Unable to create Contact Header. It will be added later on send." ) ; } } newRequest . removeHeader ( ContactHeader . NAME ) ; if ( contactHeader != null ) { newRequest . addHeader ( contactHeader ) ; } } else { newRequest . removeHeader ( ContactHeader . NAME ) ; } } } catch ( Exception ex ) { logger . warn ( "Unable to create Contact Header. It will be added later on send." , ex ) ; } } try { if ( ! sameCallId ) { // Creating new call id
final Iterator < MobicentsExtendedListeningPoint > listeningPointsIterator = getSipNetworkInterfaceManager ( ) . getExtendedListeningPoints ( ) ; if ( ! listeningPointsIterator . hasNext ( ) ) { throw new IllegalStateException ( "There is no SIP connectors available to create the request" ) ; } final MobicentsExtendedListeningPoint extendedListeningPoint = listeningPointsIterator . next ( ) ; final CallIdHeader callIdHeader = sipApplicationDispatcher . getCallId ( extendedListeningPoint , null ) ; newRequest . setHeader ( callIdHeader ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "not reusing same call id, new call id is " + callIdHeader ) ; } } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "reusing same call id = " + ( ( MessageExt ) newRequest ) . getCallIdHeader ( ) . getCallId ( ) ) ; } } newFromHeader . setTag ( ApplicationRoutingHeaderComposer . getHash ( getSipApplicationDispatcher ( ) , originalAppSession . getKey ( ) . getApplicationName ( ) , originalAppSession . getKey ( ) . getId ( ) ) ) ; final MobicentsSipSessionKey key = SessionManagerUtil . getSipSessionKey ( originalAppSession . getKey ( ) . getId ( ) , originalAppSession . getKey ( ) . getApplicationName ( ) , newRequest , false ) ; final MobicentsSipSession session = originalAppSession . getSipContext ( ) . getSipManager ( ) . getSipSession ( key , true , this , originalAppSession ) ; if ( originalSession != null ) { session . setHandler ( originalSession . getHandler ( ) ) ; } else if ( originalAppSession . getCurrentRequestHandler ( ) != null ) { session . setHandler ( originalAppSession . getCurrentRequestHandler ( ) ) ; } final SipServletRequestImpl newSipServletRequest = ( SipServletRequestImpl ) mobicentsSipServletMessageFactory . createSipServletRequest ( newRequest , session , null , null , JainSipUtils . DIALOG_CREATING_METHODS . contains ( newRequest . getMethod ( ) ) ) ; // JSR 289 Section 15.1.6
newSipServletRequest . setRoutingDirective ( SipApplicationRoutingDirective . CONTINUE , origRequest ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "newSipServletRequest = " + newSipServletRequest ) ; } return newSipServletRequest ; } catch ( Exception ex ) { logger . error ( "Unexpected exception " , ex ) ; throw new IllegalArgumentException ( "Illegal arg ecnountered while creatigng b2bua" , ex ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.