signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AbstractController { /** * Link a Service to an event triggered on a node .
* @ param node the node to follow
* @ param eventType the type of the event to follow
* @ param serviceClass the service to call
* @ param waveType the method of the service call
* @ param callback the call back to use to check if the service can be called
* @ param waveData additional Wave data
* @ param < E > The type of JavaFX Event to track */
protected < E extends Event > void linkService ( final Node node , final javafx . event . EventType < E > eventType , final Class < ? extends Service > serviceClass , final WaveType waveType , final Callback < E , Boolean > callback , final WaveData < ? > ... waveData ) { } } | // LinkService
node . addEventHandler ( eventType , event -> { if ( callback == null || callback . call ( event ) ) { model ( ) . returnData ( serviceClass , waveType , waveData ) ; } } ) ; |
public class Configuration { /** * Creates a new configuration by adding the new options to the options used in this configuration .
* @ param options options to add
* @ return a new configuration */
public Configuration addOptions ( Option ... options ) { } } | EnumSet < Option > opts = EnumSet . noneOf ( Option . class ) ; opts . addAll ( this . options ) ; opts . addAll ( asList ( options ) ) ; return Configuration . builder ( ) . jsonProvider ( jsonProvider ) . mappingProvider ( mappingProvider ) . options ( opts ) . evaluationListener ( evaluationListeners ) . build ( ) ; |
public class LTieFunctionBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */
@ Nonnull public static < T1 , T2 > LTieFunctionBuilder < T1 , T2 > tieFunction ( Consumer < LTieFunction < T1 , T2 > > consumer ) { } } | return new LTieFunctionBuilder ( consumer ) ; |
public class DocumentRootImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public NotificationChain eInverseRemove ( InternalEObject otherEnd , int featureID , NotificationChain msgs ) { } } | switch ( featureID ) { case ColorPackage . DOCUMENT_ROOT__MIXED : return ( ( InternalEList < ? > ) getMixed ( ) ) . basicRemove ( otherEnd , msgs ) ; case ColorPackage . DOCUMENT_ROOT__XMLNS_PREFIX_MAP : return ( ( InternalEList < ? > ) getXMLNSPrefixMap ( ) ) . basicRemove ( otherEnd , msgs ) ; case ColorPackage . DOCUMENT_ROOT__XSI_SCHEMA_LOCATION : return ( ( InternalEList < ? > ) getXSISchemaLocation ( ) ) . basicRemove ( otherEnd , msgs ) ; } return super . eInverseRemove ( otherEnd , featureID , msgs ) ; |
public class AbstractNotificationBuilder { /** * Sets the message UUID .
* The message UUID is optional application - specific identifier for
* book - keeping and associate it with the response .
* @ param messageId notification message ID
* @ return this */
public A messageId ( String messageId ) { } } | this . headers . add ( Pair . of ( "X-MessageId" , messageId ) ) ; return ( A ) this ; |
public class ReflectCache { /** * 往缓存里放入方法参数签名
* @ param serviceName 服务名 ( 非接口名 )
* @ param methodName 方法名
* @ param argSigs 方法参数签名 */
public static void putMethodSigsCache ( String serviceName , String methodName , String [ ] argSigs ) { } } | ConcurrentHashMap < String , String [ ] > cacheSigs = NOT_OVERLOAD_METHOD_SIGS_CACHE . get ( serviceName ) ; if ( cacheSigs == null ) { cacheSigs = new ConcurrentHashMap < String , String [ ] > ( ) ; ConcurrentHashMap < String , String [ ] > old = NOT_OVERLOAD_METHOD_SIGS_CACHE . putIfAbsent ( serviceName , cacheSigs ) ; if ( old != null ) { cacheSigs = old ; } } cacheSigs . putIfAbsent ( methodName , argSigs ) ; |
public class BasePanel { /** * Display this screen ' s hidden params .
* @ param out The html out stream .
* @ exception DBException File exception . */
public Map < String , Object > getHiddenParams ( ) { } } | Map < String , Object > mapParams = new Hashtable < String , Object > ( ) ; return mapParams ; |
public class PoiWriter { /** * Filter categories , i . e . without POIs and children . */
private void filterCategories ( ) throws SQLException { } } | LOGGER . info ( "Filtering categories..." ) ; PreparedStatement pStmtChildren = this . conn . prepareStatement ( "SELECT COUNT(*) FROM poi_categories WHERE parent = ?;" ) ; PreparedStatement pStmtPoi = this . conn . prepareStatement ( "SELECT COUNT(*) FROM poi_category_map WHERE category = ?;" ) ; PreparedStatement pStmtDel = this . conn . prepareStatement ( "DELETE FROM poi_categories WHERE id = ?;" ) ; Statement stmt = this . conn . createStatement ( ) ; ResultSet rs = stmt . executeQuery ( "SELECT id FROM poi_categories ORDER BY id;" ) ; while ( rs . next ( ) ) { int id = rs . getInt ( 1 ) ; pStmtChildren . setInt ( 1 , id ) ; ResultSet rsChildren = pStmtChildren . executeQuery ( ) ; if ( rsChildren . next ( ) ) { long nChildren = rsChildren . getLong ( 1 ) ; if ( nChildren == 0 ) { pStmtPoi . setInt ( 1 , id ) ; ResultSet rsPoi = pStmtPoi . executeQuery ( ) ; if ( rsPoi . next ( ) ) { long nPoi = rsPoi . getLong ( 1 ) ; // If category not have POI , delete it from DB
if ( nPoi == 0 ) { pStmtDel . setInt ( 1 , id ) ; pStmtDel . executeUpdate ( ) ; } } } } } |
public class host_device { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | host_device_responses result = ( host_device_responses ) service . get_payload_formatter ( ) . string_to_resource ( host_device_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . host_device_response_array ) ; } host_device [ ] result_host_device = new host_device [ result . host_device_response_array . length ] ; for ( int i = 0 ; i < result . host_device_response_array . length ; i ++ ) { result_host_device [ i ] = result . host_device_response_array [ i ] . host_device [ 0 ] ; } return result_host_device ; |
public class VTimeZone { /** * Parse individual RRULE
* On return -
* int [ 0 ] month calculated by BYMONTH - 1 , or - 1 when not found
* int [ 1 ] day of week in BYDAY , or 0 when not found
* int [ 2 ] day of week ordinal number in BYDAY , or 0 when not found
* int [ i > = 3 ] day of month , which could be multiple values , or 0 when not found
* or
* null on any error cases , for exmaple , FREQ = YEARLY is not available
* When UNTIL attribute is available , the time will be set to until [ 0 ] ,
* otherwise , MIN _ TIME */
private static int [ ] parseRRULE ( String rrule , long [ ] until ) { } } | int month = - 1 ; int dayOfWeek = 0 ; int nthDayOfWeek = 0 ; int [ ] dayOfMonth = null ; long untilTime = MIN_TIME ; boolean yearly = false ; boolean parseError = false ; StringTokenizer st = new StringTokenizer ( rrule , SEMICOLON ) ; while ( st . hasMoreTokens ( ) ) { String attr , value ; String prop = st . nextToken ( ) ; int sep = prop . indexOf ( EQUALS_SIGN ) ; if ( sep != - 1 ) { attr = prop . substring ( 0 , sep ) ; value = prop . substring ( sep + 1 ) ; } else { parseError = true ; break ; } if ( attr . equals ( ICAL_FREQ ) ) { // only support YEARLY frequency type
if ( value . equals ( ICAL_YEARLY ) ) { yearly = true ; } else { parseError = true ; break ; } } else if ( attr . equals ( ICAL_UNTIL ) ) { // ISO8601 UTC format , for example , " 20060315T020000Z "
try { untilTime = parseDateTimeString ( value , 0 ) ; } catch ( IllegalArgumentException iae ) { parseError = true ; break ; } } else if ( attr . equals ( ICAL_BYMONTH ) ) { // Note : BYMONTH may contain multiple months , but only single month make sense for
// VTIMEZONE property .
if ( value . length ( ) > 2 ) { parseError = true ; break ; } try { month = Integer . parseInt ( value ) - 1 ; if ( month < 0 || month >= 12 ) { parseError = true ; break ; } } catch ( NumberFormatException nfe ) { parseError = true ; break ; } } else if ( attr . equals ( ICAL_BYDAY ) ) { // Note : BYDAY may contain multiple day of week separated by comma . It is unlikely used for
// VTIMEZONE property . We do not support the case .
// 2 - letter format is used just for representing a day of week , for example , " SU " for Sunday
// 3 or 4 - letter format is used for represeinging Nth day of week , for example , " - 1SA " for last Saturday
int length = value . length ( ) ; if ( length < 2 || length > 4 ) { parseError = true ; break ; } if ( length > 2 ) { // Nth day of week
int sign = 1 ; if ( value . charAt ( 0 ) == '+' ) { sign = 1 ; } else if ( value . charAt ( 0 ) == '-' ) { sign = - 1 ; } else if ( length == 4 ) { parseError = true ; break ; } try { int n = Integer . parseInt ( value . substring ( length - 3 , length - 2 ) ) ; if ( n == 0 || n > 4 ) { parseError = true ; break ; } nthDayOfWeek = n * sign ; } catch ( NumberFormatException nfe ) { parseError = true ; break ; } value = value . substring ( length - 2 ) ; } int wday ; for ( wday = 0 ; wday < ICAL_DOW_NAMES . length ; wday ++ ) { if ( value . equals ( ICAL_DOW_NAMES [ wday ] ) ) { break ; } } if ( wday < ICAL_DOW_NAMES . length ) { // Sunday ( 1 ) - Saturday ( 7)
dayOfWeek = wday + 1 ; } else { parseError = true ; break ; } } else if ( attr . equals ( ICAL_BYMONTHDAY ) ) { // Note : BYMONTHDAY may contain multiple days delimited by comma
// A value of BYMONTHDAY could be negative , for example , - 1 means
// the last day in a month
StringTokenizer days = new StringTokenizer ( value , COMMA ) ; int count = days . countTokens ( ) ; dayOfMonth = new int [ count ] ; int index = 0 ; while ( days . hasMoreTokens ( ) ) { try { dayOfMonth [ index ++ ] = Integer . parseInt ( days . nextToken ( ) ) ; } catch ( NumberFormatException nfe ) { parseError = true ; break ; } } } } if ( parseError ) { return null ; } if ( ! yearly ) { // FREQ = YEARLY must be set
return null ; } until [ 0 ] = untilTime ; int [ ] results ; if ( dayOfMonth == null ) { results = new int [ 4 ] ; results [ 3 ] = 0 ; } else { results = new int [ 3 + dayOfMonth . length ] ; for ( int i = 0 ; i < dayOfMonth . length ; i ++ ) { results [ 3 + i ] = dayOfMonth [ i ] ; } } results [ 0 ] = month ; results [ 1 ] = dayOfWeek ; results [ 2 ] = nthDayOfWeek ; return results ; |
public class MutableBoolean { /** * Use the supplied function to perform a lazy transform operation when getValue is called
* < pre >
* { @ code
* MutableBoolean mutable = MutableBoolean . fromExternal ( ( ) - > ! this . value , val - > ! this . value ) ;
* Mutable < Boolean > withOverride = mutable . mapInput ( b - > {
* if ( override )
* return true ;
* return b ;
* < / pre >
* @ param fn Map function to be applied to the input when set is called
* @ return Mutable that lazily applies the provided function when set is called to the input value */
public < T1 > Mutable < T1 > mapInputToObj ( final Function < T1 , Boolean > fn ) { } } | final MutableBoolean host = this ; return new Mutable < T1 > ( ) { @ Override public Mutable < T1 > set ( final T1 value ) { host . set ( fn . apply ( value ) ) ; return this ; } } ; |
public class Controller { /** * Get para from url . The index of first url para is 0. */
public String getPara ( int index ) { } } | if ( index < 0 ) return getPara ( ) ; if ( urlParaArray == null ) { if ( urlPara == null || "" . equals ( urlPara ) ) // urlPara maybe is " " see ActionMapping . getAction ( String )
urlParaArray = NULL_URL_PARA_ARRAY ; else urlParaArray = urlPara . split ( URL_PARA_SEPARATOR ) ; for ( int i = 0 ; i < urlParaArray . length ; i ++ ) if ( "" . equals ( urlParaArray [ i ] ) ) urlParaArray [ i ] = null ; } return urlParaArray . length > index ? urlParaArray [ index ] : null ; |
public class NioThread { /** * Adds a task to be executed by the NioThread and wakes up the selector so that it will
* eventually pick up the task .
* @ param task the task to add .
* @ throws NullPointerException if task is null */
public void addTaskAndWakeup ( Runnable task ) { } } | taskQueue . add ( task ) ; if ( selectMode != SELECT_NOW ) { selector . wakeup ( ) ; } |
public class DPathUtils { @ SuppressWarnings ( "rawtypes" ) private static Object createIntermediate ( JsonNode node , StringBuffer pathSofar , String index , String nextIndex ) { } } | if ( node instanceof POJONode ) { return createIntermediate ( extractValue ( ( POJONode ) node ) , pathSofar , index , nextIndex ) ; } if ( node instanceof ContainerNode ) { ContainerNode temp = ( ContainerNode ) node ; JsonNode value = PATTERN_INDEX . matcher ( nextIndex ) . matches ( ) ? temp . arrayNode ( ) : temp . objectNode ( ) ; return createIntermediate ( temp , pathSofar , index , value ) ; } return null ; |
public class OAuth1RequestInterceptor { /** * internal helpers */
private String getAuthorizationHeaderValue ( HttpRequest request , byte [ ] body ) { } } | return signingUtils . buildAuthorizationHeaderValue ( request , body , oauth1Credentials ) ; |
public class RedisLoginImpl { /** * 登录 */
@ Override public void login ( HttpServletRequest request , User user , int expireTime ) { } } | Visitor visitor = new Visitor ( ) ; visitor . setId ( user . getId ( ) ) ; visitor . setLoginUserId ( user . getId ( ) ) ; visitor . setLoginUserName ( user . getName ( ) ) ; visitor . setRoleId ( user . getRoleId ( ) ) ; visitor . setAppIds ( user . getOwnApps ( ) ) ; // 更新session
updateSessionVisitor ( request . getSession ( ) , visitor ) ; // 更新Redis数据
updateRedisVisitor ( visitor , request , expireTime ) ; |
public class PlotCanvas { /** * Add a graphical shape to the canvas . */
public void add ( Plot p ) { } } | shapes . add ( p ) ; JComponent [ ] tb = p . getToolBar ( ) ; if ( tb != null ) { toolbar . addSeparator ( ) ; for ( JComponent comp : tb ) { toolbar . add ( comp ) ; } } repaint ( ) ; |
public class BasePrepareStatement { /** * Sets the designated parameter to the given < code > java . sql . Clob < / code > object . The driver
* converts this to an SQL
* < code > CLOB < / code > value when it sends it to the database .
* @ param parameterIndex the first parameter is 1 , the second is 2 , . . .
* @ param clob a < code > Clob < / code > object that maps an SQL < code > CLOB < / code > value
* @ throws SQLException if parameterIndex does not correspond to a parameter
* marker in the SQL statement ; if a database access error
* occurs or this method is called on a closed
* < code > PreparedStatement < / code > */
public void setClob ( final int parameterIndex , final Clob clob ) throws SQLException { } } | if ( clob == null ) { setNull ( parameterIndex , ColumnType . BLOB ) ; return ; } setParameter ( parameterIndex , new ReaderParameter ( clob . getCharacterStream ( ) , clob . length ( ) , noBackslashEscapes ) ) ; hasLongData = true ; |
public class MathUtil { /** * 提供相对精确的除法 ( 超出精度的数字默认使用BigDecimal . ROUND _ DOWN策略处理 )
* @ param doubleA
* @ param doubleB
* @ param scale 精度
* @ return */
public static double divide ( double doubleA , double doubleB , int scale ) { } } | return toBigDecimal ( doubleA ) . divide ( toBigDecimal ( doubleB ) , scale , BigDecimal . ROUND_DOWN ) . doubleValue ( ) ; |
public class DOM { /** * < p > Extract the given value from the node as a String or if the value cannot
* be extracted , { @ code defaultValue } is returned .
* < / p > < p >
* Example : To get the value of the attribute " foo " in the node , specify
* " @ foo " as the path .
* Note : This method does not handle namespaces explicitely .
* @ param node the node with the wanted attribute
* @ param xpath the XPath to extract .
* @ param defaultValue the default value
* @ return the value of the path , if existing , else
* { @ code defaultValue } */
public static String selectString ( Node node , String xpath , String defaultValue ) { } } | return selector . selectString ( node , xpath , defaultValue ) ; |
public class UniqueNameSet { /** * Generates a unique and valid name using { @ code base } . If { @ code base } has not yet been added ,
* and is not a Java keyword ; it will be returned as - is , otherwise it will have a differentiator
* appended . */
String getUniqueName ( CharSequence base ) { } } | String name = base . toString ( ) ; for ( int differentiator = 1 ; isInvalidName ( name ) ; differentiator ++ ) { name = base . toString ( ) + separator + differentiator ; } return name ; |
public class WebservicesType { /** * { @ inheritDoc } */
@ Override public boolean handleChild ( DDParser parser , String localName ) throws ParseException { } } | if ( super . handleChild ( parser , localName ) ) { return true ; } if ( "webservice-description" . equals ( localName ) ) { WebserviceDescriptionType wsdes = new WebserviceDescriptionType ( ) ; parser . parse ( wsdes ) ; addWebServiceDescription ( wsdes ) ; return true ; } return false ; |
public class EditShape { /** * before _ path can be - 1 , then the path is moved to the end of the dst _ geom . */
void movePath ( int geom , int before_path , int path_to_move ) { } } | if ( path_to_move == - 1 ) throw new IllegalArgumentException ( ) ; if ( before_path == path_to_move ) return ; int next = getNextPath ( path_to_move ) ; int prev = getPrevPath ( path_to_move ) ; int geom_src = getGeometryFromPath ( path_to_move ) ; if ( prev == - 1 ) { setFirstPath_ ( geom_src , next ) ; } else { setNextPath_ ( prev , next ) ; } if ( next == - 1 ) { setLastPath_ ( geom_src , prev ) ; } else { setPrevPath_ ( next , prev ) ; } setGeometryVertexCount_ ( geom_src , getPointCount ( geom_src ) - getPathSize ( path_to_move ) ) ; setGeometryPathCount_ ( geom_src , getPathCount ( geom_src ) - 1 ) ; if ( before_path == - 1 ) prev = getLastPath ( geom ) ; else prev = getPrevPath ( before_path ) ; setPrevPath_ ( path_to_move , prev ) ; setNextPath_ ( path_to_move , before_path ) ; if ( before_path == - 1 ) setLastPath_ ( geom , path_to_move ) ; else setPrevPath_ ( before_path , path_to_move ) ; if ( prev == - 1 ) setFirstPath_ ( geom , path_to_move ) ; else setNextPath_ ( prev , path_to_move ) ; setGeometryVertexCount_ ( geom , getPointCount ( geom ) + getPathSize ( path_to_move ) ) ; setGeometryPathCount_ ( geom , getPathCount ( geom ) + 1 ) ; setPathGeometry_ ( path_to_move , geom ) ; |
public class YarnContainerManager { /** * Match to see whether the container satisfies the request .
* We take into consideration that RM has some freedom in rounding
* up the allocation and in placing containers on other machines . */
private boolean matchContainerWithPendingRequest ( final Container container ) { } } | if ( this . requestsAfterSentToRM . isEmpty ( ) ) { return false ; } final AMRMClient . ContainerRequest request = this . requestsAfterSentToRM . peek ( ) ; final boolean resourceCondition = container . getResource ( ) . getMemory ( ) >= request . getCapability ( ) . getMemory ( ) ; // TODO [ JIRA REEF - 35 ] : check vcores once YARN - 2380 is resolved
final boolean nodeCondition = request . getNodes ( ) == null || request . getNodes ( ) . contains ( container . getNodeId ( ) . getHost ( ) ) ; final boolean rackCondition = request . getRacks ( ) == null || request . getRacks ( ) . contains ( this . nodeIdToRackName . get ( container . getNodeId ( ) . toString ( ) ) ) ; return resourceCondition && ( request . getRelaxLocality ( ) || rackCondition && nodeCondition ) ; |
public class SQLDroidDriver { /** * Will accept any string that starts with sqldroidPrefix ( " jdbc : sqldroid : " ) or
* sqllitePrefix ( " jdbc : sqlite " ) . */
@ Override public boolean acceptsURL ( String url ) throws SQLException { } } | if ( url . startsWith ( sqldroidPrefix ) || url . startsWith ( xerialPrefix ) ) { return true ; } return false ; |
public class LdaptiveResourceCRLFetcher { /** * Prepare a new LDAP connection .
* @ param ldapURL the ldap uRL
* @ return connection factory */
protected ConnectionFactory prepareConnectionFactory ( final String ldapURL ) { } } | val cc = ConnectionConfig . newConnectionConfig ( this . connectionConfig ) ; cc . setLdapUrl ( ldapURL ) ; return new DefaultConnectionFactory ( cc ) ; |
public class DefaultIndexedFile { /** * Component key ( without branch ) . */
@ Override public String key ( ) { } } | return new StringBuilder ( ) . append ( projectKey ) . append ( ":" ) . append ( projectRelativePath ) . toString ( ) ; |
public class Polyline { /** * Set the points .
* Note that a later change in the original points List will have no effect .
* To remove / change points , you must call setPoints again .
* If geodesic mode has been set , the long segments will follow the earth " great circle " . */
public void setPoints ( List < GeoPoint > points ) { } } | mOutline . clearPath ( ) ; mOriginalPoints = new ArrayList < > ( points . size ( ) ) ; for ( GeoPoint p : points ) { mOriginalPoints . add ( p ) ; } mOutline . setPoints ( points ) ; setDefaultInfoWindowLocation ( ) ; |
public class BrownianBridge { /** * Lazy initialization of brownianIncrement . Synchronized to ensure thread safety of lazy init . */
private void doGenerateBrownianMotion ( ) { } } | if ( brownianIncrements != null ) { return ; // Nothing to do
} BrownianMotion generator = new BrownianMotion ( timeDiscretization , numberOfFactors , numberOfPaths , seed ) ; // Allocate memory
brownianIncrements = new RandomVariableInterface [ generator . getTimeDiscretization ( ) . getNumberOfTimeSteps ( ) ] [ generator . getNumberOfFactors ( ) ] ; double endTime = getTimeDiscretization ( ) . getTime ( getTimeDiscretization ( ) . getNumberOfTimeSteps ( ) ) ; for ( int factor = 0 ; factor < generator . getNumberOfFactors ( ) ; factor ++ ) { // The end point
RandomVariableInterface endOfFactor = end [ factor ] ; // Initialized the bridge to the start point
RandomVariableInterface brownianBridge = start [ factor ] ; for ( int timeIndex = 0 ; timeIndex < getTimeDiscretization ( ) . getNumberOfTimeSteps ( ) ; timeIndex ++ ) { double currentTime = getTimeDiscretization ( ) . getTime ( timeIndex ) ; double nextTime = getTimeDiscretization ( ) . getTime ( timeIndex + 1 ) ; double alpha = ( nextTime - currentTime ) / ( endTime - currentTime ) ; // Calculate the next point using the " scheme " of the Brownian bridge
RandomVariableInterface nextRealization = brownianBridge . mult ( 1.0 - alpha ) . add ( endOfFactor . mult ( alpha ) ) . add ( generator . getBrownianIncrement ( timeIndex , factor ) . mult ( Math . sqrt ( 1 - alpha ) ) ) ; // Store the increment
brownianIncrements [ timeIndex ] [ factor ] = nextRealization . sub ( brownianBridge ) ; // Update the bridge to the current point
brownianBridge = nextRealization ; } } |
public class Connection { /** * Reads one < code > ProtocolDataUnit < / code > instance from the < code > receivingQueue < / code > .
* @ return An instance of a < code > ProtocolDataUnit < / code > .
* @ throws InternetSCSIException for nearly everything */
public final ProtocolDataUnit receive ( ) throws InternetSCSIException { } } | try { return senderReceiver . receiveFromWire ( ) ; } catch ( DigestException e ) { throw new InternetSCSIException ( e ) ; } catch ( IOException e ) { throw new InternetSCSIException ( e ) ; } |
public class Stopwatchs { /** * Starts a task timing with the specified task title .
* @ param taskTitle the specified task title */
public static void start ( final String taskTitle ) { } } | Stopwatch root = STOPWATCH . get ( ) ; if ( null == root ) { root = new Stopwatch ( taskTitle ) ; // Creates the root stopwatch
STOPWATCH . set ( root ) ; return ; } final Stopwatch recent = getRecentRunning ( STOPWATCH . get ( ) ) ; if ( null == recent ) { return ; } recent . addLeaf ( new Stopwatch ( taskTitle ) ) ; // Adds sub - stopwatch |
public class JaegerTraceExporter { /** * Registers the { @ link JaegerTraceExporter } .
* @ param spanExporter the instance of the { @ code SpanExporter } where this service is registered . */
@ VisibleForTesting static void register ( final SpanExporter spanExporter , final SpanExporter . Handler handler ) { } } | spanExporter . registerHandler ( REGISTER_NAME , handler ) ; |
public class BeanTypeImpl { /** * If not already created , a new < code > constructor < / code > element will be created and returned .
* Otherwise , the first existing < code > constructor < / code > element will be returned .
* @ return the instance defined for the element < code > constructor < / code > */
public ConstructorType < BeanType < T > > getOrCreateConstructor ( ) { } } | List < Node > nodeList = childNode . get ( "constructor" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new ConstructorTypeImpl < BeanType < T > > ( this , "constructor" , childNode , nodeList . get ( 0 ) ) ; } return createConstructor ( ) ; |
public class TextilejConverter { /** * / * ( non - Javadoc )
* @ see org . opoo . press . Converter # convert ( java . lang . String ) */
@ Override public String convert ( String content ) { } } | StringWriter writer = new StringWriter ( ) ; HtmlDocumentBuilder builder = new HtmlDocumentBuilder ( writer ) ; builder . setEmitAsDocument ( false ) ; parser . setBuilder ( builder ) ; parser . parse ( content ) ; parser . setBuilder ( null ) ; return writer . toString ( ) ; |
public class DataSet { /** * Initiates a Join transformation . < br / >
* A Join transformation joins the elements of two
* { @ link DataSet DataSets } on key equality and provides multiple ways to combine
* joining elements into one DataSet . < / br >
* This method returns a { @ link JoinOperatorSets } on which
* { @ link JoinOperatorSets # where ( ) } needs to be called to define the join key of the first
* joining ( i . e . , this ) DataSet .
* @ param other The other DataSet with which this DataSet is joined .
* @ return A JoinOperatorSets to continue the definition of the Join transformation .
* @ see JoinOperatorSets
* @ see JoinOperator
* @ see DataSet */
public < R > JoinOperatorSets < T , R > join ( DataSet < R > other ) { } } | return new JoinOperatorSets < T , R > ( this , other ) ; |
public class ServiceManagerIndexRdf { /** * Obtains the list of model references for a given element .
* @ param elementUri the URI of the element for which we want to obtain the model references
* @ return a List of URIs with the model references of the given element . If there are no model references the List should be empty NOT null . */
@ Override public Set < URI > listModelReferences ( URI elementUri ) { } } | if ( elementUri == null ) { return ImmutableSet . of ( ) ; } return ImmutableSet . copyOf ( this . modelReferencesMap . get ( elementUri ) ) ; |
public class AtomTypeAwareSaturationChecker { /** * A small help method that count how many bonds an atom has , regarding
* bonds due to its charge and to implicit hydrogens .
* @ param atom The atom to check
* @ param atomContainer The atomContainer containing the atom
* @ return The number of bonds that the atom has
* @ throws CDKException */
private double bondsUsed ( IAtom atom , IAtomContainer atomContainer ) throws CDKException { } } | int bondsToAtom = 0 ; for ( IBond bond : atomContainer . bonds ( ) ) if ( bond . contains ( atom ) ) bondsToAtom += BondManipulator . destroyBondOrder ( bond . getOrder ( ) ) ; int implicitHydrogens ; if ( atom . getImplicitHydrogenCount ( ) == CDKConstants . UNSET || atom . getImplicitHydrogenCount ( ) == null ) { // Will probably only work with group 13-18 , and not for helium . . .
if ( atom . getValency ( ) == CDKConstants . UNSET || atom . getValency ( ) == null ) throw new CDKException ( "Atom " + atom . getAtomTypeName ( ) + " has not got the valency set." ) ; if ( atom . getFormalNeighbourCount ( ) == CDKConstants . UNSET || atom . getFormalNeighbourCount ( ) == null ) throw new CDKException ( "Atom " + atom . getAtomTypeName ( ) + " has not got the formal neighbour count set." ) ; implicitHydrogens = ( 8 - atom . getValency ( ) ) - atom . getFormalNeighbourCount ( ) ; String warningMessage = "Number of implicite hydrogens not set for atom " + atom . getAtomTypeName ( ) + ". Estimated it to: " + implicitHydrogens ; logger . warn ( warningMessage ) ; } else implicitHydrogens = atom . getImplicitHydrogenCount ( ) ; double charge ; if ( atom . getCharge ( ) == CDKConstants . UNSET ) if ( atom . getFormalCharge ( ) == CDKConstants . UNSET ) { charge = 0 ; String warningMessage = "Neither charge nor formal charge is set for atom " + atom . getAtomTypeName ( ) + ". Estimate it to: 0" ; logger . warn ( warningMessage ) ; } else charge = atom . getFormalCharge ( ) ; else charge = atom . getCharge ( ) ; return bondsToAtom - charge + implicitHydrogens ; |
public class Recipes { /** * An array of custom recipe names to be run following a < code > deploy < / code > event .
* @ param deploy
* An array of custom recipe names to be run following a < code > deploy < / code > event . */
public void setDeploy ( java . util . Collection < String > deploy ) { } } | if ( deploy == null ) { this . deploy = null ; return ; } this . deploy = new com . amazonaws . internal . SdkInternalList < String > ( deploy ) ; |
public class QueryBldrUtil { /** * Recursive method to get a QueryBuilder .
* @ param _ queryPart the _ query part
* @ return the query bldr
* @ throws EFapsException on error */
private static QueryBuilder getQueryBldr ( final IQueryPart _queryPart ) throws EFapsException { } } | final Iterator < String > typeIter = ( ( AbstractQueryPart ) _queryPart ) . getTypes ( ) . iterator ( ) ; String typeStr = typeIter . next ( ) ; final QueryBuilder ret = new QueryBuilder ( UUIDUtil . isUUID ( typeStr ) ? Type . get ( UUID . fromString ( typeStr ) ) : Type . get ( typeStr ) ) ; while ( typeIter . hasNext ( ) ) { typeStr = typeIter . next ( ) ; ret . addType ( UUIDUtil . isUUID ( typeStr ) ? Type . get ( UUID . fromString ( typeStr ) ) : Type . get ( typeStr ) ) ; } for ( final AbstractWhere where : ( ( AbstractQueryPart ) _queryPart ) . getWheres ( ) ) { if ( where instanceof AttributeWhere ) { final AttributeWhere attrWhere = ( AttributeWhere ) where ; switch ( where . getComparison ( ) ) { case IN : case EQUAL : ret . addWhereAttrEqValue ( attrWhere . getAttribute ( ) , attrWhere . getValues ( ) . toArray ( ) ) ; break ; case GREATER : ret . addWhereAttrGreaterValue ( attrWhere . getAttribute ( ) , attrWhere . getValues ( ) . get ( 0 ) ) ; break ; case LESS : ret . addWhereAttrLessValue ( attrWhere . getAttribute ( ) , attrWhere . getValues ( ) . get ( 0 ) ) ; break ; case LIKE : ret . addWhereAttrMatchValue ( attrWhere . getAttribute ( ) , attrWhere . getValues ( ) . get ( 0 ) ) ; break ; case UNEQUAL : case NOTIN : ret . addWhereAttrNotEqValue ( attrWhere . getAttribute ( ) , attrWhere . getValues ( ) . toArray ( ) ) ; break ; default : ret . addWhereAttrEqValue ( "ID" , 0 ) ; break ; } } else if ( where instanceof SelectWhere ) { final SelectWhere selWhere = ( SelectWhere ) where ; switch ( where . getComparison ( ) ) { case EQUAL : ret . addWhereSelectEqValue ( selWhere . getSelect ( ) , selWhere . getValues ( ) . toArray ( ) ) ; break ; case GREATER : ret . addWhereSelectGreaterValue ( selWhere . getSelect ( ) , selWhere . getValues ( ) . get ( 0 ) ) ; break ; case LESS : ret . addWhereSelectLessValue ( selWhere . getSelect ( ) , selWhere . getValues ( ) . get ( 0 ) ) ; break ; case LIKE : ret . addWhereSelectMatchValue ( selWhere . getSelect ( ) , selWhere . getValues ( ) . get ( 0 ) ) ; break ; case UNEQUAL : case IN : case NOTIN : default : ret . addWhereAttrEqValue ( "ID" , 0 ) ; break ; } } else if ( where instanceof AttrQueryWhere ) { final AttrQueryWhere attrQueryWhere = ( AttrQueryWhere ) where ; switch ( where . getComparison ( ) ) { case IN : ret . addWhereAttrInQuery ( attrQueryWhere . getAttribute ( ) , getQueryBldr ( attrQueryWhere . getQuery ( ) ) . getAttributeQuery ( ( ( AbstractNestedQueryStmtPart ) attrQueryWhere . getQuery ( ) ) . getSelect ( ) ) ) ; break ; case NOTIN : ret . addWhereAttrNotInQuery ( attrQueryWhere . getAttribute ( ) , getQueryBldr ( attrQueryWhere . getQuery ( ) ) . getAttributeQuery ( ( ( AbstractNestedQueryStmtPart ) attrQueryWhere . getQuery ( ) ) . getSelect ( ) ) ) ; break ; case EQUAL : case GREATER : case LESS : case LIKE : case UNEQUAL : default : ret . addWhereAttrEqValue ( "ID" , 0 ) ; break ; } } else if ( where instanceof SelectQueryWhere ) { final SelectQueryWhere selQueryWhere = ( SelectQueryWhere ) where ; switch ( where . getComparison ( ) ) { case IN : ret . addWhereAttrInQuery ( selQueryWhere . getSelect ( ) , getQueryBldr ( selQueryWhere . getQuery ( ) ) . getAttributeQuery ( ( ( AbstractNestedQueryStmtPart ) selQueryWhere . getQuery ( ) ) . getSelect ( ) ) ) ; break ; case NOTIN : ret . addWhereAttrNotInQuery ( selQueryWhere . getSelect ( ) , getQueryBldr ( selQueryWhere . getQuery ( ) ) . getAttributeQuery ( ( ( AbstractNestedQueryStmtPart ) selQueryWhere . getQuery ( ) ) . getSelect ( ) ) ) ; break ; case EQUAL : case GREATER : case LESS : case LIKE : case UNEQUAL : default : ret . addWhereAttrEqValue ( "ID" , 0 ) ; break ; } } } if ( _queryPart instanceof AbstractQueryStmtPart ) { ret . setLimit ( ( ( AbstractQueryStmtPart ) _queryPart ) . getLimit ( ) ) ; } return ret ; |
public class SSOSamlPostProfileHandlerController { /** * Handle SSO POST profile request .
* @ param response the response
* @ param request the request
* @ throws Exception the exception */
@ PostMapping ( path = SamlIdPConstants . ENDPOINT_SAML2_SSO_PROFILE_POST ) public void handleSaml2ProfileSsoPostRequest ( final HttpServletResponse response , final HttpServletRequest request ) throws Exception { } } | val decoder = getSamlProfileHandlerConfigurationContext ( ) . getSamlMessageDecoders ( ) . getInstance ( HttpMethod . POST ) ; handleSsoPostProfileRequest ( response , request , decoder ) ; |
public class MapDotApi { /** * Walks by map ' s nodes and extracts optional value of type T .
* @ param < T > value type
* @ param clazz type of value
* @ param map subject
* @ param pathString nodes to walk in map
* @ return optional value of type T */
public static < T > T dotGetUnsafe ( final Map map , final Class < T > clazz , final String pathString ) { } } | return dotGet ( map , clazz , pathString ) . orElseThrow ( ( ) -> new IllegalAccessError ( "Map " + map + " does not have value of type " + clazz . getName ( ) + " by " + pathString ) ) ; |
public class AwsIdentityDocUtils { /** * returns the { @ code reader } as a string without closing it . */
private static String slurp ( Reader reader ) throws IOException { } } | StringBuilder to = new StringBuilder ( ) ; CharBuffer buf = CharBuffer . allocate ( AWS_IDENTITY_DOC_BUF_SIZE ) ; while ( reader . read ( buf ) != - 1 ) { buf . flip ( ) ; to . append ( buf ) ; buf . clear ( ) ; } return to . toString ( ) ; |
public class MongoService { /** * Configure a mongo option .
* @ param MongoClientOptions _ Builder builder class
* @ param optionsBuilder builder instance
* @ param propName name of the config property .
* @ param type type of the config property . */
@ FFDCIgnore ( Throwable . class ) @ Trivial private void set ( Class < ? > MongoClientOptions_Builder , Object optionsBuilder , String propName , Object value ) throws IntrospectionException , IllegalArgumentException , IllegalAccessException , InvocationTargetException { } } | try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , propName + '=' + value ) ; Class < ? > type = MONGO_CLIENT_OPTIONS_TYPES . get ( propName ) ; // setter methods are just propName , no setPropName .
Method method = MongoClientOptions_Builder . getMethod ( propName , type ) ; // even though we told the config service that some of these props are Integers , they get converted to longs . Need
// to convert them back to int so that our . invoke ( . . ) method doesn ' t blow up .
if ( type . equals ( int . class ) && value instanceof Long ) { value = ( ( Long ) value ) . intValue ( ) ; } method . invoke ( optionsBuilder , value ) ; return ; } catch ( Throwable x ) { if ( x instanceof InvocationTargetException ) x = x . getCause ( ) ; IllegalArgumentException failure = ignoreWarnOrFail ( x , IllegalArgumentException . class , "CWKKD0010.prop.error" , propName , MONGO , id , x ) ; if ( failure != null ) { FFDCFilter . processException ( failure , getClass ( ) . getName ( ) , "394" , this , new Object [ ] { value == null ? null : value . getClass ( ) , value } ) ; throw failure ; } } |
public class CmsSynchronize { /** * Gets the corresponding file to a resource in the VFS . < p >
* @ param res path to the resource inside the VFS
* @ return the corresponding file in the FS */
private File getFileInRfs ( String res ) { } } | String path = m_destinationPathInRfs + res . substring ( 0 , res . lastIndexOf ( "/" ) ) ; String fileName = res . substring ( res . lastIndexOf ( "/" ) + 1 ) ; return new File ( path , fileName ) ; |
public class AppServletContextListener { /** * We load the saved instances if persistence of enabled , on web application starting .
* @ param sce
* the context event object */
@ Override public final void contextInitialized ( final ServletContextEvent sce ) { } } | if ( persistenceEnabled ) { // Load ec2 instances
AbstractMockEc2Instance [ ] instanceArray = ( AbstractMockEc2Instance [ ] ) PersistenceUtils . loadAll ( PersistenceStoreType . EC2 ) ; if ( null != instanceArray ) { MockEc2Controller . getInstance ( ) . restoreAllMockEc2Instances ( Arrays . asList ( instanceArray ) ) ; } // Load Vpc
MockVpc [ ] vpcArray = ( MockVpc [ ] ) PersistenceUtils . loadAll ( PersistenceStoreType . VPC ) ; if ( null != vpcArray ) { MockVpcController . getInstance ( ) . restoreAllMockVpc ( Arrays . asList ( vpcArray ) ) ; } // Load Volume
MockVolume [ ] volumeArray = ( MockVolume [ ] ) PersistenceUtils . loadAll ( PersistenceStoreType . VOLUME ) ; if ( null != volumeArray ) { MockVolumeController . getInstance ( ) . restoreAllMockVolume ( Arrays . asList ( volumeArray ) ) ; } // Load Tags
MockTags [ ] tagsArray = ( MockTags [ ] ) PersistenceUtils . loadAll ( PersistenceStoreType . TAGS ) ; if ( null != tagsArray ) { MockTagsController . getInstance ( ) . restoreAllMockTags ( Arrays . asList ( tagsArray ) ) ; } // Load Subnet
MockSubnet [ ] subnetArray = ( MockSubnet [ ] ) PersistenceUtils . loadAll ( PersistenceStoreType . SUBNET ) ; if ( null != subnetArray ) { MockSubnetController . getInstance ( ) . restoreAllMockSubnet ( Arrays . asList ( subnetArray ) ) ; } // Load RouteTable
MockRouteTable [ ] routetableArray = ( MockRouteTable [ ] ) PersistenceUtils . loadAll ( PersistenceStoreType . ROUTETABLE ) ; if ( null != routetableArray ) { MockRouteTableController . getInstance ( ) . restoreAllMockRouteTable ( Arrays . asList ( routetableArray ) ) ; } // Load Internet Gateway
MockInternetGateway [ ] internetgatewayArray = ( MockInternetGateway [ ] ) PersistenceUtils . loadAll ( PersistenceStoreType . INTERNETGATEWAY ) ; if ( null != internetgatewayArray ) { MockInternetGatewayController . getInstance ( ) . restoreAllInternetGateway ( Arrays . asList ( internetgatewayArray ) ) ; } } // start a timer for cleaning up terminated instances
MockEc2Controller . getInstance ( ) . cleanupTerminatedInstances ( cleanupTerminatedInstancesPeriod ) ; log . info ( "aws-mock started." ) ; |
public class ListInvitationsResult { /** * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setInvitations ( java . util . Collection ) } or { @ link # withInvitations ( java . util . Collection ) } if you want to
* override the existing values .
* @ param invitations
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListInvitationsResult withInvitations ( Invitation ... invitations ) { } } | if ( this . invitations == null ) { setInvitations ( new java . util . ArrayList < Invitation > ( invitations . length ) ) ; } for ( Invitation ele : invitations ) { this . invitations . add ( ele ) ; } return this ; |
public class FullScreenImageGalleryAdapter { /** * endregion */
@ Override public Object instantiateItem ( ViewGroup container , int position ) { } } | LayoutInflater inflater = ( LayoutInflater ) container . getContext ( ) . getSystemService ( Context . LAYOUT_INFLATER_SERVICE ) ; View view = inflater . inflate ( R . layout . fullscreen_image , null ) ; ImageView imageView = ( ImageView ) view . findViewById ( R . id . iv ) ; final LinearLayout linearLayout = ( LinearLayout ) view . findViewById ( R . id . ll ) ; String image = images . get ( position ) ; Context context = imageView . getContext ( ) ; int width = DisplayUtility . getScreenWidth ( context ) ; fullScreenImageLoader . loadFullScreenImage ( imageView , image , width , linearLayout ) ; container . addView ( view , 0 ) ; return view ; |
public class MoneyFormatterBuilder { /** * Appends a literal to the builder .
* The localized currency symbol is the symbol as chosen by the locale
* of the formatter .
* @ param literal the literal to append , null or empty ignored
* @ return this , for chaining , never null */
public MoneyFormatterBuilder appendLiteral ( CharSequence literal ) { } } | if ( literal == null || literal . length ( ) == 0 ) { return this ; } LiteralPrinterParser pp = new LiteralPrinterParser ( literal . toString ( ) ) ; return appendInternal ( pp , pp ) ; |
public class ZipExtensions { /** * Zip the given file .
* @ param dirToZip
* the dir to zip
* @ param zipFile
* the zip file
* @ param filter
* the filter
* @ throws FileNotFoundException
* the file not found exception
* @ throws IOException
* Signals that an I / O exception has occurred .
* @ throws FileDoesNotExistException
* the file does not exist exception */
public static void zip ( final File dirToZip , final File zipFile , final FilenameFilter filter ) throws FileNotFoundException , IOException , FileDoesNotExistException { } } | zip ( dirToZip , zipFile , filter , true ) ; |
public class CharacterType { /** * Memory limits apply to Upper and Lower implementations with Clob data */
public Object upper ( Session session , Object data ) { } } | if ( data == null ) { return null ; } if ( typeCode == Types . SQL_CLOB ) { String result = ( ( ClobData ) data ) . getSubString ( session , 0 , ( int ) ( ( ClobData ) data ) . length ( session ) ) ; result = collation . toUpperCase ( result ) ; ClobData clob = session . createClob ( result . length ( ) ) ; clob . setString ( session , 0 , result ) ; return clob ; } return collation . toUpperCase ( ( String ) data ) ; |
public class TrivialSwap { /** * Swap two elements of an int array at the specified positions
* @ param intArray array that will have two of its values swapped .
* @ param index1 one of the indexes of the array .
* @ param index2 other index of the array . */
public static void swap ( int [ ] intArray , int index1 , int index2 ) { } } | TrivialSwap . swap ( intArray , index1 , intArray , index2 ) ; |
public class VectorizedRleValuesReader { /** * Reads the next group . */
private void readNextGroup ( ) { } } | try { int header = readUnsignedVarInt ( ) ; this . mode = ( header & 1 ) == 0 ? MODE . RLE : MODE . PACKED ; switch ( mode ) { case RLE : this . currentCount = header >>> 1 ; this . currentValue = readIntLittleEndianPaddedOnBitWidth ( ) ; return ; case PACKED : int numGroups = header >>> 1 ; this . currentCount = numGroups * 8 ; if ( this . currentBuffer . length < this . currentCount ) { this . currentBuffer = new int [ this . currentCount ] ; } currentBufferIdx = 0 ; int valueIndex = 0 ; while ( valueIndex < this . currentCount ) { // values are bit packed 8 at a time , so reading bitWidth will always work
ByteBuffer buffer = in . slice ( bitWidth ) ; this . packer . unpack8Values ( buffer , buffer . position ( ) , this . currentBuffer , valueIndex ) ; valueIndex += 8 ; } return ; default : throw new ParquetDecodingException ( "not a valid mode " + this . mode ) ; } } catch ( IOException e ) { throw new ParquetDecodingException ( "Failed to read from input stream" , e ) ; } |
public class HealthReport { /** * { @ inheritDoc } */
@ Override public int compareTo ( HealthReport o ) { } } | return ( this . score < o . score ? - 1 : ( this . score == o . score ? 0 : 1 ) ) ; |
public class AbstractPaxWicketInjector { /** * < p > getSingleLevelOfFields . < / p >
* @ param clazz a { @ link java . lang . Class } object .
* @ return a { @ link java . util . List } object . */
protected List < Field > getSingleLevelOfFields ( Class < ? > clazz ) { } } | List < Field > fields = new ArrayList < Field > ( ) ; for ( Field field : clazz . getDeclaredFields ( ) ) { if ( ! field . isAnnotationPresent ( Inject . class ) ) { continue ; } fields . add ( field ) ; } return fields ; |
public class ResourceUtils { /** * Convenient method to get work items ( java related stuff ) from adaptables
* @ param element
* an IAdaptable object which may provide an adapter for
* IResource
* @ return resource object or null */
@ CheckForNull public static WorkItem getWorkItem ( Object element ) { } } | if ( element instanceof IResource ) { IResource resource = ( IResource ) element ; if ( resource . getType ( ) == IResource . FILE && ! Util . isJavaArtifact ( resource ) || ! resource . isAccessible ( ) ) { // Ignore non java files or deleted / closed files / projects
return null ; } return new WorkItem ( ( IResource ) element ) ; } if ( element instanceof IJavaElement ) { return new WorkItem ( ( IJavaElement ) element ) ; } if ( element instanceof IAdaptable ) { Object adapter = ( ( IAdaptable ) element ) . getAdapter ( IResource . class ) ; if ( adapter instanceof IResource ) { IResource resource = ( IResource ) adapter ; if ( resource . getType ( ) == IResource . FILE && ! Util . isJavaArtifact ( resource ) || ! resource . isAccessible ( ) ) { // Ignore non java files or deleted / closed files / projects
return null ; } return new WorkItem ( resource ) ; } adapter = ( ( IAdaptable ) element ) . getAdapter ( IPackageFragment . class ) ; if ( adapter instanceof IPackageFragment ) { return new WorkItem ( ( IPackageFragment ) adapter ) ; } adapter = ( ( IAdaptable ) element ) . getAdapter ( IType . class ) ; if ( adapter instanceof IType ) { return new WorkItem ( ( IType ) adapter ) ; } } return null ; |
public class FailoverGroupsInner { /** * Updates a failover group .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server containing the failover group .
* @ param failoverGroupName The name of the failover group .
* @ param parameters The failover group parameters .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < FailoverGroupInner > beginUpdateAsync ( String resourceGroupName , String serverName , String failoverGroupName , FailoverGroupUpdate parameters , final ServiceCallback < FailoverGroupInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginUpdateWithServiceResponseAsync ( resourceGroupName , serverName , failoverGroupName , parameters ) , serviceCallback ) ; |
public class PropertyEditorBoolean { /** * Sets focus to the selected radio button . */
@ Override public void setFocus ( ) { } } | Radiobutton radio = editor . getSelected ( ) ; if ( radio == null ) { radio = ( Radiobutton ) editor . getChildren ( ) . get ( 0 ) ; } radio . setFocus ( true ) ; |
public class AssignmentMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Assignment assignment , ProtocolMarshaller protocolMarshaller ) { } } | if ( assignment == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( assignment . getAssignmentId ( ) , ASSIGNMENTID_BINDING ) ; protocolMarshaller . marshall ( assignment . getWorkerId ( ) , WORKERID_BINDING ) ; protocolMarshaller . marshall ( assignment . getHITId ( ) , HITID_BINDING ) ; protocolMarshaller . marshall ( assignment . getAssignmentStatus ( ) , ASSIGNMENTSTATUS_BINDING ) ; protocolMarshaller . marshall ( assignment . getAutoApprovalTime ( ) , AUTOAPPROVALTIME_BINDING ) ; protocolMarshaller . marshall ( assignment . getAcceptTime ( ) , ACCEPTTIME_BINDING ) ; protocolMarshaller . marshall ( assignment . getSubmitTime ( ) , SUBMITTIME_BINDING ) ; protocolMarshaller . marshall ( assignment . getApprovalTime ( ) , APPROVALTIME_BINDING ) ; protocolMarshaller . marshall ( assignment . getRejectionTime ( ) , REJECTIONTIME_BINDING ) ; protocolMarshaller . marshall ( assignment . getDeadline ( ) , DEADLINE_BINDING ) ; protocolMarshaller . marshall ( assignment . getAnswer ( ) , ANSWER_BINDING ) ; protocolMarshaller . marshall ( assignment . getRequesterFeedback ( ) , REQUESTERFEEDBACK_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SentryHandler { /** * Retrieves the properties of the logger . */
protected void retrieveProperties ( ) { } } | LogManager manager = LogManager . getLogManager ( ) ; String className = SentryHandler . class . getName ( ) ; setPrintfStyle ( Boolean . valueOf ( manager . getProperty ( className + ".printfStyle" ) ) ) ; setLevel ( parseLevelOrDefault ( manager . getProperty ( className + ".level" ) ) ) ; |
public class XsltPortalUrlProvider { /** * Get the portlet URL builder for the specified fname or layoutId ( fname takes precedence )
* @ param request
* @ param portalUrlBuilder
* @ param fname - can be empty string
* @ param layoutId - can by empty string
* @ param state - can be empty string
* @ param mode - can be empty string
* @ param copyCurrentRenderParameters
* @ param resourceId - can be empty string
* @ return IPortletUrlBuilder
* @ since 4.1 */
public IPortletUrlBuilder getPortletUrlBuilder ( HttpServletRequest request , IPortalUrlBuilder portalUrlBuilder , String fname , String layoutId , String state , String mode , String copyCurrentRenderParameters , String resourceId ) { } } | final IPortletUrlBuilder portletUrlBuilder ; if ( StringUtils . isNotEmpty ( fname ) ) { final IPortletWindow portletWindow = this . portletWindowRegistry . getOrCreateDefaultPortletWindowByFname ( request , fname ) ; final IPortletWindowId portletWindowId = portletWindow . getPortletWindowId ( ) ; portletUrlBuilder = portalUrlBuilder . getPortletUrlBuilder ( portletWindowId ) ; } else if ( StringUtils . isNotEmpty ( layoutId ) ) { final IPortletWindow portletWindow = this . portletWindowRegistry . getOrCreateDefaultPortletWindowByLayoutNodeId ( request , layoutId ) ; final IPortletWindowId portletWindowId = portletWindow . getPortletWindowId ( ) ; portletUrlBuilder = portalUrlBuilder . getPortletUrlBuilder ( portletWindowId ) ; } else { final IPortletWindowId targetPortletWindowId = portalUrlBuilder . getTargetPortletWindowId ( ) ; if ( targetPortletWindowId == null ) { if ( this . logger . isDebugEnabled ( ) ) { this . logger . warn ( "Can only target the default portlet if the root portal-url targets a portlet." , new Throwable ( ) ) ; } else { this . logger . warn ( "Can only target the default portlet if the root portal-url targets a portlet. Enable debug for stack trace." ) ; } return new FailSafePortletUrlBuilder ( null , portalUrlBuilder ) ; } portletUrlBuilder = portalUrlBuilder . getTargetedPortletUrlBuilder ( ) ; } portletUrlBuilder . setCopyCurrentRenderParameters ( Boolean . parseBoolean ( copyCurrentRenderParameters ) ) ; if ( StringUtils . isNotEmpty ( state ) ) { portletUrlBuilder . setWindowState ( PortletUtils . getWindowState ( state ) ) ; } if ( StringUtils . isNotEmpty ( mode ) ) { portletUrlBuilder . setPortletMode ( PortletUtils . getPortletMode ( mode ) ) ; } if ( StringUtils . isNotEmpty ( resourceId ) && portletUrlBuilder . getPortalUrlBuilder ( ) . getUrlType ( ) == UrlType . RESOURCE ) { portletUrlBuilder . setResourceId ( resourceId ) ; } return portletUrlBuilder ; |
public class ResourceManager { /** * Returns an immutable { @ link Set } of { @ link Resource } s that are at the top of the hierarchy ( that is , they do not
* have a parent ) .
* @ return a { @ link Set } of root { @ link Resource } s */
public Set < Resource < L > > getRootResources ( ) { } } | graphLockRead . lock ( ) ; try { Set < Resource < L > > roots = new HashSet < > ( ) ; Set < Resource < L > > allResources = resourcesGraph . vertexSet ( ) ; for ( Resource < L > resource : allResources ) { if ( neighborIndex . predecessorsOf ( resource ) . isEmpty ( ) ) { roots . add ( resource ) ; } } return Collections . unmodifiableSet ( roots ) ; } finally { graphLockRead . unlock ( ) ; } |
public class OpenPgpManager { /** * Decrypt and or verify an { @ link OpenPgpElement } and return the decrypted { @ link OpenPgpMessage } .
* @ param element { @ link OpenPgpElement } containing the message .
* @ param sender { @ link OpenPgpContact } who sent the message .
* @ return decrypted and / or verified message
* @ throws SmackException . NotLoggedInException in case we aren ' t logged in ( we need to know our jid )
* @ throws IOException IO error ( reading keys , streams etc )
* @ throws PGPException in case of an PGP error */
public OpenPgpMessage decryptOpenPgpElement ( OpenPgpElement element , OpenPgpContact sender ) throws SmackException . NotLoggedInException , IOException , PGPException { } } | return provider . decryptAndOrVerify ( element , getOpenPgpSelf ( ) , sender ) ; |
public class ReferenceMap { /** * Clears this map . */
@ Override public void clear ( ) { } } | Arrays . fill ( table , null ) ; size = 0 ; // noinspection StatementWithEmptyBody
while ( queue . poll ( ) != null ) { // drain the queue
} |
public class AssignedAddOnReader { /** * Make the request to the Twilio API to perform the read .
* @ param client TwilioRestClient with which to make the request
* @ return AssignedAddOn ResourceSet */
@ Override public ResourceSet < AssignedAddOn > read ( final TwilioRestClient client ) { } } | return new ResourceSet < > ( this , client , firstPage ( client ) ) ; |
public class AbstractDescriptorProvider { /** * Alternative getter method used when sufficient type - information about the
* class is not available .
* This method is basically a hack to make the compiler happy , see Ticket
* # 417.
* @ see http : / / eobjects . org / trac / ticket / 417
* @ param clazz
* @ return */
protected final FilterBeanDescriptor < ? , ? > getFilterBeanDescriptorForClassUnbounded ( Class < ? > filterClass ) { } } | for ( FilterBeanDescriptor < ? , ? > descriptor : getFilterBeanDescriptors ( ) ) { if ( filterClass == descriptor . getComponentClass ( ) ) { return descriptor ; } } return notFoundFilter ( filterClass ) ; |
public class PacketUtil { /** * Get a extension element from a collection .
* @ param collection
* @ param element
* @ param namespace
* @ param < PE >
* @ return the extension element
* @ deprecated use { @ link # extensionElementFrom ( Collection , String , String ) } instead . */
@ Deprecated public static < PE extends ExtensionElement > PE packetExtensionfromCollection ( Collection < ExtensionElement > collection , String element , String namespace ) { } } | return extensionElementFrom ( collection , element , namespace ) ; |
public class Statement { /** * Creates a new code chunk representing the concatenation of the given statements . */
public static Statement of ( Statement first , Statement ... rest ) { } } | return of ( ImmutableList . < Statement > builder ( ) . add ( first ) . add ( rest ) . build ( ) ) ; |
public class Record { /** * Get value { @ link Double } value
* @ param label target label
* @ return { @ link Double } value of the label . If it is not null . */
public Double getValueDouble ( String label ) { } } | PrimitiveObject o = getPrimitiveObject ( VALUE , label , ObjectUtil . DOUBLE , "Double" ) ; if ( o == null ) { return null ; } return ( Double ) o . getObject ( ) ; |
public class AmazonEC2Client { /** * Describes the Availability Zones that are available to you . The results include zones only for the region you ' re
* currently using . If there is an event impacting an Availability Zone , you can use this request to view the state
* and any provided message for that Availability Zone .
* For more information , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / UserGuide / using - regions - availability - zones . html " > Regions and
* Availability Zones < / a > in the < i > Amazon Elastic Compute Cloud User Guide < / i > .
* @ param describeAvailabilityZonesRequest
* @ return Result of the DescribeAvailabilityZones operation returned by the service .
* @ sample AmazonEC2 . DescribeAvailabilityZones
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeAvailabilityZones " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public DescribeAvailabilityZonesResult describeAvailabilityZones ( DescribeAvailabilityZonesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeAvailabilityZones ( request ) ; |
public class CmsSerialDateValue { /** * Convert a date to the String representation we use in the JSON .
* @ param d the date to convert
* @ return the String representation we use in the JSON . */
private JSONValue dateToJson ( Date d ) { } } | return null != d ? new JSONString ( Long . toString ( d . getTime ( ) ) ) : null ; |
public class CachingPrincipalAttributesRepository { /** * Gets cache instance from application context .
* @ return the cache instance from application context */
@ JsonIgnore public PrincipalAttributesRepositoryCache getCacheInstanceFromApplicationContext ( ) { } } | val ctx = ApplicationContextProvider . getApplicationContext ( ) ; return ctx . getBean ( "principalAttributesRepositoryCache" , PrincipalAttributesRepositoryCache . class ) ; |
public class Tracing { /** * Wrap a function call in a trace block ; designed for use in a parallel stream
* @ param < T >
* the type of the input to the function
* @ param < R >
* the type of the result of the function
* @ return */
public static < T , R > Function < T , R > wrap ( final String id , final boolean verbose , final Function < T , R > function ) { } } | return ( t ) -> { try { Tracing . start ( id , verbose ) ; return function . apply ( t ) ; |
public class ProcessUtil { /** * Returns the JMX connector address of a child process .
* @ param p the process to which to connect
* @ param startAgent whether to installed the JMX agent in the target process if not already in place
* @ return a { @ link JMXServiceURL } to the process ' s MBean server */
public static JMXServiceURL getLocalConnectorAddress ( Process p , boolean startAgent ) { } } | return getLocalConnectorAddress ( Integer . toString ( getPid ( p ) ) , startAgent ) ; |
public class Gen { /** * Derived visitor method : generate code for a boolean
* expression in a control - flow context .
* @ param _ tree The expression to be visited .
* @ param markBranches The flag to indicate that the condition is
* a flow controller so produced conditions
* should contain a proper tree to generate
* CharacterRangeTable branches for them . */
public CondItem genCond ( JCTree _tree , boolean markBranches ) { } } | JCTree inner_tree = TreeInfo . skipParens ( _tree ) ; if ( inner_tree . hasTag ( CONDEXPR ) ) { JCConditional tree = ( JCConditional ) inner_tree ; CondItem cond = genCond ( tree . cond , CRT_FLOW_CONTROLLER ) ; if ( cond . isTrue ( ) ) { code . resolve ( cond . trueJumps ) ; CondItem result = genCond ( tree . truepart , CRT_FLOW_TARGET ) ; if ( markBranches ) result . tree = tree . truepart ; return result ; } if ( cond . isFalse ( ) ) { code . resolve ( cond . falseJumps ) ; CondItem result = genCond ( tree . falsepart , CRT_FLOW_TARGET ) ; if ( markBranches ) result . tree = tree . falsepart ; return result ; } Chain secondJumps = cond . jumpFalse ( ) ; code . resolve ( cond . trueJumps ) ; CondItem first = genCond ( tree . truepart , CRT_FLOW_TARGET ) ; if ( markBranches ) first . tree = tree . truepart ; Chain falseJumps = first . jumpFalse ( ) ; code . resolve ( first . trueJumps ) ; Chain trueJumps = code . branch ( goto_ ) ; code . resolve ( secondJumps ) ; CondItem second = genCond ( tree . falsepart , CRT_FLOW_TARGET ) ; CondItem result = items . makeCondItem ( second . opcode , Code . mergeChains ( trueJumps , second . trueJumps ) , Code . mergeChains ( falseJumps , second . falseJumps ) ) ; if ( markBranches ) result . tree = tree . falsepart ; return result ; } else { CondItem result = genExpr ( _tree , syms . booleanType ) . mkCond ( ) ; if ( markBranches ) result . tree = _tree ; return result ; } |
public class ContentByteRange { /** * Parses the Range HTTP header value . Only a single range is supported ( others are dropped ) .
* @ param range Range header included in HTTP request
* @ throws IllegalArgumentException if range value is not valid */
protected void parseRange ( String range ) { } } | String prefix = "bytes=" ; if ( ! range . startsWith ( prefix ) || StringUtils . containsNone ( range , "-" ) ) { throw new IllegalArgumentException ( getUsage ( range ) ) ; } else { // Strip the prefix and drop all but the first range ( if there is a list )
String byteRange = range . substring ( prefix . length ( ) ) . split ( "," ) [ 0 ] ; try { // Parse out the range values
setRangeStart ( byteRange . substring ( 0 , byteRange . indexOf ( "-" ) ) ) ; setRangeEnd ( byteRange . substring ( byteRange . indexOf ( "-" ) + 1 , byteRange . length ( ) ) ) ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( getUsage ( range ) ) ; } // Verify that there is either a start or end value for the range ( or both )
if ( null == getRangeStart ( ) && null == getRangeEnd ( ) ) { throw new IllegalArgumentException ( getUsage ( range ) ) ; } } |
public class SSLEngineImpl { /** * Close the inbound side of the connection . We grab the
* lock here , and do the real work in the internal verison .
* We do check for truncation attacks . */
synchronized public void closeInbound ( ) throws SSLException { } } | /* * Currently closes the outbound side as well . The IETF TLS
* working group has expressed the opinion that 1/2 open
* connections are not allowed by the spec . May change
* someday in the future . */
if ( ( debug != null ) && Debug . isOn ( "ssl" ) ) { System . out . println ( threadName ( ) + ", called closeInbound()" ) ; } /* * No need to throw an Exception if we haven ' t even started yet . */
if ( ( connectionState != cs_START ) && ! recvCN ) { recvCN = true ; // Only receive the Exception once
fatal ( Alerts . alert_internal_error , "Inbound closed before receiving peer's close_notify: " + "possible truncation attack?" ) ; } else { /* * Currently , this is a no - op , but in case we change
* the close inbound code later . */
closeInboundInternal ( ) ; } |
public class Validate { /** * Checks if the given boolean expression evaluates to < code > false < / code > .
* @ param expression The expression to evaluate .
* @ param constraint Textual description of the expression to include in the exception in case the validation fails .
* @ throws ParameterException if the given expression does not evaluate to < code > false < / code > . */
public static void isFalse ( Boolean expression , String constraint ) { } } | if ( ! validation ) return ; notNull ( expression ) ; notNull ( constraint ) ; if ( ! expression ) throw new ParameterException ( ErrorCode . CONSTRAINT , "Parameter must not fulfill constraint \"" + constraint + "\"" ) ; |
public class S3Dispatcher { /** * Handles POST / bucket / id ? uploadId = X
* @ param ctx the context describing the current request
* @ param bucket the bucket containing the object to upload
* @ param id name of the object to upload
* @ param uploadId the multipart upload that should be completed
* @ param in input stream with xml listing uploaded parts */
private void completeMultipartUpload ( WebContext ctx , Bucket bucket , String id , final String uploadId , InputStreamHandler in ) { } } | if ( ! multipartUploads . remove ( uploadId ) ) { ctx . respondWith ( ) . error ( HttpResponseStatus . NOT_FOUND , ERROR_MULTIPART_UPLOAD_DOES_NOT_EXIST ) ; return ; } final Map < Integer , File > parts = new HashMap < > ( ) ; XMLReader reader = new XMLReader ( ) ; reader . addHandler ( "Part" , part -> { int number = part . queryValue ( "PartNumber" ) . asInt ( 0 ) ; parts . put ( number , new File ( getUploadDir ( uploadId ) , String . valueOf ( number ) ) ) ; } ) ; try { reader . parse ( in ) ; } catch ( IOException e ) { Exceptions . handle ( e ) ; } File file = combineParts ( id , uploadId , parts . entrySet ( ) . stream ( ) . sorted ( Comparator . comparing ( Map . Entry :: getKey ) ) . map ( Map . Entry :: getValue ) . collect ( Collectors . toList ( ) ) ) ; file . deleteOnExit ( ) ; if ( ! file . exists ( ) ) { ctx . respondWith ( ) . error ( HttpResponseStatus . NOT_FOUND , "Multipart File does not exist" ) ; return ; } try { StoredObject object = bucket . getObject ( id ) ; Files . move ( file , object . getFile ( ) ) ; delete ( getUploadDir ( uploadId ) ) ; String etag = Files . hash ( object . getFile ( ) , Hashing . md5 ( ) ) . toString ( ) ; XMLStructuredOutput out = ctx . respondWith ( ) . xml ( ) ; out . beginOutput ( "CompleteMultipartUploadResult" ) ; out . property ( "Location" , "" ) ; out . property ( RESPONSE_BUCKET , bucket . getName ( ) ) ; out . property ( "Key" , id ) ; out . property ( HTTP_HEADER_NAME_ETAG , etag ) ; out . endOutput ( ) ; } catch ( IOException e ) { Exceptions . ignore ( e ) ; ctx . respondWith ( ) . error ( HttpResponseStatus . INTERNAL_SERVER_ERROR , "Could not build response" ) ; } |
public class CmsAccountsApp { /** * Creates info panel for principals . < p >
* @ param principal to get info panel for
* @ return CmsResourceInfo */
public static CmsResourceInfo getPrincipalInfo ( I_CmsPrincipal principal ) { } } | if ( principal == null ) { return null ; } if ( principal instanceof CmsUser ) { CmsUser user = ( CmsUser ) principal ; CmsUserIconHelper helper = OpenCms . getWorkplaceAppManager ( ) . getUserIconHelper ( ) ; return new CmsResourceInfo ( user . getName ( ) , user . getEmail ( ) , new ExternalResource ( helper . getTinyIconPath ( A_CmsUI . getCmsObject ( ) , user ) ) ) ; } if ( principal . getId ( ) . equals ( CmsAccessControlEntry . PRINCIPAL_ALL_OTHERS_ID ) ) { return new CmsResourceInfo ( CmsVaadinUtils . getMessageText ( org . opencms . workplace . commons . Messages . GUI_LABEL_ALLOTHERS_0 ) , CmsVaadinUtils . getMessageText ( org . opencms . workplace . commons . Messages . GUI_DESCRIPTION_ALLOTHERS_0 ) , new CmsCssIcon ( OpenCmsTheme . ICON_PRINCIPAL_ALL ) ) ; } if ( principal . getId ( ) . equals ( CmsAccessControlEntry . PRINCIPAL_OVERWRITE_ALL_ID ) ) { return new CmsResourceInfo ( CmsVaadinUtils . getMessageText ( org . opencms . workplace . commons . Messages . GUI_LABEL_OVERWRITEALL_0 ) , CmsVaadinUtils . getMessageText ( org . opencms . workplace . commons . Messages . GUI_DESCRIPTION_OVERWRITEALL_0 ) , new CmsCssIcon ( OpenCmsTheme . ICON_PRINCIPAL_OVERWRITE ) ) ; } CmsRole role = CmsRole . valueOfId ( principal . getId ( ) ) ; if ( role != null ) { return new CmsResourceInfo ( role . getName ( A_CmsUI . get ( ) . getLocale ( ) ) , role . getDescription ( A_CmsUI . get ( ) . getLocale ( ) ) , new CmsCssIcon ( OpenCmsTheme . ICON_ROLE ) ) ; } return new CmsResourceInfo ( principal . getName ( ) , principal . getDescription ( A_CmsUI . get ( ) . getLocale ( ) ) , new CmsCssIcon ( OpenCmsTheme . ICON_GROUP ) ) ; |
public class ExplicitMessageEncryptionElement { /** * Return true , if the { @ code message } already contains an EME element with the specified { @ code protocolNamespace } .
* @ param message message
* @ param protocolNamespace namespace
* @ return true if message has EME element for that namespace , otherwise false */
public static boolean hasProtocol ( Message message , String protocolNamespace ) { } } | List < ExtensionElement > extensionElements = message . getExtensions ( ExplicitMessageEncryptionElement . ELEMENT , ExplicitMessageEncryptionElement . NAMESPACE ) ; for ( ExtensionElement extensionElement : extensionElements ) { ExplicitMessageEncryptionElement e = ( ExplicitMessageEncryptionElement ) extensionElement ; if ( e . getEncryptionNamespace ( ) . equals ( protocolNamespace ) ) { return true ; } } return false ; |
public class JCurand { /** * < pre >
* Generate normally distributed floats .
* Use generator to generate num float results into the device memory at
* outputPtr . The device memory must have been previously allocated and be
* large enough to hold all the results . Launches are done with the stream
* set using : : curandSetStream ( ) , or the null stream if no stream has been set .
* Results are 32 - bit floating point values with mean mean and standard
* deviation stddev .
* Normally distributed results are generated from pseudorandom generators
* with a Box - Muller transform , and so require num to be even .
* Quasirandom generators use an inverse cumulative distribution
* function to preserve dimensionality .
* There may be slight numerical differences between results generated
* on the GPU with generators created with : : curandCreateGenerator ( )
* and results calculated on the CPU with generators created with
* : : curandCreateGeneratorHost ( ) . These differences arise because of
* differences in results for transcendental functions . In addition ,
* future versions of CURAND may use newer versions of the CUDA math
* library , so different versions of CURAND may give slightly different
* numerical values .
* @ param generator - Generator to use
* @ param outputPtr - Pointer to device memory to store CUDA - generated results , or
* Pointer to host memory to store CPU - generated results
* @ param n - Number of floats to generate
* @ param mean - Mean of normal distribution
* @ param stddev - Standard deviation of normal distribution
* @ return
* CURAND _ STATUS _ NOT _ INITIALIZED if the generator was never created
* CURAND _ STATUS _ PREEXISTING _ FAILURE if there was an existing error from
* a previous kernel launch
* CURAND _ STATUS _ LAUNCH _ FAILURE if the kernel launch failed for any reason
* CURAND _ STATUS _ LENGTH _ NOT _ MULTIPLE if the number of output samples is
* not a multiple of the quasirandom dimension , or is not a multiple
* of two for pseudorandom generators
* CURAND _ STATUS _ SUCCESS if the results were generated successfully
* < / pre > */
public static int curandGenerateNormal ( curandGenerator generator , Pointer outputPtr , long n , float mean , float stddev ) { } } | return checkResult ( curandGenerateNormalNative ( generator , outputPtr , n , mean , stddev ) ) ; |
public class H2InboundLink { /** * ( non - Javadoc )
* @ see com . ibm . ws . http . channel . internal . inbound . HttpInboundLink # close ( com . ibm . wsspi . channelfw . VirtualConnection , java . lang . Exception ) */
@ Override public void close ( VirtualConnection inVC , Exception e ) { } } | // This H2InboundLink . close method should only get called from the H2HttpInboundLinkWrap . close method .
// for this reason , if we sync this method , then if a stream changes state while we are looking at it , we should
// be able to do the close when that stream closing causes this close method to be called .
// the device link close should always use the initial VC that this object was created with , so inVC will be ignored .
synchronized ( linkStatusSync ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close(vc,e): :linkstatus: is: " + linkStatus + " :close: H2InboundLink hc: " + this . hashCode ( ) ) ; } if ( ( linkStatus == LINK_STATUS . CLOSING ) || ( linkStatus == LINK_STATUS . GOAWAY_SENDING ) || ( linkStatus == LINK_STATUS . WAIT_TO_SEND_GOAWAY ) ) { // another thread is in charge of closing , or another thread has already armed the future to close
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close(vc,e): returning: close of muxLink is being done on a differnt thread" + " :close: H2InboundLink hc: " + this . hashCode ( ) ) ; } return ; } if ( e == null ) { // Attempt to close down cleanly if all streams are closed .
// Determine if all streams are in half closed or closed state
// If not , do nothing and return
// If so , look to see if the GoAway frame has been sent
// If not , trigger a timer and wait to send the GOAWAY frame
// If so , call close on the TCP - Channel / Device - Channel below us
H2StreamProcessor stream ; for ( Integer i : streamTable . keySet ( ) ) { stream = streamTable . get ( i ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close(vc,e): looking at stream: " + stream . getId ( ) ) ; } if ( stream . getId ( ) != 0 && ! stream . isHalfClosed ( ) && ! stream . isStreamClosed ( ) && highestLocalStreamId > - 1 ) { continue ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close(vc,e): stream not ready to close: " + stream . getId ( ) + " :close: H2InboundLink hc: " + this . hashCode ( ) ) ; } return ; } } } // All streams are either closed or in half closed , and a GOAWAY frame needs to be sent
// Wait the timeout time and then send the GOAWAY frame with the last good stream
linkStatus = LINK_STATUS . WAIT_TO_SEND_GOAWAY ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close(vc,e): loading up the wait to close timeout" + " :close: H2InboundLink hc: " + this . hashCode ( ) ) ; } ScheduledExecutorService scheduler = CHFWBundle . getScheduledExecutorService ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close : scheduler : " + scheduler + " config : " + config ) ; } connTimeout = new H2ConnectionTimeout ( e ) ; if ( e == null ) { // close cleanly if no other traffic has been received for this H2 connection within the timeout
// Save the future so we can cancel it later on
closeFuture = scheduler . schedule ( connTimeout , config . getH2ConnCloseTimeout ( ) , TimeUnit . SECONDS ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close(vc,e): close on link called with exception: " + e ) ; } // do the close immediately on this thread
connTimeout . run ( ) ; } } |
public class CommerceDiscountUsageEntryLocalServiceWrapper { /** * Adds the commerce discount usage entry to the database . Also notifies the appropriate model listeners .
* @ param commerceDiscountUsageEntry the commerce discount usage entry
* @ return the commerce discount usage entry that was added */
@ Override public com . liferay . commerce . discount . model . CommerceDiscountUsageEntry addCommerceDiscountUsageEntry ( com . liferay . commerce . discount . model . CommerceDiscountUsageEntry commerceDiscountUsageEntry ) { } } | return _commerceDiscountUsageEntryLocalService . addCommerceDiscountUsageEntry ( commerceDiscountUsageEntry ) ; |
public class servicegroup { /** * Use this API to delete servicegroup resources . */
public static base_responses delete ( nitro_service client , servicegroup resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { servicegroup deleteresources [ ] = new servicegroup [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { deleteresources [ i ] = new servicegroup ( ) ; deleteresources [ i ] . servicegroupname = resources [ i ] . servicegroupname ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ; |
public class QuickSelect { /** * The usual swap method .
* @ param < T > object type
* @ param data Array
* @ param a First index
* @ param b Second index */
private static final < T > void swap ( List < T > data , int a , int b ) { } } | data . set ( b , data . set ( a , data . get ( b ) ) ) ; |
public class NavMeshQuery { /** * Gets a path from the explored nodes in the previous search .
* @ param endRef
* The reference id of the end polygon .
* @ returns An ordered list of polygon references representing the path . ( Start to end . )
* @ remarks The result of this function depends on the state of the query object . For that reason it should only be
* used immediately after one of the two Dijkstra searches , findPolysAroundCircle or findPolysAroundShape . */
public Result < List < Long > > getPathFromDijkstraSearch ( long endRef ) { } } | if ( ! m_nav . isValidPolyRef ( endRef ) ) { return Result . invalidParam ( "Invalid end ref" ) ; } List < Node > nodes = m_nodePool . findNodes ( endRef ) ; if ( nodes . size ( ) != 1 ) { return Result . invalidParam ( "Invalid end ref" ) ; } Node endNode = nodes . get ( 0 ) ; if ( ( endNode . flags & DT_NODE_CLOSED ) == 0 ) { return Result . invalidParam ( "Invalid end ref" ) ; } return Result . success ( getPathToNode ( endNode ) ) ; |
public class SarlSkillImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EList < JvmParameterizedTypeReference > getImplements ( ) { } } | if ( implements_ == null ) { implements_ = new EObjectContainmentEList < JvmParameterizedTypeReference > ( JvmParameterizedTypeReference . class , this , SarlPackage . SARL_SKILL__IMPLEMENTS ) ; } return implements_ ; |
public class CmsDriverManager { /** * Reads a principal ( an user or group ) from the historical archive based on its ID . < p >
* @ param dbc the current database context
* @ param principalId the id of the principal to read
* @ return the historical principal entry with the given id
* @ throws CmsException if something goes wrong , ie . { @ link CmsDbEntryNotFoundException }
* @ see CmsObject # readUser ( CmsUUID )
* @ see CmsObject # readGroup ( CmsUUID )
* @ see CmsObject # readHistoryPrincipal ( CmsUUID ) */
public CmsHistoryPrincipal readHistoricalPrincipal ( CmsDbContext dbc , CmsUUID principalId ) throws CmsException { } } | return getHistoryDriver ( dbc ) . readPrincipal ( dbc , principalId ) ; |
public class TokenBucket { /** * Note : this method should only be called while holding the class lock . For performance , the lock is not explicitly
* acquired . */
private void updateTokensStored ( long now ) { } } | if ( now <= this . nextTokenAvailableMillis ) { return ; } long millisUnaccounted = now - this . nextTokenAvailableMillis ; double newTokens = millisUnaccounted * this . tokensPerMilli ; this . nextTokenAvailableMillis = now ; this . tokensStored = Math . min ( this . tokensStored + newTokens , Math . max ( this . tokensStored , this . maxBucketSizeInTokens ) ) ; |
public class InstallUtils { /** * Java 2 security APIs for file . listFiles ( ) */
public static File [ ] listFiles ( final File f ) { } } | return AccessController . doPrivileged ( new PrivilegedAction < File [ ] > ( ) { @ Override public File [ ] run ( ) { return f . listFiles ( ) ; } } ) ; |
public class Follow { /** * This is rule 2 from Dragon Book :
* 2 ) Gibt es eine Produktion A - - > alpha B beta , ist der gesamte Inhalt von
* FIRST ( beta ) ausser epsilon in FOLLOW ( B ) enthalten . */
private boolean iterate ( Production production ) { } } | List < Construction > constructions = production . getConstructions ( ) ; boolean changed = false ; /* * Search production for non - terminals . . . */
for ( int i = 0 ; i < constructions . size ( ) ; i ++ ) { Construction construction = constructions . get ( i ) ; if ( construction . isTerminal ( ) ) { continue ; } Set < Terminal > followSet = follow . get ( construction . getName ( ) ) ; if ( followSet == null ) { continue ; } int startSize = followSet . size ( ) ; /* * For the found non - terminal find the following constructions by first sets . */
if ( i < constructions . size ( ) - 1 ) { for ( int j = i + 1 ; j < constructions . size ( ) ; j ++ ) { Construction followingConstruction = constructions . get ( j ) ; Set < Terminal > firstSet = first . get ( followingConstruction ) ; if ( firstSet == null ) { continue ; } for ( Terminal follower : firstSet ) { if ( ! follower . equals ( EmptyTerminal . getInstance ( ) ) ) { followSet . add ( follower ) ; } } if ( ! firstSet . contains ( EmptyTerminal . getInstance ( ) ) ) { break ; } if ( j == constructions . size ( ) - 1 ) { followSet . addAll ( follow . get ( production . getName ( ) ) ) ; } } } else { followSet . addAll ( follow . get ( production . getName ( ) ) ) ; } if ( startSize < followSet . size ( ) ) { changed = true ; } } return changed ; |
public class ReturnPathType { /** * Merge this fact with given fact .
* @ param fact
* another dataflow fact */
public void mergeWith ( ReturnPathType fact ) { } } | if ( fact . isTop ( ) ) { // other fact is top : no change to this one
return ; } else if ( this . isTop ( ) ) { // this fact is top : copy other fact
this . copyFrom ( fact ) ; } else { // neither fact is top : as long as one of the two
// facts represents a ( possible ) normal return , then the result
// is a possible normal return
if ( fact . type == CAN_RETURN_NORMALLY ) { this . type = CAN_RETURN_NORMALLY ; } } |
public class HazelcastExecutorTopologyService { /** * Asynchronously put the work into the pending map so we can work on submitting it to the worker
* if we wanted . Could possibly cause duplicate work if we execute the work , then add to the map .
* @ param task
* @ return */
public Future < HazeltaskTask < GROUP > > addPendingTaskAsync ( HazeltaskTask < GROUP > task ) { } } | return pendingTask . putAsync ( task . getId ( ) , task ) ; |
public class Base64Coder { /** * Decode lines .
* @ param text the text
* @ return the byte [ ] */
public static byte [ ] decodeLines ( final String text ) { } } | char [ ] buf = new char [ text . length ( ) ] ; int pValue = 0 ; for ( int ip = 0 ; ip < text . length ( ) ; ip ++ ) { final char cValue = text . charAt ( ip ) ; if ( cValue != ' ' && cValue != '\r' && cValue != '\n' && cValue != '\t' ) { buf [ pValue ++ ] = cValue ; } } return decode ( buf , 0 , pValue ) ; |
public class NotificationView { /** * Set contentView .
* @ param resId */
public void setContentView ( int resId ) { } } | if ( mCurrentLayoutId != resId ) { View view = inflate ( mContext , resId , null ) ; if ( mDefaultContentView == null && resId == mCallback . getContentViewDefaultLayoutId ( this ) ) { mDefaultContentView = view ; mDefaultLayoutId = resId ; } mCurrentLayoutId = resId ; setContentView ( view ) ; } |
public class ItemDataCloneVisitor { /** * Return true if the itemstate for item with < code > itemId < / code > UUId exist in
* < code > List & lt ; ItemState & gt ; < / code > list .
* @ param list
* @ param itemId
* @ param state
* @ return */
private boolean itemInItemStateList ( List < ItemState > list , String itemId , int state ) { } } | boolean retval = false ; for ( ItemState itemState : list ) { if ( itemState . getState ( ) == state && itemState . getData ( ) . getIdentifier ( ) . equals ( itemId ) ) { retval = true ; break ; } } return retval ; |
public class MethodSorter { /** * Gets declared methods of a class in a predictable order , unless @ FixMethodOrder ( MethodSorters . JVM ) is specified .
* Using the JVM order is unwise since the Java platform does not
* specify any particular order , and in fact JDK 7 returns a more or less
* random order ; well - written test code would not assume any order , but some
* does , and a predictable failure is better than a random failure on
* certain platforms . By default , uses an unspecified but deterministic order .
* @ param clazz a class
* @ return same as { @ link Class # getDeclaredMethods } but sorted
* @ see < a href = " http : / / bugs . sun . com / view _ bug . do ? bug _ id = 7023180 " > JDK
* ( non - ) bug # 7023180 < / a > */
public static Method [ ] getDeclaredMethods ( Class < ? > clazz ) { } } | Comparator < Method > comparator = getSorter ( clazz . getAnnotation ( FixMethodOrder . class ) ) ; Method [ ] methods = clazz . getDeclaredMethods ( ) ; if ( comparator != null ) { Arrays . sort ( methods , comparator ) ; } return methods ; |
public class CPDAvailabilityEstimateLocalServiceUtil { /** * Returns a range of all the cpd availability estimates .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . model . impl . CPDAvailabilityEstimateModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of cpd availability estimates
* @ param end the upper bound of the range of cpd availability estimates ( not inclusive )
* @ return the range of cpd availability estimates */
public static java . util . List < com . liferay . commerce . model . CPDAvailabilityEstimate > getCPDAvailabilityEstimates ( int start , int end ) { } } | return getService ( ) . getCPDAvailabilityEstimates ( start , end ) ; |
public class BeanMappingConfigRespository { /** * = = = = = helper method = = = = = */
private String mapperObjectName ( Class src , Class dest ) { } } | String name1 = src . getName ( ) ; String name2 = dest . getName ( ) ; return name1 + SEPERATOR + name2 ; |
public class CompactingHashTable { public void buildTableWithUniqueKey ( final MutableObjectIterator < T > input ) throws IOException { } } | // go over the complete input and insert every element into the hash table
T value ; while ( this . running && ( value = input . next ( ) ) != null ) { insertOrReplaceRecord ( value ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.