signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class MaxSATSolver { /** * Solves the formula on the solver and returns the result .
* @ param handler a MaxSAT handler
* @ return the result ( SAT , UNSAT , Optimum found , or UNDEF if canceled by the handler ) */
public MaxSAT . MaxSATResult solve ( final MaxSATHandler handler ) { } }
|
if ( this . result != UNDEF ) return this . result ; if ( this . solver . currentWeight ( ) == 1 ) this . solver . setProblemType ( MaxSAT . ProblemType . UNWEIGHTED ) ; else this . solver . setProblemType ( MaxSAT . ProblemType . WEIGHTED ) ; this . result = this . solver . search ( handler ) ; return this . result ;
|
public class Record { /** * Copy all the fields from one record to another .
* @ param recSource
* @ param resource
* @ param bDisplayOption
* @ param iMoveMode
* @ param bAllowFieldChange
* @ param bOnlyModifiedFields
* @ param bMoveModifiedState
* @ param syncSelection TODO
* @ return true if successful */
public boolean moveFields ( Record recSource , ResourceBundle resource , boolean bDisplayOption , int iMoveMode , boolean bAllowFieldChange , boolean bOnlyModifiedFields , boolean bMoveModifiedState , boolean syncSelection ) { } }
|
boolean bFieldsMoved = false ; for ( int iFieldSeq = 0 ; iFieldSeq < this . getFieldCount ( ) ; iFieldSeq ++ ) { BaseField fldDest = this . getField ( iFieldSeq ) ; BaseField fldSource = null ; try { if ( resource == Record . MOVE_BY_NAME ) { String strSourceField = fldDest . getFieldName ( ) ; fldSource = recSource . getField ( strSourceField ) ; } else if ( resource != null ) { String strSourceField = resource . getString ( fldDest . getFieldName ( ) ) ; // Lookup source field name from dest
if ( ( strSourceField != null ) && ( strSourceField . length ( ) > 0 ) ) fldSource = recSource . getField ( strSourceField ) ; } else // if ( resource = = null )
{ fldSource = recSource . getField ( iFieldSeq ) ; } } catch ( MissingResourceException ex ) { fldSource = null ; } if ( fldSource != null ) { if ( ( ! bOnlyModifiedFields ) || ( fldSource . isModified ( ) ) ) { boolean [ ] rgbEnabled = null ; if ( bAllowFieldChange == false ) // Don ' t enable a disabled field listener
rgbEnabled = fldDest . setEnableListeners ( bAllowFieldChange ) ; // Don ' t call the HandleFieldChanged beh until ALL inited !
FieldDataScratchHandler listenerScratchData = null ; if ( ( bAllowFieldChange == false ) && ( bMoveModifiedState ) ) if ( iMoveMode == DBConstants . READ_MOVE ) // Very obscure - Make sure this fake read move does not change the scratch area
if ( fldDest . getNextValidListener ( iMoveMode ) instanceof FieldDataScratchHandler ) // Always enable would have to be true since listeners have been disabled
( listenerScratchData = ( ( FieldDataScratchHandler ) fldDest . getNextValidListener ( iMoveMode ) ) ) . setAlwaysEnabled ( false ) ; fldDest . moveFieldToThis ( fldSource , bDisplayOption , iMoveMode ) ; if ( listenerScratchData != null ) listenerScratchData . setAlwaysEnabled ( true ) ; if ( rgbEnabled != null ) fldDest . setEnableListeners ( rgbEnabled ) ; if ( bAllowFieldChange == false ) fldDest . setModified ( false ) ; // At this point , no changes have been done
bFieldsMoved = true ; } if ( ( bAllowFieldChange ) || ( bMoveModifiedState ) ) fldDest . setModified ( fldSource . isModified ( ) ) ; // If you allow field change set if source is modified .
if ( syncSelection ) fldDest . setSelected ( fldSource . isSelected ( ) ) ; } } return bFieldsMoved ;
|
public class ActionRow { /** * { @ inheritDoc } */
@ Override public List < Example > actionCells ( Example row ) { } }
|
return ExampleUtil . asList ( row . firstChild ( ) ) ;
|
public class GVRInputManager { /** * Dispatch a { @ link MotionEvent } to the { @ link GVRInputManager } .
* @ param event The { @ link MotionEvent } to be processed .
* @ return < code > true < / code > if the { @ link MotionEvent } is handled by the
* { @ link GVRInputManager } , < code > false < / code > otherwise . */
public boolean dispatchMotionEvent ( MotionEvent event ) { } }
|
GVRCursorController controller = getUniqueControllerId ( event . getDeviceId ( ) ) ; if ( ( controller != null ) && controller . isEnabled ( ) ) { return controller . dispatchMotionEvent ( event ) ; } return false ;
|
public class ResourceGroovyMethods { /** * Filters the lines of a File and creates a Writable in return to
* stream the filtered lines .
* @ param self a File
* @ param closure a closure which returns a boolean indicating to filter
* the line or not
* @ return a Writable closure
* @ throws IOException if < code > self < / code > is not readable
* @ see IOGroovyMethods # filterLine ( java . io . Reader , groovy . lang . Closure )
* @ since 1.0 */
public static Writable filterLine ( File self , @ ClosureParams ( value = SimpleType . class , options = "java.lang.String" ) Closure closure ) throws IOException { } }
|
return IOGroovyMethods . filterLine ( newReader ( self ) , closure ) ;
|
public class SQLDroidStatement { /** * Close the result set ( if open ) and null the rs variable . */
public void closeResultSet ( ) throws SQLException { } }
|
if ( rs != null ) { if ( ! rs . isClosed ( ) ) { rs . close ( ) ; } rs = null ; }
|
public class CredentialsServiceImpl { /** * { @ inheritDoc } */
@ Override public void setCredentials ( Subject subject ) throws CredentialException { } }
|
// Step through the list of registered providers
Iterator < CredentialProvider > itr = credentialProviders . getServices ( ) ; while ( itr . hasNext ( ) ) { CredentialProvider provider = itr . next ( ) ; provider . setCredential ( subject ) ; }
|
public class SibRaEngineComponent { /** * Returns < code > true < / code > if the given messaging engine is reloading ,
* otherwise < code > false < / code > .
* @ param meUuid
* the messaging engine UUID
* @ return < code > true < / code > if the messaging engine is reloading ,
* otherwise < code > false < / code > */
public static boolean isMessagingEngineReloading ( final String meUuid ) { } }
|
final String methodName = "isMessagingEngineReloading" ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . entry ( TRACE , methodName , meUuid ) ; } final boolean reloading = RELOADING_MESSAGING_ENGINES . contains ( meUuid ) ; if ( TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName , Boolean . valueOf ( reloading ) ) ; } return reloading ;
|
public class ApiOvhMe { /** * Delete this object
* REST : DELETE / me / identity / group / { group }
* @ param group [ required ] Group ' s name */
public void identity_group_group_DELETE ( String group ) throws IOException { } }
|
String qPath = "/me/identity/group/{group}" ; StringBuilder sb = path ( qPath , group ) ; exec ( qPath , "DELETE" , sb . toString ( ) , null ) ;
|
public class RemoteBundleContextClient { /** * { @ inheritDoc } */
public long installBundle ( final String bundleUrl ) { } }
|
try { return getRemoteBundleContext ( ) . installBundle ( bundleUrl ) ; } catch ( RemoteException e ) { throw new TestContainerException ( "Remote exception" , e ) ; } catch ( BundleException e ) { throw new TestContainerException ( "Bundle cannot be installed" , e ) ; }
|
public class DefaultPropertyExtractor { /** * getText .
* @ param key a { @ link java . lang . String } object .
* @ param defaultVal a { @ link java . lang . String } object .
* @ return a { @ link java . lang . String } object . */
protected String getText ( String key , String defaultVal ) { } }
|
return textResource . getText ( key , defaultVal ) ;
|
public class RippleComponent { /** * Starts a ripple enter animation .
* @ param fast whether the ripple should enter quickly */
public final void enter ( boolean fast ) { } }
|
cancel ( ) ; mSoftwareAnimator = createSoftwareEnter ( fast ) ; if ( mSoftwareAnimator != null ) { mSoftwareAnimator . start ( ) ; }
|
public class SqlHelper { /** * 判断自动 = = null的条件结构
* @ param column
* @ param contents
* @ param empty
* @ return */
public static String getIfIsNull ( EntityColumn column , String contents , boolean empty ) { } }
|
return getIfIsNull ( null , column , contents , empty ) ;
|
public class AbstractScriptProvider { /** * 找出脚本类
* @ param clazzs
* @ return
* @ throws InstantiationException
* @ throws IllegalAccessException */
@ SuppressWarnings ( "unchecked" ) private Set < Class < ? extends T > > findScriptClass ( Set < Class < ? > > clazzs ) throws InstantiationException , IllegalAccessException { } }
|
Set < Class < ? extends T > > scriptClazzs = new HashSet < Class < ? extends T > > ( ) ; for ( Class < ? > clazz : clazzs ) { Class < T > scriptClazz = null ; try { scriptClazz = ( Class < T > ) clazz ; } catch ( Throwable e ) { } if ( scriptClazz == null ) { continue ; } if ( acceptClass ( scriptClazz ) ) { scriptClazzs . add ( scriptClazz ) ; } // 如果A接口有B , C实现 , B和C之间不能转换 , 如果T是B , 则不能使用A . class . isAssignableFrom ( clazz ) 判断
// if ( IScript . class . isAssignableFrom ( clazz ) ) {
// Class < T > scriptClazz = ( Class < T > ) clazz ;
// scriptClazzs . add ( scriptClazz ) ;
} return scriptClazzs ;
|
public class Base64EncodedCiphererImpl { /** * Encrypts or decrypts a message . The encryption / decryption mode depends on
* the configuration of the mode parameter .
* @ param key a base64 encoded version of the symmetric key
* @ param initializationVector a base64 encoded version of the
* initialization vector
* @ param message if in encryption mode , the clear - text message to encrypt ,
* otherwise a base64 encoded version of the message to decrypt
* @ return if in encryption mode , returns a base64 encoded version of the
* encrypted message , otherwise returns the decrypted clear - text
* message
* @ throws SymmetricEncryptionException on runtime errors
* @ see # setMode ( com . google . code . springcryptoutils . core . cipher . Mode ) */
public String encrypt ( String key , String initializationVector , String message ) { } }
|
try { IvParameterSpec initializationVectorSpec = new IvParameterSpec ( Base64 . decodeBase64 ( initializationVector ) ) ; final SecretKeySpec keySpec = new SecretKeySpec ( Base64 . decodeBase64 ( key ) , keyAlgorithm ) ; final Cipher cipher = ( ( ( provider == null ) || ( provider . length ( ) == 0 ) ) ? Cipher . getInstance ( cipherAlgorithm ) : Cipher . getInstance ( cipherAlgorithm , provider ) ) ; byte [ ] messageAsByteArray ; switch ( mode ) { case ENCRYPT : cipher . init ( Cipher . ENCRYPT_MODE , keySpec , initializationVectorSpec ) ; messageAsByteArray = message . getBytes ( charsetName ) ; final byte [ ] encryptedMessage = cipher . doFinal ( messageAsByteArray ) ; return new String ( Base64 . encodeBase64 ( encryptedMessage , chunkOutput ) ) ; case DECRYPT : cipher . init ( Cipher . DECRYPT_MODE , keySpec , initializationVectorSpec ) ; messageAsByteArray = Base64 . decodeBase64 ( message ) ; final byte [ ] decryptedMessage = cipher . doFinal ( messageAsByteArray ) ; return new String ( decryptedMessage , charsetName ) ; default : return null ; } } catch ( Exception e ) { throw new SymmetricEncryptionException ( "error encrypting/decrypting message; mode=" + mode , e ) ; }
|
public class DatabaseTaskStore { /** * { @ inheritDoc } */
@ Override public TaskRecord getTrigger ( long taskId ) throws Exception { } }
|
String find = "SELECT t.OWNR,t.STATES,t.TRIG FROM Task t WHERE t.ID=:i" ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getTrigger" , taskId , find ) ; List < Object [ ] > resultList ; EntityManager em = getPersistenceServiceUnit ( ) . createEntityManager ( ) ; try { TypedQuery < Object [ ] > query = em . createQuery ( find . toString ( ) , Object [ ] . class ) ; query . setParameter ( "i" , taskId ) ; resultList = query . getResultList ( ) ; } finally { em . close ( ) ; } TaskRecord taskRecord ; if ( resultList . isEmpty ( ) ) taskRecord = null ; else { Object [ ] result = resultList . get ( 0 ) ; taskRecord = new TaskRecord ( false ) ; taskRecord . setIdentifierOfOwner ( ( String ) result [ 0 ] ) ; taskRecord . setState ( ( Short ) result [ 1 ] ) ; taskRecord . setTrigger ( ( byte [ ] ) result [ 2 ] ) ; } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getTrigger" , taskRecord ) ; return taskRecord ;
|
public class JAXBMarshallerHelper { /** * Set the Sun specific namespace prefix mapper . Value must implement either
* < code > com . sun . xml . bind . marshaller . NamespacePrefixMapper < / code > or
* < code > com . sun . xml . internal . bind . marshaller . NamespacePrefixMapper < / code >
* depending on the implementation type of < code > Marshaller < / code > .
* @ param aMarshaller
* The marshaller to set the property . May not be < code > null < / code > .
* @ param aNamespacePrefixMapper
* the value to be set */
public static void setSunNamespacePrefixMapper ( @ Nonnull final Marshaller aMarshaller , @ Nonnull final JAXBNamespacePrefixMapper aNamespacePrefixMapper ) { } }
|
final String sPropertyName = SUN_PREFIX_MAPPER ; _setProperty ( aMarshaller , sPropertyName , aNamespacePrefixMapper ) ;
|
public class ChineseEnglishWordMap { /** * Returns a reversed map of the current map .
* @ return A reversed map of the current map . */
public Map < String , Set < String > > getReverseMap ( ) { } }
|
Set < Map . Entry < String , Set < String > > > entries = map . entrySet ( ) ; Map < String , Set < String > > rMap = new HashMap < String , Set < String > > ( entries . size ( ) ) ; for ( Map . Entry < String , Set < String > > me : entries ) { String k = me . getKey ( ) ; Set < String > transList = me . getValue ( ) ; for ( String trans : transList ) { Set < String > entry = rMap . get ( trans ) ; if ( entry == null ) { // reduce default size as most will be small
Set < String > toAdd = new LinkedHashSet < String > ( 6 ) ; toAdd . add ( k ) ; rMap . put ( trans , toAdd ) ; } else { entry . add ( k ) ; } } } return rMap ;
|
public class FieldPosition { /** * Return true if the receiver wants a < code > Format . Field < / code > value and
* < code > attribute < / code > is equal to it . */
private boolean matchesField ( Format . Field attribute ) { } }
|
if ( this . attribute != null ) { return this . attribute . equals ( attribute ) ; } return false ;
|
public class Hex { /** * Converts an array of characters representing hexidecimal values into an
* array of bytes of those same values . The returned array will be half the
* length of the passed array , as it takes two characters to represent any
* given byte . An exception is thrown if the passed char array has an odd
* number of elements .
* @ param data An array of characters containing hexidecimal digits
* @ return A byte array containing binary data decoded from
* the supplied char array .
* @ throws DecoderException Thrown if an odd number or illegal of characters
* is supplied */
public static byte [ ] decodeHex ( char [ ] data ) throws DecoderException { } }
|
int len = data . length ; if ( ( len & 0x01 ) != 0 ) { throw new DecoderException ( "Odd number of characters." ) ; } byte [ ] out = new byte [ len >> 1 ] ; // two characters form the hex value .
for ( int i = 0 , j = 0 ; j < len ; i ++ ) { int f = toDigit ( data [ j ] , j ) << 4 ; j ++ ; f = f | toDigit ( data [ j ] , j ) ; j ++ ; out [ i ] = ( byte ) ( f & 0xFF ) ; } return out ;
|
public class TriggerBuilder { /** * Set the identity of the Job which should be fired by the produced Trigger ,
* by extracting the JobKey from the given job .
* @ param jobDetail
* the Job to fire .
* @ return the updated TriggerBuilder
* @ see ITrigger # getJobKey ( ) */
@ Nonnull public TriggerBuilder < T > forJob ( @ Nonnull final IJobDetail jobDetail ) { } }
|
final JobKey k = jobDetail . getKey ( ) ; if ( k . getName ( ) == null ) throw new IllegalArgumentException ( "The given job has not yet had a name assigned to it." ) ; m_aJobKey = k ; return this ;
|
public class MarkdownRenderer { /** * ( non - Javadoc )
* @ see net . roboconf . doc . generator . internal . AbstractStructuredRenderer
* # endSection ( java . lang . String , java . lang . StringBuilder ) */
@ Override protected StringBuilder endSection ( String sectionName , StringBuilder sb ) { } }
|
sb . append ( "<br />\n" ) ; return sb ;
|
public class CmsADEConfigData { /** * Returns the formatter change sets for this and all parent sitemaps , ordered by increasing folder depth of the sitemap . < p >
* @ return the formatter change sets for all ancestor sitemaps */
public List < CmsFormatterChangeSet > getFormatterChangeSets ( ) { } }
|
CmsADEConfigData currentConfig = this ; List < CmsFormatterChangeSet > result = Lists . newArrayList ( ) ; while ( currentConfig != null ) { CmsFormatterChangeSet changes = currentConfig . getOwnFormatterChangeSet ( ) ; if ( changes != null ) { result . add ( changes ) ; } currentConfig = currentConfig . parent ( ) ; } Collections . reverse ( result ) ; return result ;
|
public class Timestamp { /** * Returns the result of dividing x by y rounded using floor . */
private static long floorDiv ( long x , long y ) { } }
|
return BigDecimal . valueOf ( x ) . divide ( BigDecimal . valueOf ( y ) , 0 , RoundingMode . FLOOR ) . longValue ( ) ;
|
public class LSrtToCharFunctionBuilder { /** * 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 LSrtToCharFunction srtToCharFunctionFrom ( Consumer < LSrtToCharFunctionBuilder > buildingFunction ) { } }
|
LSrtToCharFunctionBuilder builder = new LSrtToCharFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ;
|
public class JdbcUtil { /** * Imports the data from < code > DataSet < / code > to database .
* @ param dataset
* @ param selectColumnNames
* @ param stmt the column order in the sql must be consistent with the column order in the DataSet .
* @ return
* @ throws UncheckedSQLException */
public static int importData ( final DataSet dataset , final Collection < String > selectColumnNames , final PreparedStatement stmt ) throws UncheckedSQLException { } }
|
return importData ( dataset , selectColumnNames , 0 , dataset . size ( ) , stmt ) ;
|
public class ConfigurationRegistry { /** * Reloads a specific dynamic configuration option .
* @ param key the key of the configuration option */
public void reload ( String key ) { } }
|
if ( configurationOptionsByKey . containsKey ( key ) ) { configurationOptionsByKey . get ( key ) . reload ( false ) ; }
|
public class RequestEvents { /** * Publish finish events for each of the specified query types
* < pre >
* { @ code
* RequestEvents . start ( " get " , 1l , bus , " typeA " , " custom " ) ;
* try {
* return " ok " ;
* } finally {
* RequestEvents . finish ( " get " , 1l , bus , " typeA " , " custom " ) ;
* < / pre >
* @ param query Completed query
* @ param correlationId Identifier
* @ param bus EventBus to post events to
* @ param types Query types to post to event bus */
public static < T > void finish ( T query , long correlationId , EventBus bus , String ... types ) { } }
|
for ( String type : types ) { RemoveQuery < T > next = finish ( query , correlationId , type ) ; bus . post ( next ) ; }
|
public class LogFetcher { /** * Downloads the logs to a local temp folder .
* @ param applicationId
* @ return
* @ throws URISyntaxException
* @ throws StorageException
* @ throws IOException */
private File downloadToTempFolder ( final String applicationId ) throws URISyntaxException , StorageException , IOException { } }
|
final File outputFolder = Files . createTempDirectory ( "reeflogs-" + applicationId ) . toFile ( ) ; if ( ! outputFolder . exists ( ) && ! outputFolder . mkdirs ( ) ) { LOG . log ( Level . WARNING , "Failed to create [{0}]" , outputFolder . getAbsolutePath ( ) ) ; } final CloudBlobDirectory logFolder = this . container . getDirectoryReference ( LOG_FOLDER_PREFIX + applicationId + "/" ) ; int fileCounter = 0 ; for ( final ListBlobItem blobItem : logFolder . listBlobs ( ) ) { if ( blobItem instanceof CloudBlob ) { try ( final OutputStream outputStream = new FileOutputStream ( new File ( outputFolder , "File-" + fileCounter ) ) ) { ( ( CloudBlob ) blobItem ) . download ( outputStream ) ; ++ fileCounter ; } } } LOG . log ( Level . FINE , "Downloaded logs to: {0}" , outputFolder . getAbsolutePath ( ) ) ; return outputFolder ;
|
public class Httpserver { /** * LogHandler */
public void start ( ) { } }
|
int numHandler = 3 ; InetSocketAddress socketAddr = new InetSocketAddress ( port ) ; Executor executor = Executors . newFixedThreadPool ( numHandler ) ; try { hs = HttpServer . create ( socketAddr , 0 ) ; hs . createContext ( HttpserverUtils . HTTPSERVER_CONTEXT_PATH_LOGVIEW , new LogHandler ( conf ) ) ; hs . setExecutor ( executor ) ; hs . start ( ) ; } catch ( BindException e ) { LOG . info ( "HttpServer has started already!" ) ; hs = null ; return ; } catch ( IOException e ) { LOG . error ( "Failed to start HttpServer" , e ) ; hs = null ; return ; } LOG . info ( "Success started HttpServer at port:" + port ) ;
|
import java . util . * ; public class Main { public static void main ( String [ ] args ) { System . out . println ( filterOutEvenNumbers ( Arrays . asList ( 1 , 3 , 5 , 2 ) ) ) ; // [1 , 3 , 5]
System . out . println ( filterOutEvenNumbers ( Arrays . asList ( 5 , 6 , 7 ) ) ) ; // [5 , 7]
System . out . println ( filterOutEvenNumbers ( Arrays . asList ( 1 , 2 , 3 , 4 ) ) ) ; // [1 , 3]
} /** * This Java function filters out even numbers from the provided list .
* @ param inputList A list of integers
* @ return Returns a list consisting only of the odd numbers from the input list . */
public static List < Integer > filterOutEvenNumbers ( List < Integer > inputList ) { } }
|
List < Integer > outputList = new ArrayList < > ( ) ; for ( Integer i : inputList ) { if ( i % 2 != 0 ) { outputList . add ( i ) ; } } return outputList ;
|
public class PrivacyListManager { /** * Client declines the use of active lists .
* @ throws XMPPErrorException
* @ throws NoResponseException
* @ throws NotConnectedException
* @ throws InterruptedException */
public void declineActiveList ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } }
|
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy ( ) ; request . setDeclineActiveList ( true ) ; // Send the package to the server
setRequest ( request ) ;
|
public class BezierCurve { /** * Creates Bezier function for fixed control points .
* @ param controlPoints
* @ return */
public ParameterizedOperator operator ( Point2D . Double ... controlPoints ) { } }
|
if ( controlPoints . length != length ) { throw new IllegalArgumentException ( "control-points length not " + length ) ; } double [ ] cp = convert ( controlPoints ) ; return operator ( cp ) ;
|
public class CmsAliasBulkEditHelper { /** * Message accessor .
* @ param locale the locale for messages
* @ return the message string */
private String messageDuplicateAliasPath ( Locale locale ) { } }
|
return Messages . get ( ) . getBundle ( locale ) . key ( Messages . ERR_ALIAS_DUPLICATE_ALIAS_PATH_0 ) ;
|
public class AbstractStreamParameters { /** * Add a location to the filter
* Does not replace any existing locations in the filter .
* @ param west the longitude of the western side of the location ' s bounding box .
* @ param south the latitude of the southern side of the location ' s bounding box .
* @ param east the longitude of the eastern side of the location ' s bounding box .
* @ param north the latitude of the northern side of the location ' s bounding box .
* @ return this StreamFilter for building up filter parameters . */
public AbstractStreamParameters addLocation ( float west , float south , float east , float north ) { } }
|
if ( locations . length ( ) > 0 ) { locations . append ( ',' ) ; } locations . append ( west ) . append ( ',' ) . append ( south ) . append ( ',' ) ; locations . append ( east ) . append ( ',' ) . append ( north ) . append ( ',' ) ; return this ;
|
public class HealthCheckClient { /** * Returns the specified HealthCheck resource . Gets a list of available health checks by making a
* list ( ) request .
* < p > Sample code :
* < pre > < code >
* try ( HealthCheckClient healthCheckClient = HealthCheckClient . create ( ) ) {
* ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName . of ( " [ PROJECT ] " , " [ HEALTH _ CHECK ] " ) ;
* HealthCheck response = healthCheckClient . getHealthCheck ( healthCheck ) ;
* < / code > < / pre >
* @ param healthCheck Name of the HealthCheck resource to return .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final HealthCheck getHealthCheck ( ProjectGlobalHealthCheckName healthCheck ) { } }
|
GetHealthCheckHttpRequest request = GetHealthCheckHttpRequest . newBuilder ( ) . setHealthCheck ( healthCheck == null ? null : healthCheck . toString ( ) ) . build ( ) ; return getHealthCheck ( request ) ;
|
public class TileBoundingBoxUtils { /** * Get the tolerance distance in meters for the zoom level and pixels length
* @ param zoom
* zoom level
* @ param pixelWidth
* pixel width
* @ param pixelHeight
* pixel height
* @ return tolerance distance in meters
* @ since 2.0.0 */
public static double toleranceDistance ( int zoom , int pixelWidth , int pixelHeight ) { } }
|
return toleranceDistance ( zoom , Math . max ( pixelWidth , pixelHeight ) ) ;
|
public class Util { /** * Creates a filtered sublist . */
@ Nonnull public static < T > List < T > filter ( @ Nonnull List < ? > base , @ Nonnull Class < T > type ) { } }
|
return filter ( ( Iterable ) base , type ) ;
|
public class SimpleCallStateMachine { /** * Since traffic can come in any order due to the fact that we can merge
* multiple pcaps etc we may miss the initial traffic ( perhaps we didn ' t
* even captured it ) so when initializing the state we can really jump into
* the state machine anywhere . Hence , this method tries to figure out where
* in the state machine we need to " jump " into assuming that we would have
* received the traffic that has gone missing .
* @ param msg
* @ throws SipPacketParseException */
private void initializeState ( final SipPacket msg ) throws SipPacketParseException { } }
|
if ( msg . isRequest ( ) ) { if ( msg . isInvite ( ) && msg . isInitial ( ) ) { transition ( CallState . INITIAL , msg ) ; } else if ( msg . isAck ( ) ) { // TODO : need to figure out whether this is an ACK to a 200 or
// a error response since we would transition differently
// but not sure how we could if the initial invite is lost
transition ( CallState . IN_CALL , msg ) ; } else if ( msg . isBye ( ) && ! msg . isInitial ( ) ) { transition ( CallState . COMPLETED , msg ) ; } } else { final SipResponsePacket response = ( SipResponsePacket ) msg ; if ( response . isInvite ( ) ) { if ( response . is100Trying ( ) ) { transition ( CallState . TRYING , msg ) ; } else if ( response . isRinging ( ) ) { transition ( CallState . RINGING , msg ) ; } else if ( response . isSuccess ( ) ) { transition ( CallState . IN_CALL , msg ) ; } } else if ( response . isBye ( ) && ! response . isInitial ( ) ) { transition ( CallState . COMPLETED , msg ) ; } }
|
public class Closeables { /** * Creates a closeable spliterator that when closed will close the underlying stream as well
* @ param stream The stream to change into a closeable spliterator
* @ param < R > The type of the stream
* @ return A spliterator that when closed will also close the underlying stream */
public static < R > CloseableSpliterator < R > spliterator ( BaseStream < R , Stream < R > > stream ) { } }
|
Spliterator < R > spliterator = stream . spliterator ( ) ; if ( spliterator instanceof CloseableSpliterator ) { return ( CloseableSpliterator < R > ) spliterator ; } return new StreamToCloseableSpliterator < > ( stream , spliterator ) ;
|
public class LooseArtifactNotifier { /** * { @ inheritDoc } */
@ Override public synchronized boolean removeListener ( ArtifactListener listenerToRemove ) { } }
|
ArtifactListenerSelector listenerSelectorToRemove = new ArtifactListenerSelector ( listenerToRemove ) ; List < Registration > rToRemove = new ArrayList < Registration > ( ) ; for ( Registration r : listeners ) { if ( r . listener . equals ( listenerSelectorToRemove ) ) { rToRemove . add ( r ) ; } } listeners . removeAll ( rToRemove ) ; rebuildPaths ( ) ; reprocessChildrenNotifiers ( ) ; processMonitoredPathList ( ) ; return rToRemove . size ( ) > 0 ;
|
public class Settings { /** * Loads a property of the type URL from the Properties object
* @ param propertyKey
* the property name
* @ return the value */
@ SuppressWarnings ( "unused" ) private URL loadURLProperty ( String propertyKey ) { } }
|
String urlPropValue = prop . getProperty ( propertyKey ) ; if ( urlPropValue == null || urlPropValue . isEmpty ( ) ) { return null ; } else { try { return new URL ( urlPropValue . trim ( ) ) ; } catch ( MalformedURLException e ) { LOGGER . error ( "'" + propertyKey + "' contains malformed url." , e ) ; return null ; } }
|
public class Input { /** * Returns a boolean stating whether there are more properties
* @ return boolean < code > true < / code > if there are more properties to read ,
* < code > false < / code > otherwise */
public boolean hasMoreProperties ( ) { } }
|
if ( buf . remaining ( ) >= 3 ) { byte [ ] threeBytes = new byte [ 3 ] ; int pos = buf . position ( ) ; buf . get ( threeBytes ) ; if ( Arrays . equals ( AMF . END_OF_OBJECT_SEQUENCE , threeBytes ) ) { log . trace ( "End of object" ) ; return false ; } buf . position ( pos ) ; return true ; } // an end - of - object marker can ' t occupy less than 3 bytes so return true
return true ;
|
public class ApacheLogSplitFunction { /** * ログ情報マップを基にApacheLogエンティティを生成する 。
* @ param logInfoMap ログ情報マップ
* @ return ApacheLogエンティティ
* @ throws ParseException パース失敗時 */
protected ApacheLog createEntity ( Map < String , String > logInfoMap ) throws ParseException { } }
|
String serverName = logInfoMap . get ( "hostname" ) ; String sizeStr = logInfoMap . get ( "size" ) ; String timeStr = logInfoMap . get ( "reqtime_microsec" ) ; String recordedTimeStr = logInfoMap . get ( "time" ) ; long size = 0 ; long time = 0 ; Date recordedTime = null ; if ( sizeStr != null && StringUtils . equals ( sizeStr , "-" ) == false ) { size = Long . valueOf ( sizeStr ) ; } if ( timeStr != null && StringUtils . equals ( timeStr , "-" ) == false ) { time = Long . valueOf ( timeStr ) ; } if ( recordedTimeStr != null ) { recordedTime = this . javaDateFormat . parse ( recordedTimeStr ) ; } else { recordedTime = new Date ( ) ; } ApacheLog result = new ApacheLog ( serverName , 1 , size , time , recordedTime , 0d ) ; return result ;
|
public class TargetStreamManager { /** * Send a request to flush a stream . The originator of the stream ,
* and the ID for the stream must be known . This method is public
* because it ' s not clear who ' s going to call this yet .
* @ param source The originator of the stream ( may be multiple hops
* away ) .
* @ param stream The UUID of the stream to flush . */
public void requestFlushAtSource ( SIBUuid8 source , SIBUuid12 destID , SIBUuid8 busID , SIBUuid12 stream , boolean indoubtDiscard ) throws SIException , SIResourceException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "requestFlushAtSource" , new Object [ ] { source , stream } ) ; // Synchronize here to avoid races ( not that we expect any )
synchronized ( flushMap ) { if ( flushMap . containsKey ( stream ) ) { // Already a request on the way so ignore .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "requestFlushAtSource" ) ; return ; } // Ok , new entry :
// 1 . Create a request ID and flush record , store it in the map .
// 2 . Create and send an " request flush " .
// 3 . Start an alarm to repeat " request flush " a set number of
// times .
// Create and store the request record
long reqID = messageProcessor . nextTick ( ) ; FlushQueryRecord entry = new FlushQueryRecord ( source , destID , busID , reqID ) ; flushMap . put ( stream , entry ) ; // Create and send the query
upControl . sendRequestFlushMessage ( source , destID , busID , reqID , stream , indoubtDiscard ) ; // Start the alarm . The context for the alarm is the stream ID ,
// which we can use to look up the FlushQueryRecord if the alarm
// expires .
entry . resend = am . create ( GDConfig . REQUEST_FLUSH_INTERVAL , this , stream ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "requestFlushAtSource" ) ;
|
public class GeniaCorpusCollectionReader { /** * Recursive , since annotations can overlap */
private static String annotatateContent ( JCas jcas , Object contentObj , int start ) { } }
|
LOG . trace ( "annotate: " + reflectionToString ( contentObj ) ) ; int end = start ; StringBuilder internalSb = new StringBuilder ( ) ; if ( contentObj instanceof String ) { String c = ( String ) contentObj ; internalSb . append ( c ) ; end += c . length ( ) ; } else if ( contentObj instanceof Cons ) { Cons cons = ( Cons ) contentObj ; for ( Object o : cons . getContent ( ) ) { String parse = annotatateContent ( jcas , o , end ) ; end += parse . length ( ) ; internalSb . append ( parse ) ; } BioEntityMention entity = new BioEntityMention ( jcas , start , end ) ; entity . setSpecificType ( cons . getSem ( ) ) ; entity . setComponentId ( GeniaCorpusCollectionReader . COMPONENT_ID ) ; entity . setTextualRepresentation ( cons . getLex ( ) ) ; entity . addToIndexes ( ) ; } return internalSb . toString ( ) ;
|
public class MapMessage { /** * Adds an item to the data Map .
* @ param key The name of the data item .
* @ param value The value of the data item . */
public void put ( final String key , final String value ) { } }
|
if ( value == null ) { throw new IllegalArgumentException ( "No value provided for key " + key ) ; } validate ( key , value ) ; data . putValue ( key , value ) ;
|
public class FrameworkManager { /** * Delayed registration of the platform MBeanServerPipeline in the OSGi registry .
* @ param systemContext The framework system bundle context */
private void preRegisterMBeanServerPipelineService ( final BundleContext systemContext ) { } }
|
PlatformMBeanServerBuilder . addPlatformMBeanServerBuilderListener ( new PlatformMBeanServerBuilderListener ( ) { @ Override @ FFDCIgnore ( IllegalStateException . class ) public void platformMBeanServerCreated ( final MBeanServerPipeline pipeline ) { if ( pipeline != null ) { final Hashtable < String , String > svcProps = new Hashtable < String , String > ( ) ; try { AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { @ Override public Void run ( ) { systemContext . registerService ( MBeanServerPipeline . class . getName ( ) , pipeline , svcProps ) ; return null ; } } ) ; } catch ( IllegalStateException ise ) { /* This instance of the system bundle is no longer valid . Ignore it . */
} } } } ) ;
|
public class RandomVMPlacement { /** * Check if a VM can stay on its current node .
* @ param rp the reconfiguration problem .
* @ param vm the VM
* @ return { @ code true } iff the VM can stay */
public int canStay ( ReconfigurationProblem rp , VM vm ) { } }
|
Mapping m = rp . getSourceModel ( ) . getMapping ( ) ; if ( m . isRunning ( vm ) ) { Node n = m . getVMLocation ( vm ) ; int curPos = nodeMap [ n . id ( ) ] ; if ( actionMap [ vm . id ( ) ] . getDSlice ( ) . getHoster ( ) . contains ( curPos ) ) { return curPos ; } } return - 1 ;
|
public class ArrayMatrix { /** * { @ inheritDoc } */
public double [ ] getRow ( int row ) { } }
|
checkIndices ( row , 0 ) ; double [ ] rowArr = new double [ cols ] ; int index = getIndex ( row , 0 ) ; for ( int i = 0 ; i < cols ; ++ i ) rowArr [ i ] = matrix [ index ++ ] ; return rowArr ;
|
public class SwimMembershipProtocol { /** * Gossips this node ' s pending updates with the given peer .
* @ param member the peer with which to gossip this node ' s updates
* @ param updates the updated members to gossip */
private void gossip ( SwimMember member , Collection < ImmutableMember > updates ) { } }
|
LOGGER . trace ( "{} - Gossipping updates {} to {}" , localMember . id ( ) , updates , member ) ; bootstrapService . getUnicastService ( ) . unicast ( member . address ( ) , MEMBERSHIP_GOSSIP , SERIALIZER . encode ( updates ) ) ;
|
public class ArrowConverter { /** * Provide a value look up dictionary based on the
* given set of input { @ link FieldVector } s for
* reading and writing to arrow streams
* @ param vectors the vectors to use as a lookup
* @ return the associated { @ link DictionaryProvider } for the given
* input { @ link FieldVector } list */
public static DictionaryProvider providerForVectors ( List < FieldVector > vectors , List < Field > fields ) { } }
|
Dictionary [ ] dictionaries = new Dictionary [ vectors . size ( ) ] ; for ( int i = 0 ; i < vectors . size ( ) ; i ++ ) { DictionaryEncoding dictionary = fields . get ( i ) . getDictionary ( ) ; if ( dictionary == null ) { dictionary = new DictionaryEncoding ( i , true , null ) ; } dictionaries [ i ] = new Dictionary ( vectors . get ( i ) , dictionary ) ; } return new DictionaryProvider . MapDictionaryProvider ( dictionaries ) ;
|
public class ArrayTypes { /** * / * @ Nullable */
public ArrayTypeReference tryConvertToArray ( ParameterizedTypeReference typeReference ) { } }
|
ArrayTypeReference result = doTryConvertToArray ( typeReference ) ; if ( result != null ) { return result ; } else { JvmType type = typeReference . getType ( ) ; if ( type . eClass ( ) == TypesPackage . Literals . JVM_TYPE_PARAMETER ) { return doTryConvertToArray ( typeReference , new RecursionGuard < JvmTypeParameter > ( ) ) ; } } return null ;
|
public class ControlServerHandler { /** * will send no message after the FINISHED */
private void writeEvent ( final ChannelHandlerContext ctx , final Object message ) { } }
|
if ( isFinishedSent ) return ; if ( message instanceof FinishedMessage ) isFinishedSent = true ; Channels . write ( ctx , Channels . future ( null ) , message ) ;
|
public class SqlREPL { /** * HELPメッセージの表示
* @ param terminal Terminal */
private void showHelp ( final Terminal terminal ) { } }
|
showMessage ( terminal , "/message.txt" ) ; commands . stream ( ) . filter ( c -> ! c . isHidden ( ) ) . forEach ( c -> c . showHelp ( terminal ) ) ;
|
public class RestoreAgent { /** * Get the txnId of the snapshot the cluster is restoring from from ZK .
* NOTE that the barrier for this is now completely contained
* in run ( ) in the restorePlanner thread ; nobody gets out of there until
* someone wins the leader election and successfully writes the VoltZK . restore _ snapshot _ id
* node , so we just need to read it here . */
private void fetchSnapshotTxnId ( ) { } }
|
try { byte [ ] data = m_zk . getData ( VoltZK . restore_snapshot_id , false , null ) ; String jsonData = new String ( data , Constants . UTF8ENCODING ) ; if ( ! jsonData . equals ( "{}" ) ) { m_hasRestored = true ; JSONObject jo = new JSONObject ( jsonData ) ; SnapshotInfo info = new SnapshotInfo ( jo ) ; m_replayAgent . setSnapshotTxnId ( info ) ; } else { m_hasRestored = false ; m_replayAgent . setSnapshotTxnId ( null ) ; } } catch ( KeeperException e2 ) { VoltDB . crashGlobalVoltDB ( e2 . getMessage ( ) , false , e2 ) ; } catch ( InterruptedException e2 ) { } catch ( JSONException je ) { VoltDB . crashLocalVoltDB ( je . getMessage ( ) , true , je ) ; }
|
public class Value { /** * Performing a dynamic type conversion . This method is usually specialized by subclasses that know how to convert
* themselves to other types . If they fail , they delegate the conversion up to this superclass method which deals
* with the special cases : unions , type parameters , optional types , bracketed types and named types . If all these
* also fail , the method throws a runtime dynamic type check exception - though that may be caught , for example by
* the union processing , as it iterates through the types in the union given , trying to convert the value .
* @ param to
* The target type .
* @ param ctxt
* The context in which to make the conversion .
* @ return This value converted to the target type .
* @ throws AnalysisException */
public Value convertTo ( PType to , Context ctxt ) throws AnalysisException { } }
|
if ( Settings . dynamictypechecks ) { // In VDM + + and VDM - RT , we do not want to do thread swaps half way
// through a DTC check ( which can include calculating an invariant ) ,
// so we set the atomic flag around the conversion . This also stops
// VDM - RT from performing " time step " calculations .
Value converted ; try { ctxt . threadState . setAtomic ( true ) ; converted = convertValueTo ( to , ctxt ) ; } finally { ctxt . threadState . setAtomic ( false ) ; } return converted ; } else { return this ; // Good luck ! !
}
|
public class ListBackupVaultsResult { /** * An array of backup vault list members containing vault metadata , including Amazon Resource Name ( ARN ) , display
* name , creation date , number of saved recovery points , and encryption information if the resources saved in the
* backup vault are encrypted .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setBackupVaultList ( java . util . Collection ) } or { @ link # withBackupVaultList ( java . util . Collection ) } if you
* want to override the existing values .
* @ param backupVaultList
* An array of backup vault list members containing vault metadata , including Amazon Resource Name ( ARN ) ,
* display name , creation date , number of saved recovery points , and encryption information if the resources
* saved in the backup vault are encrypted .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListBackupVaultsResult withBackupVaultList ( BackupVaultListMember ... backupVaultList ) { } }
|
if ( this . backupVaultList == null ) { setBackupVaultList ( new java . util . ArrayList < BackupVaultListMember > ( backupVaultList . length ) ) ; } for ( BackupVaultListMember ele : backupVaultList ) { this . backupVaultList . add ( ele ) ; } return this ;
|
public class VerticalViewPager { /** * Fake drag by an offset in pixels . You must have called { @ link # beginFakeDrag ( ) } first .
* @ param yOffset Offset in pixels to drag by .
* @ see # beginFakeDrag ( )
* @ see # endFakeDrag ( ) */
public void fakeDragBy ( float yOffset ) { } }
|
if ( ! mFakeDragging ) { throw new IllegalStateException ( "No fake drag in progress. Call beginFakeDrag first." ) ; } mLastMotionY += yOffset ; float oldScrollY = getScrollY ( ) ; float scrollY = oldScrollY - yOffset ; final int height = getClientHeight ( ) ; float topBound = height * mFirstOffset ; float bottomBound = height * mLastOffset ; final ItemInfo firstItem = mItems . get ( 0 ) ; final ItemInfo lastItem = mItems . get ( mItems . size ( ) - 1 ) ; if ( firstItem . position != 0 ) { topBound = firstItem . offset * height ; } if ( lastItem . position != mAdapter . getCount ( ) - 1 ) { bottomBound = lastItem . offset * height ; } if ( scrollY < topBound ) { scrollY = topBound ; } else if ( scrollY > bottomBound ) { scrollY = bottomBound ; } // Don ' t lose the rounded component
mLastMotionY += scrollY - ( int ) scrollY ; scrollTo ( getScrollX ( ) , ( int ) scrollY ) ; pageScrolled ( ( int ) scrollY ) ; // Synthesize an event for the VelocityTracker .
final long time = SystemClock . uptimeMillis ( ) ; final MotionEvent ev = MotionEvent . obtain ( mFakeDragBeginTime , time , MotionEvent . ACTION_MOVE , 0 , mLastMotionY , 0 ) ; mVelocityTracker . addMovement ( ev ) ; ev . recycle ( ) ;
|
public class clusternodegroup { /** * Use this API to update clusternodegroup . */
public static base_response update ( nitro_service client , clusternodegroup resource ) throws Exception { } }
|
clusternodegroup updateresource = new clusternodegroup ( ) ; updateresource . name = resource . name ; updateresource . strict = resource . strict ; return updateresource . update_resource ( client ) ;
|
public class ValidatingDocumentBuilder { /** * Parses the given File and validates the resulting DOM . */
public Document parse ( File file ) throws SAXException , IOException { } }
|
return verify ( _WrappedBuilder . parse ( file ) ) ;
|
public class InfixParser { /** * Count how many time needle appears in haystack
* @ param haystack
* @ param needle
* @ return */
private int countOccurrences ( String haystack , char needle ) { } }
|
int count = 0 ; for ( int i = 0 ; i < haystack . length ( ) ; i ++ ) { if ( haystack . charAt ( i ) == needle ) count ++ ; } return count ;
|
public class Compiler { /** * Runs custom passes that are designated to run at a particular time . */
private void runCustomPasses ( CustomPassExecutionTime executionTime ) { } }
|
if ( options . customPasses != null ) { Tracer t = newTracer ( "runCustomPasses" ) ; try { for ( CompilerPass p : options . customPasses . get ( executionTime ) ) { process ( p ) ; } } finally { stopTracer ( t , "runCustomPasses" ) ; } }
|
public class TagContextUtils { /** * Add a { @ code Tag } of any type to a builder .
* @ param tag tag containing the key and value to set .
* @ param builder the builder to update . */
static void addTagToBuilder ( Tag tag , TagMapBuilderImpl builder ) { } }
|
builder . put ( tag . getKey ( ) , tag . getValue ( ) , tag . getTagMetadata ( ) ) ;
|
public class AudioNormalizationSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AudioNormalizationSettings audioNormalizationSettings , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( audioNormalizationSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( audioNormalizationSettings . getAlgorithm ( ) , ALGORITHM_BINDING ) ; protocolMarshaller . marshall ( audioNormalizationSettings . getAlgorithmControl ( ) , ALGORITHMCONTROL_BINDING ) ; protocolMarshaller . marshall ( audioNormalizationSettings . getCorrectionGateLevel ( ) , CORRECTIONGATELEVEL_BINDING ) ; protocolMarshaller . marshall ( audioNormalizationSettings . getLoudnessLogging ( ) , LOUDNESSLOGGING_BINDING ) ; protocolMarshaller . marshall ( audioNormalizationSettings . getPeakCalculation ( ) , PEAKCALCULATION_BINDING ) ; protocolMarshaller . marshall ( audioNormalizationSettings . getTargetLkfs ( ) , TARGETLKFS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class AbatisService { /** * 指定したSQLIDにparameterをmappingして 、 クエリする 。 結果mapをリストで返却 。
* mappingの時 、 parameterが足りない場合はnullを返す 。
* @ param sqlId
* SQLID
* @ param bindParams
* sql parameter
* @ return List < Map < String , Object > > result */
public List < Map < String , Object > > executeForMapList ( int sqlId , Map < String , ? extends Object > bindParams ) { } }
|
String sql = context . getResources ( ) . getString ( sqlId ) ; return executeForMapList ( sql , bindParams ) ;
|
public class LayerControlPanelPresenterImpl { @ Override public void toggleLayerVisibility ( ) { } }
|
log . log ( Level . INFO , "toggleLayerVisibility()" ) ; layer . setMarkedAsVisible ( ! layer . isMarkedAsVisible ( ) ) ;
|
public class StreamScanner { /** * Note : does not check for number of colons , amongst other things .
* Main idea is to skip through what superficially seems like a valid
* id , nothing more . This is only done when really skipping through
* something we do not care about at all : not even whether names / ids
* would be valid ( for example , when ignoring internal DTD subset ) .
* @ return Length of skipped name . */
protected int skipFullName ( char c ) throws XMLStreamException { } }
|
if ( ! isNameStartChar ( c ) ) { -- mInputPtr ; return 0 ; } /* After which there may be zero or more name chars
* we have to consider */
int count = 1 ; while ( true ) { c = ( mInputPtr < mInputEnd ) ? mInputBuffer [ mInputPtr ++ ] : getNextChar ( SUFFIX_EOF_EXP_NAME ) ; if ( c != ':' && ! isNameChar ( c ) ) { break ; } ++ count ; } return count ;
|
public class TaskClient { /** * Removes a task from a taskType queue
* @ param taskType the taskType to identify the queue
* @ param taskId the id of the task to be removed */
public void removeTaskFromQueue ( String taskType , String taskId ) { } }
|
Preconditions . checkArgument ( StringUtils . isNotBlank ( taskType ) , "Task type cannot be blank" ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( taskId ) , "Task id cannot be blank" ) ; delete ( "tasks/queue/{taskType}/{taskId}" , taskType , taskId ) ;
|
public class Rechnungsmonat { /** * Hiermit kann der Rechnungsmonats im gewuenschten Format ausgegeben
* werden . Als Parameter sind die gleichen Patterns wie beim
* { @ link DateTimeFormatter # ofPattern ( String , Locale ) } bzw .
* { @ link java . text . SimpleDateFormat } moeglich .
* @ param pattern z . B . " MM / yyyy "
* @ param locale gewuenschte Locale
* @ return z . B . " 07/2017" */
public String format ( String pattern , Locale locale ) { } }
|
DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( pattern , locale ) ; return asLocalDate ( ) . format ( formatter ) ;
|
public class CommonOps_DDF4 { /** * < p > Performs an element by element multiplication operation : < br >
* < br >
* c < sub > ij < / sub > = a < sub > ij < / sub > * b < sub > ij < / sub > < br >
* @ param a The left matrix in the multiplication operation . Not modified .
* @ param b The right matrix in the multiplication operation . Not modified .
* @ param c Where the results of the operation are stored . Modified . */
public static void elementMult ( DMatrix4x4 a , DMatrix4x4 b , DMatrix4x4 c ) { } }
|
c . a11 = a . a11 * b . a11 ; c . a12 = a . a12 * b . a12 ; c . a13 = a . a13 * b . a13 ; c . a14 = a . a14 * b . a14 ; c . a21 = a . a21 * b . a21 ; c . a22 = a . a22 * b . a22 ; c . a23 = a . a23 * b . a23 ; c . a24 = a . a24 * b . a24 ; c . a31 = a . a31 * b . a31 ; c . a32 = a . a32 * b . a32 ; c . a33 = a . a33 * b . a33 ; c . a34 = a . a34 * b . a34 ; c . a41 = a . a41 * b . a41 ; c . a42 = a . a42 * b . a42 ; c . a43 = a . a43 * b . a43 ; c . a44 = a . a44 * b . a44 ;
|
public class Sudoku { /** * ( non - Javadoc )
* @ see org . kie . examples . sudoku . swing . SudokuGridModel # setCellValues ( java . lang . Integer [ ] [ ] ) */
public void setCellValues ( Integer [ ] [ ] cellValues ) { } }
|
if ( session != null ) { session . removeEventListener ( workingMemoryListener ) ; session . dispose ( ) ; steppingFactHandle = null ; } this . session = kc . newKieSession ( "SudokuKS" ) ; session . setGlobal ( "explain" , explain ) ; session . addEventListener ( workingMemoryListener ) ; Setting s000 = new Setting ( 0 , 0 , 0 ) ; FactHandle fh000 = this . session . insert ( s000 ) ; this . create ( ) ; int initial = 0 ; for ( int iRow = 0 ; iRow < 9 ; iRow ++ ) { for ( int iCol = 0 ; iCol < 9 ; iCol ++ ) { Integer value = cellValues [ iRow ] [ iCol ] ; if ( value != null ) { session . insert ( new Setting ( iRow , iCol , value ) ) ; initial ++ ; } } } this . counter = new Counter ( initial ) ; this . session . insert ( counter ) ; this . session . delete ( fh000 ) ; this . session . fireAllRules ( ) ;
|
public class ParentsRenderer { /** * This method is public for testing purposes only . Do not try to call it
* outside of the context of the rendering engine .
* @ param builder Buffer for holding the rendition
* @ param pad Minimum number spaces for padding each line of the output
* @ param father Father */
public void renderFather ( final StringBuilder builder , final int pad , final Person father ) { } }
|
renderParent ( builder , pad , father , "Father" ) ;
|
public class GlobalForwardingRuleClient { /** * Deletes the specified GlobalForwardingRule resource .
* < p > Sample code :
* < pre > < code >
* try ( GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient . create ( ) ) {
* ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName . of ( " [ PROJECT ] " , " [ FORWARDING _ RULE ] " ) ;
* Operation response = globalForwardingRuleClient . deleteGlobalForwardingRule ( forwardingRule ) ;
* < / code > < / pre >
* @ param forwardingRule Name of the ForwardingRule resource to delete .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation deleteGlobalForwardingRule ( ProjectGlobalForwardingRuleName forwardingRule ) { } }
|
DeleteGlobalForwardingRuleHttpRequest request = DeleteGlobalForwardingRuleHttpRequest . newBuilder ( ) . setForwardingRule ( forwardingRule == null ? null : forwardingRule . toString ( ) ) . build ( ) ; return deleteGlobalForwardingRule ( request ) ;
|
public class SaneSession { /** * Establishes a connection to the SANE daemon running on the given host on the default SANE port
* with the given connection timeout . */
public static SaneSession withRemoteSane ( InetAddress saneAddress , long timeout , TimeUnit timeUnit ) throws IOException { } }
|
return withRemoteSane ( saneAddress , DEFAULT_PORT , timeout , timeUnit , 0 , TimeUnit . MILLISECONDS ) ;
|
public class InjectorImpl { /** * Create a provider based on registered auto - binders . */
private < T > Provider < T > autoProvider ( Key < T > key ) { } }
|
for ( InjectAutoBind autoBind : _autoBind ) { Provider < T > provider = autoBind . provider ( this , key ) ; if ( provider != null ) { return provider ; } } return providerDefault ( key ) ;
|
public class CryptoUtil { /** * 使用AES加密原始字符串 .
* @ param input 原始输入字符数组
* @ param key 符合AES要求的密钥
* @ param iv 初始向量 */
public static byte [ ] aesEncrypt ( byte [ ] input , byte [ ] key , byte [ ] iv ) { } }
|
return aes ( input , key , iv , Cipher . ENCRYPT_MODE ) ;
|
public class TextProcessorChain { /** * Process the text
* @ param source the sourcetext
* @ return the result of text processing
* @ see TextProcessor # process ( CharSequence ) */
public CharSequence process ( CharSequence source ) { } }
|
CharSequence target = source ; for ( TextProcessor processor : processors ) { target = processor . process ( target ) ; } return target ;
|
public class StandardResponsesApi { /** * Get the details of a Standard Response .
* @ param id id of the Standard Response ( required )
* @ param getStandardResponseData ( required )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiSuccessResponse getStandardResponse ( String id , GetStandardResponseData getStandardResponseData ) throws ApiException { } }
|
ApiResponse < ApiSuccessResponse > resp = getStandardResponseWithHttpInfo ( id , getStandardResponseData ) ; return resp . getData ( ) ;
|
public class ArrayUtils { /** * Divides the given object - array using the boundaries in < code > cuts < / code > .
* < br >
* Cuts are interpreted in an inclusive way , which means that a single cut
* at position i divides the given array in 0 . . . i - 1 + i . . . n < br >
* This method deals with both cut positions including and excluding start
* and end - indexes < br >
* @ param < T >
* Object array type .
* @ param arr
* Array to divide
* @ param cuts
* Cut positions for divide operations
* @ return A list of subarrays of < code > arr < / code > according to the given
* cut positions
* @ see # divideArray ( Object [ ] , Integer [ ] ) */
public static < T > List < T [ ] > divideObjectArray ( T [ ] arr , Integer ... cuts ) { } }
|
return divideArray ( arr , cuts ) ;
|
public class SQLExpressions { /** * divides an ordered data set into a number of buckets indicated by expr and assigns the
* appropriate bucket number to each row
* @ param num bucket size
* @ return ntile ( num ) */
@ SuppressWarnings ( "unchecked" ) public static < T extends Number & Comparable > WindowOver < T > ntile ( T num ) { } }
|
return new WindowOver < T > ( ( Class < T > ) num . getClass ( ) , SQLOps . NTILE , ConstantImpl . create ( num ) ) ;
|
public class JirmUrlEncodedUtils { /** * Returns a String that is suitable for use as an < code > application / x - www - form - urlencoded < / code >
* list of parameters in an HTTP PUT or HTTP POST .
* @ param parameters The parameters to include .
* @ param encoding The encoding to use . */
public static String format ( final List < ? extends NameValuePair > parameters , final String encoding ) { } }
|
final StringBuilder result = new StringBuilder ( ) ; for ( final NameValuePair parameter : parameters ) { final String encodedName = encode ( parameter . getName ( ) , encoding ) ; final String value = parameter . getValue ( ) ; final String encodedValue = value != null ? encode ( value , encoding ) : "" ; if ( result . length ( ) > 0 ) result . append ( PARAMETER_SEPARATOR ) ; result . append ( encodedName ) ; result . append ( NAME_VALUE_SEPARATOR ) ; result . append ( encodedValue ) ; } return result . toString ( ) ;
|
public class ForestDBStore { /** * TODO return value from long to Status */
@ Override public long setInfo ( String key , String info ) { } }
|
final String k = key ; final String i = info ; try { Status status = inTransaction ( new Task ( ) { @ Override public Status run ( ) { try { forest . rawPut ( "info" , k , null , i == null ? null : i . getBytes ( ) ) ; return new Status ( Status . OK ) ; } catch ( ForestException e ) { Log . e ( TAG , "Error in KeyStoreWriter.set()" , e ) ; return ForestBridge . err2status ( e ) ; } } } ) ; return status . getCode ( ) ; } catch ( Exception e ) { Log . e ( TAG , "Exception in setInfo()" , e ) ; return Status . UNKNOWN ; }
|
public class Router { /** * Specify a middleware that will be called for a matching HTTP PUT
* @ param pattern The simple pattern
* @ param handlers The middleware to call */
public Router put ( @ NotNull final String pattern , @ NotNull final IMiddleware ... handlers ) { } }
|
addPattern ( "PUT" , pattern , handlers , putBindings ) ; return this ;
|
public class DirectPDPClient { /** * ( non - Javadoc )
* @ see org . fcrepo . server . security . xacml . pep . PEPClient # evaluate ( java . lang . String ) */
@ Override public String evaluate ( String request ) throws PEPException { } }
|
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Resolving String request:\n" + request ) ; } String response = null ; try { response = this . client . evaluate ( request ) ; } catch ( Exception e ) { logger . error ( "Error evaluating request." , e ) ; throw new PEPException ( "Error evaluating request" , e ) ; } return response ;
|
public class TCPInputPoller { /** * Immediately stop waiting for messages , and close the SocketServer . */
public void stopServer ( ) { } }
|
Log ( Level . INFO , "Attempting to stop SocketServer" ) ; keepRunning = false ; // Thread will be blocked waiting for input - unblock it by closing the socket underneath it :
if ( this . serverSocket != null ) { try { this . serverSocket . close ( ) ; } catch ( IOException e ) { Log ( Level . WARNING , "Something happened when closing SocketServer: " + e ) ; } this . serverSocket = null ; }
|
public class ConfigurationCredentialsPolicy { /** * Adds the required headers to authenticate a request to Azure Application Configuration service .
* @ param context The request context
* @ param next The next HTTP pipeline policy to process the { @ code context ' s } request after this policy completes .
* @ return A { @ link Mono } representing the HTTP response that will arrive asynchronously . */
@ Override public Mono < HttpResponse > process ( HttpPipelineCallContext context , HttpPipelineNextPolicy next ) { } }
|
final Flux < ByteBuf > contents = context . httpRequest ( ) . body ( ) == null ? Flux . just ( getEmptyBuffer ( ) ) : context . httpRequest ( ) . body ( ) ; return contents . defaultIfEmpty ( getEmptyBuffer ( ) ) . collect ( ( ) -> { try { return MessageDigest . getInstance ( "SHA-256" ) ; } catch ( NoSuchAlgorithmException e ) { throw Exceptions . propagate ( e ) ; } } , ( messageDigest , byteBuffer ) -> { if ( messageDigest != null ) { messageDigest . update ( byteBuffer . nioBuffer ( ) ) ; } } ) . flatMap ( messageDigest -> { final HttpHeaders headers = context . httpRequest ( ) . headers ( ) ; final String contentHash = Base64 . getEncoder ( ) . encodeToString ( messageDigest . digest ( ) ) ; // All three of these headers are used by ConfigurationClientCredentials to generate the
// Authentication header value . So , we need to ensure that they exist .
headers . set ( HOST_HEADER , context . httpRequest ( ) . url ( ) . getHost ( ) ) ; headers . set ( CONTENT_HASH_HEADER , contentHash ) ; if ( headers . value ( DATE_HEADER ) == null ) { String utcNow = OffsetDateTime . now ( ZoneOffset . UTC ) . format ( DateTimeFormatter . RFC_1123_DATE_TIME ) ; headers . set ( DATE_HEADER , utcNow ) ; } return next . process ( ) ; } ) ;
|
public class SoundStore { /** * Find a free sound source
* @ return The index of the free sound source */
private int findFreeSource ( ) { } }
|
for ( int i = 1 ; i < sourceCount - 1 ; i ++ ) { int state = AL10 . alGetSourcei ( sources . get ( i ) , AL10 . AL_SOURCE_STATE ) ; if ( ( state != AL10 . AL_PLAYING ) && ( state != AL10 . AL_PAUSED ) ) { return i ; } } return - 1 ;
|
public class LineSearchFletcher86 { /** * Use either quadratic of cubic interpolation to guess the minimum . */
protected double interpolate ( double boundA , double boundB ) { } }
|
double alphaNew ; // interpolate minimum for rapid convergence
if ( Double . isNaN ( gp ) ) { alphaNew = SearchInterpolate . quadratic ( fprev , gprev , stprev , fp , stp ) ; } else { alphaNew = SearchInterpolate . cubic2 ( fprev , gprev , stprev , fp , gp , stp ) ; if ( Double . isNaN ( alphaNew ) ) alphaNew = SearchInterpolate . quadratic ( fprev , gprev , stprev , fp , stp ) ; } // order the bound
double l , u ; if ( boundA < boundB ) { l = boundA ; u = boundB ; } else { l = boundB ; u = boundA ; } // enforce min / max allowed values
if ( alphaNew < l ) alphaNew = l ; else if ( alphaNew > u ) alphaNew = u ; return alphaNew ;
|
public class JsSrcMain { /** * Generates JS source code given a Soy parse tree , an options object , and an optional bundle of
* translated messages .
* @ param soyTree The Soy parse tree to generate JS source code for .
* @ param templateRegistry The template registry that contains all the template information .
* @ param jsSrcOptions The compilation options relevant to this backend .
* @ param msgBundle The bundle of translated messages , or null to use the messages from the Soy
* source .
* @ param errorReporter The Soy error reporter that collects errors during code generation .
* @ return A list of strings where each string represents the JS source code that belongs in one
* JS file . The generated JS files correspond one - to - one to the original Soy source files . */
public List < String > genJsSrc ( SoyFileSetNode soyTree , TemplateRegistry templateRegistry , SoyJsSrcOptions jsSrcOptions , @ Nullable SoyMsgBundle msgBundle , ErrorReporter errorReporter ) { } }
|
// VeLogInstrumentationVisitor add html attributes for { velog } commands and also run desugaring
// pass since code generator does not understand html nodes ( yet ) .
new VeLogInstrumentationVisitor ( templateRegistry ) . exec ( soyTree ) ; BidiGlobalDir bidiGlobalDir = SoyBidiUtils . decodeBidiGlobalDirFromJsOptions ( jsSrcOptions . getBidiGlobalDir ( ) , jsSrcOptions . getUseGoogIsRtlForBidiGlobalDir ( ) ) ; try ( SoyScopedData . InScope inScope = apiCallScope . enter ( msgBundle , bidiGlobalDir ) ) { // Replace MsgNodes .
if ( jsSrcOptions . shouldGenerateGoogMsgDefs ( ) ) { Preconditions . checkState ( bidiGlobalDir != null , "If enabling shouldGenerateGoogMsgDefs, must also set bidi global directionality." ) ; } else { Preconditions . checkState ( bidiGlobalDir == null || bidiGlobalDir . isStaticValue ( ) , "If using bidiGlobalIsRtlCodeSnippet, must also enable shouldGenerateGoogMsgDefs." ) ; new InsertMsgsVisitor ( msgBundle , errorReporter ) . insertMsgs ( soyTree ) ; } // Combine raw text nodes before codegen .
new CombineConsecutiveRawTextNodesPass ( ) . run ( soyTree ) ; return createVisitor ( jsSrcOptions , typeRegistry , inScope . getBidiGlobalDir ( ) , errorReporter ) . gen ( soyTree , templateRegistry , errorReporter ) ; }
|
public class InitialRequestDispatcher { /** * Dispatch a request inside the container based on the information returned by the AR
* @ param sipProvider the sip Provider on which the request has been received
* @ param applicationRouterInfo information returned by the AR
* @ param sipServletRequest the request to dispatch
* @ param sipFactoryImpl the sip factory
* @ param joinReplacesSipSession the potential corresponding Join / Replaces SipSession previously found , can be null
* @ throws DispatcherException a problem occured while dispatching the request */
private void dispatchInsideContainer ( final SipProvider sipProvider , final SipApplicationRouterInfo applicationRouterInfo , final SipServletRequestImpl sipServletRequest , final MobicentsSipFactory sipFactoryImpl , MobicentsSipSession joinReplacesSipSession , MobicentsSipApplicationSession encodeURISipApplicationSession ) throws DispatcherException { } }
|
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "dispatchInsideContainer - sipProvider=" + sipProvider + ", applicationRouterInfo=" + applicationRouterInfo + ", joinReplacesSipSession=" + joinReplacesSipSession + ", sipServletRequest=" + sipServletRequest + ", sipFactoryImpl=" + sipFactoryImpl + ", encodeURISipApplicationSession=" + encodeURISipApplicationSession ) ; if ( joinReplacesSipSession != null ) { logger . debug ( "dispatchInsideContainer - joinReplacesSipSession.getCallId()=" + joinReplacesSipSession . getCallId ( ) + ", joinReplacesSipSession.getId()=" + joinReplacesSipSession . getId ( ) + ", joinReplacesSipSession.getKey()=" + joinReplacesSipSession . getKey ( ) + ", joinReplacesSipSession.getApplicationSession()=" + joinReplacesSipSession . getApplicationSession ( ) + ", joinReplacesSipSession.getSipApplicationSession()=" + joinReplacesSipSession . getSipApplicationSession ( ) ) ; if ( joinReplacesSipSession . getSipApplicationSession ( ) != null ) { logger . debug ( "dispatchInsideContainer - joinReplacesSipSession.getSipApplicationSession().getId()=" + joinReplacesSipSession . getSipApplicationSession ( ) . getId ( ) + ", joinReplacesSipSession.getSipApplicationSession().getKey()=" + joinReplacesSipSession . getSipApplicationSession ( ) . getKey ( ) ) ; } } } final String nextApplicationName = applicationRouterInfo . getNextApplicationName ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Dispatching the request event to " + nextApplicationName ) ; } final Request request = ( Request ) sipServletRequest . getMessage ( ) ; sipServletRequest . setCurrentApplicationName ( nextApplicationName ) ; final SipContext sipContext = sipApplicationDispatcher . findSipApplication ( nextApplicationName ) ; // follow the procedures of Chapter 16 to select a servlet from the application .
// no matching deployed apps
if ( sipContext == null ) { // the app returned by the Application Router returned an app
// that is not currently deployed , sends a 500 error response as was discussed
// in the JSR 289 EG , ( for reference thread " Questions regarding AR " initiated by Uri Segev )
// and stops processing .
throw new DispatcherException ( Response . SERVER_INTERNAL_ERROR , "No matching deployed application has been found !" ) ; } final SipManager sipManager = sipContext . getSipManager ( ) ; // subscriber URI should be set before calling makeAppSessionKey method , see Issue 750
// http : / / code . google . com / p / mobicents / issues / detail ? id = 750
if ( applicationRouterInfo . getSubscriberURI ( ) != null ) { // https : / / github . com / Mobicents / sip - servlets / issues / 49 NullPointerException if the approuter returns a subscriberUri is null
try { URI subscriberUri = SipFactoryImpl . addressFactory . createAddress ( applicationRouterInfo . getSubscriberURI ( ) ) . getURI ( ) ; javax . servlet . sip . URI jainSipSubscriberUri = null ; if ( subscriberUri instanceof javax . sip . address . SipURI ) { jainSipSubscriberUri = new SipURIImpl ( ( javax . sip . address . SipURI ) subscriberUri , ModifiableRule . NotModifiable ) ; } else if ( subscriberUri instanceof javax . sip . address . TelURL ) { jainSipSubscriberUri = new TelURLImpl ( ( javax . sip . address . TelURL ) subscriberUri ) ; } else { jainSipSubscriberUri = new GenericURIImpl ( subscriberUri ) ; } sipServletRequest . setSubscriberURI ( jainSipSubscriberUri ) ; } catch ( ParseException pe ) { throw new DispatcherException ( Response . SERVER_INTERNAL_ERROR , "Impossible to parse the subscriber URI returned by the Application Router " + applicationRouterInfo . getSubscriberURI ( ) + ", please put one of DAR:<HeaderName> with Header containing a valid URI or an exlicit valid URI " , pe ) ; } } MobicentsSipApplicationSession sipApplicationSession = encodeURISipApplicationSession ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "the encoded URI Sip Application Session is " + sipApplicationSession ) ; } if ( joinReplacesSipSession != null && nextApplicationName . equals ( joinReplacesSipSession . getKey ( ) . getApplicationName ( ) ) ) { // 15.11.4.5 . If the Application Router returns an application name that matches the application name found in step 15.11.4.2,
// then the container must create a SipSession object and associate it with the SipApplicationSession identified in step 2.
final JoinHeader joinHeader = ( JoinHeader ) request . getHeader ( JoinHeader . NAME ) ; final ReplacesHeader replacesHeader = ( ReplacesHeader ) request . getHeader ( ReplacesHeader . NAME ) ; String headerName = null ; if ( joinHeader != null ) { headerName = JoinHeader . NAME ; } else if ( replacesHeader != null ) { headerName = ReplacesHeader . NAME ; } sipApplicationSession = joinReplacesSipSession . getSipApplicationSession ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Reusing the application session from the Join/Replaces " + sipApplicationSession . getId ( ) ) ; } SipApplicationSessionKey sipApplicationSessionKey = makeAppSessionKey ( sipContext , sipServletRequest , nextApplicationName ) ; sipContext . getSipSessionsUtil ( ) . addCorrespondingSipApplicationSession ( sipApplicationSessionKey , sipApplicationSession . getKey ( ) , headerName ) ; } else if ( sipApplicationSession == null ) { // 15.11.4.6 . If the Application Router returns an application name that does not match the application name found in step 15.11.4.2,
// then the container invokes the application using its normal procedure , creating a new SipSession and SipApplicationSession .
SipApplicationSessionKey sipApplicationSessionKey = makeAppSessionKey ( sipContext , sipServletRequest , nextApplicationName ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "dispatchInsideContainer - newly created sipApplicationSessionKey.getId()=" + sipApplicationSessionKey . getId ( ) + ", sipApplicationSessionKey.getAppGeneratedKey()" + sipApplicationSessionKey . getAppGeneratedKey ( ) + ", sipApplicationSessionKey.getApplicationName()" + sipApplicationSessionKey . getApplicationName ( ) ) ; } sipApplicationSession = sipManager . getSipApplicationSession ( sipApplicationSessionKey , true ) ; if ( StaticServiceHolder . sipStandardService . isHttpFollowsSip ( ) ) { String jvmRoute = StaticServiceHolder . sipStandardService . getJvmRoute ( ) ; if ( jvmRoute != null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "dispatchInsideContainer - setting jvmRoute to " + jvmRoute ) ; } sipApplicationSession . setJvmRoute ( jvmRoute ) ; } } } // sip application session association
final MobicentsSipApplicationSession appSession = sipApplicationSession ; // sip session association
final SipSessionKey sessionKey = SessionManagerUtil . getSipSessionKey ( appSession . getKey ( ) . getId ( ) , nextApplicationName , request , false ) ; final MobicentsSipSession sipSessionImpl = sipManager . getSipSession ( sessionKey , true , sipFactoryImpl , appSession ) ; sipServletRequest . setSipSession ( sipSessionImpl ) ; if ( joinReplacesSipSession != null && nextApplicationName . equals ( joinReplacesSipSession . getKey ( ) . getApplicationName ( ) ) ) { final JoinHeader joinHeader = ( JoinHeader ) request . getHeader ( JoinHeader . NAME ) ; final ReplacesHeader replacesHeader = ( ReplacesHeader ) request . getHeader ( ReplacesHeader . NAME ) ; String headerName = null ; if ( joinHeader != null ) { headerName = JoinHeader . NAME ; } else if ( replacesHeader != null ) { headerName = ReplacesHeader . NAME ; } // 15.11.4.5 . If the Application Router returns an application name that matches the application name found in step 15.11.4.2,
// then the container must create a SipSession object and associate it with the SipApplicationSession identified in step 2.
// The association of this newly created SipSession with the one found in step 15.11.4.2 is made available to the application
// through the SipSessionsUtil . getCorrespondingSipSession ( SipSession session , String headerName ) method .
sipContext . getSipSessionsUtil ( ) . addCorrespondingSipSession ( sipSessionImpl , joinReplacesSipSession , headerName ) ; } // set the request ' s stateInfo to result . getStateInfo ( ) , region to result . getRegion ( ) , and URI to result . getSubscriberURI ( ) .
sipSessionImpl . setStateInfo ( applicationRouterInfo . getStateInfo ( ) ) ; sipSessionImpl . setRoutingRegion ( applicationRouterInfo . getRoutingRegion ( ) ) ; sipServletRequest . setRoutingRegion ( applicationRouterInfo . getRoutingRegion ( ) ) ; if ( sipServletRequest . getSubscriberURI ( ) != null ) { // https : / / github . com / Mobicents / sip - servlets / issues / 49 NullPointerException if the approuter returns a subscriberUri is null
sipSessionImpl . setSipSubscriberURI ( sipServletRequest . getSubscriberURI ( ) . toString ( ) ) ; } final long cSeq = ( ( CSeqHeader ) request . getHeader ( CSeqHeader . NAME ) ) . getSeqNumber ( ) ; sipSessionImpl . setCseq ( cSeq ) ; if ( request . getMethod ( ) . equals ( Request . INVITE ) ) { sipSessionImpl . setRequestsPending ( sipSessionImpl . getRequestsPending ( ) + 1 ) ; sipSessionImpl . setAckReceived ( cSeq , false ) ; } final InitialDispatchTask dispatchTask = new InitialDispatchTask ( sipServletRequest , sipProvider ) ; // we enter the sip app here , thus acuiring the semaphore on the session ( if concurrency control is set ) before the jain sip tx semaphore is released and ensuring that
// the tx serialization is preserved
sipContext . enterSipApp ( sipApplicationSession , sipSessionImpl , false , true ) ; // The fastest way to figure out the transport is the mandatory Via transport header
ViaHeader via = ( ViaHeader ) request . getHeader ( ViaHeader . NAME ) ; sipSessionImpl . setTransport ( via . getTransport ( ) ) ; handleSipOutbound ( sipServletRequest ) ; // if the flag is set we bypass the executor . This flag should be made deprecated
if ( sipApplicationDispatcher . isBypassRequestExecutor ( ) || ConcurrencyControlMode . Transaction . equals ( ( sipContext . getConcurrencyControlMode ( ) ) ) ) { dispatchTask . dispatchAndHandleExceptions ( ) ; } else { getConcurrencyModelExecutorService ( sipContext , sipServletRequest ) . execute ( dispatchTask ) ; }
|
public class RSAKeySecret { /** * Creates a private key from the PKCS # 8 - encoded value of the given bytes .
* @ param privateKey The PKCS # 8 - encoded private key bytes .
* @ return The private key . */
public static PrivateKey createPrivateKey ( byte [ ] privateKey ) { } }
|
if ( privateKey == null ) { return null ; } try { KeyFactory fac = KeyFactory . getInstance ( "RSA" ) ; EncodedKeySpec spec = new PKCS8EncodedKeySpec ( privateKey ) ; return fac . generatePrivate ( spec ) ; } catch ( NoSuchAlgorithmException e ) { throw new IllegalStateException ( e ) ; } catch ( InvalidKeySpecException e ) { throw new IllegalStateException ( e ) ; }
|
public class ApiOvhIp { /** * Release the ip from anti - spam system
* REST : POST / ip / { ip } / spam / { ipSpamming } / unblock
* @ param ip [ required ]
* @ param ipSpamming [ required ] IP address which is sending spam */
public OvhSpamIp ip_spam_ipSpamming_unblock_POST ( String ip , String ipSpamming ) throws IOException { } }
|
String qPath = "/ip/{ip}/spam/{ipSpamming}/unblock" ; StringBuilder sb = path ( qPath , ip , ipSpamming ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhSpamIp . class ) ;
|
public class Context { /** * control flow */
public void bootstrap ( String className , Closure rootSpec ) { } }
|
assertNonNull ( "className" , className ) ; assertNonNull ( "rootSpec" , rootSpec ) ; changeStatus ( NOT_STARTED , RUNNING ) ; enterRootSpec ( className ) ; processSpec ( rootSpec ) ; exitSpec ( ) ; changeStatus ( RUNNING , FINISHED ) ;
|
public class KnowledgePackageImpl { /** * Rule flows can be removed by ID . */
public void removeRuleFlow ( String id ) { } }
|
ProcessPackage rtp = ( ProcessPackage ) getResourceTypePackages ( ) . get ( ResourceType . BPMN2 ) ; if ( rtp == null || rtp . lookup ( id ) == null ) { throw new IllegalArgumentException ( "The rule flow with id [" + id + "] is not part of this package." ) ; } rtp . remove ( id ) ;
|
public class XMLUpdateShredder { /** * Process start tag .
* @ param paramElem
* { @ link StartElement } currently parsed .
* @ throws XMLStreamException
* In case of any StAX parsing error .
* @ throws IOException
* In case of any I / O error .
* @ throws TTException
* In case of any Treetank error . */
private void processStartTag ( final StartElement paramElem ) throws IOException , XMLStreamException , TTException { } }
|
assert paramElem != null ; // Initialize variables .
initializeVars ( ) ; // Main algorithm to determine if same , insert or a delete has to be
// made .
algorithm ( paramElem ) ; if ( mFound && mIsRightSibling ) { mDelete = EDelete . ATSTARTMIDDLE ; deleteNode ( ) ; } else if ( ! mFound ) { // Increment levels .
mLevelInToShredder ++ ; insertElementNode ( paramElem ) ; } else if ( mFound ) { // Increment levels .
mLevelInToShredder ++ ; sameElementNode ( ) ; }
|
public class JobInProgress { /** * A taskid assigned to this JobInProgress has reported in successfully . */
public synchronized boolean completedTask ( TaskInProgress tip , TaskStatus status ) { } }
|
TaskAttemptID taskid = status . getTaskID ( ) ; int oldNumAttempts = tip . getActiveTasks ( ) . size ( ) ; final JobTrackerInstrumentation metrics = jobtracker . getInstrumentation ( ) ; // Metering
meterTaskAttempt ( tip , status ) ; // Sanity check : is the TIP already complete ?
// It _ is _ safe to not decrement running { Map | Reduce } Tasks and
// finished { Map | Reduce } Tasks variables here because one and only
// one task - attempt of a TIP gets to completedTask . This is because
// the TaskCommitThread in the JobTracker marks other , completed ,
// speculative tasks as _ complete _ .
if ( tip . isComplete ( ) ) { // Mark this task as KILLED
tip . alreadyCompletedTask ( taskid ) ; // Let the JobTracker cleanup this taskid if the job isn ' t running
if ( this . status . getRunState ( ) != JobStatus . RUNNING ) { jobtracker . markCompletedTaskAttempt ( status . getTaskTracker ( ) , taskid ) ; } return false ; } LOG . info ( "Task '" + taskid + "' has completed " + tip . getTIPId ( ) + " successfully." ) ; // Mark the TIP as complete
tip . completed ( taskid ) ; resourceEstimator . updateWithCompletedTask ( status , tip ) ; // Update jobhistory
TaskTrackerStatus ttStatus = this . jobtracker . getTaskTrackerStatus ( status . getTaskTracker ( ) ) ; String trackerHostname = jobtracker . getNode ( ttStatus . getHost ( ) ) . toString ( ) ; String taskType = getTaskType ( tip ) ; if ( status . getIsMap ( ) ) { JobHistory . MapAttempt . logStarted ( status . getTaskID ( ) , status . getStartTime ( ) , status . getTaskTracker ( ) , ttStatus . getHttpPort ( ) , taskType ) ; JobHistory . MapAttempt . logFinished ( status . getTaskID ( ) , status . getFinishTime ( ) , trackerHostname , taskType , status . getStateString ( ) , status . getCounters ( ) ) ; } else { JobHistory . ReduceAttempt . logStarted ( status . getTaskID ( ) , status . getStartTime ( ) , status . getTaskTracker ( ) , ttStatus . getHttpPort ( ) , taskType ) ; JobHistory . ReduceAttempt . logFinished ( status . getTaskID ( ) , status . getShuffleFinishTime ( ) , status . getSortFinishTime ( ) , status . getFinishTime ( ) , trackerHostname , taskType , status . getStateString ( ) , status . getCounters ( ) ) ; } JobHistory . Task . logFinished ( tip . getTIPId ( ) , taskType , tip . getExecFinishTime ( ) , status . getCounters ( ) ) ; int newNumAttempts = tip . getActiveTasks ( ) . size ( ) ; if ( tip . isJobSetupTask ( ) ) { // setup task has finished . kill the extra setup tip
killSetupTip ( ! tip . isMapTask ( ) ) ; setupComplete ( ) ; } else if ( tip . isJobCleanupTask ( ) ) { // cleanup task has finished . Kill the extra cleanup tip
if ( tip . isMapTask ( ) ) { // kill the reduce tip
cleanup [ 1 ] . kill ( ) ; } else { cleanup [ 0 ] . kill ( ) ; } // The Job is done
// if the job is failed , then mark the job failed .
if ( jobFailed ) { terminateJob ( JobStatus . FAILED ) ; } // if the job is killed , then mark the job killed .
if ( jobKilled ) { terminateJob ( JobStatus . KILLED ) ; } else { jobComplete ( ) ; } // The job has been killed / failed / successful
// JobTracker should cleanup this task
jobtracker . markCompletedTaskAttempt ( status . getTaskTracker ( ) , taskid ) ; } else if ( tip . isMapTask ( ) ) { // check if this was a sepculative task
if ( oldNumAttempts > 1 ) { speculativeMapTasks -= ( oldNumAttempts - newNumAttempts ) ; if ( ! garbageCollected ) { totalSpeculativeMapTasks . addAndGet ( newNumAttempts - oldNumAttempts ) ; } } if ( tip . isSpeculativeAttempt ( taskid ) ) { metrics . speculativeSucceededMap ( taskid , tip . isUsingProcessingRateForSpeculation ( ) ) ; } int level = getLocalityLevel ( tip , ttStatus ) ; long inputBytes = tip . getCounters ( ) . getGroup ( "org.apache.hadoop.mapred.Task$Counter" ) . getCounter ( "Map input bytes" ) ; switch ( level ) { case 0 : jobCounters . incrCounter ( Counter . LOCAL_MAP_INPUT_BYTES , inputBytes ) ; metrics . addLocalMapInputBytes ( inputBytes ) ; break ; case 1 : jobCounters . incrCounter ( Counter . RACK_MAP_INPUT_BYTES , inputBytes ) ; metrics . addRackMapInputBytes ( inputBytes ) ; break ; default : metrics . addMapInputBytes ( inputBytes ) ; break ; } finishedMapTasks += 1 ; metrics . completeMap ( taskid ) ; if ( ! garbageCollected ) { if ( ! tip . isJobSetupTask ( ) && hasSpeculativeMaps ) { updateTaskTrackerStats ( tip , ttStatus , trackerMapStats , mapTaskStats ) ; } } // remove the completed map from the resp running caches
retireMap ( tip ) ; if ( ( finishedMapTasks + failedMapTIPs ) == ( numMapTasks ) ) { this . status . setMapProgress ( 1.0f ) ; } } else { if ( oldNumAttempts > 1 ) { speculativeReduceTasks -= ( oldNumAttempts - newNumAttempts ) ; if ( ! garbageCollected ) { totalSpeculativeReduceTasks . addAndGet ( newNumAttempts - oldNumAttempts ) ; } } if ( tip . isSpeculativeAttempt ( taskid ) ) { metrics . speculativeSucceededReduce ( taskid , tip . isUsingProcessingRateForSpeculation ( ) ) ; } finishedReduceTasks += 1 ; metrics . completeReduce ( taskid ) ; if ( ! garbageCollected ) { if ( ! tip . isJobSetupTask ( ) && hasSpeculativeReduces ) { updateTaskTrackerStats ( tip , ttStatus , trackerReduceStats , reduceTaskStats ) ; } } // remove the completed reduces from the running reducers set
retireReduce ( tip ) ; if ( ( finishedReduceTasks + failedReduceTIPs ) == ( numReduceTasks ) ) { this . status . setReduceProgress ( 1.0f ) ; } } // is job complete ?
if ( ! jobSetupCleanupNeeded && canLaunchJobCleanupTask ( ) ) { jobComplete ( ) ; } return true ;
|
public class MessageAPI { /** * 获取设置的行业信息
* @ param access _ token access _ token
* @ return GetIndustryResult
* @ since 2.6.1 */
public static GetIndustryResult templateGet_industry ( String access_token ) { } }
|
HttpUriRequest httpUriRequest = RequestBuilder . post ( ) . setUri ( BASE_URI + "/cgi-bin/template/get_industry" ) . addParameter ( PARAM_ACCESS_TOKEN , API . accessToken ( access_token ) ) . build ( ) ; return LocalHttpClient . executeJsonResult ( httpUriRequest , GetIndustryResult . class ) ;
|
public class Page { /** * 判断当前Page的Http响应头的Content - Type是否符合正则
* @ param contentTypeRegex
* @ return */
public boolean matchContentType ( String contentTypeRegex ) { } }
|
if ( contentTypeRegex == null ) { return contentType ( ) == null ; } return Pattern . matches ( contentTypeRegex , contentType ( ) ) ;
|
public class StorePackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getPrimitiveDefinition ( ) { } }
|
if ( primitiveDefinitionEClass == null ) { primitiveDefinitionEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( StorePackage . eNS_URI ) . getEClassifiers ( ) . get ( 69 ) ; } return primitiveDefinitionEClass ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.