signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ShortField { /** * Read the physical data from a stream file and set this field .
* @ param daIn Input stream to read this field ' s data from .
* @ param bFixedLength If false ( default ) be sure to save the length in the stream .
* @ return boolean Success ? */
public boolean read ( DataInputStream daIn , boolean bFixedLength ) // Fixed length = false
{ } } | try { short sData = daIn . readShort ( ) ; Short shData = null ; if ( sData != NAN ) shData = new Short ( sData ) ; int errorCode = this . setData ( shData , DBConstants . DONT_DISPLAY , DBConstants . READ_MOVE ) ; return ( errorCode == DBConstants . NORMAL_RETURN ) ; // Success
} catch ( IOException ex ) { ex . printStackTrace ( ) ; return false ; } |
public class ExcelFunctions { /** * Converts a text string to uppercase */
public static String upper ( EvaluationContext ctx , Object text ) { } } | return Conversions . toString ( text , ctx ) . toUpperCase ( ) ; |
public class PathValueData { /** * { @ inheritDoc } */
@ Override protected InternalQName getName ( ) throws ValueFormatException { } } | if ( value . getDepth ( ) == 0 && ! value . isAbsolute ( ) ) { QPathEntry entry = value . getEntries ( ) [ 0 ] ; return new InternalQName ( entry . getNamespace ( ) , entry . getName ( ) ) ; } throw new ValueFormatException ( "Can't conver to InternalQName. Wrong value type." ) ; |
public class MonitorEndpointHelper { /** * Browse a queue for messages
* @ param muleJmsConnectorName
* @ param queueName
* @ return
* @ throws JMSException */
@ SuppressWarnings ( "rawtypes" ) private static boolean isQueueEmpty ( MuleContext muleContext , String muleJmsConnectorName , String queueName ) throws JMSException { } } | JmsConnector muleCon = ( JmsConnector ) MuleUtil . getSpringBean ( muleContext , muleJmsConnectorName ) ; Session s = null ; QueueBrowser b = null ; try { // Get a jms connection from mule and create a jms session
s = muleCon . getConnection ( ) . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; Queue q = s . createQueue ( queueName ) ; b = s . createBrowser ( q ) ; Enumeration e = b . getEnumeration ( ) ; return ! e . hasMoreElements ( ) ; } finally { try { if ( b != null ) b . close ( ) ; } catch ( JMSException e ) { } try { if ( s != null ) s . close ( ) ; } catch ( JMSException e ) { } } |
public class ForkedFrameworkFactory { /** * Forks a Java VM process running an OSGi framework and returns a { @ link RemoteFramework }
* handle to it .
* @ param vmArgs
* VM arguments
* @ param systemProperties
* system properties for the forked Java VM
* @ param frameworkProperties
* framework properties for the remote framework
* @ return remote framework */
public RemoteFramework fork ( List < String > vmArgs , Map < String , String > systemProperties , Map < String , Object > frameworkProperties ) { } } | return fork ( vmArgs , systemProperties , frameworkProperties , null , null ) ; |
public class CollectionUtil { /** * 返回无序集合中的最小值和最大值
* 在返回的Pair中 , 第一个为最小值 , 第二个为最大值 */
public static < T > Pair < T , T > minAndMax ( Collection < ? extends T > coll , Comparator < ? super T > comp ) { } } | Iterator < ? extends T > i = coll . iterator ( ) ; T minCandidate = i . next ( ) ; T maxCandidate = minCandidate ; while ( i . hasNext ( ) ) { T next = i . next ( ) ; if ( comp . compare ( next , minCandidate ) < 0 ) { minCandidate = next ; } else if ( comp . compare ( next , maxCandidate ) > 0 ) { maxCandidate = next ; } } return Pair . of ( minCandidate , maxCandidate ) ; |
public class CandidateCluster { /** * Returns the average data point assigned to this candidate cluster */
public DoubleVector centerOfMass ( ) { } } | // Handle lazy initialization
if ( centroid == null ) { if ( indices . size ( ) == 1 ) centroid = sumVector ; else { // Update the centroid by normalizing by the number of elements .
// We expect that the centroid vector might be compared with
// other vectors multiple times . If we used a ScaledVector here ,
// we would be re - doing this multiplication each time , which is
// wasted . The centerOfMass is already lazily instantiated , so
// we know that if we do the computation here we ' ll be using the
// results at least once . Therefore do the normalization here
// once to save cost .
int length = sumVector . length ( ) ; double d = 1d / indices . size ( ) ; if ( sumVector instanceof SparseVector ) { centroid = new SparseHashDoubleVector ( length ) ; SparseVector sv = ( SparseVector ) sumVector ; for ( int nz : sv . getNonZeroIndices ( ) ) centroid . set ( nz , sumVector . get ( nz ) * d ) ; } else { centroid = new DenseVector ( length ) ; for ( int i = 0 ; i < length ; ++ i ) centroid . set ( i , sumVector . get ( i ) * d ) ; } } } return centroid ; |
public class CardAPI { /** * 设置卡券失效
* @ param accessToken accessToken
* @ param codeUnavailable codeUnavailable
* @ return result */
public static BaseResult codeUnavailable ( String accessToken , CodeUnavailable codeUnavailable ) { } } | return codeUnavailable ( accessToken , JsonUtil . toJSONString ( codeUnavailable ) ) ; |
public class IdentityInfoMarshaller { /** * Marshall the given parameter object . */
public void marshall ( IdentityInfo identityInfo , ProtocolMarshaller protocolMarshaller ) { } } | if ( identityInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( identityInfo . getIdentityType ( ) , IDENTITYTYPE_BINDING ) ; protocolMarshaller . marshall ( identityInfo . getIdentityName ( ) , IDENTITYNAME_BINDING ) ; protocolMarshaller . marshall ( identityInfo . getSendingEnabled ( ) , SENDINGENABLED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Request { /** * Creates a new Request configured to create a user owned Open Graph object .
* @ param session
* the Session to use , or null ; if non - null , the session must be in an opened state
* @ param type
* the fully - specified Open Graph object type ( e . g . , my _ app _ namespace : my _ object _ name ) ; must not be null
* @ param title
* the title of the Open Graph object ; must not be null
* @ param imageUrl
* the link to an image to be associated with the Open Graph object ; may be null
* @ param url
* the url to be associated with the Open Graph object ; may be null
* @ param description
* the description to be associated with the object ; may be null
* @ param objectProperties
* any additional type - specific properties for the Open Graph object ; may be null
* @ param callback
* a callback that will be called when the request is completed to handle success or error conditions ;
* may be null
* @ return a Request that is ready to execute */
public static Request newPostOpenGraphObjectRequest ( Session session , String type , String title , String imageUrl , String url , String description , GraphObject objectProperties , Callback callback ) { } } | OpenGraphObject openGraphObject = OpenGraphObject . Factory . createForPost ( OpenGraphObject . class , type , title , imageUrl , url , description ) ; if ( objectProperties != null ) { openGraphObject . setData ( objectProperties ) ; } return newPostOpenGraphObjectRequest ( session , openGraphObject , callback ) ; |
public class PutResponseUnmarshaller { /** * { @ inheritDoc } */
@ Override public Object unMarshall ( Response < PutResponse > response , Object entity ) { } } | return unMarshall ( response , entity . getClass ( ) ) ; |
public class SeaGlassStyle { /** * Simple utility method that searchs the given array of Strings for the
* given string . This method is only called from getExtendedState if the
* developer has specified a specific state for the component to be in ( ie ,
* has " wedged " the component in that state ) by specifying they client
* property " SeaGlass . State " .
* @ param names a non - null array of strings
* @ param name the name to look for in the array
* @ return true or false based on whether the given name is in the array */
private boolean contains ( String [ ] names , String name ) { } } | assert name != null ; for ( int i = 0 ; i < names . length ; i ++ ) { if ( name . equals ( names [ i ] ) ) { return true ; } } return false ; |
public class DataSetUtils { /** * < b > showINDArray < / b > < br >
* public void showINDArray ( int mtLv , String itemCode , INDArray INDA , < br >
* int digits , int r _ End _ I , int c _ End _ I ) < br >
* Shows content of INDArray . < br >
* Shows first rows and than columns . < br >
* @ param mtLv - method level
* @ param itemCode - item code
* @ param INDA - INDArray
* @ param digits - values digits
* @ param r _ End _ I - rows end index
* @ param c _ End _ I - columns end index */
public void showINDArray ( int mtLv , String itemCode , INDArray INDA , int digits , int r_End_I , int c_End_I ) { } } | showINDArray ( mtLv , itemCode , INDA , digits , r_End_I , c_End_I , false ) ; |
public class SegmentLocationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SegmentLocation segmentLocation , ProtocolMarshaller protocolMarshaller ) { } } | if ( segmentLocation == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( segmentLocation . getCountry ( ) , COUNTRY_BINDING ) ; protocolMarshaller . marshall ( segmentLocation . getGPSPoint ( ) , GPSPOINT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcCurveBoundedPlane ( ) { } } | if ( ifcCurveBoundedPlaneEClass == null ) { ifcCurveBoundedPlaneEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 162 ) ; } return ifcCurveBoundedPlaneEClass ; |
public class AnyValueMap { /** * Converts map element into a string or returns default value if conversion is
* not possible .
* @ param key a key of element to get .
* @ param defaultValue the default value
* @ return string value of the element or default value if conversion is not
* supported .
* @ see StringConverter # toStringWithDefault ( Object , String ) */
public String getAsStringWithDefault ( String key , String defaultValue ) { } } | Object value = getAsObject ( key ) ; return StringConverter . toStringWithDefault ( value , defaultValue ) ; |
public class AbstractInjectionEngine { /** * This method will unregister an instance of an InjectionMetaDataListener with the current
* engine instance . */
@ Override public void unregisterInjectionMetaDataListener ( InjectionMetaDataListener metaDataListener ) { } } | if ( metaDataListener == null ) { throw new IllegalArgumentException ( "A null InjectionMetaDataListener cannot be unregistered " + "from the injection engine." ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "unregisterInjectionMetaDataListener" , metaDataListener . getClass ( ) . getName ( ) ) ; metaDataListeners . remove ( metaDataListener ) ; |
public class tmtrafficpolicy { /** * Use this API to fetch all the tmtrafficpolicy resources that are configured on netscaler . */
public static tmtrafficpolicy [ ] get ( nitro_service service , options option ) throws Exception { } } | tmtrafficpolicy obj = new tmtrafficpolicy ( ) ; tmtrafficpolicy [ ] response = ( tmtrafficpolicy [ ] ) obj . get_resources ( service , option ) ; return response ; |
public class Quaternion { /** * Sets this quaternion to the rotation of the first normalized vector onto the second .
* @ return a reference to this quaternion , for chaining . */
public Quaternion fromVectors ( IVector3 from , IVector3 to ) { } } | float angle = from . angle ( to ) ; if ( angle < MathUtil . EPSILON ) { return set ( IDENTITY ) ; } if ( angle <= FloatMath . PI - MathUtil . EPSILON ) { return fromAngleAxis ( angle , from . cross ( to ) . normalizeLocal ( ) ) ; } // it ' s a 180 degree rotation ; any axis orthogonal to the from vector will do
Vector3 axis = new Vector3 ( 0f , from . z ( ) , - from . y ( ) ) ; float length = axis . length ( ) ; return fromAngleAxis ( FloatMath . PI , length < MathUtil . EPSILON ? axis . set ( - from . z ( ) , 0f , from . x ( ) ) . normalizeLocal ( ) : axis . multLocal ( 1f / length ) ) ; |
public class LssClient { /** * Update stream destination push url in live stream service
* @ param request The request object containing all options for updating destination push url */
public void updateStreamDestinationPushUrl ( UpdateStreamDestinationPushUrlRequest request ) { } } | checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getDomain ( ) , "Domain should NOT be empty." ) ; checkStringNotEmpty ( request . getApp ( ) , "App should NOT be empty" ) ; checkStringNotEmpty ( request . getStream ( ) , "Stream should NOT be empty." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . PUT , request , LIVE_DOMAIN , request . getDomain ( ) , LIVE_APP , request . getApp ( ) , LIVE_STREAM , request . getStream ( ) ) ; internalRequest . addParameter ( "destinationPushUrl" , request . getDestinationPushUrl ( ) ) ; invokeHttpClient ( internalRequest , AbstractBceResponse . class ) ; |
public class RoleAssignmentsInner { /** * Creates a role assignment by ID .
* @ param roleAssignmentId The fully qualified ID of the role assignment , including the scope , resource name and resource type . Use the format , / { scope } / providers / Microsoft . Authorization / roleAssignments / { roleAssignmentName } . Example : / subscriptions / { subId } / resourcegroups / { rgname } / / providers / Microsoft . Authorization / roleAssignments / { roleAssignmentName } .
* @ param properties Role assignment properties .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the RoleAssignmentInner object if successful . */
public RoleAssignmentInner createById ( String roleAssignmentId , RoleAssignmentProperties properties ) { } } | return createByIdWithServiceResponseAsync ( roleAssignmentId , properties ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class SocketUtility { /** * Create socket according to options . In case of compilation ahead of time , will throw an error
* if dependencies found , then use default socket implementation .
* @ return Socket */
@ SuppressWarnings ( "unchecked" ) public static SocketHandlerFunction getSocketHandler ( ) { } } | try { // forcing use of JNA to ensure AOT compilation
Platform . getOSType ( ) ; return ( urlParser , host ) -> { if ( urlParser . getOptions ( ) . pipe != null ) { return new NamedPipeSocket ( host , urlParser . getOptions ( ) . pipe ) ; } else if ( urlParser . getOptions ( ) . localSocket != null ) { try { return new UnixDomainSocket ( urlParser . getOptions ( ) . localSocket ) ; } catch ( RuntimeException re ) { throw new IOException ( re . getMessage ( ) , re . getCause ( ) ) ; } } else if ( urlParser . getOptions ( ) . sharedMemory != null ) { try { return new SharedMemorySocket ( urlParser . getOptions ( ) . sharedMemory ) ; } catch ( RuntimeException re ) { throw new IOException ( re . getMessage ( ) , re . getCause ( ) ) ; } } else { return Utils . standardSocket ( urlParser , host ) ; } } ; } catch ( Throwable cle ) { // jna jar ' s are not in classpath
} return ( urlParser , host ) -> Utils . standardSocket ( urlParser , host ) ; |
public class Endpoint { /** * Creates a new host { @ link Endpoint } .
* @ throws IllegalArgumentException if { @ code host } is not a valid host name or
* { @ code port } is not a valid port number */
public static Endpoint of ( String host , int port ) { } } | validatePort ( "port" , port ) ; return create ( host , port ) ; |
public class StreamEx { /** * Returns a new { @ code StreamEx } which is a concatenation of this stream
* and the supplied value .
* This is a < a href = " package - summary . html # StreamOps " > quasi - intermediate
* operation < / a > with < a href = " package - summary . html # TSO " > tail - stream
* optimization < / a > .
* @ param value the value to append to the stream
* @ return the new stream
* @ since 0.5.4 */
public StreamEx < T > append ( T value ) { } } | return appendSpliterator ( null , new ConstSpliterator . OfRef < > ( value , 1 , true ) ) ; |
public class EntryStream { /** * Returns a { @ link Map } containing the elements of this stream . There are
* no guarantees on the type or serializability of the { @ code Map } returned ;
* if more control over the returned { @ code Map } is required , use
* { @ link # toCustomMap ( BinaryOperator , Supplier ) } .
* If the mapped keys contains duplicates ( according to
* { @ link Object # equals ( Object ) } ) , the value mapping function is applied to
* each equal element , and the results are merged using the provided merging
* function .
* This is a < a href = " package - summary . html # StreamOps " > terminal < / a >
* operation .
* Returned { @ code Map } is guaranteed to be modifiable .
* @ param mergeFunction a merge function , used to resolve collisions between
* values associated with the same key , as supplied to
* { @ link Map # merge ( Object , Object , BiFunction ) }
* @ return a { @ code Map } containing the elements of this stream
* @ see Collectors # toMap ( Function , Function )
* @ see Collectors # toConcurrentMap ( Function , Function )
* @ since 0.1.0 */
public Map < K , V > toMap ( BinaryOperator < V > mergeFunction ) { } } | Function < Entry < K , V > , K > keyMapper = Entry :: getKey ; Function < Entry < K , V > , V > valueMapper = Entry :: getValue ; return collect ( Collectors . toMap ( keyMapper , valueMapper , mergeFunction , HashMap :: new ) ) ; |
public class PathUtils { /** * Deletes empty directories starting with startPath and all ancestors up to but not including limitPath .
* @ param fs { @ link FileSystem } where paths are located .
* @ param limitPath only { @ link Path } s that are strict descendants of this path will be deleted .
* @ param startPath first { @ link Path } to delete . Afterwards empty ancestors will be deleted .
* @ throws IOException */
public static void deleteEmptyParentDirectories ( FileSystem fs , Path limitPath , Path startPath ) throws IOException { } } | if ( PathUtils . isAncestor ( limitPath , startPath ) && ! PathUtils . getPathWithoutSchemeAndAuthority ( limitPath ) . equals ( PathUtils . getPathWithoutSchemeAndAuthority ( startPath ) ) && fs . listStatus ( startPath ) . length == 0 ) { if ( ! fs . delete ( startPath , false ) ) { log . warn ( "Failed to delete empty directory " + startPath ) ; } else { log . info ( "Deleted empty directory " + startPath ) ; } deleteEmptyParentDirectories ( fs , limitPath , startPath . getParent ( ) ) ; } |
public class ListItemGrabberAction { /** * This operation is used to retrieve a value from a list . When the index of an element from a list is known ,
* this operation can be used to extract the element .
* @ param list The list to get the value from .
* @ param delimiter The delimiter that separates values in the list .
* @ param index The index of the value ( starting with 0 ) to retrieve from the list .
* @ return It returns the value found at the specified index in the list , if the value specified for
* the @ index parameter is positive and less than the size of the list . Otherwise , it returns
* the value specified for @ index . */
@ Action ( name = "List Item Grabber" , outputs = { } } | @ Output ( RESULT_TEXT ) , @ Output ( RESPONSE ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @ Response ( text = FAILURE , field = RESPONSE , value = RETURN_CODE_FAILURE , matchType = MatchType . COMPARE_EQUAL , isOnFail = true , isDefault = true ) } ) public Map < String , String > grabItemFromList ( @ Param ( value = LIST , required = true ) String list , @ Param ( value = DELIMITER , required = true ) String delimiter , @ Param ( value = INDEX , required = true ) String index ) { Map < String , String > result = new HashMap < > ( ) ; try { String [ ] table = ListProcessor . toArray ( list , delimiter ) ; int resolvedIndex ; try { resolvedIndex = ListProcessor . getIndex ( index , table . length ) ; } catch ( NumberFormatException e ) { throw new NumberFormatException ( e . getMessage ( ) + WHILE_PARSING_INDEX ) ; } String value = table [ resolvedIndex ] ; result . put ( RESULT_TEXT , value ) ; result . put ( RESPONSE , SUCCESS ) ; result . put ( RETURN_RESULT , value ) ; result . put ( RETURN_CODE , RETURN_CODE_SUCCESS ) ; } catch ( Exception e ) { result . put ( RESULT_TEXT , e . getMessage ( ) ) ; result . put ( RESPONSE , FAILURE ) ; result . put ( RETURN_RESULT , e . getMessage ( ) ) ; result . put ( RETURN_CODE , RETURN_CODE_FAILURE ) ; } return result ; |
public class RewindableInputStream { /** * Reads up to len bytes of data from the input stream into an array of bytes . In its current
* implementation it cannot return more bytes than left in the buffer if in " non - chunked " mode (
* < code > fMayReadChunks = = false < / code > ) . After reaching the end of the buffer , each invocation
* of this method will read exactly 1 byte then . In " chunked " mode this method < em > may < / em >
* return more than 1 byte , but it doesn ' t buffer the result .
* < p > From the other hand , for the task of reading xml declaration , such behavior may be
* desirable , as we probably don ' t need reset / rewind functionality after we finished with
* charset deduction . It is good idea to call < code > enableChunkedMode < / code > after that , in
* order to improve perfomance and lessen memoery consumption when reading the rest of the data .
* @ return Total number of bytes actually read or < code > - 1 < / code > if end of stream has been
* reached .
* @ throws IOException when an I / O error occurs while reading data
* @ throws IndexOutOfBoundsException in case of invalid < code > off < / code > , < code > len < / code > and
* < code > b . length < / code > combination */
public int read ( byte [ ] b , int off , int len ) throws IOException { } } | if ( null == b ) { throw new NullPointerException ( "Destination byte array is null." ) ; } else if ( 0 == len ) { return 0 ; } else if ( ( b . length < off ) || ( b . length < ( off + len ) ) || ( 0 > off ) || ( 0 > len ) ) { throw new IndexOutOfBoundsException ( ) ; } int bytesLeft = fLength - fOffset ; /* * There is no more bytes in the buffer . We either reading 1 byte
* from underlying InputStream and saving it in the buffer , or
* getting more bytes without saving them , depending on the value
* of ` fMayReadChunks ` field . */
if ( bytesLeft == 0 ) { if ( fOffset == fEndOffset ) { return - 1 ; } // better get some more for the voracious reader . . .
if ( fMayReadChunks ) { // Hmm , this can be buffered in theory . But in many
// cases this would be undesirable , so let it be as it is .
return fInputStream . read ( b , off , len ) ; } int returnedVal = read ( ) ; if ( returnedVal == - 1 ) { fEndOffset = fOffset ; return - 1 ; } b [ off ] = ( byte ) returnedVal ; return 1 ; } /* * In non - chunked mode we shouldn ' t give out more bytes then left
* in the buffer . */
if ( fMayReadChunks ) { // Count of bytes to get form buffer
int readFromBuffer = ( len < bytesLeft ) ? len : bytesLeft ; System . arraycopy ( fData , fOffset , b , off , readFromBuffer ) ; int readFromStream = 0 ; if ( len > bytesLeft ) { readFromStream = fInputStream . read ( b , off + bytesLeft , len - bytesLeft ) ; } fOffset += readFromBuffer ; return readFromBuffer + ( ( - 1 == readFromStream ) ? 0 : readFromStream ) ; } else { // This will prevent returning more bytes than the remainder of
// the buffer array .
if ( len > bytesLeft ) { len = bytesLeft ; } System . arraycopy ( fData , fOffset , b , off , len ) ; fOffset += len ; return len ; } |
public class OpenPgpSelf { /** * Return the { @ link PGPSecretKeyRing } which we will use to sign our messages .
* @ return signing key
* @ throws IOException IO is dangerous
* @ throws PGPException PGP is brittle */
public PGPSecretKeyRing getSigningKeyRing ( ) throws IOException , PGPException { } } | PGPSecretKeyRingCollection secretKeyRings = getSecretKeys ( ) ; if ( secretKeyRings == null ) { return null ; } PGPSecretKeyRing signingKeyRing = null ; for ( PGPSecretKeyRing ring : secretKeyRings ) { if ( signingKeyRing == null ) { signingKeyRing = ring ; continue ; } if ( ring . getPublicKey ( ) . getCreationTime ( ) . after ( signingKeyRing . getPublicKey ( ) . getCreationTime ( ) ) ) { signingKeyRing = ring ; } } return signingKeyRing ; |
public class CoreFields { /** * Override preparePaintComponent to perform initialisation the first time through .
* @ param request the request being responded to . */
@ Override protected void preparePaintComponent ( final Request request ) { } } | super . preparePaintComponent ( request ) ; if ( ! isInitialised ( ) ) { textArea . setFocussed ( ) ; setInitialised ( true ) ; } |
public class PatchedBigQueryTableRowIterator { /** * Adjusts a field returned from the BigQuery API to match what we will receive when running
* BigQuery ' s export - to - GCS and parallel read , which is the efficient parallel implementation
* used for batch jobs executed on the Beam Runners that perform initial splitting .
* < p > The following is the relationship between BigQuery schema and Java types :
* < ul >
* < li > Nulls are { @ code null } .
* < li > Repeated fields are { @ code List } of objects .
* < li > Record columns are { @ link TableRow } objects .
* < li > { @ code BOOLEAN } columns are JSON booleans , hence Java { @ code Boolean } objects .
* < li > { @ code FLOAT } columns are JSON floats , hence Java { @ code Double } objects .
* < li > { @ code TIMESTAMP } columns are { @ code String } objects that are of the format
* { @ code yyyy - MM - dd HH : mm : ss [ . SSSSS ] UTC } , where the { @ code . SSSSS } has no trailing
* zeros and can be 1 to 6 digits long .
* < li > Every other atomic type is a { @ code String } .
* < / ul >
* < p > Note that integers are encoded as strings to match BigQuery ' s exported JSON format .
* < p > Finally , values are stored in the { @ link TableRow } as { " field name " : value } pairs
* and are not accessible through the { @ link TableRow # getF } function . */
@ Nullable private Object getTypedCellValue ( TableFieldSchema fieldSchema , Object v ) { } } | if ( Data . isNull ( v ) ) { return null ; } if ( Objects . equals ( fieldSchema . getMode ( ) , "REPEATED" ) ) { TableFieldSchema elementSchema = fieldSchema . clone ( ) . setMode ( "REQUIRED" ) ; @ SuppressWarnings ( "unchecked" ) List < Map < String , Object > > rawCells = ( List < Map < String , Object > > ) v ; ImmutableList . Builder < Object > values = ImmutableList . builder ( ) ; for ( Map < String , Object > element : rawCells ) { values . add ( getTypedCellValue ( elementSchema , element . get ( "v" ) ) ) ; } return values . build ( ) ; } if ( fieldSchema . getType ( ) . equals ( "RECORD" ) ) { @ SuppressWarnings ( "unchecked" ) Map < String , Object > typedV = ( Map < String , Object > ) v ; return getTypedTableRow ( fieldSchema . getFields ( ) , typedV ) ; } if ( fieldSchema . getType ( ) . equals ( "FLOAT" ) ) { return Double . parseDouble ( ( String ) v ) ; } if ( fieldSchema . getType ( ) . equals ( "BOOLEAN" ) ) { return Boolean . parseBoolean ( ( String ) v ) ; } if ( fieldSchema . getType ( ) . equals ( "TIMESTAMP" ) ) { return formatTimestamp ( ( String ) v ) ; } // Returns the original value for :
// 1 . String , 2 . base64 encoded BYTES , 3 . DATE , DATETIME , TIME strings .
return v ; |
public class GetServiceLastAccessedDetailsWithEntitiesResult { /** * An < code > EntityDetailsList < / code > object that contains details about when an IAM entity ( user or role ) used group
* or policy permissions in an attempt to access the specified AWS service .
* @ param entityDetailsList
* An < code > EntityDetailsList < / code > object that contains details about when an IAM entity ( user or role )
* used group or policy permissions in an attempt to access the specified AWS service . */
public void setEntityDetailsList ( java . util . Collection < EntityDetails > entityDetailsList ) { } } | if ( entityDetailsList == null ) { this . entityDetailsList = null ; return ; } this . entityDetailsList = new com . amazonaws . internal . SdkInternalList < EntityDetails > ( entityDetailsList ) ; |
public class CommerceWishListPersistenceImpl { /** * Returns a range of all the commerce wish lists where groupId = & # 63 ; and userId = & # 63 ; and defaultWishList = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceWishListModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param groupId the group ID
* @ param userId the user ID
* @ param defaultWishList the default wish list
* @ param start the lower bound of the range of commerce wish lists
* @ param end the upper bound of the range of commerce wish lists ( not inclusive )
* @ return the range of matching commerce wish lists */
@ Override public List < CommerceWishList > findByG_U_D ( long groupId , long userId , boolean defaultWishList , int start , int end ) { } } | return findByG_U_D ( groupId , userId , defaultWishList , start , end , null ) ; |
public class Configuration { /** * Sets the local FailureScope reference .
* @ param localFailureScope The local FailureScope */
public static final void localFailureScope ( FailureScope localFailureScope ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "localFailureScope" , localFailureScope ) ; _localFailureScope = localFailureScope ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "localFailureScope" ) ; |
public class CmsGroupTransferList { /** * Sets the icon actions for the transfer list . < p >
* @ param transferCol the column to set the action */
protected void setTransferAction ( CmsListColumnDefinition transferCol ) { } } | CmsListDirectAction transferAction = new CmsListDirectAction ( LIST_ACTION_TRANSFER ) ; transferAction . setName ( Messages . get ( ) . container ( Messages . GUI_GROUPS_TRANSFER_LIST_ACTION_TRANSFER_NAME_0 ) ) ; transferAction . setHelpText ( Messages . get ( ) . container ( Messages . GUI_GROUPS_TRANSFER_LIST_ACTION_TRANSFER_HELP_0 ) ) ; transferAction . setIconPath ( A_CmsUsersList . PATH_BUTTONS + "group.png" ) ; transferCol . addDirectAction ( transferAction ) ; |
public class WorkQueue { /** * Add a unit of work . May be called by workers to add more work units to the tail of the queue .
* @ param workUnit
* the work unit
* @ throws NullPointerException
* if the work unit is null . */
public void addWorkUnit ( final T workUnit ) { } } | if ( workUnit == null ) { throw new NullPointerException ( "workUnit cannot be null" ) ; } numIncompleteWorkUnits . incrementAndGet ( ) ; workUnits . add ( new WorkUnitWrapper < > ( workUnit ) ) ; |
public class FastSafeIterableMap { /** * Return an entry added to prior to an entry associated with the given key .
* @ param k the key
* @ return the map . entry */
public Map . Entry < K , V > ceil ( K k ) { } } | if ( contains ( k ) ) { return mHashMap . get ( k ) . mPrevious ; } return null ; |
public class XMLUtil { /** * Replies an XML / HTML color .
* @ param red the red component .
* @ param green the green component .
* @ param blue the blue component .
* @ param alpha the alpha component .
* @ return the XML color encoding .
* @ see # parseColor ( String ) */
@ Pure public static String toColor ( int red , int green , int blue , int alpha ) { } } | return toColor ( encodeRgbaColor ( red , green , blue , alpha ) ) ; |
public class Repository { /** * simplified load method for testing */
public static Repository load ( Resolver resolver ) throws IOException { } } | Repository repository ; repository = new Repository ( ) ; repository . loadClasspath ( resolver ) ; repository . link ( ) ; return repository ; |
public class Caster { /** * cast a Object to a TimeSpan Object ( alias for toTimeSpan )
* @ param o Object to cast
* @ return casted TimeSpan Object
* @ throws PageException */
public static TimeSpan toTimespan ( Object o ) throws PageException { } } | TimeSpan ts = toTimespan ( o , null ) ; if ( ts != null ) return ts ; throw new CasterException ( o , "timespan" ) ; |
public class HtmlMenuRendererBase { /** * private static final Log log = LogFactory . getLog ( HtmlMenuRenderer . class ) ; */
public void encodeEnd ( FacesContext facesContext , UIComponent component ) throws IOException { } } | RendererUtils . checkParamValidity ( facesContext , component , null ) ; Map < String , List < ClientBehavior > > behaviors = null ; if ( component instanceof ClientBehaviorHolder ) { behaviors = ( ( ClientBehaviorHolder ) component ) . getClientBehaviors ( ) ; if ( ! behaviors . isEmpty ( ) ) { ResourceUtils . renderDefaultJsfJsInlineIfNecessary ( facesContext , facesContext . getResponseWriter ( ) ) ; } } if ( component instanceof UISelectMany ) { renderMenu ( facesContext , ( UISelectMany ) component , isDisabled ( facesContext , component ) , getConverter ( facesContext , component ) ) ; } else if ( component instanceof UISelectOne ) { renderMenu ( facesContext , ( UISelectOne ) component , isDisabled ( facesContext , component ) , getConverter ( facesContext , component ) ) ; } else { throw new IllegalArgumentException ( "Unsupported component class " + component . getClass ( ) . getName ( ) ) ; } |
public class SparseDirectedTypedEdgeSet { /** * Adds the edge to this set if one of the vertices is the root vertex and
* if the non - root vertex has a greater index that this vertex . */
public boolean add ( DirectedTypedEdge < T > e ) { } } | if ( e . from ( ) == rootVertex ) return add ( outEdges , e . to ( ) , e . edgeType ( ) ) ; else if ( e . to ( ) == rootVertex ) return add ( inEdges , e . from ( ) , e . edgeType ( ) ) ; return false ; |
public class AbstractAmazonElasticLoadBalancingAsync { /** * Simplified method form for invoking the DescribeLoadBalancerPolicyTypes operation with an AsyncHandler .
* @ see # describeLoadBalancerPolicyTypesAsync ( DescribeLoadBalancerPolicyTypesRequest ,
* com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < DescribeLoadBalancerPolicyTypesResult > describeLoadBalancerPolicyTypesAsync ( com . amazonaws . handlers . AsyncHandler < DescribeLoadBalancerPolicyTypesRequest , DescribeLoadBalancerPolicyTypesResult > asyncHandler ) { } } | return describeLoadBalancerPolicyTypesAsync ( new DescribeLoadBalancerPolicyTypesRequest ( ) , asyncHandler ) ; |
public class ContextualStorage { /** * If the context is a passivating scope then we return
* the passivationId of the Bean . Otherwise we use
* the Bean directly .
* @ return the key to use in the context map */
public < T > Object getBeanKey ( Contextual < T > bean ) { } } | if ( passivationCapable ) { // if the
return ( ( PassivationCapable ) bean ) . getId ( ) ; } return bean ; |
public class MicrochipPotentiometerDeviceController { /** * Returns the status of the device according EEPROM and WiperLocks .
* @ return The device ' s status
* @ throws IOException Thrown if communication fails or device returned a malformed result */
public DeviceControllerDeviceStatus getDeviceStatus ( ) throws IOException { } } | // get status from device
int deviceStatus = read ( MEMADDR_STATUS ) ; // check formal criterias
int reservedValue = deviceStatus & STATUS_RESERVED_MASK ; if ( reservedValue != STATUS_RESERVED_VALUE ) { throw new IOException ( "status-bits 4 to 8 must be 1 according to documentation chapter 4.2.2.1. got '" + Integer . toString ( reservedValue , 2 ) + "'!" ) ; } // build the result
boolean eepromWriteActive = ( deviceStatus & STATUS_EEPROM_WRITEACTIVE_BIT ) > 0 ; boolean eepromWriteProtection = ( deviceStatus & STATUS_EEPROM_WRITEPROTECTION_BIT ) > 0 ; boolean wiperLock0 = ( deviceStatus & STATUS_WIPERLOCK0_BIT ) > 0 ; boolean wiperLock1 = ( deviceStatus & STATUS_WIPERLOCK1_BIT ) > 0 ; return new DeviceControllerDeviceStatus ( eepromWriteActive , eepromWriteProtection , wiperLock0 , wiperLock1 ) ; |
public class InlineBox { /** * Assigns the line box assigned to this inline box and all the inline sub - boxes .
* @ param linebox The assigned linebox . */
public void setLineBox ( LineBox linebox ) { } } | this . linebox = linebox ; for ( int i = startChild ; i < endChild ; i ++ ) { Box sub = getSubBox ( i ) ; if ( sub instanceof InlineElement ) ( ( InlineElement ) sub ) . setLineBox ( linebox ) ; } |
public class File { /** * Returns a list of the files that your account has access to . The files are returned sorted by
* creation date , with the most recently created files appearing first . */
public static FileCollection list ( Map < String , Object > params ) throws StripeException { } } | return list ( params , null ) ; |
public class AmazonWorkLinkClient { /** * Updates the identity provider configuration for the fleet .
* @ param updateIdentityProviderConfigurationRequest
* @ return Result of the UpdateIdentityProviderConfiguration operation returned by the service .
* @ throws UnauthorizedException
* You are not authorized to perform this action .
* @ throws InternalServerErrorException
* The service is temporarily unavailable .
* @ throws InvalidRequestException
* The request is not valid .
* @ throws ResourceNotFoundException
* The requested resource was not found .
* @ throws TooManyRequestsException
* The number of requests exceeds the limit .
* @ sample AmazonWorkLink . UpdateIdentityProviderConfiguration
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / worklink - 2018-09-25 / UpdateIdentityProviderConfiguration "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateIdentityProviderConfigurationResult updateIdentityProviderConfiguration ( UpdateIdentityProviderConfigurationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateIdentityProviderConfiguration ( request ) ; |
public class FSDatasetDelta { /** * / * This method is used for testing purposes */
synchronized int size ( int nsid ) { } } | Map < Long , FSDatasetDelta . BlockOperation > ns = delta . get ( nsid ) ; return ns == null ? 0 : ns . size ( ) ; |
public class ParserRoutine { /** * < SQL control statement > : : =
* < call statement >
* | < return statement >
* < compound statement >
* < case statement >
* < if statement >
* < iterate statement >
* < leave statement >
* < loop statement >
* < while statement >
* < repeat statement >
* < for statement >
* < assignment statement > SET ( , , , ) = ( , , , ) or SET a = b */
private Object [ ] readLocalDeclarationList ( Routine routine , StatementCompound context ) { } } | HsqlArrayList list = new HsqlArrayList ( ) ; while ( token . tokenType == Tokens . DECLARE ) { Object var = readLocalVariableDeclarationOrNull ( ) ; if ( var == null ) { var = readLocalHandlerDeclaration ( routine , context ) ; } list . add ( var ) ; } Object [ ] declarations = new Object [ list . size ( ) ] ; list . toArray ( declarations ) ; return declarations ; |
public class EJBMethodInvoker { /** * This invokes the target operation . We override this method to deal with the
* fact that the ' serviceObject ' is actually an EJB wrapper class . We need
* to get an equivalent method on the ' serviceObject ' class in order to invoke
* the target operation . */
@ Override protected Object performInvocation ( Exchange exchange , final Object serviceObject , Method m , Object [ ] paramArray ) throws Exception { } } | // This retrieves the appropriate method from the wrapper class
m = serviceObject . getClass ( ) . getMethod ( m . getName ( ) , m . getParameterTypes ( ) ) ; return super . performInvocation ( exchange , serviceObject , m , paramArray ) ; |
public class WaveformDetailComponent { /** * Determine the X coordinate within the component at which the specified beat begins .
* @ param beat the beat number whose position is desired
* @ return the horizontal position within the component coordinate space where that beat begins
* @ throws IllegalArgumentException if the beat number exceeds the number of beats in the track . */
public int getXForBeat ( int beat ) { } } | BeatGrid grid = beatGrid . get ( ) ; if ( grid != null ) { return millisecondsToX ( grid . getTimeWithinTrack ( beat ) ) ; } return 0 ; |
public class PrefixedPropertiesPersister { /** * Loads from json .
* @ param props
* the props
* @ param is
* the is
* @ throws IOException
* Signals that an I / O exception has occurred . */
public void loadFromYAML ( final Properties props , final InputStream is ) throws IOException { } } | try { ( ( PrefixedProperties ) props ) . loadFromYAML ( is ) ; } catch ( final NoSuchMethodError err ) { throw new IOException ( "Cannot load properties JSON file - not using PrefixedProperties: " + err . getMessage ( ) ) ; } |
public class StoryRunner { /** * Runs a Story with the given configuration and steps , applying the given
* meta filter , and staring from given state .
* @ param configuration the Configuration used to run story
* @ param candidateSteps the List of CandidateSteps containing the candidate
* steps methods
* @ param story the Story to run
* @ param filter the Filter to apply to the story Meta
* @ param beforeStories the State before running any of the stories , if not
* < code > null < / code >
* @ throws Throwable if failures occurred and FailureStrategy dictates it to
* be re - thrown . */
public void run ( Configuration configuration , List < CandidateSteps > candidateSteps , Story story , MetaFilter filter , State beforeStories ) throws Throwable { } } | run ( configuration , new ProvidedStepsFactory ( candidateSteps ) , story , filter , beforeStories ) ; |
public class TwitterImpl { /** * " command = INIT & media _ type = video / mp4 & total _ bytes = 4430752" */
private UploadedMedia uploadMediaChunkedInit ( long size ) throws TwitterException { } } | return new UploadedMedia ( post ( conf . getUploadBaseURL ( ) + "media/upload.json" , new HttpParameter [ ] { new HttpParameter ( "command" , CHUNKED_INIT ) , new HttpParameter ( "media_type" , "video/mp4" ) , new HttpParameter ( "media_category" , "tweet_video" ) , new HttpParameter ( "total_bytes" , size ) } ) . asJSONObject ( ) ) ; |
public class TangoEventsAdapter { public void addTangoUserListener ( ITangoUserListener listener , String attrName , boolean stateless ) throws DevFailed { } } | addTangoUserListener ( listener , attrName , new String [ 0 ] , stateless ) ; |
public class DiagnosticsInner { /** * Get site detector response .
* Get site detector response .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param siteName Site Name
* @ param detectorName Detector Resource Name
* @ param slot Slot Name
* @ 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 < DetectorResponseInner > getSiteDetectorResponseSlotAsync ( String resourceGroupName , String siteName , String detectorName , String slot , final ServiceCallback < DetectorResponseInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getSiteDetectorResponseSlotWithServiceResponseAsync ( resourceGroupName , siteName , detectorName , slot ) , serviceCallback ) ; |
public class BaseMessageHeader { /** * Return the state of this object as a properties object .
* @ return The properties . */
public Map < String , Object > getProperties ( ) { } } | Map < String , Object > properties = new HashMap < String , Object > ( ) ; if ( m_mxProperties != null ) { for ( int i = 0 ; i < m_mxProperties . length ; i ++ ) { if ( m_mxProperties [ i ] [ MessageConstants . NAME ] != null ) if ( m_mxProperties [ i ] [ MessageConstants . VALUE ] != null ) properties . put ( ( String ) m_mxProperties [ i ] [ MessageConstants . NAME ] , m_mxProperties [ i ] [ MessageConstants . VALUE ] ) ; } } return properties ; |
public class XmlConfiguration { /** * Create a new array object .
* @ param obj @ param node @ return @ exception NoSuchMethodException @ exception
* ClassNotFoundException @ exception InvocationTargetException */
private Object newArray ( Object obj , XmlParser . Node node ) throws NoSuchMethodException , ClassNotFoundException , InvocationTargetException , IllegalAccessException { } } | // Get the type
Class aClass = java . lang . Object . class ; String type = node . getAttribute ( "type" ) ; String id = node . getAttribute ( "id" ) ; if ( type != null ) { aClass = TypeUtil . fromName ( type ) ; if ( aClass == null ) { if ( "String" . equals ( type ) ) aClass = java . lang . String . class ; else if ( "URL" . equals ( type ) ) aClass = java . net . URL . class ; else if ( "InetAddress" . equals ( type ) ) aClass = java . net . InetAddress . class ; else if ( "InetAddrPort" . equals ( type ) ) aClass = org . browsermob . proxy . jetty . util . InetAddrPort . class ; else aClass = Loader . loadClass ( XmlConfiguration . class , type ) ; } } Object array = Array . newInstance ( aClass , node . size ( ) ) ; if ( id != null ) _idMap . put ( id , obj ) ; for ( int i = 0 ; i < node . size ( ) ; i ++ ) { Object o = node . get ( i ) ; if ( o instanceof String ) continue ; XmlParser . Node item = ( XmlParser . Node ) o ; if ( ! item . getTag ( ) . equals ( "Item" ) ) throw new IllegalStateException ( "Not an Item" ) ; id = item . getAttribute ( "id" ) ; Object v = value ( obj , item ) ; if ( v != null ) Array . set ( array , i , v ) ; if ( id != null ) _idMap . put ( id , v ) ; } return array ; |
public class TCPChannel { /** * Initialize the endpoint listening socket .
* @ throws ChannelException */
private void initializePort ( ) throws ChannelException { } } | try { this . endPoint . initServerSocket ( ) ; } catch ( IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "TCP Channel: " + getExternalName ( ) + "- Problem occurred while initializing TCP Channel: " + ioe . getMessage ( ) ) ; } throw new ChannelException ( "TCP Channel: " + getExternalName ( ) + "- Problem occurred while starting channel: " + ioe . getMessage ( ) ) ; } catch ( RetryableChannelException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "TCP Channel: " + getExternalName ( ) + "- Problem occurred while starting TCP Channel: " + e . getMessage ( ) ) ; } throw e ; } // add property to config to provide actual port used ( could be ephemeral
// port if ' 0 ' passed in )
this . channelData . getPropertyBag ( ) . put ( TCPConfigConstants . LISTENING_PORT , String . valueOf ( this . endPoint . getListenPort ( ) ) ) ; |
public class NTriplesDataSource { /** * common utility method for adding a statement to a record */
private void addStatement ( RecordImpl record , String subject , String property , String object ) { } } | Collection < Column > cols = columns . get ( property ) ; if ( cols == null ) { if ( property . equals ( RDF_TYPE ) && ! types . isEmpty ( ) ) addValue ( record , subject , property , object ) ; return ; } for ( Column col : cols ) { String cleaned = object ; if ( col . getCleaner ( ) != null ) cleaned = col . getCleaner ( ) . clean ( object ) ; if ( cleaned != null && ! cleaned . equals ( "" ) ) addValue ( record , subject , col . getProperty ( ) , cleaned ) ; } |
public class Stanza { /** * Add to , from , id and ' xml : lang ' attributes
* @ param xml the { @ link XmlStringBuilder } .
* @ param enclosingXmlEnvironment the enclosing XML namespace .
* @ return the XML environment for this stanza . */
protected XmlEnvironment addCommonAttributes ( XmlStringBuilder xml , XmlEnvironment enclosingXmlEnvironment ) { } } | String language = getLanguage ( ) ; String namespace = StreamOpen . CLIENT_NAMESPACE ; if ( enclosingXmlEnvironment != null ) { String effectiveEnclosingNamespace = enclosingXmlEnvironment . getEffectiveNamespaceOrUse ( namespace ) ; switch ( effectiveEnclosingNamespace ) { case StreamOpen . CLIENT_NAMESPACE : case StreamOpen . SERVER_NAMESPACE : break ; default : namespace = effectiveEnclosingNamespace ; } } xml . xmlnsAttribute ( namespace ) ; xml . optAttribute ( "to" , getTo ( ) ) ; xml . optAttribute ( "from" , getFrom ( ) ) ; xml . optAttribute ( "id" , getStanzaId ( ) ) ; xml . xmllangAttribute ( language ) ; return new XmlEnvironment ( namespace , language ) ; |
public class LoggerFactory { /** * 获取日志输出器
* @ param key 分类键
* @ return 日志输出器 , 后验条件 : 不返回null . */
public static Logger getLogger ( String key ) { } } | FailsafeLogger logger = LOGGERS . get ( key ) ; if ( logger == null ) { LOGGERS . putIfAbsent ( key , new FailsafeLogger ( LOGGER_ADAPTER . getLogger ( key ) ) ) ; logger = LOGGERS . get ( key ) ; } return logger ; |
public class ResponseImpl { /** * This conversion is needed as some values may not be Strings */
private List < String > toListOfStrings ( String headerName , List < Object > values ) { } } | if ( values == null ) { return null ; } List < String > stringValues = new ArrayList < > ( values . size ( ) ) ; HeaderDelegate < Object > hd = HttpUtils . getHeaderDelegate ( values . get ( 0 ) ) ; for ( Object value : values ) { String actualValue = hd == null ? value . toString ( ) : hd . toString ( value ) ; stringValues . add ( actualValue ) ; } return stringValues ; |
public class ColumnVector { /** * Gets double type values from [ rowId , rowId + count ) . The return values for the null slots
* are undefined and can be anything . */
public double [ ] getDoubles ( int rowId , int count ) { } } | double [ ] res = new double [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { res [ i ] = getDouble ( rowId + i ) ; } return res ; |
public class AdaptiveTableLayout { /** * Method change columns . Change view holders indexes , kay in map , init changing items in adapter .
* @ param fromColumn from column index which need to shift
* @ param toColumn to column index which need to shift */
private void shiftColumnsViews ( final int fromColumn , final int toColumn ) { } } | if ( mAdapter != null ) { // change data
mAdapter . changeColumns ( getBindColumn ( fromColumn ) , getBindColumn ( toColumn ) ) ; // change view holders
switchHeaders ( mHeaderColumnViewHolders , fromColumn , toColumn , ViewHolderType . COLUMN_HEADER ) ; // change indexes in array with widths
mManager . switchTwoColumns ( fromColumn , toColumn ) ; Collection < ViewHolder > fromHolders = mViewHolders . getColumnItems ( fromColumn ) ; Collection < ViewHolder > toHolders = mViewHolders . getColumnItems ( toColumn ) ; removeViewHolders ( fromHolders ) ; removeViewHolders ( toHolders ) ; for ( ViewHolder holder : fromHolders ) { holder . setColumnIndex ( toColumn ) ; mViewHolders . put ( holder . getRowIndex ( ) , holder . getColumnIndex ( ) , holder ) ; } for ( ViewHolder holder : toHolders ) { holder . setColumnIndex ( fromColumn ) ; mViewHolders . put ( holder . getRowIndex ( ) , holder . getColumnIndex ( ) , holder ) ; } } |
public class RepositoryResourceImpl { /** * Perform the matching logic for { @ link # getResources ( Collection , Collection , Visibility , RepositoryConnectionList ) } and
* { @ link # findResources ( String , Collection , Collection , Visibility , RepositoryConnectionList ) } so that this method will return < code > true < / code > if the resource has the
* < code > visibility < / code > supplied and matches one of the products in < code > productDefinitions < / code > .
* @ param resource The resource to test
* @ param productDefinitions The product definitions to match to , maybe < code > null < / code > which means that no product matching will take place .
* @ param visibility The visibility to match to , maybe < code > null < / code > which means that no visibility matching will take place .
* @ return */
public boolean doesResourceMatch ( Collection < ProductDefinition > productDefinitions , Visibility visibility ) { } } | ResourceType type = getType ( ) ; if ( ResourceType . FEATURE == type && visibility != null ) { EsaResourceImpl esa = ( EsaResourceImpl ) this ; Visibility visibilityMatches = esa . getVisibility ( ) == null ? Visibility . PUBLIC : esa . getVisibility ( ) ; if ( ! visibilityMatches . equals ( visibility ) ) { // Visibility is different , no match
return false ; } } // If there is no product definitions defined then say it matches - not being filtered to a specific version
boolean matches = productDefinitions == null || productDefinitions . isEmpty ( ) ; if ( productDefinitions != null ) { for ( ProductDefinition productDefinition : productDefinitions ) { if ( matches ( productDefinition ) == MatchResult . MATCHED ) { matches = true ; break ; } } } return matches ; |
public class Jenkins { /** * Overwrites the existing item by new one .
* This is a short cut for deleting an existing job and adding a new one . */
public synchronized void putItem ( TopLevelItem item ) throws IOException , InterruptedException { } } | String name = item . getName ( ) ; TopLevelItem old = items . get ( name ) ; if ( old == item ) return ; // noop
checkPermission ( Item . CREATE ) ; if ( old != null ) old . delete ( ) ; items . put ( name , item ) ; ItemListener . fireOnCreated ( item ) ; |
public class EasyMockProvider { /** * Resets the given mock object and turns them to a mock with default
* behavior . For details , see the EasyMock documentation .
* @ param mock
* the mock object
* @ return the mock object */
@ SuppressWarnings ( "unchecked" ) public < X > X resetToDefault ( final Object mock ) { } } | EasyMock . resetToDefault ( mock ) ; return ( X ) mock ; |
public class BusItineraryHalt { /** * Replies the geo position .
* @ return the geo position . */
@ Pure public GeoLocationPoint getGeoPosition ( ) { } } | final Point2d p = getPosition2D ( ) ; if ( p != null ) { return new GeoLocationPoint ( p . getX ( ) , p . getY ( ) ) ; } return null ; |
public class AbstractSQLQuery { /** * Called to make the call back to listeners when an exception happens
* @ param context the current context in play
* @ param e the exception */
protected void onException ( SQLListenerContextImpl context , Exception e ) { } } | context . setException ( e ) ; listeners . exception ( context ) ; |
public class CollisionFindingServlet { /** * [ START createMapReduceSpec ] */
public static MapReduceSpecification < Long , Integer , Integer , ArrayList < Integer > , GoogleCloudStorageFileSet > createMapReduceSpec ( String bucket , long start , long limit , int shards ) { } } | ConsecutiveLongInput input = new ConsecutiveLongInput ( start , limit , shards ) ; Mapper < Long , Integer , Integer > mapper = new SeedToRandomMapper ( ) ; Marshaller < Integer > intermediateKeyMarshaller = Marshallers . getIntegerMarshaller ( ) ; Marshaller < Integer > intermediateValueMarshaller = Marshallers . getIntegerMarshaller ( ) ; Reducer < Integer , Integer , ArrayList < Integer > > reducer = new CollisionFindingReducer ( ) ; Marshaller < ArrayList < Integer > > outputMarshaller = Marshallers . getSerializationMarshaller ( ) ; Output < ArrayList < Integer > , GoogleCloudStorageFileSet > output = new MarshallingOutput < > ( new GoogleCloudStorageFileOutput ( bucket , "CollidingSeeds-%04d" , "integers" ) , outputMarshaller ) ; // [ START mapReduceSpec ]
MapReduceSpecification < Long , Integer , Integer , ArrayList < Integer > , GoogleCloudStorageFileSet > spec = new MapReduceSpecification . Builder < > ( input , mapper , reducer , output ) . setKeyMarshaller ( intermediateKeyMarshaller ) . setValueMarshaller ( intermediateValueMarshaller ) . setJobName ( "DemoMapreduce" ) . setNumReducers ( shards ) . build ( ) ; // [ END mapReduceSpec ]
return spec ; |
public class GroupedPriorityQueueLocking { public ITrackedQueue < E > getQueueByGroup ( G group ) { } } | lock . readLock ( ) . lock ( ) ; try { return this . queuesByGroup . get ( group ) ; } finally { lock . readLock ( ) . unlock ( ) ; } |
public class PropertyValues { /** * Return the property getter type */
Class < ? > getGetterPropertyType ( Clazz < ? > clazz , String name ) { } } | String getterName = "get" + capitalizeFirstLetter ( name ) ; Method getter = clazz . getMethod ( getterName ) ; if ( getter != null ) return getter . getReturnType ( ) ; // try direct field access
Field field = clazz . getAllField ( name ) ; if ( field != null ) return field . getType ( ) ; return null ; |
public class AbstractIntSet { /** * { @ inheritDoc } */
@ Override public int [ ] toArray ( int [ ] a ) { } } | if ( a . length < size ( ) ) a = new int [ size ( ) ] ; IntIterator itr = iterator ( ) ; int i = 0 ; while ( itr . hasNext ( ) ) a [ i ++ ] = itr . next ( ) ; for ( ; i < a . length ; i ++ ) a [ i ] = 0 ; return a ; |
public class CmsADEConfigData { /** * Returns the configuration for a specific resource type . < p >
* @ param typeName the name of the type
* @ return the resource type configuration for that type */
public CmsResourceTypeConfig getResourceType ( String typeName ) { } } | for ( CmsResourceTypeConfig type : getResourceTypes ( ) ) { if ( typeName . equals ( type . getTypeName ( ) ) ) { return type ; } } return null ; |
public class UserImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < OAuthAuthorizationCode > getOAuthAuthorizationCodes ( ) { } } | return ( EList < OAuthAuthorizationCode > ) eGet ( StorePackage . Literals . USER__OAUTH_AUTHORIZATION_CODES , true ) ; |
public class RunnersApi { /** * Register a new runner for the gitlab instance .
* < pre > < code > GitLab Endpoint : POST / runners / < / code > < / pre >
* @ param token the token of the project ( for project specific runners ) or the token from the admin page
* @ param description The description of a runner
* @ param active The state of a runner ; can be set to true or false
* @ param tagList The list of tags for a runner ; put array of tags , that should be finally assigned to a runner
* @ param runUntagged Flag indicating the runner can execute untagged jobs
* @ param locked Flag indicating the runner is locked
* @ param maximumTimeout the maximum timeout set when this Runner will handle the job
* @ return RunnerDetail instance .
* @ throws GitLabApiException if any exception occurs */
public RunnerDetail registerRunner ( String token , String description , Boolean active , List < String > tagList , Boolean runUntagged , Boolean locked , Integer maximumTimeout ) throws GitLabApiException { } } | GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "token" , token , true ) . withParam ( "description" , description , false ) . withParam ( "active" , active , false ) . withParam ( "locked" , locked , false ) . withParam ( "run_untagged" , runUntagged , false ) . withParam ( "tag_list" , tagList , false ) . withParam ( "maximum_timeout" , maximumTimeout , false ) ; Response response = post ( Response . Status . CREATED , formData . asMap ( ) , "runners" ) ; return ( response . readEntity ( RunnerDetail . class ) ) ; |
public class JsonBooleanDocument { /** * Creates a { @ link JsonBooleanDocument } which the document id and content .
* @ param id the per - bucket unique document id .
* @ param content the content of the document .
* @ return a { @ link JsonBooleanDocument } . */
public static JsonBooleanDocument create ( String id , Boolean content ) { } } | return new JsonBooleanDocument ( id , 0 , content , 0 , null ) ; |
public class ChangeId { /** * As the part of the URL .
* @ return the url part . */
public String asUrlPart ( ) { } } | try { return encode ( projectName ) + "~" + encode ( branchName ) + "~" + id ; } catch ( UnsupportedEncodingException e ) { String parameter = projectName + "~" + branchName + "~" + id ; logger . error ( "Failed to encode ChangeId {}, falling back to unencoded {}" , this , parameter ) ; return parameter ; } |
public class WalkerState { /** * Resets the calendar */
private void resetCalendar ( ) { } } | _calendar = getCalendar ( ) ; if ( _defaultTimeZone != null ) { _calendar . setTimeZone ( _defaultTimeZone ) ; } _currentYear = _calendar . get ( Calendar . YEAR ) ; |
public class EntityStatisticsProcessor { /** * Prints and stores final result of the processing . This should be called
* after finishing the processing of a dump . It will print the statistics
* gathered during processing and it will write a CSV file with usage counts
* for every property . */
private void writeFinalResults ( ) { } } | // Print a final report :
printStatus ( ) ; // Store property counts in files :
writePropertyStatisticsToFile ( this . itemStatistics , "item-property-counts.csv" ) ; writePropertyStatisticsToFile ( this . propertyStatistics , "property-property-counts.csv" ) ; // Store site link statistics in file :
try ( PrintStream out = new PrintStream ( ExampleHelpers . openExampleFileOuputStream ( "site-link-counts.csv" ) ) ) { out . println ( "Site key,Site links" ) ; for ( Entry < String , Integer > entry : this . siteLinkStatistics . entrySet ( ) ) { out . println ( entry . getKey ( ) + "," + entry . getValue ( ) ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } // Store term statistics in file :
writeTermStatisticsToFile ( this . itemStatistics , "item-term-counts.csv" ) ; writeTermStatisticsToFile ( this . propertyStatistics , "property-term-counts.csv" ) ; |
public class AnimatedModelComponent { /** * Only called for BLOCK and ITEM render type */
@ Override public void render ( Block block , MalisisRenderer < ? extends TileEntity > renderer ) { } } | if ( renderer . getRenderType ( ) == RenderType . BLOCK && animatedShapes . size ( ) != 0 ) onRender ( renderer . getWorldAccess ( ) , renderer . getPos ( ) , renderer . getBlockState ( ) ) ; model . resetState ( ) ; if ( renderer . getRenderType ( ) == RenderType . BLOCK ) model . rotate ( DirectionalComponent . getDirection ( renderer . getBlockState ( ) ) ) ; staticShapes . forEach ( name -> model . render ( renderer , name , rp ) ) ; if ( renderer . getRenderType ( ) == RenderType . ITEM ) animatedShapes . forEach ( name -> model . render ( renderer , name , rp ) ) ; |
public class CacheConfiguration { /** * 载入缓存配置
* @ param file 配置文件
* @ return 缓存配置
* @ throws IOException 配置文件读取异常 */
public static CacheConfiguration build ( File file ) throws IOException { } } | ConfigMap < String , String > config = ConfigMap . load ( file ) ; return CacheConfiguration . build ( config ) ; |
public class YggdrasilAuthenticator { /** * Creates a < code > YggdrasilAuthenticator < / code > with the given client
* token , and initializes it with password .
* @ param username the username
* @ param password the password
* @ param characterSelector the character selector
* @ param clientToken the client token
* @ return a YggdrasilAuthenticator
* @ throws AuthenticationException If an exception occurs during the
* authentication */
public static YggdrasilAuthenticator password ( String username , String password , CharacterSelector characterSelector , String clientToken ) throws AuthenticationException { } } | return password ( username , password , characterSelector , clientToken , YggdrasilAuthenticationServiceBuilder . buildDefault ( ) ) ; |
public class S3ALowLevelOutputStream { /** * Executes the upload part request .
* @ param request the upload part request */
private void execUpload ( UploadPartRequest request ) { } } | File file = request . getFile ( ) ; ListenableFuture < PartETag > futureTag = mExecutor . submit ( ( Callable ) ( ) -> { PartETag partETag ; AmazonClientException lastException ; try { do { try { partETag = mClient . uploadPart ( request ) . getPartETag ( ) ; return partETag ; } catch ( AmazonClientException e ) { lastException = e ; } } while ( mRetryPolicy . attempt ( ) ) ; } finally { // Delete the uploaded or failed to upload file
if ( ! file . delete ( ) ) { LOG . error ( "Failed to delete temporary file @ {}" , file . getPath ( ) ) ; } } throw new IOException ( "Fail to upload part " + request . getPartNumber ( ) + " to " + request . getKey ( ) , lastException ) ; } ) ; mTagFutures . add ( futureTag ) ; LOG . debug ( "Submit upload part request. key={}, partNum={}, file={}, fileSize={}, lastPart={}." , mKey , request . getPartNumber ( ) , file . getPath ( ) , file . length ( ) , request . isLastPart ( ) ) ; |
public class CmsElementUtil { /** * Checks if a group element is allowed in a container with a given type . < p >
* @ param containerType the container type spec ( comma separated )
* @ param groupContainer the group
* @ return true if the group is allowed in the container */
public static boolean checkGroupAllowed ( String containerType , CmsGroupContainerBean groupContainer ) { } } | return ! Sets . intersection ( CmsContainer . splitType ( containerType ) , groupContainer . getTypes ( ) ) . isEmpty ( ) ; |
public class DefaultAnnotationMetadata { /** * Registers annotation default values . Used by generated byte code . DO NOT REMOVE .
* @ param annotation The annotation name
* @ param defaultValues The default values */
@ SuppressWarnings ( "unused" ) @ Internal @ UsedByGeneratedCode protected static void registerAnnotationDefaults ( String annotation , Map < String , Object > defaultValues ) { } } | AnnotationMetadataSupport . registerDefaultValues ( annotation , defaultValues ) ; |
public class BigQuerySchemaMarshallerByType { /** * Parses the annotations on field and returns a populated { @ link TableFieldSchema } . */
private TableFieldSchema parseFieldAnnotations ( Field field ) { } } | TableFieldSchema tf = new TableFieldSchema ( ) ; String name = getFieldName ( field ) ; String desc = getFieldDescription ( field ) ; String fieldMode = getFieldMode ( field ) ; return tf . setName ( name ) . setDescription ( desc ) . setMode ( fieldMode ) ; |
public class SparseCpuLevel1 { /** * Adds a scalar multiple of float compressed sparse vector to a full - storage vector .
* @ param N The number of elements in vector X
* @ param alpha
* @ param X a sparse vector
* @ param pointers A DataBuffer that specifies the indices for the elements of x .
* @ param Y a dense vector */
@ Override protected void saxpyi ( long N , double alpha , INDArray X , DataBuffer pointers , INDArray Y ) { } } | cblas_saxpyi ( ( int ) N , ( float ) alpha , ( FloatPointer ) X . data ( ) . addressPointer ( ) , ( IntPointer ) pointers . addressPointer ( ) , ( FloatPointer ) Y . data ( ) . addressPointer ( ) ) ; |
public class inat { /** * Use this API to update inat . */
public static base_response update ( nitro_service client , inat resource ) throws Exception { } } | inat updateresource = new inat ( ) ; updateresource . name = resource . name ; updateresource . privateip = resource . privateip ; updateresource . tcpproxy = resource . tcpproxy ; updateresource . ftp = resource . ftp ; updateresource . tftp = resource . tftp ; updateresource . usip = resource . usip ; updateresource . usnip = resource . usnip ; updateresource . proxyip = resource . proxyip ; updateresource . mode = resource . mode ; return updateresource . update_resource ( client ) ; |
public class AbstractBaseJnlpMojo { /** * Removes the signature of the files in the specified directory which satisfy the
* specified filter .
* @ param workDirectory working directory used to unsign jars
* @ return the number of unsigned jars
* @ throws MojoExecutionException if could not remove signatures */
private int removeExistingSignatures ( File workDirectory ) throws MojoExecutionException { } } | getLog ( ) . info ( "-- Remove existing signatures" ) ; // cleanup tempDir if exists
File tempDir = new File ( workDirectory , "temp_extracted_jars" ) ; ioUtil . removeDirectory ( tempDir ) ; // recreate temp dir
ioUtil . makeDirectoryIfNecessary ( tempDir ) ; // process jars
File [ ] jarFiles = workDirectory . listFiles ( unprocessedJarFileFilter ) ; for ( File jarFile : jarFiles ) { if ( isJarSigned ( jarFile ) ) { if ( ! canUnsign ) { throw new MojoExecutionException ( "neverUnsignAlreadySignedJar is set to true and a jar file [" + jarFile + " was asked to be unsign,\n please prefer use in this case an extension for " + "signed jars or not set to true the neverUnsignAlreadySignedJar parameter, Make " + "your choice:)" ) ; } verboseLog ( "Remove signature " + toProcessFile ( jarFile ) . getName ( ) ) ; signTool . unsign ( jarFile , isVerbose ( ) ) ; } else { verboseLog ( "Skip not signed " + toProcessFile ( jarFile ) . getName ( ) ) ; } } // cleanup tempDir
ioUtil . removeDirectory ( tempDir ) ; return jarFiles . length ; // FIXME this is wrong . Not all jars are signed . |
public class LocalTokenGenerator { /** * Reads JWK into PrivateKEy instance
* @ param fileName Path to the JWK file
* @ return java . security . PrivateKey instance of JWK
* @ throws InvalidKeySpecException
* @ throws NoSuchAlgorithmException
* @ throws IOException
* @ throws NoSuchProviderException */
private PrivateKey readEcPrivateKey ( String fileName ) throws InvalidKeySpecException , NoSuchAlgorithmException , IOException , NoSuchProviderException { } } | StringBuilder sb = new StringBuilder ( ) ; BufferedReader br = new BufferedReader ( new FileReader ( fileName ) ) ; try { char [ ] cbuf = new char [ 1024 ] ; for ( int i = 0 ; i <= 10 * 1024 ; i ++ ) { if ( ! br . ready ( ) ) break ; int len = br . read ( cbuf , i * 1024 , 1024 ) ; sb . append ( cbuf , 0 , len ) ; } if ( br . ready ( ) ) { throw new IndexOutOfBoundsException ( "JWK file larger than 10MB" ) ; } Type mapType = new TypeToken < Map < String , String > > ( ) { } . getType ( ) ; Map < String , String > son = new Gson ( ) . fromJson ( sb . toString ( ) , mapType ) ; try { @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) EllipticCurveJsonWebKey jwk = new EllipticCurveJsonWebKey ( ( Map < String , Object > ) ( Map ) son ) ; Base64Encoder enc = new Base64Encoder ( ) ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; enc . encode ( jwk . getPrivateKey ( ) . getEncoded ( ) , 0 , jwk . getPrivateKey ( ) . getEncoded ( ) . length , os ) ; return jwk . getPrivateKey ( ) ; } catch ( JoseException e1 ) { e1 . printStackTrace ( ) ; } return null ; } finally { br . close ( ) ; } |
public class WaveformFinder { /** * Ask the specified player for the specified waveform detail from the specified media slot , first checking if we
* have a cached copy .
* @ param dataReference uniquely identifies the desired waveform detail
* @ return the waveform detail , if it was found , or { @ code null }
* @ throws IllegalStateException if the WaveformFinder is not running */
public WaveformDetail requestWaveformDetailFrom ( final DataReference dataReference ) { } } | ensureRunning ( ) ; for ( WaveformDetail cached : detailHotCache . values ( ) ) { if ( cached . dataReference . equals ( dataReference ) ) { // Found a hot cue hit , use it .
return cached ; } } return requestDetailInternal ( dataReference , false ) ; |
public class DescribeAutomationStepExecutionsResult { /** * A list of details about the current state of all steps that make up an execution .
* @ param stepExecutions
* A list of details about the current state of all steps that make up an execution . */
public void setStepExecutions ( java . util . Collection < StepExecution > stepExecutions ) { } } | if ( stepExecutions == null ) { this . stepExecutions = null ; return ; } this . stepExecutions = new com . amazonaws . internal . SdkInternalList < StepExecution > ( stepExecutions ) ; |
public class RequireMavenVersion { /** * ( non - Javadoc )
* @ see org . apache . maven . enforcer . rule . api . EnforcerRule # execute ( org . apache . maven . enforcer . rule . api . EnforcerRuleHelper ) */
public void execute ( EnforcerRuleHelper helper ) throws EnforcerRuleException { } } | try { RuntimeInformation rti = ( RuntimeInformation ) helper . getComponent ( RuntimeInformation . class ) ; ArtifactVersion detectedMavenVersion = rti . getApplicationVersion ( ) ; helper . getLog ( ) . debug ( "Detected Maven Version: " + detectedMavenVersion ) ; enforceVersion ( helper . getLog ( ) , "Maven" , getVersion ( ) , detectedMavenVersion ) ; } catch ( ComponentLookupException e ) { // TODO Auto - generated catch block
e . printStackTrace ( ) ; } |
public class HashIntMap { /** * documentation inherited */
public void putAll ( IntMap < V > t ) { } } | // if we can , avoid creating Integer objects while copying
for ( IntEntry < V > entry : t . intEntrySet ( ) ) { put ( entry . getIntKey ( ) , entry . getValue ( ) ) ; } |
public class InferredNullability { /** * Get inferred nullness qualifier for an expression , if possible . */
public Optional < Nullness > getExprNullness ( ExpressionTree exprTree ) { } } | InferenceVariable iv = TypeArgInferenceVar . create ( ImmutableList . of ( ) , exprTree ) ; return constraintGraph . nodes ( ) . contains ( iv ) ? getNullness ( iv ) : Optional . empty ( ) ; |
public class CmsCmisUtil { /** * Helper method to add the dynamic properties for a resource . < p >
* @ param cms the current CMS context
* @ param typeManager the type manager instance
* @ param props the properties to which the dynamic properties should be added
* @ param typeId the type id
* @ param resource the resource
* @ param filter the property filter */
public static void addDynamicProperties ( CmsObject cms , CmsCmisTypeManager typeManager , PropertiesImpl props , String typeId , CmsResource resource , Set < String > filter ) { } } | List < I_CmsPropertyProvider > providers = typeManager . getPropertyProviders ( ) ; for ( I_CmsPropertyProvider provider : providers ) { String propertyName = CmsCmisTypeManager . PROPERTY_PREFIX_DYNAMIC + provider . getName ( ) ; if ( ! checkAddProperty ( typeManager , props , typeId , filter , propertyName ) ) { continue ; } try { String value = provider . getPropertyValue ( cms , resource ) ; addPropertyString ( typeManager , props , typeId , filter , propertyName , value ) ; } catch ( Throwable t ) { addPropertyString ( typeManager , props , typeId , filter , propertyName , null ) ; } } |
public class DefaultMobicentsCluster { /** * Method handle a change on the cluster members set
* @ param event */
@ ViewChanged public synchronized void onViewChangeEvent ( ViewChangedEvent event ) { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "onViewChangeEvent : pre[" + event . isPre ( ) + "] : event local address[" + event . getCache ( ) . getLocalAddress ( ) + "]" ) ; } final List < Address > oldView = currentView ; currentView = new ArrayList < Address > ( event . getNewView ( ) . getMembers ( ) ) ; final Address localAddress = getLocalAddress ( ) ; // just a precaution , it can be null !
if ( oldView != null ) { final Cache jbossCache = mobicentsCache . getJBossCache ( ) ; final Configuration config = jbossCache . getConfiguration ( ) ; final boolean isBuddyReplicationEnabled = config . getBuddyReplicationConfig ( ) != null && config . getBuddyReplicationConfig ( ) . isEnabled ( ) ; // recover stuff from lost members
Runnable runnable = new Runnable ( ) { public void run ( ) { for ( Address oldMember : oldView ) { if ( ! currentView . contains ( oldMember ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "onViewChangeEvent : processing lost member " + oldMember ) ; } for ( FailOverListener localListener : failOverListeners ) { ClientLocalListenerElector localListenerElector = localListener . getElector ( ) ; if ( localListenerElector != null && ! isBuddyReplicationEnabled ) { // going to use the local listener elector instead , which gives results based on data
performTakeOver ( localListener , oldMember , localAddress , true , isBuddyReplicationEnabled ) ; } else { List < Address > electionView = getElectionView ( oldMember ) ; if ( electionView != null && elector . elect ( electionView ) . equals ( localAddress ) ) { performTakeOver ( localListener , oldMember , localAddress , false , isBuddyReplicationEnabled ) ; } cleanAfterTakeOver ( localListener , oldMember ) ; } } } } } } ; Thread t = new Thread ( runnable ) ; t . start ( ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.