signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CPDisplayLayoutPersistenceImpl { /** * Returns the cp display layout where classNameId = & # 63 ; and classPK = & # 63 ; or returns < code > null < / code > if it could not be found , optionally using the finder cache .
* @ param classNameId the class name ID
* @ param classPK the class pk
* @ param retrieveFromCache whether to retrieve from the finder cache
* @ return the matching cp display layout , or < code > null < / code > if a matching cp display layout could not be found */
@ Override public CPDisplayLayout fetchByC_C ( long classNameId , long classPK , boolean retrieveFromCache ) { } } | Object [ ] finderArgs = new Object [ ] { classNameId , classPK } ; Object result = null ; if ( retrieveFromCache ) { result = finderCache . getResult ( FINDER_PATH_FETCH_BY_C_C , finderArgs , this ) ; } if ( result instanceof CPDisplayLayout ) { CPDisplayLayout cpDisplayLayout = ( CPDisplayLayout ) result ; if ( ( classNameId != cpDisplayLayout . getClassNameId ( ) ) || ( classPK != cpDisplayLayout . getClassPK ( ) ) ) { result = null ; } } if ( result == null ) { StringBundler query = new StringBundler ( 4 ) ; query . append ( _SQL_SELECT_CPDISPLAYLAYOUT_WHERE ) ; query . append ( _FINDER_COLUMN_C_C_CLASSNAMEID_2 ) ; query . append ( _FINDER_COLUMN_C_C_CLASSPK_2 ) ; String sql = query . toString ( ) ; Session session = null ; try { session = openSession ( ) ; Query q = session . createQuery ( sql ) ; QueryPos qPos = QueryPos . getInstance ( q ) ; qPos . add ( classNameId ) ; qPos . add ( classPK ) ; List < CPDisplayLayout > list = q . list ( ) ; if ( list . isEmpty ( ) ) { finderCache . putResult ( FINDER_PATH_FETCH_BY_C_C , finderArgs , list ) ; } else { CPDisplayLayout cpDisplayLayout = list . get ( 0 ) ; result = cpDisplayLayout ; cacheResult ( cpDisplayLayout ) ; } } catch ( Exception e ) { finderCache . removeResult ( FINDER_PATH_FETCH_BY_C_C , finderArgs ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } if ( result instanceof List < ? > ) { return null ; } else { return ( CPDisplayLayout ) result ; } |
public class GroupHandlerImpl { /** * Adds child group . */
private void addChild ( Session session , GroupImpl parent , GroupImpl child , boolean broadcast ) throws Exception { } } | Node parentNode = utils . getGroupNode ( session , parent ) ; Node groupNode = parentNode . addNode ( child . getGroupName ( ) , JCROrganizationServiceImpl . JOS_HIERARCHY_GROUP_NODETYPE ) ; String parentId = parent == null ? null : parent . getId ( ) ; child . setParentId ( parentId ) ; child . setInternalId ( groupNode . getUUID ( ) ) ; if ( broadcast ) { preSave ( child , true ) ; } writeGroup ( child , groupNode ) ; session . save ( ) ; putInCache ( child ) ; if ( broadcast ) { postSave ( child , true ) ; } |
public class GeometryService { /** * We assume neither is null or empty . */
private static boolean intersectsPoint ( Geometry point , Geometry geometry ) { } } | if ( geometry . getGeometries ( ) != null ) { for ( Geometry child : geometry . getGeometries ( ) ) { if ( intersectsPoint ( point , child ) ) { return true ; } } } if ( geometry . getCoordinates ( ) != null ) { Coordinate coordinate = point . getCoordinates ( ) [ 0 ] ; if ( geometry . getCoordinates ( ) . length == 1 ) { return coordinate . equals ( geometry . getCoordinates ( ) [ 0 ] ) ; } else { for ( int i = 0 ; i < geometry . getCoordinates ( ) . length - 1 ; i ++ ) { double distance = MathService . distance ( geometry . getCoordinates ( ) [ i ] , geometry . getCoordinates ( ) [ i + 1 ] , coordinate ) ; if ( distance < DEFAULT_DOUBLE_DELTA ) { return true ; } } } } return false ; |
public class Collection { /** * Requests i ' th page from UserVoice . Thread - safe and makes one HTTP
* connection .
* @ param i
* and index between 1 . . ( 1 / PER _ PAGE ) + 1
* @ return The page in a JSONArray
* @ throws APIError
* if something unexpected happened
* @ throws Unauthorized
* if the user didn ' t have permissions to request the page */
public synchronized JSONArray loadPage ( int i ) { } } | if ( pages == null || pages . get ( i ) == null ) { String url ; if ( path . contains ( "?" ) ) { url = path + "&" ; } else { url = path + "?" ; } // System . out . println ( url ) ;
JSONObject result = client . get ( url + "per_page=" + perPage + "&page=" + i ) ; // System . out . println ( result ) ;
if ( result != null && result . names ( ) . size ( ) == 2 && ! result . getJSONObject ( "response_data" ) . isNullObject ( ) ) { responseData = result . getJSONObject ( "response_data" ) ; for ( Object name : result . names ( ) ) { if ( ! "response_data" . equals ( name ) ) { pages . put ( i , result . getJSONArray ( name . toString ( ) ) ) ; } } pages . put ( i , pages . get ( i ) ) ; } else { throw new NotFound ( "The resource you requested is not a collection." ) ; } } return pages . get ( i ) ; |
public class YQueue { /** * unsynchronised thread . */
public void unpush ( ) { } } | // First , move ' back ' one position backwards .
if ( backPos > 0 ) { -- backPos ; } else { backPos = size - 1 ; backChunk = backChunk . prev ; } // Now , move ' end ' position backwards . Note that obsolete end chunk
// is not used as a spare chunk . The analysis shows that doing so
// would require free and atomic operation per chunk deallocated
// instead of a simple free .
if ( endPos > 0 ) { -- endPos ; } else { endPos = size - 1 ; endChunk = endChunk . prev ; endChunk . next = null ; } |
public class MjdbcConfig { /** * Creates new { @ link Overrider } implementation instance based on default statement handler
* implementation class set via { @ link # setDefaultOverrider ( Class ) }
* @ return new { @ link Overrider } instance */
public static Overrider getDefaultOverrider ( ) { } } | Overrider result = null ; Class < Overrider > clazz = instance ( ) . defaultOverrider ; try { result = clazz . newInstance ( ) ; } catch ( InstantiationException e ) { throw new MjdbcRuntimeException ( ERROR_OR_INIT_FAILED , e ) ; } catch ( IllegalAccessException e ) { throw new MjdbcRuntimeException ( ERROR_OR_INIT_FAILED , e ) ; } return result ; |
public class BackupManagerImpl { /** * Get parameters which passed from the file .
* @ throws RepositoryConfigurationException */
private void readParamsFromFile ( ) { } } | PropertiesParam pps = initParams . getPropertiesParam ( BACKUP_PROPERTIES ) ; backupDir = pps . getProperty ( BACKUP_DIR ) ; // full backup type can be not defined . Using default .
fullBackupType = pps . getProperty ( FULL_BACKUP_TYPE ) == null ? DEFAULT_VALUE_FULL_BACKUP_TYPE : pps . getProperty ( FULL_BACKUP_TYPE ) ; // incremental backup can be not configured . Using default values .
defIncrPeriod = pps . getProperty ( DEFAULT_INCREMENTAL_JOB_PERIOD ) == null ? DEFAULT_VALUE_INCREMENTAL_JOB_PERIOD : pps . getProperty ( DEFAULT_INCREMENTAL_JOB_PERIOD ) ; incrementalBackupType = pps . getProperty ( INCREMENTAL_BACKUP_TYPE ) == null ? DEFAULT_VALUE_INCREMENTAL_BACKUP_TYPE : pps . getProperty ( INCREMENTAL_BACKUP_TYPE ) ; LOG . info ( "Backup dir from configuration file: " + backupDir ) ; LOG . info ( "Full backup type from configuration file: " + fullBackupType ) ; LOG . info ( "(Experimental) Incremental backup type from configuration file: " + incrementalBackupType ) ; LOG . info ( "(Experimental) Default incremental job period from configuration file: " + defIncrPeriod ) ; checkParams ( ) ; |
public class PostgreSqlExceptionTranslator { /** * Package private for testability
* @ param pSqlException PostgreSQL exception
* @ return translated validation exception */
static MolgenisValidationException translateInvalidIntegerException ( PSQLException pSqlException ) { } } | ServerErrorMessage serverErrorMessage = pSqlException . getServerErrorMessage ( ) ; String message = serverErrorMessage . getMessage ( ) ; Matcher matcher = Pattern . compile ( "invalid input syntax for \\b(?:type )?\\b(.+?): \"(.*?)\"" ) . matcher ( message ) ; boolean matches = matcher . matches ( ) ; if ( ! matches ) { throw new RuntimeException ( ERROR_TRANSLATING_EXCEPTION_MSG , pSqlException ) ; } String postgreSqlType = matcher . group ( 1 ) ; // convert PostgreSQL data type to attribute type :
String type ; switch ( postgreSqlType ) { case "boolean" : type = BOOL . toString ( ) ; break ; case "date" : type = DATE . toString ( ) ; break ; case "timestamp with time zone" : type = DATE_TIME . toString ( ) ; break ; case "double precision" : type = DECIMAL . toString ( ) ; break ; case "integer" : type = INT . toString ( ) + " or " + LONG . toString ( ) ; break ; default : type = postgreSqlType ; break ; } String value = matcher . group ( 2 ) ; ConstraintViolation constraintViolation = new ConstraintViolation ( format ( "Value [%s] of this entity attribute is not of type [%s]." , value , type ) , null ) ; return new MolgenisValidationException ( singleton ( constraintViolation ) ) ; |
public class ObjectNameAddressUtil { /** * Straight conversion from an ObjectName to a PathAddress .
* There may not necessarily be a Resource at this path address ( if that correspond to a pattern ) but it must
* match a model in the registry .
* @ param domain the name of the caller ' s JMX domain
* @ param registry the root resource for the management model
* @ param name the ObjectName to convert
* @ return the PathAddress , or { @ code null } if no address matches the object name */
static PathAddress toPathAddress ( String domain , ImmutableManagementResourceRegistration registry , ObjectName name ) { } } | if ( ! name . getDomain ( ) . equals ( domain ) ) { return PathAddress . EMPTY_ADDRESS ; } if ( name . equals ( ModelControllerMBeanHelper . createRootObjectName ( domain ) ) ) { return PathAddress . EMPTY_ADDRESS ; } final Hashtable < String , String > properties = name . getKeyPropertyList ( ) ; return searchPathAddress ( PathAddress . EMPTY_ADDRESS , registry , properties ) ; |
public class JavaDocument { /** * Override to apply syntax highlighting after the document has been updated */
@ Override public void insertString ( int offset , String str , AttributeSet a ) throws BadLocationException { } } | switch ( str ) { case "(" : str = addParenthesis ( ) ; break ; case "\n" : str = addWhiteSpace ( offset ) ; break ; case "\"" : str = addMatchingQuotationMark ( ) ; break ; case "{" : str = addMatchingBrace ( offset ) ; break ; } super . insertString ( offset , str , a ) ; processChangedLines ( offset , str . length ( ) ) ; |
public class TypicalLoginAssist { @ Override public boolean checkUserLoginable ( LoginCredential credential ) { } } | final CredentialChecker checker = new CredentialChecker ( credential ) ; checkCredential ( checker ) ; if ( ! checker . isChecked ( ) ) { handleUnknownLoginCredential ( credential ) ; } return checker . isLoginable ( ) ; |
public class ComputeNodeListHeaders { /** * Set the time at which the resource was last modified .
* @ param lastModified the lastModified value to set
* @ return the ComputeNodeListHeaders object itself . */
public ComputeNodeListHeaders withLastModified ( DateTime lastModified ) { } } | if ( lastModified == null ) { this . lastModified = null ; } else { this . lastModified = new DateTimeRfc1123 ( lastModified ) ; } return this ; |
public class SynchroReader { /** * Extract calendar data . */
private void processCalendars ( ) throws IOException { } } | CalendarReader reader = new CalendarReader ( m_data . getTableData ( "Calendars" ) ) ; reader . read ( ) ; for ( MapRow row : reader . getRows ( ) ) { processCalendar ( row ) ; } m_project . setDefaultCalendar ( m_calendarMap . get ( reader . getDefaultCalendarUUID ( ) ) ) ; |
public class PreferenceActivity { /** * Notifies all registered listeners , that a navigation preference has been removed from the
* activity .
* @ param navigationPreference
* The navigation preference , which has been removed , as an instance of the class { @ link
* NavigationPreference } . The navigation preference may not be null */
private void notifyOnNavigationPreferenceRemoved ( @ NonNull final NavigationPreference navigationPreference ) { } } | for ( NavigationListener listener : navigationListeners ) { listener . onNavigationPreferenceRemoved ( navigationPreference ) ; } |
public class GenericTypeExtractor { /** * Extract generic type of root class either from the target base class or from target base interface .
* Examples :
* 1 . Foo implements IFoo [ Integer ] :
* genericTypeOf ( Foo . class , Object . class , IFoo . class ) returns Integer
* 2 . Foo extends BaseFoo [ String ] :
* genericTypeOf ( Foo . class , BaseFoo . class , IFoo . class ) returns String
* 3 . Foo extends BaseFoo ; BaseFoo implements IFoo [ String ] :
* genericTypeOf ( Foo . class , BaseFoo . class , Object . class ) returns String
* Does not support nested generics , only supports single type parameter .
* @ param rootClass - the root class that the search begins from
* @ param targetBaseClass - if one of the classes in the root class ' hierarchy extends this base class
* it will be used for generic type extraction
* @ param targetBaseInterface - if one of the interfaces in the root class ' hierarchy implements this interface
* it will be used for generic type extraction
* @ return generic interface if found , Object . class if not found . */
public static Class < ? > genericTypeOf ( Class < ? > rootClass , Class < ? > targetBaseClass , Class < ? > targetBaseInterface ) { } } | // looking for candidates in the hierarchy of rootClass
Class < ? > match = rootClass ; while ( match != Object . class ) { // check the super class first
if ( match . getSuperclass ( ) == targetBaseClass ) { return extractGeneric ( match . getGenericSuperclass ( ) ) ; } // check the interfaces ( recursively )
Type genericInterface = findGenericInterface ( match , targetBaseInterface ) ; if ( genericInterface != null ) { return extractGeneric ( genericInterface ) ; } // recurse the hierarchy
match = match . getSuperclass ( ) ; } return Object . class ; |
public class StandardBullhornData { /** * Makes the api call to delete a file attached to an entity .
* @ param type
* @ param entityId
* @ param fileId
* @ return */
protected FileApiResponse handleDeleteFile ( Class < ? extends FileEntity > type , Integer entityId , Integer fileId ) { } } | Map < String , String > uriVariables = restUriVariablesFactory . getUriVariablesDeleteFile ( BullhornEntityInfo . getTypesRestEntityName ( type ) , entityId , fileId ) ; String url = restUrlFactory . assembleDeleteFileUrl ( ) ; StandardFileApiResponse fileApiResponse = this . performCustomRequest ( url , null , StandardFileApiResponse . class , uriVariables , HttpMethod . DELETE , null ) ; return fileApiResponse ; |
public class ActiveMQQueueJmxStats { /** * Return a new queue stats structure with the total of the stats from this structure and the one given . Returning
* a new structure keeps all three structures unchanged , in the manner of immutability , to make it easier to have
* safe usage under concurrency . Note that non - count values are copied out from this instance ; those values from
* the given other stats are ignored .
* @ param other
* @ param resultBrokerName
* @ return */
public ActiveMQQueueJmxStats addCounts ( ActiveMQQueueJmxStats other , String resultBrokerName ) { } } | ActiveMQQueueJmxStats result = new ActiveMQQueueJmxStats ( resultBrokerName , this . queueName ) ; result . setCursorPercentUsage ( this . getCursorPercentUsage ( ) ) ; result . setDequeueCount ( this . getDequeueCount ( ) + other . getDequeueCount ( ) ) ; result . setEnqueueCount ( this . getEnqueueCount ( ) + other . getEnqueueCount ( ) ) ; result . setMemoryPercentUsage ( this . getMemoryPercentUsage ( ) ) ; result . setNumConsumers ( this . getNumConsumers ( ) + other . getNumConsumers ( ) ) ; result . setNumProducers ( this . getNumProducers ( ) + other . getNumProducers ( ) ) ; result . setQueueSize ( this . getQueueSize ( ) + other . getQueueSize ( ) ) ; result . setInflightCount ( this . getInflightCount ( ) + other . getInflightCount ( ) ) ; return result ; |
public class SQLManager { /** * Builds SQL SELECT to retrieve single row from a table based on type of database
* @ param databaseType
* @ param table
* @ param columns
* @ return String SQL SELECT statement */
static String buildSelectSingleRowSql ( String databaseType , String table , String columns ) { } } | switch ( databaseType ) { case SQL_SERVER_DB_TYPE : // syntax supported since SQLServer 2008
return "SELECT TOP(1) " + columns + " FROM " + table ; case ORACLE_DB_TYPE : return "SELECT " + columns + " FROM " + table + " FETCH NEXT 1 ROWS ONLY" ; case TERADATA_DB_TYPE : return "SELECT TOP 1 " + columns + " FROM " + table ; default : return "SELECT " + columns + " FROM " + table + " LIMIT 1" ; } |
public class AccountCRCAlgs { /** * TODO : more tests */
public static boolean alg_52 ( int [ ] blz , int [ ] number ) { } } | boolean ok ; if ( number [ 0 ] == 9 ) { ok = alg_20 ( blz , number ) ; } else { // Kontonummer muss 8 - stellig sein ( mgl : number [ 2 ] darf 0 sein , d . h . Kontonummer faengt mit 0 an
if ( number [ 0 ] != 0 || number [ 1 ] != 0 || number [ 2 ] == 0 ) { ok = false ; } else { int [ ] weights = new int [ ] { 4 , 2 , 1 , 6 , 3 , 7 , 9 , 10 , 5 , 8 , 4 , 2 } ; // ESER - Nummer bauen
int [ ] eser = new int [ 12 ] ; int knstartindex = 4 ; while ( number [ knstartindex ] == 0 ) { knstartindex ++ ; } // kontonummer - > eser
int i = 11 ; for ( int j = 9 ; j >= knstartindex ; j -- , i -- ) { eser [ i ] = number [ j ] ; } // Pruefziffer number [ 3 ] muss 0 gesetzt werden
int indexOfPruefziffer = i ; eser [ i -- ] = 0 ; // erste Stelle der Kontonummer ;
eser [ i -- ] = number [ 2 ] ; for ( int j = 7 ; j > 3 ; j -- , i -- ) { eser [ i ] = blz [ j ] ; } // Ende Eser - Nummer bauen
int sum = addProducts ( eser , 0 , 11 , weights , false ) ; int crc = sum % 11 ; int factor = 0 ; boolean found = false ; while ( ! found && factor < 10 ) { int tocheck = ( crc + factor * weights [ indexOfPruefziffer ] ) % 11 ; if ( tocheck == 10 ) { crc = factor ; found = true ; } factor ++ ; } ok = found && number [ 3 ] == crc ; } } return ok ; |
public class BooleanUtil { /** * Determines if the specified string contains ' true ' or ' 1'
* @ param value a String representation of a boolean to convert
* @ return a boolean
* @ since 1.0.0 */
public static boolean valueOf ( String value ) { } } | return ( value != null ) && ( value . trim ( ) . equalsIgnoreCase ( "true" ) || value . trim ( ) . equals ( "1" ) ) ; |
public class DefaultGroovyMethods { /** * Allows the closure to be called for the object reference self .
* Any method invoked inside the closure will first be invoked on the
* self reference . For example , the following method calls to the append ( )
* method are invoked on the StringBuilder instance and then , because
* ' returning ' is true , the self instance is returned :
* < pre class = " groovyTestCase " >
* def b = new StringBuilder ( ) . with ( true ) {
* append ( ' foo ' )
* append ( ' bar ' )
* assert b . toString ( ) = = ' foobar '
* < / pre >
* The returning parameter is commonly set to true when using with to simplify object
* creation , such as this example :
* < pre >
* def p = new Person ( ) . with ( true ) {
* firstName = ' John '
* lastName = ' Doe '
* < / pre >
* Alternatively , ' tap ' is an alias for ' with ( true ) ' , so that method can be used instead .
* The other main use case for with is when returning a value calculated using self as shown here :
* < pre >
* def fullName = person . with ( false ) { " $ firstName $ lastName " }
* < / pre >
* Alternatively , ' with ' is an alias for ' with ( false ) ' , so the boolean parameter can be ommitted instead .
* @ param self the object to have a closure act upon
* @ param returning if true , return the self object ; otherwise , the result of calling the closure
* @ param closure the closure to call on the object
* @ return the self object or the result of calling the closure depending on ' returning '
* @ see # with ( Object , Closure )
* @ see # tap ( Object , Closure )
* @ since 2.5.0 */
public static < T , U extends T , V extends T > T with ( @ DelegatesTo . Target ( "self" ) U self , boolean returning , @ DelegatesTo ( value = DelegatesTo . Target . class , target = "self" , strategy = Closure . DELEGATE_FIRST ) @ ClosureParams ( FirstParam . class ) Closure < T > closure ) { } } | @ SuppressWarnings ( "unchecked" ) final Closure < V > clonedClosure = ( Closure < V > ) closure . clone ( ) ; clonedClosure . setResolveStrategy ( Closure . DELEGATE_FIRST ) ; clonedClosure . setDelegate ( self ) ; V result = clonedClosure . call ( self ) ; return returning ? self : result ; |
public class SQLTemplates { /** * template method for SELECT serialization
* @ param metadata
* @ param forCountRow
* @ param context */
public void serialize ( QueryMetadata metadata , boolean forCountRow , SQLSerializer context ) { } } | context . serializeForQuery ( metadata , forCountRow ) ; if ( ! metadata . getFlags ( ) . isEmpty ( ) ) { context . serialize ( Position . END , metadata . getFlags ( ) ) ; } |
public class EsaResourceImpl { /** * This generates the string that should be displayed on the website to indicate
* the supported Java versions . The requirements come from the bundle manifests .
* The mapping between the two is non - obvious , as it is the intersection between
* the Java EE requirement and the versions of Java that Liberty supports . */
private void addVersionDisplayString ( ) { } } | WlpInformation wlp = _asset . getWlpInformation ( ) ; JavaSEVersionRequirements reqs = wlp . getJavaSEVersionRequirements ( ) ; if ( reqs == null ) { return ; } String minVersion = reqs . getMinVersion ( ) ; // Null means no requirements specified which is fine
if ( minVersion == null ) { return ; } String minJava11 = "Java SE 11" ; String minJava8 = "Java SE 8, Java SE 11" ; String minJava7 = "Java SE 7, Java SE 8, Java SE 11" ; String minJava6 = "Java SE 6, Java SE 7, Java SE 8, Java SE 11" ; // TODO : Temporary special case for jdbc - 4.3 ( the first feature to require Java > 8)
// Once all builds are upgrade to Java 11 + , we can remove this workaround
if ( "jdbc-4.3" . equals ( wlp . getLowerCaseShortName ( ) ) ) { reqs . setVersionDisplayString ( minJava11 ) ; return ; } // The min version should have been validated when the ESA was constructed
// so checking for the version string should be safe
if ( minVersion . equals ( "1.6.0" ) ) { reqs . setVersionDisplayString ( minJava6 ) ; return ; } if ( minVersion . equals ( "1.7.0" ) ) { reqs . setVersionDisplayString ( minJava7 ) ; return ; } if ( minVersion . equals ( "1.8.0" ) ) { reqs . setVersionDisplayString ( minJava8 ) ; return ; } if ( minVersion . startsWith ( "9." ) || minVersion . startsWith ( "10." ) || minVersion . startsWith ( "11." ) ) { // If a feature requires a min of Java 9/10/11 , state Java 11 is required because
// Liberty does not officially support Java 9 or 10
reqs . setVersionDisplayString ( minJava11 ) ; return ; } // The min version string has been generated / validated incorrectly
// Can ' t recover from this , it is a bug in EsaUploader
throw new AssertionError ( "Unrecognized java version: " + minVersion ) ; |
public class CookieConverter { /** * Converts Selenium cookie to Apache http client .
* @ param browserCookie selenium cookie .
* @ return http client format . */
protected ClientCookie convertCookie ( Cookie browserCookie ) { } } | BasicClientCookie cookie = new BasicClientCookie ( browserCookie . getName ( ) , browserCookie . getValue ( ) ) ; String domain = browserCookie . getDomain ( ) ; if ( domain != null && domain . startsWith ( "." ) ) { // http client does not like domains starting with ' . ' , it always removes it when it receives them
domain = domain . substring ( 1 ) ; } cookie . setDomain ( domain ) ; cookie . setPath ( browserCookie . getPath ( ) ) ; cookie . setExpiryDate ( browserCookie . getExpiry ( ) ) ; cookie . setSecure ( browserCookie . isSecure ( ) ) ; if ( browserCookie . isHttpOnly ( ) ) { cookie . setAttribute ( "httponly" , "" ) ; } return cookie ; |
public class CreateDeviceDefinitionRequest { /** * Tag ( s ) to add to the new resource
* @ param tags
* Tag ( s ) to add to the new resource
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateDeviceDefinitionRequest withTags ( java . util . Map < String , String > tags ) { } } | setTags ( tags ) ; return this ; |
public class EndpointService { /** * Works only before { @ link # start ( ) } or after { @ link # stop ( ) } .
* @ param listener to add */
public void addInventoryListener ( InventoryListener listener ) { } } | this . inventoryListenerSupport . inventoryListenerRWLock . writeLock ( ) . lock ( ) ; try { status . assertInitialOrStopped ( getClass ( ) , "addInventoryListener()" ) ; this . inventoryListenerSupport . inventoryListeners . add ( listener ) ; LOG . debugf ( "Added inventory listener [%s] for endpoint [%s]" , listener , getMonitoredEndpoint ( ) ) ; } finally { this . inventoryListenerSupport . inventoryListenerRWLock . writeLock ( ) . unlock ( ) ; } |
public class ProtectedFunctionMapper { /** * Stores a mapping from the given EL function prefix and name to
* the given Java method .
* @ param prefix The EL function prefix
* @ param fnName The EL function name
* @ param c The class containing the Java method
* @ param methodName The name of the Java method
* @ param args The arguments of the Java method
* @ throws RuntimeException if no method with the given signature
* could be found . */
public void mapFunction ( String prefix , String fnName , final Class c , final String methodName , final Class [ ] args ) { } } | // 192474 start
// We can get in to this method with null parameters if a JSP was compiled against the jsp - 2.3 feature but running in a jsp - 2.2 server .
// This check is needed for the temporary JspClassInformation created in AbstractJSPExtensionServletWrapper class .
if ( fnName == null ) { return ; } // 192474 end
java . lang . reflect . Method method ; if ( System . getSecurityManager ( ) != null ) { try { method = ( java . lang . reflect . Method ) AccessController . doPrivileged ( new PrivilegedExceptionAction ( ) { public Object run ( ) throws Exception { return c . getDeclaredMethod ( methodName , args ) ; } } ) ; } catch ( PrivilegedActionException ex ) { throw new RuntimeException ( "Invalid function mapping - no such method: " + ex . getException ( ) . getMessage ( ) ) ; } } else { try { method = c . getDeclaredMethod ( methodName , args ) ; } catch ( NoSuchMethodException e ) { throw new RuntimeException ( "Invalid function mapping - no such method: " + e . getMessage ( ) ) ; } } this . fnmap . put ( prefix + ":" + fnName , method ) ; |
public class ResponseCreationSupport { /** * Shorthand for invoking
* { @ link # sendStaticContent ( HttpRequest , IOSubchannel , Function , MaxAgeCalculator ) }
* with the { @ link HttpRequest } from the event . Also sets the result
* of the event to ` true ` and invokes { @ link Event # stop ( ) }
* if a response was sent .
* @ param event the event
* @ param channel the channel
* @ param resolver the resolver
* @ param maxAgeCalculator the max age calculator , if ` null `
* the default calculator is used .
* @ return ` true ` if a response was sent
* @ throws ParseException the parse exception */
public static boolean sendStaticContent ( Request . In event , IOSubchannel channel , Function < String , URL > resolver , MaxAgeCalculator maxAgeCalculator ) { } } | if ( sendStaticContent ( event . httpRequest ( ) , channel , resolver , maxAgeCalculator ) ) { event . setResult ( true ) ; event . stop ( ) ; return true ; } return false ; |
public class StreamingEndpointsInner { /** * List StreamingEndpoints .
* Lists the StreamingEndpoints in the account .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; StreamingEndpointInner & gt ; object */
public Observable < Page < StreamingEndpointInner > > listNextAsync ( final String nextPageLink ) { } } | return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < StreamingEndpointInner > > , Page < StreamingEndpointInner > > ( ) { @ Override public Page < StreamingEndpointInner > call ( ServiceResponse < Page < StreamingEndpointInner > > response ) { return response . body ( ) ; } } ) ; |
public class NumberFormat { /** * Sets the maximum number of digits allowed in the fraction portion of a
* number . maximumFractionDigits must be > = minimumFractionDigits . If the
* new value for maximumFractionDigits is less than the current value
* of minimumFractionDigits , then minimumFractionDigits will also be set to
* the new value .
* @ param newValue the maximum number of fraction digits to be shown ; if
* less than zero , then zero is used . The concrete subclass may enforce an
* upper limit to this value appropriate to the numeric type being formatted .
* @ see # getMaximumFractionDigits */
public void setMaximumFractionDigits ( int newValue ) { } } | maximumFractionDigits = Math . max ( 0 , newValue ) ; if ( maximumFractionDigits < minimumFractionDigits ) { minimumFractionDigits = maximumFractionDigits ; } |
public class SharedFlowController { /** * Store information about recent pages displayed . This is a framework - invoked method that should not normally be
* called directly . */
public void savePreviousPageInfo ( ActionForward forward , ActionForm form , ActionMapping mapping , HttpServletRequest request , ServletContext servletContext , boolean isSpecialForward ) { } } | // Special case : if the given forward has a path to a page in the current pageflow , let that pageflow save
// the info on this page . Otherwise , don ' t ever save any info on what we ' re forwarding to .
if ( ! isSpecialForward && forward != null ) // i . e . , it ' s a straight Forward to a path , not a navigateTo , etc .
{ PageFlowController currentJpf = PageFlowUtils . getCurrentPageFlow ( request , getServletContext ( ) ) ; if ( currentJpf != null ) { if ( forward . getContextRelative ( ) && forward . getPath ( ) . startsWith ( currentJpf . getModulePath ( ) ) ) { currentJpf . savePreviousPageInfo ( forward , form , mapping , request , servletContext , isSpecialForward ) ; } } } |
public class KafkaMsgConsumer { /** * Commit the specified offsets for the last consumed message .
* @ param msg
* @ return { @ code true } if the topic is in subscription list , { @ code false }
* otherwise
* @ since 1.3.2 */
public boolean commit ( KafkaMessage msg ) { } } | KafkaConsumer < String , byte [ ] > consumer = _getConsumer ( msg . topic ( ) ) ; synchronized ( consumer ) { Set < String > subscription = consumer . subscription ( ) ; if ( subscription == null || ! subscription . contains ( msg . topic ( ) ) ) { // this consumer has not subscribed to the topic
return false ; } else { try { Map < TopicPartition , OffsetAndMetadata > offsets = new HashMap < > ( ) ; offsets . put ( new TopicPartition ( msg . topic ( ) , msg . partition ( ) ) , new OffsetAndMetadata ( msg . offset ( ) + 1 ) ) ; consumer . commitSync ( offsets ) ; } catch ( WakeupException e ) { } catch ( Exception e ) { throw new KafkaException ( e ) ; } return true ; } } |
public class RaftSessionConnection { /** * Sends a metadata request to the given node .
* @ param request the request to send
* @ return a future to be completed with the response */
public CompletableFuture < MetadataResponse > metadata ( MetadataRequest request ) { } } | CompletableFuture < MetadataResponse > future = new CompletableFuture < > ( ) ; if ( context . isCurrentContext ( ) ) { sendRequest ( request , protocol :: metadata , future ) ; } else { context . execute ( ( ) -> sendRequest ( request , protocol :: metadata , future ) ) ; } return future ; |
public class Type { /** * Getter method for instance variable { @ link # classifiedByTypes } .
* The method retrieves lazy the Classification Types .
* @ return value of instance variable { @ link # classifiedByTypes }
* @ throws EFapsException on error */
public Set < Classification > getClassifiedByTypes ( ) throws EFapsException { } } | if ( ! this . checked4classifiedBy ) { final QueryBuilder attrQueryBldr = new QueryBuilder ( CIAdminDataModel . TypeClassifies ) ; attrQueryBldr . addWhereAttrEqValue ( CIAdminDataModel . TypeClassifies . To , getId ( ) ) ; final AttributeQuery attrQuery = attrQueryBldr . getAttributeQuery ( CIAdminDataModel . TypeClassifies . From ) ; final QueryBuilder queryBldr = new QueryBuilder ( CIAdminDataModel . Type ) ; queryBldr . addWhereAttrInQuery ( CIAdminDataModel . Type . ID , attrQuery ) ; final InstanceQuery query = queryBldr . getQuery ( ) ; query . executeWithoutAccessCheck ( ) ; while ( query . next ( ) ) { Type . get ( query . getCurrentValue ( ) . getId ( ) ) ; } this . checked4classifiedBy = true ; setDirty ( ) ; } final Set < Classification > ret = new HashSet < > ( ) ; if ( getParentType ( ) != null ) { ret . addAll ( getParentType ( ) . getClassifiedByTypes ( ) ) ; } for ( final Long id : this . classifiedByTypes ) { ret . add ( ( Classification ) Type . get ( id ) ) ; } return Collections . unmodifiableSet ( ret ) ; |
public class UploadCallable { /** * Uploads the given request in a single chunk and returns the result . */
private UploadResult uploadInOneChunk ( ) { } } | PutObjectResult putObjectResult = s3 . putObject ( origReq ) ; UploadResult uploadResult = new UploadResult ( ) ; uploadResult . setBucketName ( origReq . getBucketName ( ) ) ; uploadResult . setKey ( origReq . getKey ( ) ) ; uploadResult . setETag ( putObjectResult . getETag ( ) ) ; uploadResult . setVersionId ( putObjectResult . getVersionId ( ) ) ; return uploadResult ; |
public class DataNode { /** * { @ inheritDoc } */
public LocatedBlock recoverBlock ( Block block , boolean keepLength , DatanodeInfo [ ] targets ) throws IOException { } } | // old client : use default namespace
return recoverBlock ( getAllNamespaces ( ) [ 0 ] , block , keepLength , targets ) ; |
public class Preconditions { /** * Ensures the value is not null .
* @ param value value to be validated .
* @ param errorMessage error message thrown if value is null .
* @ param < T > type of value .
* @ return value passed in if not null . */
@ Nonnull public static < T > T checkNotNull ( T value , @ Nonnull String errorMessage ) { } } | if ( value == null ) { throw new NullPointerException ( errorMessage ) ; } return value ; |
public class CookieDeviceFingerprintComponentExtractor { /** * Create device finger print cookie .
* @ param context the context
* @ param request the request
* @ param cookieValue the cookie value */
protected void createDeviceFingerPrintCookie ( final RequestContext context , final HttpServletRequest request , final String cookieValue ) { } } | val response = WebUtils . getHttpServletResponseFromExternalWebflowContext ( context ) ; cookieGenerator . addCookie ( request , response , cookieValue ) ; |
public class GrailsNameUtils { /** * Returns a property name equivalent for the given setter name or null if it is not a valid setter . If not null
* or empty the setter name is assumed to be a valid identifier .
* @ param setterName The setter name , must be null or empty or a valid identifier name
* @ return The property name equivalent */
public static String getPropertyForSetter ( String setterName ) { } } | if ( setterName == null || setterName . length ( ) == 0 ) return null ; if ( setterName . startsWith ( "set" ) ) { String prop = setterName . substring ( 3 ) ; return convertValidPropertyMethodSuffix ( prop ) ; } return null ; |
public class TransformerIdentityImpl { /** * Receive notification of the end of an element .
* < p > By default , do nothing . Application writers may override this
* method in a subclass to take specific actions at the end of
* each element ( such as finalising a tree node or writing
* output to a file ) . < / p >
* @ param uri The Namespace URI , or the empty string if the
* element has no Namespace URI or if Namespace
* processing is not being performed .
* @ param localName The local name ( without prefix ) , or the
* empty string if Namespace processing is not being
* performed .
* @ param qName The qualified name ( with prefix ) , or the
* empty string if qualified names are not available .
* @ throws org . xml . sax . SAXException Any SAX exception , possibly
* wrapping another exception .
* @ see org . xml . sax . ContentHandler # endElement
* @ throws SAXException */
public void endElement ( String uri , String localName , String qName ) throws SAXException { } } | m_resultContentHandler . endElement ( uri , localName , qName ) ; |
public class LogScribe { /** * Creates the default line prepend for a message . */
protected String createPrepend ( LogEvent e ) { } } | StringBuffer pre = new StringBuffer ( 80 ) ; String code = "??" ; switch ( e . getType ( ) ) { case LogEvent . DEBUG_TYPE : code = " D" ; break ; case LogEvent . INFO_TYPE : code = " I" ; break ; case LogEvent . WARN_TYPE : code = "*W" ; break ; case LogEvent . ERROR_TYPE : code = "*E" ; break ; } pre . append ( code ) ; pre . append ( ',' ) ; if ( mFastFormat != null ) { pre . append ( mFastFormat . format ( e . getTimestamp ( ) ) ) ; } else { synchronized ( mSlowFormat ) { pre . append ( mSlowFormat . format ( e . getTimestamp ( ) ) ) ; } } if ( isShowThreadEnabled ( ) ) { pre . append ( ',' ) ; pre . append ( e . getThreadName ( ) ) ; } if ( isShowSourceEnabled ( ) ) { Log source = e . getLogSource ( ) ; if ( source != null ) { String sourceName = source . getName ( ) ; if ( sourceName != null ) { pre . append ( ',' ) ; pre . append ( sourceName ) ; } } } pre . append ( '>' ) ; pre . append ( ' ' ) ; return pre . toString ( ) ; |
public class ClassUtils { /** * Get a certain annotation parameter of a { @ link TypeElement } .
* See < a href = " https : / / stackoverflow . com / a / 10167558 " > stackoverflow . com < / a > for more information .
* @ param typeElement the type element , that contains the requested annotation
* @ param annotationClass the class of the requested annotation
* @ param annotationParameter the name of the requested annotation parameter
* @ return the requested parameter or null , if no annotation for the provided class was found or no annotation parameter was found
* @ throws NullPointerException if < code > typeElement < / code > or < code > annotationClass < / code > is null */
public static AnnotationValue getAnnotationValue ( TypeElement typeElement , Class < ? > annotationClass , String annotationParameter ) { } } | AnnotationMirror annotationMirror = getAnnotationMirror ( typeElement , annotationClass ) ; return ( annotationMirror != null ) ? getAnnotationValue ( annotationMirror , annotationParameter ) : null ; |
public class IOUtil { /** * 加载词典 , 词典必须遵守HanLP核心词典格式
* @ param pathArray 词典路径 , 可以有任意个 。 每个路径支持用空格表示默认词性 , 比如 “ 全国地名大全 . txt ns ”
* @ return 一个储存了词条的map
* @ throws IOException 异常表示加载失败 */
public static TreeMap < String , CoreDictionary . Attribute > loadDictionary ( String ... pathArray ) throws IOException { } } | TreeMap < String , CoreDictionary . Attribute > map = new TreeMap < String , CoreDictionary . Attribute > ( ) ; for ( String path : pathArray ) { File file = new File ( path ) ; String fileName = file . getName ( ) ; int natureIndex = fileName . lastIndexOf ( ' ' ) ; Nature defaultNature = Nature . n ; if ( natureIndex > 0 ) { String natureString = fileName . substring ( natureIndex + 1 ) ; path = file . getParent ( ) + File . separator + fileName . substring ( 0 , natureIndex ) ; if ( natureString . length ( ) > 0 && ! natureString . endsWith ( ".txt" ) && ! natureString . endsWith ( ".csv" ) ) { defaultNature = Nature . create ( natureString ) ; } } BufferedReader br = new BufferedReader ( new InputStreamReader ( IOUtil . newInputStream ( path ) , "UTF-8" ) ) ; loadDictionary ( br , map , path . endsWith ( ".csv" ) , defaultNature ) ; } return map ; |
public class DefaultThemeController { /** * Removes all link tags in the head if not initialized . */
private void removeCssLinks ( ) { } } | if ( this . isInit ) { return ; } this . isInit = true ; // Remove all existing link element
NodeList < Element > links = this . getHead ( ) . getElementsByTagName ( LinkElement . TAG ) ; int size = links . getLength ( ) ; for ( int i = 0 ; i < size ; i ++ ) { LinkElement elem = LinkElement . as ( links . getItem ( 0 ) ) ; if ( "stylesheet" . equals ( elem . getRel ( ) ) ) { elem . removeFromParent ( ) ; } } |
public class DevUtils { /** * Log a warning message to the logger ' org . archive . util . DevUtils ' made of
* the passed ' note ' and a stack trace based off passed exception .
* @ param ex Exception we print a stacktrace on .
* @ param note Message to print ahead of the stacktrace . */
public static void warnHandle ( Throwable ex , String note ) { } } | logger . warning ( TextUtils . exceptionToString ( note , ex ) ) ; |
public class SwipeLayout { /** * bind a view with a specific
* { @ link com . daimajia . swipe . SwipeLayout . OnRevealListener }
* @ param childId the view id .
* @ param l the target
* { @ link com . daimajia . swipe . SwipeLayout . OnRevealListener } */
public void addRevealListener ( int childId , OnRevealListener l ) { } } | View child = findViewById ( childId ) ; if ( child == null ) { throw new IllegalArgumentException ( "Child does not belong to SwipeListener." ) ; } if ( ! mShowEntirely . containsKey ( child ) ) { mShowEntirely . put ( child , false ) ; } if ( mRevealListeners . get ( child ) == null ) mRevealListeners . put ( child , new ArrayList < OnRevealListener > ( ) ) ; mRevealListeners . get ( child ) . add ( l ) ; |
public class Type2Message { /** * Returns the default flags for a Type - 2 message created in response
* to the given Type - 1 message in the current environment .
* @ return An < code > int < / code > containing the default flags . */
public static int getDefaultFlags ( Type1Message type1 ) { } } | if ( type1 == null ) return DEFAULT_FLAGS ; int flags = NTLMSSP_NEGOTIATE_NTLM ; int type1Flags = type1 . getFlags ( ) ; flags |= ( ( type1Flags & NTLMSSP_NEGOTIATE_UNICODE ) != 0 ) ? NTLMSSP_NEGOTIATE_UNICODE : NTLMSSP_NEGOTIATE_OEM ; if ( ( type1Flags & NTLMSSP_REQUEST_TARGET ) != 0 ) { String domain = getDefaultDomain ( ) ; if ( domain != null ) { flags |= NTLMSSP_REQUEST_TARGET | NTLMSSP_TARGET_TYPE_DOMAIN ; } } return flags ; |
public class XDSRepositoryAuditor { /** * Audits an ITI - 42 Register Document Set - b event for XDS . b Document Repository actors .
* @ param eventOutcome The event outcome indicator
* @ param registryEndpointUri The endpoint of the registry in this transaction
* @ param submissionSetUniqueId The UniqueID of the Submission Set registered
* @ param patientId The Patient Id that this submission pertains to
* @ param purposesOfUse purpose of use codes ( may be taken from XUA token )
* @ param userRoles roles of the human user ( may be taken from XUA token ) */
public void auditRegisterDocumentSetBEvent ( RFC3881EventOutcomeCodes eventOutcome , String repositoryUserId , String userName , String registryEndpointUri , String submissionSetUniqueId , String patientId , List < CodedValueType > purposesOfUse , List < CodedValueType > userRoles ) { } } | if ( ! isAuditorEnabled ( ) ) { return ; } auditRegisterEvent ( new IHETransactionEventTypeCodes . RegisterDocumentSetB ( ) , eventOutcome , repositoryUserId , userName , registryEndpointUri , submissionSetUniqueId , patientId , purposesOfUse , userRoles ) ; |
public class ArtifactoryCollectorTask { /** * Clean up unused artifactory collector items
* @ param collector the { @ link ArtifactoryCollector } */
private void clean ( ArtifactoryCollector collector , List < ArtifactoryRepo > existingRepos ) { } } | // find the server url ' s to collect from
Set < String > serversToBeCollected = new HashSet < > ( ) ; serversToBeCollected . addAll ( collector . getArtifactoryServers ( ) ) ; // find the repos to collect from each server url above
List < Set < String > > repoNamesToBeCollected = new ArrayList < Set < String > > ( ) ; List < String [ ] > allRepos = new ArrayList < > ( ) ; artifactorySettings . getServers ( ) . forEach ( serverSetting -> { allRepos . add ( ( String [ ] ) getRepoAndPatternsForServ ( serverSetting . getRepoAndPatterns ( ) ) . keySet ( ) . toArray ( ) ) ; } ) ; for ( int i = 0 ; i < allRepos . size ( ) ; i ++ ) { Set < String > reposSet = new HashSet < > ( ) ; if ( allRepos . get ( i ) != null ) { reposSet . addAll ( Arrays . asList ( allRepos . get ( i ) ) ) ; } repoNamesToBeCollected . add ( reposSet ) ; } assert ( serversToBeCollected . size ( ) == repoNamesToBeCollected . size ( ) ) ; List < ArtifactoryRepo > stateChangeRepoList = new ArrayList < > ( ) ; for ( ArtifactoryRepo repo : existingRepos ) { if ( isRepoEnabledAndNotCollected ( collector , serversToBeCollected , repoNamesToBeCollected , repo ) || // if it was enabled but not to be collected
isRepoDisabledAndToBeCollected ( collector , serversToBeCollected , repoNamesToBeCollected , repo ) ) { // OR it was disabled and now is to be collected
repo . setEnabled ( isRepoCollected ( collector , serversToBeCollected , repoNamesToBeCollected , repo ) ) ; stateChangeRepoList . add ( repo ) ; } } if ( ! CollectionUtils . isEmpty ( stateChangeRepoList ) ) { artifactoryRepoRepository . save ( stateChangeRepoList ) ; } |
public class SelectByMinFunction { /** * Reduce implementation , returns smaller tuple or value1 if both tuples are
* equal . Comparison highly depends on the order and amount of fields chosen
* as indices . All given fields ( at construction time ) are checked in the same
* order as defined ( at construction time ) . If both tuples are equal in one
* index , the next index is compared . Or if no next index is available value1
* is returned .
* The tuple which has a smaller value at one index will be returned . */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) @ Override public T reduce ( T value1 , T value2 ) throws Exception { for ( int position : fields ) { // Save position of compared key
// Get both values - both implement comparable
Comparable comparable1 = value1 . getFieldNotNull ( position ) ; Comparable comparable2 = value2 . getFieldNotNull ( position ) ; // Compare values
int comp = comparable1 . compareTo ( comparable2 ) ; // If comp is smaller than 0 comparable 1 is smaller .
// Return the smaller value .
if ( comp < 0 ) { return value1 ; } else if ( comp > 0 ) { return value2 ; } } return value1 ; |
public class ListWebACLsResult { /** * An array of < a > WebACLSummary < / a > objects .
* @ param webACLs
* An array of < a > WebACLSummary < / a > objects . */
public void setWebACLs ( java . util . Collection < WebACLSummary > webACLs ) { } } | if ( webACLs == null ) { this . webACLs = null ; return ; } this . webACLs = new java . util . ArrayList < WebACLSummary > ( webACLs ) ; |
public class CmsRemoteShellClient { /** * Updates the internal client state based on the state received from the server . < p >
* @ param result the result of the last shell command execution */
private void updateState ( CmsShellCommandResult result ) { } } | m_errorCode = result . getErrorCode ( ) ; m_prompt = result . getPrompt ( ) ; m_exitCalled = result . isExitCalled ( ) ; m_hasError = result . hasError ( ) ; m_echo = result . hasEcho ( ) ; |
public class AmazonLightsailClient { /** * Returns information about a specific instance snapshot .
* @ param getInstanceSnapshotRequest
* @ return Result of the GetInstanceSnapshot operation returned by the service .
* @ throws ServiceException
* A general service exception .
* @ throws InvalidInputException
* Lightsail throws this exception when user input does not conform to the validation rules of an input
* field . < / p > < note >
* Domain - related APIs are only available in the N . Virginia ( us - east - 1 ) Region . Please set your AWS Region
* configuration to us - east - 1 to create , view , or edit these resources .
* @ throws NotFoundException
* Lightsail throws this exception when it cannot find a resource .
* @ throws OperationFailureException
* Lightsail throws this exception when an operation fails to execute .
* @ throws AccessDeniedException
* Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to
* access a resource .
* @ throws AccountSetupInProgressException
* Lightsail throws this exception when an account is still in the setup in progress state .
* @ throws UnauthenticatedException
* Lightsail throws this exception when the user has not been authenticated .
* @ sample AmazonLightsail . GetInstanceSnapshot
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lightsail - 2016-11-28 / GetInstanceSnapshot " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public GetInstanceSnapshotResult getInstanceSnapshot ( GetInstanceSnapshotRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetInstanceSnapshot ( request ) ; |
public class MultipleInvocationListener { /** * { @ inheritDoc } */
public void willInvoke ( Method method , List < JsonNode > arguments ) { } } | for ( InvocationListener invocationListener : invocationListeners ) { invocationListener . willInvoke ( method , arguments ) ; } |
public class Mealy2ETFWriterIO { /** * Write ETF parts specific for Mealy machines with IO semantics .
* Writes :
* - the initial state ,
* - the valuations for the state ids ,
* - the transitions ,
* - the input alphabet ( for the input labels on edges ) ,
* - the output alphabet ( for the output labels on edges ) .
* @ param pw the Writer .
* @ param mealy the Mealy machine to write .
* @ param inputs the alphabet . */
@ Override protected void writeETF ( PrintWriter pw , MealyMachine < ? , I , ? , O > mealy , Alphabet < I > inputs ) { } } | writeETFInternal ( pw , mealy , inputs ) ; |
public class StatefulBeanO { /** * Remove this < code > SessionBeanO < / code > instance . < p > */
@ Override public final synchronized void remove ( ) throws RemoteException , RemoveException { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "remove: " + this ) ; // It ' s debatable whether a session bean whose ejbRemove fails
// should be kept around or whether the container should
// unilaterally destroy it . For now , allow the remove to fail and
// allow the client to " recover " from the failure , i . e . don ' t
// destroy the session bean if it raises a checked exception
// ( any subclass of RemoteException ) .
canBeRemoved ( ) ; setState ( REMOVING ) ; // d159152
// d367572.1 start
String lifeCycle = null ; // d367572.4
CallbackContextHelper contextHelper = null ; // d399469
try { BeanMetaData bmd = home . beanMetaData ; if ( ivExPcContext != null ) // d515803
{ container . getEJBRuntime ( ) . getEJBJPAContainer ( ) . onRemoveOrDiscard ( ivExPcContext ) ; // d416151.3 d416151.3.5
} if ( ivCallbackKind != CallbackKind . None ) { contextHelper = new CallbackContextHelper ( this ) ; // d630940
beginLifecycleCallback ( LifecycleInterceptorWrapper . MID_PRE_DESTROY , contextHelper , CallbackContextHelper . Contexts . All ) ; // Invoke the PreDestroy callback if any needs to be called .
if ( ivCallbackKind == CallbackKind . SessionBean ) { if ( isTraceOn && // d527372
TEBeanLifeCycleInfo . isTraceEnabled ( ) ) // d367572.4
{ lifeCycle = "ejbRemove" ; TEBeanLifeCycleInfo . traceEJBCallEntry ( lifeCycle ) ; // d161864
} sessionBean . ejbRemove ( ) ; } else if ( ivCallbackKind == CallbackKind . InvocationContext ) { // Invoke the PreDestroy interceptor methods .
InterceptorMetaData imd = home . beanMetaData . ivInterceptorMetaData ; InterceptorProxy [ ] proxies = imd . ivPreDestroyInterceptors ; if ( proxies != null ) { if ( isTraceOn && // d527372
TEBeanLifeCycleInfo . isTraceEnabled ( ) ) // d367572.4
{ lifeCycle = "PreDestroy" ; TEBeanLifeCycleInfo . traceEJBCallEntry ( lifeCycle ) ; } InvocationContextImpl < ? > inv = getInvocationContext ( ) ; inv . doLifeCycle ( proxies , bmd . _moduleMetaData ) ; // d450431 , F743-14982
} } } // d383586 - mark removed and destroy since no exception occurred .
// If there is an exception , the bean will be removed in destroy ( ) .
// We count beanRemoved ( if any ) in destroy ( ) too .
if ( pmiBean != null ) { pmiBean . beanRemoved ( ) ; } removed = true ; destroy ( ) ; } catch ( RemoteException ex ) { FFDCFilter . processException ( ex , CLASS_NAME + ".remove" , "611" , this ) ; if ( isTraceOn && tc . isEventEnabled ( ) ) // d144064
{ Tr . event ( tc , "remove caught exception" , new Object [ ] { this , ex } ) ; // d367572.4 / / d402681
} // d383586 - discard the instance .
discard ( ) ; // d383586
// It is wrong to convert RemoteException to RemoveException , but we
// keep this for backwards compatibility . d591915
throw new RemoveException ( ex . getMessage ( ) ) ; } catch ( Throwable ex ) // d367572.4
{ FFDCFilter . processException ( ex , CLASS_NAME + ".remove" , "611" , this ) ; if ( isTraceOn && tc . isEventEnabled ( ) ) // d144064
{ Tr . event ( tc , "remove caught exception:" , new Object [ ] { this , ex } ) ; // d367572.4 / / d402681
} // d383586 - discard the instance .
// d591915
// It looks like we are non spec - compliant here . In all cases , we
// bury the exception that we caught from the above try block .
// However , the spec implies that there are many cases where we do
// want to throw an exception here .
// In the above try block , we do a number of things , including the
// SessionBean . ejbRemove ( ) method on the user ' s underlying bean instance .
// Presumably , this is a result of the user invoking the . ejbRemove ( )
// method on the interface , and in this case it seems like we would
// fall under the goverence of section 14.3.2 ( tables 17 and 18 ) of the EJB 3.1 spec ,
// which indicates that in all cases where we get an exception , we
// have to re - throw some type of exception ( as opposed to what we
// are doing here , which is to not throw any exception ) .
// Additionally , it appears that this . remove ( ) method gets called into
// when the transaction that the session bean is on is either committed
// or rolled back , which presumably can happen as the result of user
// invoked business method . . . and so the argument could be made that
// this also falls under section 14.3.1 ( tables 15 and 16 ) of the EJB 3.1 spec , which also
// seems to indicate that in all cases where we get an exception , we
// have to re - throw some type of exception .
// If we ever wanted to fix this , things are further complicated
// because it seems like in some cases its the correct behavior to
// not throw an exception here . In the try block above we are also
// executing the preDestroy interceptor methods , and so that seems to
// fall under section 14.3.3 ( table 19 ) of the EJB 3.1 spec , which
// says that we should swallow the exception .
discard ( ) ; // d383586
} finally { if ( isTraceOn && // d527372
TEBeanLifeCycleInfo . isTraceEnabled ( ) ) { if ( lifeCycle != null ) // d367572.4
{ TEBeanLifeCycleInfo . traceEJBCallExit ( lifeCycle ) ; } } // Resume the TX context if it was suspended .
if ( contextHelper != null ) // d399469
{ contextHelper . complete ( true ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "remove: " + this ) ; } // d367572.1 end |
public class GetInstanceStateRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetInstanceStateRequest getInstanceStateRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getInstanceStateRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getInstanceStateRequest . getInstanceName ( ) , INSTANCENAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class NotDependsOn { /** * { @ inheritDoc } */
public final String toDebugString ( ) { } } | final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "packageName=" + getPackageName ( ) + ", " ) ; sb . append ( "includeSubPackages=" + isIncludeSubPackages ( ) + ", " ) ; sb . append ( "comment=" + comment ) ; return sb . toString ( ) ; |
public class GenericCollectionTypeResolver { /** * Determine the generic key type of the given Map class
* ( if it declares one through a generic superclass or generic interface ) .
* @ param mapClass the map class to introspect
* @ return the generic type , or { @ code null } if none */
@ SuppressWarnings ( "rawtypes" ) public static Class < ? > getMapKeyType ( Class < ? extends Map > mapClass ) { } } | return ResolvableType . forClass ( mapClass ) . asMap ( ) . resolveGeneric ( 0 ) ; |
public class EpubMetadata { /** * Parse the container file to get the list of all rootfile packages . */
private List < String > getRootfiles ( ZipInputStream zipStream ) throws Exception { } } | List < String > rootfiles = new ArrayList < > ( ) ; ZipEntry entry = null ; while ( ( entry = zipStream . getNextEntry ( ) ) != null ) { String entryName = entry . getName ( ) ; if ( entryName . endsWith ( "META-INF/container.xml" ) ) { ByteArrayOutputStream content = getZipEntryContent ( zipStream , entry ) ; DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; Document doc = builder . parse ( new ByteArrayInputStream ( content . toByteArray ( ) ) ) ; XPathFactory xPathfactory = XPathFactory . newInstance ( ) ; XPath xpath = xPathfactory . newXPath ( ) ; XPathExpression expr = xpath . compile ( "/container/rootfiles/rootfile" ) ; NodeList rootfileNodes = ( NodeList ) expr . evaluate ( doc , XPathConstants . NODESET ) ; for ( int i = 0 ; i < rootfileNodes . getLength ( ) ; i ++ ) { Node node = rootfileNodes . item ( i ) ; rootfiles . add ( node . getAttributes ( ) . getNamedItem ( "full-path" ) . getNodeValue ( ) ) ; } break ; } } return rootfiles ; |
public class DescribeScalingActivitiesResult { /** * A list of scaling activity objects .
* @ param scalingActivities
* A list of scaling activity objects . */
public void setScalingActivities ( java . util . Collection < ScalingActivity > scalingActivities ) { } } | if ( scalingActivities == null ) { this . scalingActivities = null ; return ; } this . scalingActivities = new java . util . ArrayList < ScalingActivity > ( scalingActivities ) ; |
public class TargetingIdeaServiceLocator { /** * For the given interface , get the stub implementation .
* If this service has no port for the given interface ,
* then ServiceException is thrown . */
public java . rmi . Remote getPort ( Class serviceEndpointInterface ) throws javax . xml . rpc . ServiceException { } } | try { if ( com . google . api . ads . adwords . axis . v201809 . o . TargetingIdeaServiceInterface . class . isAssignableFrom ( serviceEndpointInterface ) ) { com . google . api . ads . adwords . axis . v201809 . o . TargetingIdeaServiceSoapBindingStub _stub = new com . google . api . ads . adwords . axis . v201809 . o . TargetingIdeaServiceSoapBindingStub ( new java . net . URL ( TargetingIdeaServiceInterfacePort_address ) , this ) ; _stub . setPortName ( getTargetingIdeaServiceInterfacePortWSDDServiceName ( ) ) ; return _stub ; } } catch ( java . lang . Throwable t ) { throw new javax . xml . rpc . ServiceException ( t ) ; } throw new javax . xml . rpc . ServiceException ( "There is no stub implementation for the interface: " + ( serviceEndpointInterface == null ? "null" : serviceEndpointInterface . getName ( ) ) ) ; |
public class CollectionUtil { /** * Remove element from a list if it matches a predicate .
* < b > Note : < / b > the list must implement { @ link java . util . RandomAccess } to be efficient .
* @ param values to be iterated over .
* @ param predicate to test the value against
* @ param < T > type of the value .
* @ return the number of items remove . */
public static < T > int removeIf ( final List < T > values , final Predicate < T > predicate ) { } } | int size = values . size ( ) ; int total = 0 ; for ( int i = 0 ; i < size ; ) { final T value = values . get ( i ) ; if ( predicate . test ( value ) ) { values . remove ( i ) ; total ++ ; size -- ; } else { i ++ ; } } return total ; |
public class StringUtils { /** * Check whether the given { @ code CharSequence } contains any whitespace characters .
* @ param str the { @ code CharSequence } to check ( may be { @ code null } )
* @ return { @ code true } if the { @ code CharSequence } is not empty and contains at least 1
* whitespace character
* @ see Character # isWhitespace */
public static boolean containsWhitespace ( @ Nullable final CharSequence str ) { } } | if ( ! StringUtils . hasLength ( str ) ) { return false ; } final int strLen = str . length ( ) ; for ( int i = 0 ; i < strLen ; i ++ ) { if ( Character . isWhitespace ( str . charAt ( i ) ) ) { return true ; } } return false ; |
public class CLI { /** * Connect to the server using a specified host and port .
* @ param controllerHost The host name .
* @ param controllerPort The port .
* @ param username The user name for logging in .
* @ param password The password for logging in . */
public void connect ( String controllerHost , int controllerPort , String username , char [ ] password ) { } } | connect ( "remote+http" , controllerHost , controllerPort , username , password , null ) ; |
public class Selector { /** * Gets the ordering value for this Selector .
* @ return ordering * The fields on which you want to sort , and the sort order . The
* order in the list is
* significant : The first element in the list indicates
* the primary sort order , the next
* specifies the secondary sort order and so on . */
public com . google . api . ads . adwords . axis . v201809 . cm . OrderBy [ ] getOrdering ( ) { } } | return ordering ; |
public class TemplateParser { /** * In some cases we want to skip expression processing for optimization . This is when we are sure
* the expression is valid and there is no need to create a Java method for it .
* @ param expressionString The expression to asses
* @ return true if we can skip the expression */
private boolean shouldSkipExpressionProcessing ( String expressionString ) { } } | // We don ' t skip if it ' s a component prop as we want Java validation
// We don ' t optimize String expression , as we want GWT to convert Java values
// to String for us ( Enums , wrapped primitives . . . )
return currentProp == null && ! String . class . getCanonicalName ( ) . equals ( currentExpressionReturnType . toString ( ) ) && isSimpleVueJsExpression ( expressionString ) ; |
public class MUCScorer { /** * Returns absent if the score is undefined ( e . g . one side is all singletons ) . */
public Optional < FMeasureInfo > score ( final Iterable < ? extends Iterable < ? > > predicted , final Iterable < ? extends Iterable < ? > > gold ) { } } | final List < Set < Object > > predictedAsSets = CorefScorerUtils . toSets ( predicted ) ; final List < Set < Object > > goldAsSets = CorefScorerUtils . toSets ( gold ) ; final Map < Object , Set < Object > > predictedItemToGroup = CollectionUtils . makeElementsToContainersMap ( predictedAsSets ) ; final Map < Object , Set < Object > > goldItemToGroup = CollectionUtils . makeElementsToContainersMap ( goldAsSets ) ; CorefScorerUtils . checkPartitionsOverSameElements ( predictedItemToGroup . keySet ( ) , goldItemToGroup . keySet ( ) ) ; final Optional < Float > recall = mucScoreComponent ( goldAsSets , predictedAsSets , predictedItemToGroup ) ; final Optional < Float > precision = mucScoreComponent ( predictedAsSets , goldAsSets , goldItemToGroup ) ; if ( recall . isPresent ( ) && precision . isPresent ( ) ) { // why are these floats ?
return Optional . < FMeasureInfo > of ( new PrecisionRecallPair ( precision . get ( ) , recall . get ( ) ) ) ; } else { return Optional . absent ( ) ; } |
public class JsJmsTextMessageImpl { /** * Return a DOM Document representation of the message payload .
* Javadoc description supplied by the JsApiMessageImpl superclass . */
final Document getPayloadDocument ( ) throws ParserConfigurationException , IOException , UnsupportedEncodingException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getPayloadDocument" ) ; Document domDoc = null ; // If we already have a Document cached we don ' t need to build it again
if ( softRefToDocument != null ) { domDoc = softRefToDocument . get ( ) ; } // Otherwise we ' ll take the hit of building it , and cache it in a soft reference
if ( domDoc == null ) { String text = getText ( ) ; if ( ( text != null ) && ( text . length ( ) > 0 ) ) { DocumentBuilderFactory domFactory = DocumentBuilderFactory . newInstance ( ) ; // We need to tell the factory that we want it to be namespace aware .
domFactory . setNamespaceAware ( true ) ; DocumentBuilder builder = domFactory . newDocumentBuilder ( ) ; InputSource is = new InputSource ( new StringReader ( text ) ) ; try { domDoc = builder . parse ( is ) ; softRefToDocument = new SoftReference < Document > ( domDoc ) ; } catch ( SAXException e ) { // No FFDC code needed
// This is not really an error - it just means the data is not XML .
// As the XPath Expression can ' t evaluate to True we just set the document to null ;
domDoc = null ; } } else { domDoc = null ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getPayloadDocument" , domDoc ) ; return domDoc ; |
public class HTTaxinvoiceServiceImp { /** * ( non - Javadoc )
* @ see com . popbill . api . HTTaxinvoiceService # GetXML ( java . lang . String , java . lang . String , java . lang . String ) */
@ Override public HTTaxinvoiceXMLResponse getXML ( String CorpNum , String NTSConfirmNum , String UserID ) throws PopbillException { } } | if ( NTSConfirmNum . length ( ) != 24 ) throw new PopbillException ( - 99999999 , "국세청승인번호가 올바르지 않았습니다." ) ; return httpget ( "/HomeTax/Taxinvoice/" + NTSConfirmNum + "?T=xml" , CorpNum , UserID , HTTaxinvoiceXMLResponse . class ) ; |
public class StringUtil { /** * Get the stack trace of the supplied exception .
* @ param throwable the exception for which the stack trace is to be returned
* @ return the stack trace , or null if the supplied exception is null */
public static String getStackTrace ( Throwable throwable ) { } } | if ( throwable == null ) return null ; final ByteArrayOutputStream bas = new ByteArrayOutputStream ( ) ; final PrintWriter pw = new PrintWriter ( bas ) ; throwable . printStackTrace ( pw ) ; pw . close ( ) ; return bas . toString ( ) ; |
public class ApiOvhSms { /** * Sms sent associated to the sms account
* REST : GET / sms / { serviceName } / virtualNumbers / { number } / outgoing
* @ param sender [ required ] Filter the value of sender property ( = )
* @ param receiver [ required ] Filter the value of receiver property ( = )
* @ param tag [ required ] Filter the value of tag property ( = )
* @ param creationDatetime _ from [ required ] Filter the value of creationDatetime property ( > = )
* @ param deliveryReceipt [ required ] Filter the value of deliveryReceipt property ( = )
* @ param ptt [ required ] Filter the value of ptt property ( = )
* @ param creationDatetime _ to [ required ] Filter the value of creationDatetime property ( < = )
* @ param differedDelivery [ required ] Filter the value of differedDelivery property ( = )
* @ param serviceName [ required ] The internal name of your SMS offer
* @ param number [ required ] The virtual number */
public ArrayList < Long > serviceName_virtualNumbers_number_outgoing_GET ( String serviceName , String number , Date creationDatetime_from , Date creationDatetime_to , Long deliveryReceipt , Long differedDelivery , Long ptt , String receiver , String sender , String tag ) throws IOException { } } | String qPath = "/sms/{serviceName}/virtualNumbers/{number}/outgoing" ; StringBuilder sb = path ( qPath , serviceName , number ) ; query ( sb , "creationDatetime.from" , creationDatetime_from ) ; query ( sb , "creationDatetime.to" , creationDatetime_to ) ; query ( sb , "deliveryReceipt" , deliveryReceipt ) ; query ( sb , "differedDelivery" , differedDelivery ) ; query ( sb , "ptt" , ptt ) ; query ( sb , "receiver" , receiver ) ; query ( sb , "sender" , sender ) ; query ( sb , "tag" , tag ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t2 ) ; |
public class CenterLossOutputLayer { /** * Compute the score for each example individually , after labels and input have been set .
* @ param fullNetRegTerm Regularization term for the entire network ( or , 0.0 to not include regularization )
* @ return A column INDArray of shape [ numExamples , 1 ] , where entry i is the score of the ith example */
@ Override public INDArray computeScoreForExamples ( double fullNetRegTerm , LayerWorkspaceMgr workspaceMgr ) { } } | if ( input == null || labels == null ) throw new IllegalStateException ( "Cannot calculate score without input and labels " + layerId ( ) ) ; INDArray preOut = preOutput2d ( false , workspaceMgr ) ; // calculate the intra - class score component
INDArray centers = params . get ( CenterLossParamInitializer . CENTER_KEY ) ; INDArray centersForExamples = labels . mmul ( centers ) ; INDArray intraClassScoreArray = input . sub ( centersForExamples ) ; // calculate the inter - class score component
ILossFunction interClassLoss = layerConf ( ) . getLossFn ( ) ; INDArray scoreArray = interClassLoss . computeScoreArray ( getLabels2d ( workspaceMgr , ArrayType . FF_WORKING_MEM ) , preOut , layerConf ( ) . getActivationFn ( ) , maskArray ) ; scoreArray . addi ( intraClassScoreArray . muli ( layerConf ( ) . getLambda ( ) / 2 ) ) ; if ( fullNetRegTerm != 0.0 ) { scoreArray . addi ( fullNetRegTerm ) ; } return workspaceMgr . leverageTo ( ArrayType . ACTIVATIONS , scoreArray ) ; |
public class PortletPreferencesJsonDaoImpl { /** * Read the specified portlet preference and parse it as a JSON string into the specified type .
* If the preference is null returns null .
* @ param prefs Preferences to read from
* @ param key Preference key to read from
* @ param type The class type parse the JSON into */
@ Override public < E > E getJson ( PortletPreferences prefs , String key , Class < E > type ) throws IOException { } } | final String prefValue = StringUtils . trimToNull ( prefs . getValue ( key , null ) ) ; if ( prefValue == null ) { return null ; } return mapper . readValue ( prefValue , type ) ; |
public class XGMMLUtility { /** * Write the XGMML start using the { @ code graphName } as the label .
* @ param name { @ link String } , the name of the XGMML graph
* @ param writer { @ link PrintWriter } , the writer */
public static void writeStart ( String name , PrintWriter writer ) { } } | StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<graph xmlns='http://www.cs.rpi.edu/XGMML' " ) . append ( "xmlns:ns2='http://www.w3.org/1999/xlink' " ) . append ( "xmlns:cy='http://www.cytoscape.org' " ) . append ( "Graphic='1' label='" ) . append ( name ) . append ( "' directed='1'>\n" ) ; writer . write ( sb . toString ( ) ) ; |
public class TeaToolsUtils { /** * Loads and returns the runtime context classes specified by the
* ContextClassEntry array .
* @ return a 2 element Object array : < br >
* < pre >
* index [ 0 ] is the Class [ ] containing the context classes .
* index [ 1 ] is the String [ ] containing the context prefix names . */
public Object [ ] loadContextClasses ( ClassLoader loader , ContextClassEntry [ ] contextClasses ) throws Exception { } } | if ( loader == null ) { throw new IllegalArgumentException ( "ClassLoader is null" ) ; } if ( contextClasses == null || contextClasses . length == 0 ) { throw new IllegalArgumentException ( "No Context Classes" ) ; } Vector < Class < ? > > classVector = new Vector < Class < ? > > ( contextClasses . length ) ; String [ ] prefixNames = new String [ contextClasses . length ] ; String className = null ; for ( int i = 0 ; i < contextClasses . length ; i ++ ) { className = contextClasses [ i ] . getContextClassName ( ) ; Class < ? > contextClass = loader . loadClass ( className ) ; classVector . addElement ( contextClass ) ; String prefixName = contextClasses [ i ] . getPrefixName ( ) ; if ( prefixName != null ) { prefixNames [ i ] = prefixName + "$" ; } else { prefixNames [ i ] = null ; } } Class < ? > [ ] classes = new Class < ? > [ classVector . size ( ) ] ; classVector . copyInto ( classes ) ; return new Object [ ] { classes , prefixNames } ; |
public class Model { /** * 获得特征所在权重数组
* @ param featureStr
* @ return */
public float [ ] getFeature ( char ... chars ) { } } | if ( chars == null ) { return null ; } SmartForest < float [ ] > sf = featureTree ; sf = sf . getBranch ( chars ) ; if ( sf == null || sf . getParam ( ) == null ) { return null ; } return sf . getParam ( ) ; |
public class rewritepolicy_rewritepolicylabel_binding { /** * Use this API to fetch filtered set of rewritepolicy _ rewritepolicylabel _ binding resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static rewritepolicy_rewritepolicylabel_binding [ ] get_filtered ( nitro_service service , String name , String filter ) throws Exception { } } | rewritepolicy_rewritepolicylabel_binding obj = new rewritepolicy_rewritepolicylabel_binding ( ) ; obj . set_name ( name ) ; options option = new options ( ) ; option . set_filter ( filter ) ; rewritepolicy_rewritepolicylabel_binding [ ] response = ( rewritepolicy_rewritepolicylabel_binding [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class Matrix4d { /** * Apply an arcball view transformation to this matrix with the given < code > radius < / code > and < code > center < / code >
* position of the arcball and the specified X and Y rotation angles .
* This method is equivalent to calling : < code > translate ( 0 , 0 , - radius ) . rotateX ( angleX ) . rotateY ( angleY ) . translate ( - center . x , - center . y , - center . z ) < / code >
* @ param radius
* the arcball radius
* @ param center
* the center position of the arcball
* @ param angleX
* the rotation angle around the X axis in radians
* @ param angleY
* the rotation angle around the Y axis in radians
* @ return this */
public Matrix4d arcball ( double radius , Vector3dc center , double angleX , double angleY ) { } } | return arcball ( radius , center . x ( ) , center . y ( ) , center . z ( ) , angleX , angleY , this ) ; |
public class AsynchronousRequest { /** * For more info on Finishers API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / finishers " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see Finisher finisher info */
public void getAllFinisherID ( Callback < List < Integer > > callback ) throws NullPointerException { } } | gw2API . getAllFinisherIDs ( ) . enqueue ( callback ) ; |
public class BidiagonalDecompositionRow_DDRM { /** * Sets up internal data structures and creates a copy of the input matrix .
* @ param A The input matrix . Not modified . */
protected void init ( DMatrixRMaj A ) { } } | UBV = A ; m = UBV . numRows ; n = UBV . numCols ; min = Math . min ( m , n ) ; int max = Math . max ( m , n ) ; if ( b . length < max + 1 ) { b = new double [ max + 1 ] ; u = new double [ max + 1 ] ; } if ( gammasU . length < m ) { gammasU = new double [ m ] ; } if ( gammasV . length < n ) { gammasV = new double [ n ] ; } |
public class OperationSupport { /** * Create a resource .
* @ param resource resource provided
* @ param outputType resource type you want as output
* @ param < T > template argument for output type
* @ param < I > template argument for resource
* @ return returns de - serialized version of apiserver response in form of type provided
* @ throws ExecutionException Execution Exception
* @ throws InterruptedException Interrupted Exception
* @ throws KubernetesClientException KubernetesClientException
* @ throws IOException IOException */
protected < T , I > T handleCreate ( I resource , Class < T > outputType ) throws ExecutionException , InterruptedException , KubernetesClientException , IOException { } } | RequestBody body = RequestBody . create ( JSON , JSON_MAPPER . writeValueAsString ( resource ) ) ; Request . Builder requestBuilder = new Request . Builder ( ) . post ( body ) . url ( getNamespacedUrl ( checkNamespace ( resource ) ) ) ; return handleResponse ( requestBuilder , outputType , Collections . < String , String > emptyMap ( ) ) ; |
public class FpKit { /** * Concatenates ( appends ) a single elements to an existing list
* @ param l the list onto which to append the element
* @ param t the element to append
* @ param < T > the type of elements of the list
* @ return a < strong > new < / strong > list componsed of the first list elements and the new element */
public static < T > List < T > concat ( List < T > l , T t ) { } } | return concat ( l , singletonList ( t ) ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public BDDUBASE createBDDUBASEFromString ( EDataType eDataType , String initialValue ) { } } | BDDUBASE result = BDDUBASE . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class WebAppTypeImpl { /** * If not already created , a new < code > session - config < / code > element will be created and returned .
* Otherwise , the first existing < code > session - config < / code > element will be returned .
* @ return the instance defined for the element < code > session - config < / code > */
public SessionConfigType < WebAppType < T > > getOrCreateSessionConfig ( ) { } } | List < Node > nodeList = childNode . get ( "session-config" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new SessionConfigTypeImpl < WebAppType < T > > ( this , "session-config" , childNode , nodeList . get ( 0 ) ) ; } return createSessionConfig ( ) ; |
public class AppDescriptor { /** * Deserialize an ` AppDescriptor ` from byte array
* @ param bytes
* the byte array
* @ return
* an ` AppDescriptor ` instance */
public static AppDescriptor deserializeFrom ( byte [ ] bytes ) { } } | try { ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; ObjectInputStream ois = new ObjectInputStream ( bais ) ; return ( AppDescriptor ) ois . readObject ( ) ; } catch ( IOException e ) { throw E . ioException ( e ) ; } catch ( ClassNotFoundException e ) { throw E . unexpected ( e ) ; } |
public class JBasePanel { /** * Get the sub - component with this name .
* @ param strName The name I ' m looking for .
* @ param parent The container to start the search from .
* @ return The component with this name ( or null ) . */
public Component getComponentByName ( String strName , Container parent ) { } } | for ( int i = 0 ; i < parent . getComponentCount ( ) ; i ++ ) { Component component = parent . getComponent ( i ) ; if ( strName . equals ( component . getName ( ) ) ) return component ; if ( component instanceof Container ) { component = this . getComponentByName ( strName , ( Container ) component ) ; if ( component != null ) return component ; } } return null ; // Not found |
public class nspbr6_stats { /** * Use this API to fetch the statistics of all nspbr6 _ stats resources that are configured on netscaler . */
public static nspbr6_stats [ ] get ( nitro_service service , options option ) throws Exception { } } | nspbr6_stats obj = new nspbr6_stats ( ) ; nspbr6_stats [ ] response = ( nspbr6_stats [ ] ) obj . stat_resources ( service , option ) ; return response ; |
public class DeleteLambdaMojo { /** * The entry point into the AWS lambda function . */
public void execute ( ) throws MojoExecutionException { } } | super . execute ( ) ; try { lambdaFunctions . forEach ( context -> { try { deleteTriggers . andThen ( deleteFunction ) . apply ( context . withFunctionArn ( lambdaClient . getFunction ( new GetFunctionRequest ( ) . withFunctionName ( context . getFunctionName ( ) ) ) . getConfiguration ( ) . getFunctionArn ( ) ) ) ; } catch ( Exception e ) { getLog ( ) . error ( e . getMessage ( ) ) ; } } ) ; } catch ( Exception e ) { getLog ( ) . error ( e . getMessage ( ) , e ) ; } |
public class Example { /** * Constructs an example from the given { @ code inputVar } and { @ code outputVar }
* @ param inputVar
* @ param outputVar */
public static < I , O > Example < I , O > create ( I input , O output ) { } } | return new Example < I , O > ( input , output ) ; |
public class JaxbUtils { /** * Convert a string to an object of a given class .
* @ param cl Type of object
* @ param s Input string
* @ return Object of the given type */
public static < T > T unmarshal ( Class < T > cl , String s ) throws JAXBException { } } | return unmarshal ( cl , new StringReader ( s ) ) ; |
public class AmazonWorkspacesClient { /** * Creates an IP access control group .
* An IP access control group provides you with the ability to control the IP addresses from which users are allowed
* to access their WorkSpaces . To specify the CIDR address ranges , add rules to your IP access control group and
* then associate the group with your directory . You can add rules when you create the group or at any time using
* < a > AuthorizeIpRules < / a > .
* There is a default IP access control group associated with your directory . If you don ' t associate an IP access
* control group with your directory , the default group is used . The default group includes a default rule that
* allows users to access their WorkSpaces from anywhere . You cannot modify the default IP access control group for
* your directory .
* @ param createIpGroupRequest
* @ return Result of the CreateIpGroup operation returned by the service .
* @ throws InvalidParameterValuesException
* One or more parameter values are not valid .
* @ throws ResourceLimitExceededException
* Your resource limits have been exceeded .
* @ throws ResourceAlreadyExistsException
* The specified resource already exists .
* @ throws ResourceCreationFailedException
* The resource could not be created .
* @ throws AccessDeniedException
* The user is not authorized to access a resource .
* @ sample AmazonWorkspaces . CreateIpGroup
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / workspaces - 2015-04-08 / CreateIpGroup " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public CreateIpGroupResult createIpGroup ( CreateIpGroupRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateIpGroup ( request ) ; |
public class FuzzyActivityDomain { /** * Add one or more sensor events to this { @ link MetaConstraint } .
* @ param events The events to add . */
public void addFuzzySensorEvents ( FuzzySensorEvent ... events ) { } } | for ( FuzzySensorEvent e : events ) updateSensorData ( e ) ; for ( int i = 0 ; i < solver . getVariables ( ) . length ; i ++ ) { groundActivity . add ( ( FuzzyActivity ) solver . getVariables ( ) [ i ] ) ; } setCrispCons ( ) ; |
public class DB { /** * Updates a post meta value if it exists or inserts if it does not .
* @ param postId The post id .
* @ param metaKey The key .
* @ param metaValue The value .
* @ throws SQLException on database error . */
public void updatePostMetaValue ( final long postId , final String metaKey , final String metaValue ) throws SQLException { } } | Meta currMeta = selectPostMetaValue ( postId , metaKey ) ; if ( currMeta == null ) { Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . setPostMetaTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( insertPostMetaSQL ) ; stmt . setLong ( 1 , postId ) ; stmt . setString ( 2 , metaKey ) ; stmt . setString ( 3 , metaValue ) ; stmt . executeUpdate ( ) ; } finally { ctx . stop ( ) ; SQLUtil . closeQuietly ( conn , stmt ) ; } } else { Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . setPostMetaTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostMetaValueSQL ) ; stmt . setString ( 1 , metaValue ) ; stmt . setString ( 2 , metaKey ) ; stmt . setLong ( 3 , postId ) ; stmt . executeUpdate ( ) ; } finally { ctx . stop ( ) ; SQLUtil . closeQuietly ( conn , stmt ) ; } } |
public class LinuxUtils { /** * Checks if the given extension is already registered .
* @ param fileTypeExtension File extension with leading dot , e . g .
* < code > . bar < / code > .
* @ return < code > true < / code > if extension is registered , < code > false < / code >
* otherwise .
* @ throws OSException */
@ Override public boolean isFileExtensionRegistered ( String fileTypeExtension ) throws OSException { } } | try { getFileExtension ( fileTypeExtension ) ; return true ; } catch ( OSException e ) { return false ; } |
public class ColorPickerDialog { /** * region Presets Picker */
View createPresetsView ( ) { } } | View contentView = View . inflate ( getActivity ( ) , R . layout . cpv_dialog_presets , null ) ; shadesLayout = ( LinearLayout ) contentView . findViewById ( R . id . shades_layout ) ; transparencySeekBar = ( SeekBar ) contentView . findViewById ( R . id . transparency_seekbar ) ; transparencyPercText = ( TextView ) contentView . findViewById ( R . id . transparency_text ) ; GridView gridView = ( GridView ) contentView . findViewById ( R . id . gridView ) ; loadPresets ( ) ; if ( showColorShades ) { createColorShades ( color ) ; } else { shadesLayout . setVisibility ( View . GONE ) ; contentView . findViewById ( R . id . shades_divider ) . setVisibility ( View . GONE ) ; } adapter = new ColorPaletteAdapter ( new ColorPaletteAdapter . OnColorSelectedListener ( ) { @ Override public void onColorSelected ( int newColor ) { if ( color == newColor ) { // Double tab selects the color
ColorPickerDialog . this . onColorSelected ( color ) ; dismiss ( ) ; return ; } color = newColor ; if ( showColorShades ) { createColorShades ( color ) ; } } } , presets , getSelectedItemPosition ( ) , colorShape ) ; gridView . setAdapter ( adapter ) ; if ( showAlphaSlider ) { setupTransparency ( ) ; } else { contentView . findViewById ( R . id . transparency_layout ) . setVisibility ( View . GONE ) ; contentView . findViewById ( R . id . transparency_title ) . setVisibility ( View . GONE ) ; } return contentView ; |
public class GLINERGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setXPOS ( Integer newXPOS ) { } } | Integer oldXPOS = xpos ; xpos = newXPOS ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . GLINERG__XPOS , oldXPOS , xpos ) ) ; |
public class PreconditionRequired { /** * Returns a static PreconditionRequired instance and set the { @ link # payload } thread local
* with cause specified .
* When calling the instance on { @ link # getMessage ( ) } method , it will return whatever
* stored in the { @ link # payload } thread local
* @ param cause the cause
* @ return a static PreconditionRequired instance as described above */
public static PreconditionRequired of ( Throwable cause ) { } } | if ( _localizedErrorMsg ( ) ) { return of ( cause , defaultMessage ( PRECONDITION_REQUIRED ) ) ; } else { touchPayload ( ) . cause ( cause ) ; return _INSTANCE ; } |
public class CDBFactory { /** * Used by iSCSI transport layer to decode CDB data off the wire .
* @ param input
* @ return
* @ throws BufferUnderflowException
* @ throws IOException */
@ SuppressWarnings ( "unchecked" ) public CDB decode ( ByteBuffer input ) throws IOException { } } | byte [ ] opcode = new byte [ 1 ] ; input . duplicate ( ) . get ( opcode ) ; // Read in the operation code without changing the position
DataInputStream in = new DataInputStream ( new ByteArrayInputStream ( opcode ) ) ; int operationCode = in . readUnsignedByte ( ) ; if ( ! _cdbs . containsKey ( operationCode ) ) { throw new IOException ( String . format ( "Could not create new cdb with unsupported operation code: %x" , operationCode ) ) ; } try { CDB cdb = _cdbs . get ( operationCode ) . newInstance ( ) ; cdb . decode ( null , input ) ; return cdb ; } catch ( InstantiationException e ) { throw new IOException ( "Could not create new cdb parser: " + e . getMessage ( ) ) ; } catch ( IllegalAccessException e ) { throw new IOException ( "Could not create new cdb parser: " + e . getMessage ( ) ) ; } |
public class ApiOvhDedicatedCloud { /** * Change Private Cloud user properties
* REST : POST / dedicatedCloud / { serviceName } / user / { userId } / changeProperties
* @ param fullAdminRo [ required ] Defines if the user is a full admin in readonly
* @ param canManageNetwork [ required ] Defines if the user can manage the network
* @ param canManageRights [ required ] Defines if the user can manage the users rights
* @ param receiveAlerts [ required ] Defines if the user receives technical alerts
* @ param nsxRight [ required ] Is this User able to access nsx interface ( requires NSX option )
* @ param tokenValidator [ required ] Defines if the user can confirm security tokens ( if a compatible option is enabled )
* @ param lastName [ required ] Last name of the user
* @ param firstName [ required ] First name of the user
* @ param phoneNumber [ required ] Mobile phone number of the user in international format ( + prefix . number )
* @ param email [ required ] Email address of the user
* @ param canManageIpFailOvers [ required ] Defines if the user can manage ip failovers
* @ param serviceName [ required ] Domain of the service
* @ param userId [ required ] */
public OvhTask serviceName_user_userId_changeProperties_POST ( String serviceName , Long userId , Boolean canManageIpFailOvers , Boolean canManageNetwork , Boolean canManageRights , String email , String firstName , Boolean fullAdminRo , String lastName , Boolean nsxRight , String phoneNumber , Boolean receiveAlerts , Boolean tokenValidator ) throws IOException { } } | String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/changeProperties" ; StringBuilder sb = path ( qPath , serviceName , userId ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "canManageIpFailOvers" , canManageIpFailOvers ) ; addBody ( o , "canManageNetwork" , canManageNetwork ) ; addBody ( o , "canManageRights" , canManageRights ) ; addBody ( o , "email" , email ) ; addBody ( o , "firstName" , firstName ) ; addBody ( o , "fullAdminRo" , fullAdminRo ) ; addBody ( o , "lastName" , lastName ) ; addBody ( o , "nsxRight" , nsxRight ) ; addBody ( o , "phoneNumber" , phoneNumber ) ; addBody ( o , "receiveAlerts" , receiveAlerts ) ; addBody ( o , "tokenValidator" , tokenValidator ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.