signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Postcard { /** * Navigation to the route with path in postcard . * @ param context Activity and so on . */ public Object navigation ( Context context , NavigationCallback callback ) { } }
return ARouter . getInstance ( ) . navigation ( context , this , - 1 , callback ) ;
public class GcsExampleServlet { /** * Transfer the data from the inputStream to the outputStream . Then close both streams . */ private void copy ( InputStream input , OutputStream output ) throws IOException { } }
try { byte [ ] buffer = new byte [ BUFFER_SIZE ] ; int bytesRead = input . read ( buffer ) ; while ( bytesRead != - 1 ) { output . write ( buffer , 0 , bytesRead ) ; bytesRead = input . read ( buffer ) ; } } finally { input . close ( ) ; output . close ( ) ; }
public class DependencyIdentifier { /** * TODO * @ param clazz * @ param qualifiers * @ return */ public static DependencyIdentifier getDependencyIdentifierForClass ( Class clazz , SortedSet < String > qualifiers ) { } }
List < Type > typeList = new ArrayList < Type > ( ) ; addTypeToList ( clazz , typeList ) ; return new DependencyIdentifier ( typeList , qualifiers ) ;
public class CaffeinatedGuava { /** * Returns a Caffeine cache wrapped in a Guava { @ link LoadingCache } facade . * @ param builder the configured cache builder * @ param loader the cache loader used to obtain new values * @ return a cache exposed under the Guava APIs */ @ NonNull public static < K , V , K1 extends K , V1 extends V > LoadingCache < K1 , V1 > build ( @ NonNull Caffeine < K , V > builder , @ NonNull CacheLoader < ? super K1 , V1 > loader ) { } }
@ SuppressWarnings ( "unchecked" ) CacheLoader < K1 , V1 > castedLoader = ( CacheLoader < K1 , V1 > ) loader ; return build ( builder , hasLoadAll ( castedLoader ) ? new BulkLoader < > ( castedLoader ) : new SingleLoader < > ( castedLoader ) ) ;
public class IfcAddressImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) public EList < IfcPerson > getOfPerson ( ) { } }
return ( EList < IfcPerson > ) eGet ( Ifc2x3tc1Package . Literals . IFC_ADDRESS__OF_PERSON , true ) ;
public class ValidatorClassLoader { /** * cleanup jar file factory cache */ public boolean cleanupJarFileFactory ( ) throws ValidatorManagerException { } }
boolean res = false ; final Class classJarURLConnection = JarURLConnection . class ; Field f ; try { f = classJarURLConnection . getDeclaredField ( "factory" ) ; } catch ( final NoSuchFieldException e ) { throw new ValidatorManagerException ( e ) ; } if ( f == null ) { return false ; } f . setAccessible ( true ) ; Object obj ; try { obj = f . get ( null ) ; } catch ( final IllegalAccessException e ) { throw new ValidatorManagerException ( e ) ; } if ( obj == null ) { return false ; } final Class classJarFileFactory = obj . getClass ( ) ; HashMap fileCache = null ; try { f = classJarFileFactory . getDeclaredField ( "fileCache" ) ; f . setAccessible ( true ) ; obj = f . get ( null ) ; if ( obj instanceof HashMap ) { fileCache = ( HashMap ) obj ; } } catch ( NoSuchFieldException | IllegalAccessException e ) { throw new ValidatorManagerException ( e ) ; } HashMap urlCache = null ; try { f = classJarFileFactory . getDeclaredField ( "urlCache" ) ; f . setAccessible ( true ) ; obj = f . get ( null ) ; if ( obj instanceof HashMap ) { urlCache = ( HashMap ) obj ; } } catch ( NoSuchFieldException | IllegalAccessException e ) { throw new ValidatorManagerException ( e ) ; } if ( urlCache != null ) { final HashMap urlCacheTmp = ( HashMap ) urlCache . clone ( ) ; final Iterator it = urlCacheTmp . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { obj = it . next ( ) ; if ( ! ( obj instanceof JarFile ) ) { continue ; } final JarFile jarFile = ( JarFile ) obj ; if ( this . setJarFileNames2Close . contains ( jarFile . getName ( ) ) ) { try { jarFile . close ( ) ; } catch ( final IOException e ) { throw new ValidatorManagerException ( e ) ; } if ( fileCache != null ) { fileCache . remove ( urlCache . get ( jarFile ) ) ; } urlCache . remove ( jarFile ) ; } } res = true ; } else if ( fileCache != null ) { final HashMap fileCacheTmp = ( HashMap ) fileCache . clone ( ) ; final Iterator it = fileCacheTmp . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { final Object key = it . next ( ) ; obj = fileCache . get ( key ) ; if ( ! ( obj instanceof JarFile ) ) { continue ; } final JarFile jarFile = ( JarFile ) obj ; if ( this . setJarFileNames2Close . contains ( jarFile . getName ( ) ) ) { try { jarFile . close ( ) ; } catch ( final IOException e ) { throw new ValidatorManagerException ( e ) ; } fileCache . remove ( key ) ; } } res = true ; } this . setJarFileNames2Close . clear ( ) ; return res ;
public class DiagnosticRenderUtil { /** * Render the diagnostics . * @ param renderContext the current renderContext * @ param component the component being rendered * @ param diags the list of Diagnostic objects * @ param severity the severity we are rendering */ private static void renderHelper ( final WebXmlRenderContext renderContext , final Diagnosable component , final List < Diagnostic > diags , final int severity ) { } }
if ( diags . isEmpty ( ) ) { return ; } XmlStringBuilder xml = renderContext . getWriter ( ) ; xml . appendTagOpen ( TAG_NAME ) ; xml . appendAttribute ( "id" , "_wc_" . concat ( UUID . randomUUID ( ) . toString ( ) ) ) ; xml . appendAttribute ( "type" , getLevel ( severity ) ) ; xml . appendAttribute ( "for" , component . getId ( ) ) ; xml . appendClose ( ) ; for ( Diagnostic diagnostic : diags ) { xml . appendTag ( MESSAGE_TAG_NAME ) ; xml . appendEscaped ( diagnostic . getDescription ( ) ) ; xml . appendEndTag ( MESSAGE_TAG_NAME ) ; } xml . appendEndTag ( TAG_NAME ) ;
public class FluentCloseableIterable { /** * Returns an { @ code ImmutableList } containing all of the elements from this { @ code * FluentIterable } in the order specified by { @ code comparator } . To produce an { @ code * ImmutableList } sorted by its natural ordering , use { @ code toSortedList ( Ordering . natural ( ) ) } . */ public final ImmutableList < T > toSortedList ( Comparator < ? super T > comparator ) { } }
return Ordering . from ( comparator ) . immutableSortedCopy ( this ) ;
public class DTMDocumentImpl { /** * Append a comment child at the current insertion point . Assumes that the * actual content of the comment has previously been appended to the m _ char * buffer ( shared with the builder ) . * @ param m _ char _ current _ start int Starting offset of node ' s content in m _ char . * @ param contentLength int Length of node ' s content in m _ char . */ void appendComment ( int m_char_current_start , int contentLength ) { } }
// create a Comment Node // % TBD % may be possible to combine with appendNode ( ) to replace the next chunk of code int w0 = COMMENT_NODE ; // W1 : Parent int w1 = currentParent ; // W2 : Start position within m _ char int w2 = m_char_current_start ; // W3 : Length of the full string int w3 = contentLength ; int ourslot = appendNode ( w0 , w1 , w2 , w3 ) ; previousSibling = ourslot ;
public class DRL6StrictParser { /** * lhsNot : = NOT * ( ( LEFT _ PAREN ( or _ key | and _ key ) ) = > lhsOr / / prevents ' ( ( ' for prefixed and / or * | LEFT _ PAREN lhsOr RIGHT _ PAREN * | lhsPatternBind * @ param ce * @ return * @ throws org . antlr . runtime . RecognitionException */ protected BaseDescr lhsNot ( CEDescrBuilder < ? , ? > ce , boolean allowOr ) throws RecognitionException { } }
CEDescrBuilder < ? , NotDescr > not = null ; if ( state . backtracking == 0 ) { not = ce . not ( ) ; helper . start ( not , CEDescrBuilder . class , null ) ; } try { match ( input , DRL6Lexer . ID , DroolsSoftKeywords . NOT , null , DroolsEditorType . KEYWORD ) ; if ( state . failed ) return null ; if ( state . backtracking == 0 ) { helper . emit ( Location . LOCATION_LHS_BEGIN_OF_CONDITION_NOT ) ; } if ( input . LA ( 1 ) == DRL6Lexer . LEFT_PAREN ) { boolean prefixed = helper . validateLT ( 2 , DroolsSoftKeywords . AND ) || helper . validateLT ( 2 , DroolsSoftKeywords . OR ) ; if ( ! prefixed ) { match ( input , DRL6Lexer . LEFT_PAREN , null , null , DroolsEditorType . SYMBOL ) ; if ( state . failed ) return null ; } if ( state . backtracking == 0 && input . LA ( 1 ) != DRL6Lexer . EOF ) { helper . emit ( Location . LOCATION_LHS_BEGIN_OF_CONDITION ) ; } lhsOr ( not , allowOr ) ; if ( state . failed ) return null ; if ( ! prefixed ) { match ( input , DRL6Lexer . RIGHT_PAREN , null , null , DroolsEditorType . SYMBOL ) ; if ( state . failed ) return null ; } } else if ( input . LA ( 1 ) != DRL6Lexer . EOF ) { lhsPatternBind ( not , true ) ; if ( state . failed ) return null ; } } finally { if ( state . backtracking == 0 ) { helper . end ( CEDescrBuilder . class , not ) ; } } return not != null ? not . getDescr ( ) : null ;
public class ObjectCellFormatter { /** * ロケールを指定して 、 文字列型をフォーマットし 、 結果を直接文字列として取得する 。 * @ param formatPattern フォーマットの書式 。 * @ param value フォーマット対象の値 。 * @ param locale ロケール 。 書式にロケール条件の記述 ( 例 . { @ code [ $ - 403 ] } ) が含まれている場合は 、 書式のロケールが優先されます 。 * @ return フォーマットした結果の文字列 。 */ public String formatAsString ( final String formatPattern , final String value , final Locale locale ) { } }
return format ( formatPattern , value , locale ) . getText ( ) ;
public class ClientInterfaceHandleManager { /** * Create a new handle for a transaction and store the client information * for that transaction in the internal structures . * ClientInterface handles have the partition ID encoded in them as the 10 * high - order non - sign bits ( where the SHORT _ CIRCUIT _ PART _ ID is the max value ) , * and a 53 bit sequence number in the low 53 bits . */ long getHandle ( boolean isSinglePartition , int partitionId , long clientHandle , int messageSize , long creationTimeNanos , String procName , long initiatorHSId , boolean isShortCircuitRead ) { } }
assert ( ! shouldCheckThreadIdAssertion ( ) || m_expectedThreadId == Thread . currentThread ( ) . getId ( ) ) ; if ( isShortCircuitRead ) { partitionId = SHORT_CIRCUIT_PART_ID ; } else if ( ! isSinglePartition ) { partitionId = MP_PART_ID ; } else if ( initiatorHSId == ClientInterface . NTPROC_JUNK_ID ) { partitionId = NT_PROC_PART_ID ; } PartitionInFlightTracker tracker = m_trackerMap . get ( partitionId ) ; if ( tracker == null ) { tracker = new PartitionInFlightTracker ( partitionId ) ; m_trackerMap = new Builder < Integer , PartitionInFlightTracker > ( ) . putAll ( m_trackerMap ) . put ( partitionId , tracker ) . build ( ) ; } long ciHandle = tracker . m_generator . getNextHandle ( ) ; Iv2InFlight inFlight = new Iv2InFlight ( ciHandle , clientHandle , messageSize , creationTimeNanos , procName , initiatorHSId ) ; tracker . m_inFlights . put ( ciHandle , inFlight ) ; m_outstandingTxns ++ ; m_acg . increaseBackpressure ( messageSize ) ; return ciHandle ;
public class LogPane { /** * Print a message as if it were logged , without going through the full * logger . * @ param message * Message text * @ param level * Message level */ public void publish ( String message , Level level ) { } }
try { publish ( new LogRecord ( level , message ) ) ; } catch ( BadLocationException e ) { throw new RuntimeException ( "Error writing a log-like message." , e ) ; }
public class Term { /** * 进行term合并 * @ param term * @ param maxNature */ public Term merage ( Term to ) { } }
this . name = this . name + to . getName ( ) ; if ( StringUtil . isNotBlank ( this . realName ) && StringUtil . isNotBlank ( to . getRealName ( ) ) ) { this . realName = this . realName + to . getRealName ( ) ; } this . setTo ( to . to ) ; return this ;
public class FastAdapter { /** * is called when the ViewHolder is in a transient state . return true if you want to reuse * that view anyways * @ param holder the viewHolder for the view which failed to recycle * @ return true if we want to recycle anyways ( false - it get ' s destroyed ) */ @ Override public boolean onFailedToRecycleView ( RecyclerView . ViewHolder holder ) { } }
if ( mVerbose ) Log . v ( TAG , "onFailedToRecycleView: " + holder . getItemViewType ( ) ) ; return mOnBindViewHolderListener . onFailedToRecycleView ( holder , holder . getAdapterPosition ( ) ) || super . onFailedToRecycleView ( holder ) ;
public class ExceptionWrapper { /** * Returns the given throwable as a < code > RuntimeException < / code > wrapping it in a new * < code > RuntimeException < / code > if necessary . * @ param throwable The throwable to wrap * @ return The wrapped throwable */ public static RuntimeException wrap ( Throwable throwable ) { } }
RuntimeException result ; if ( throwable instanceof RuntimeException ) { result = ( RuntimeException ) throwable ; } else { result = new RuntimeException ( throwable . getClass ( ) . getSimpleName ( ) , throwable ) ; } return result ;
public class ClusterExpirationManager { /** * holds the lock until this CompletableFuture completes . Without lock skipping this would deadlock . */ CompletableFuture < Void > handleLifespanExpireEntry ( K key , V value , long lifespan , boolean skipLocking ) { } }
// The most used case will be a miss so no extra read before if ( expiring . putIfAbsent ( key , key ) == null ) { if ( trace ) { log . tracef ( "Submitting expiration removal for key %s which had lifespan of %s" , toStr ( key ) , lifespan ) ; } AdvancedCache < K , V > cacheToUse = skipLocking ? cache . withFlags ( Flag . SKIP_LOCKING ) : cache ; CompletableFuture < Void > future = cacheToUse . removeLifespanExpired ( key , value , lifespan ) ; return future . whenComplete ( ( v , t ) -> expiring . remove ( key , key ) ) ; } return CompletableFutures . completedNull ( ) ;
public class CognitiveServicesAccountsInner { /** * Regenerates the specified account key for the specified Cognitive Services account . * @ param resourceGroupName The name of the resource group within the user ' s subscription . * @ param accountName The name of the cognitive services account within the specified resource group . Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower - case letters only . * @ 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 < CognitiveServicesAccountKeysInner > regenerateKeyAsync ( String resourceGroupName , String accountName , final ServiceCallback < CognitiveServicesAccountKeysInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( regenerateKeyWithServiceResponseAsync ( resourceGroupName , accountName ) , serviceCallback ) ;
public class TransitionsExtractorImpl { /** * Get the tiles for the transition . Create empty list if new transition . * @ param transitions The transitions data . * @ param transition The transition type . * @ return The associated tiles . */ private static Collection < TileRef > getTiles ( Map < Transition , Collection < TileRef > > transitions , Transition transition ) { } }
if ( ! transitions . containsKey ( transition ) ) { transitions . put ( transition , new HashSet < TileRef > ( ) ) ; } return transitions . get ( transition ) ;
public class ApiOvhIpLoadbalancing { /** * Add a new UDP frontend on your IP Load Balancing * REST : POST / ipLoadbalancing / { serviceName } / udp / frontend * @ param zone [ required ] Zone of your frontend . Use " all " for all owned zone . * @ param dedicatedIpfo [ required ] Only attach frontend on these ip . No restriction if null * @ param disabled [ required ] Disable your frontend . Default : ' false ' * @ param displayName [ required ] Human readable name for your frontend , this field is for you * @ param defaultFarmId [ required ] Default UDP Farm of your frontend * @ param port [ required ] Port ( s ) attached to your frontend . Supports single port ( numerical value ) , range ( 2 dash - delimited increasing ports ) and comma - separated list of ' single port ' and / or ' range ' . Each port must be in the [ 1;49151 ] range . * @ param serviceName [ required ] The internal name of your IP load balancing * API beta */ public OvhFrontendUdp serviceName_udp_frontend_POST ( String serviceName , String [ ] dedicatedIpfo , Long defaultFarmId , Boolean disabled , String displayName , String port , String zone ) throws IOException { } }
String qPath = "/ipLoadbalancing/{serviceName}/udp/frontend" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "dedicatedIpfo" , dedicatedIpfo ) ; addBody ( o , "defaultFarmId" , defaultFarmId ) ; addBody ( o , "disabled" , disabled ) ; addBody ( o , "displayName" , displayName ) ; addBody ( o , "port" , port ) ; addBody ( o , "zone" , zone ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhFrontendUdp . class ) ;
public class Smb2ChangeNotifyRequest { /** * { @ inheritDoc } * @ see jcifs . internal . smb2 . ServerMessageBlock2Request # createResponse ( jcifs . CIFSContext , * jcifs . internal . smb2 . ServerMessageBlock2Request ) */ @ Override protected Smb2ChangeNotifyResponse createResponse ( CIFSContext tc , ServerMessageBlock2Request < Smb2ChangeNotifyResponse > req ) { } }
return new Smb2ChangeNotifyResponse ( tc . getConfig ( ) ) ;
public class CmsUgcSession { /** * Adds the given value to the content document . < p > * @ param content the content document * @ param locale the content locale * @ param path the value XPath * @ param value the value */ protected void addContentValue ( CmsXmlContent content , Locale locale , String path , String value ) { } }
boolean hasValue = content . hasValue ( path , locale ) ; if ( ! hasValue ) { String [ ] pathElements = path . split ( "/" ) ; String currentPath = pathElements [ 0 ] ; for ( int i = 0 ; i < pathElements . length ; i ++ ) { if ( i > 0 ) { currentPath = CmsStringUtil . joinPaths ( currentPath , pathElements [ i ] ) ; } while ( ! content . hasValue ( currentPath , locale ) ) { content . addValue ( m_cms , currentPath , locale , CmsXmlUtils . getXpathIndexInt ( currentPath ) - 1 ) ; } } } content . getValue ( path , locale ) . setStringValue ( m_cms , value ) ;
public class BindTypeBuilder { /** * Parse entity properties and write code to read only CData Text fields . * @ param context * the context * @ param methodBuilder * the method builder * @ param instanceName * the instance name * @ param parserName * the parser name * @ param entity * the entity */ private static void generateParserOnXmlCharacters ( BindTypeContext context , MethodSpec . Builder methodBuilder , String instanceName , String parserName , BindEntity entity ) { } }
BindTransform bindTransform ; int count = 0 ; for ( BindProperty property : entity . getCollection ( ) ) { if ( property . xmlInfo . xmlType != XmlType . VALUE && property . xmlInfo . xmlType != XmlType . VALUE_CDATA ) continue ; count ++ ; methodBuilder . beginControlFlow ( "if (elementName!=null && $L.hasText())" , parserName ) ; methodBuilder . addCode ( "// property $L\n" , property . getName ( ) ) ; bindTransform = BindTransformer . lookup ( property ) ; bindTransform . generateParseOnXml ( context , methodBuilder , parserName , property . getPropertyType ( ) . getTypeName ( ) , "instance" , property ) ; methodBuilder . endControlFlow ( ) ; } if ( count == 0 ) { methodBuilder . addCode ( "// no property is binded to VALUE o CDATA " ) ; }
public class AipImageSearch { /** * 相同图检索 — 检索接口 * 完成入库后 , 可使用该接口实现相同图检索 。 * * 支持传入指定分类维度 ( 具体变量tags ) 进行检索 , 返回结果支持翻页 ( 具体变量pn 、 rn ) 。 * * * * 请注意 , 检索接口不返回原图 , 仅反馈当前填写的brief信息 , 请调用入库接口时尽量填写可关联至本地图库的图片id或者图片url等信息 。 * * * @ param url - 图片完整URL , URL长度不超过1024字节 , URL对应的图片base64编码后大小不超过4M , 最短边至少15px , 最长边最大4096px , 支持jpg / png / bmp格式 , 当image字段存在时url字段失效 * @ param options - 可选参数对象 , key : value都为string类型 * options - options列表 : * tags 1 - 65535范围内的整数 , tag间以逗号分隔 , 最多2个tag 。 样例 : " 100,11 " ; 检索时可圈定分类维度进行检索 * tag _ logic 检索时tag之间的逻辑 , 0 : 逻辑and , 1 : 逻辑or * pn 分页功能 , 起始位置 , 例 : 0 。 未指定分页时 , 默认返回前300个结果 ; 接口返回数量最大限制1000条 , 例如 : 起始位置为900 , 截取条数500条 , 接口也只返回第900 - 1000条的结果 , 共计100条 * rn 分页功能 , 截取条数 , 例 : 250 * @ return JSONObject */ public JSONObject sameHqSearchUrl ( String url , HashMap < String , String > options ) { } }
AipRequest request = new AipRequest ( ) ; preOperation ( request ) ; request . addBody ( "url" , url ) ; if ( options != null ) { request . addBody ( options ) ; } request . setUri ( ImageSearchConsts . SAME_HQ_SEARCH ) ; postOperation ( request ) ; return requestServer ( request ) ;
public class UnsupportedDateTimeField { /** * Gets an instance of UnsupportedDateTimeField for a specific named field . * Names should be of standard format , such as ' monthOfYear ' or ' hourOfDay ' . * The returned instance is cached . * @ param type the type to obtain * @ return the instance * @ throws IllegalArgumentException if durationField is null */ public static synchronized UnsupportedDateTimeField getInstance ( DateTimeFieldType type , DurationField durationField ) { } }
UnsupportedDateTimeField field ; if ( cCache == null ) { cCache = new HashMap < DateTimeFieldType , UnsupportedDateTimeField > ( 7 ) ; field = null ; } else { field = cCache . get ( type ) ; if ( field != null && field . getDurationField ( ) != durationField ) { field = null ; } } if ( field == null ) { field = new UnsupportedDateTimeField ( type , durationField ) ; cCache . put ( type , field ) ; } return field ;
public class PipelineScheduleQueue { /** * TODO : # 5163 - this is a concurrency issue - talk to Rajesh or JJ */ public boolean hasBuildCause ( CaseInsensitiveString pipelineName ) { } }
BuildCause buildCause = toBeScheduled . get ( pipelineName ) ; return buildCause != null && buildCause . getMaterialRevisions ( ) . totalNumberOfModifications ( ) > 0 ;
public class SqlInfoBuilder { /** * 构建 " IN " 范围查询的SqlInfo信息 . * @ param fieldText 数据库字段文本 * @ param values 对象数组的值 * @ return 返回SqlInfo信息 */ public SqlInfo buildInSql ( String fieldText , Object [ ] values ) { } }
if ( values == null || values . length == 0 ) { return sqlInfo ; } // 遍历数组 , 并遍历添加in查询的替换符和参数 this . suffix = StringHelper . isBlank ( this . suffix ) ? ZealotConst . IN_SUFFIX : this . suffix ; join . append ( prefix ) . append ( fieldText ) . append ( this . suffix ) . append ( "(" ) ; int len = values . length ; for ( int i = 0 ; i < len ; i ++ ) { if ( i == len - 1 ) { join . append ( "?) " ) ; } else { join . append ( "?, " ) ; } params . add ( values [ i ] ) ; } return sqlInfo . setJoin ( join ) . setParams ( params ) ;
public class HttpClientHelper { /** * for bad response , whose responseCode is not 200 level * @ param responseCode * @ param errorCode * @ param errorMsg * @ return * @ throws JSONException */ public static JSONObject processGoodRespStr ( int responseCode , String goodRespStr ) throws JSONException { } }
JSONObject response = new JSONObject ( ) ; response . put ( "responseCode" , responseCode ) ; if ( goodRespStr . equalsIgnoreCase ( "" ) ) { response . put ( "responseMsg" , "" ) ; } else { response . put ( "responseMsg" , new JSONObject ( goodRespStr ) ) ; } return response ;
public class HamcrestMatchers { /** * < p > Creates an order agnostic matcher for { @ linkplain Iterable } s that matches when a single pass over the examined * { @ linkplain Iterable } yields a series of items , each logically equal to one item anywhere in the specified items . * For a positive match , the examined iterable must be of the same length as the number of specified items . < / p > * < p > N . B . each of the specified items will only be used once during a given examination , so be careful when * specifying items that may be equal to more than one entry in an examined iterable . For example : < / p > * < br / > * < pre > * / / Arrange * Iterable < String > actual = Arrays . asList ( " foo " , " bar " ) ; * Iterable < String > expected = Arrays . asList ( " bar " , " foo " ) ; * / / Assert * assertThat ( actual , containsInAnyOrder ( expected ) ) ; * < / pre > * @ param items the items that must equal the items provided by an examined { @ linkplain Iterable } in any order */ public static < T > Matcher < Iterable < ? extends T > > containsInAnyOrder ( final Iterable < T > items ) { } }
return IsIterableContainingInAnyOrder . containsInAnyOrder ( items ) ;
public class TimeUtils { /** * Checks that a date falls in the interval allowing for a certain clock skew * expressed in minutes . The interval defined by ( startDate , endDate ) is * modified to be ( startDate - skewInMinutes , endDate + skewInMinutes ) . * @ param timeToCheck * the time to be checked * @ param startDate * the start date of the time range * @ param endDate * the end date of the time range * @ param skewInMinutes * the clock skew in minutes to take into account * @ throws IllegalArgumentException * if passed an illegal time range * @ return < code > true < / code > , if the time is in the given range , * < code > false < / code > otherwise */ public static boolean checkTimeInRangeWithSkew ( Date timeToCheck , Date startDate , Date endDate , int skewInMinutes ) { } }
if ( startDate . after ( endDate ) || startDate . equals ( endDate ) ) { String msg = String . format ( "Illegal time interval: start date must be before end date. [start date: %s, end date: %s]" , startDate , endDate ) ; throw new IllegalArgumentException ( msg ) ; } Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( startDate ) ; cal . add ( Calendar . MINUTE , - skewInMinutes ) ; Date skewedStartDate = cal . getTime ( ) ; cal . clear ( ) ; cal . setTime ( endDate ) ; cal . add ( Calendar . MINUTE , skewInMinutes ) ; Date skewedEndDate = cal . getTime ( ) ; return skewedEndDate . after ( timeToCheck ) && skewedStartDate . before ( timeToCheck ) ;
public class Security { /** * Implementation detail : If the property we just set in * setProperty ( ) was either " package . access " or * " package . definition " , we need to signal to the SecurityManager * class that the value has just changed , and that it should * invalidate it ' s local cache values . * Rather than create a new API entry for this function , * we use reflection to set a private variable . */ private static void invalidateSMCache ( String key ) { } }
final boolean pa = key . equals ( "package.access" ) ; final boolean pd = key . equals ( "package.definition" ) ; if ( pa || pd ) { AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { public Void run ( ) { try { /* Get the class via the bootstrap class loader . */ Class cl = Class . forName ( "java.lang.SecurityManager" , false , null ) ; Field f = null ; boolean accessible = false ; if ( pa ) { f = cl . getDeclaredField ( "packageAccessValid" ) ; accessible = f . isAccessible ( ) ; f . setAccessible ( true ) ; } else { f = cl . getDeclaredField ( "packageDefinitionValid" ) ; accessible = f . isAccessible ( ) ; f . setAccessible ( true ) ; } f . setBoolean ( f , false ) ; f . setAccessible ( accessible ) ; } catch ( Exception e1 ) { /* If we couldn ' t get the class , it hasn ' t * been loaded yet . If there is no such * field , we shouldn ' t try to set it . There * shouldn ' t be a security execption , as we * are loaded by boot class loader , and we * are inside a doPrivileged ( ) here . * NOOP : don ' t do anything . . . */ } return null ; } /* run */ } ) ; /* PrivilegedAction */ } /* if */
public class Stream { /** * Zip together the " a " , " b " and " c " arrays until one of them runs out of values . * Each triple of values is combined into a single value using the supplied zipFunction function . * @ param a * @ param b * @ return */ public static < R > Stream < R > zip ( final double [ ] a , final double [ ] b , final double [ ] c , final DoubleTriFunction < R > zipFunction ) { } }
return zip ( DoubleIteratorEx . of ( a ) , DoubleIteratorEx . of ( b ) , DoubleIteratorEx . of ( c ) , zipFunction ) ;
public class VListIterator { /** * helper function to be called after set ( ) and setValue ( ) */ private void afterSet ( E element ) { } }
switch ( _lastCall ) { case NEXT : _previousNode = _stack . getListNode ( _lastId ) ; break ; case PREVIOUS : _nextNode = _stack . getListNode ( _lastId ) ; break ; default : throw new IllegalStateException ( ) ; }
public class ServerGroup { /** * If the server group has a sequence number , then return it . Otherwise return null . */ public String sequence ( ) { } }
return dN == asg . length ( ) ? null : substr ( asg , dN + 1 , asg . length ( ) ) ;
public class BaseClassFinderService { /** * Get the configuration properties for this Pid . * @ param servicePid The service Pid * @ return The properties or null if they don ' t exist . */ @ SuppressWarnings ( "unchecked" ) @ Override public Dictionary < String , String > getProperties ( String servicePid ) { } }
Dictionary < String , String > properties = null ; try { if ( servicePid != null ) { ServiceReference caRef = bundleContext . getServiceReference ( ConfigurationAdmin . class . getName ( ) ) ; if ( caRef != null ) { ConfigurationAdmin configAdmin = ( ConfigurationAdmin ) bundleContext . getService ( caRef ) ; Configuration config = configAdmin . getConfiguration ( servicePid ) ; properties = config . getProperties ( ) ; } } } catch ( IOException e ) { e . printStackTrace ( ) ; } return properties ;
public class SpecificationMethodAdapter { /** * Injects the specified contract method code into the current * class , and returns a new Method object representing the injected * method . This is done by bypassing the SpecificationClassAdapter * and talking directly to its parent ( usually , a class writer ) . * @ param handle the handle from the code pool that holds code and * meta - information about the contract method * @ return the method node to invoke */ @ Requires ( "handle != null" ) @ Ensures ( "result != null" ) protected MethodNode injectContractMethod ( ContractHandle handle ) { } }
MethodNode methodNode = handle . getContractMethod ( ) ; if ( ! handle . isInjected ( ) ) { DebugUtils . info ( "instrument" , "contract method " + className + "." + methodNode . name + methodNode . desc ) ; ClassVisitor cv = classAdapter . getParent ( ) ; List < Long > lineNumbers = handle . getLineNumbers ( ) ; if ( lineNumbers != null ) { cv = new LineNumberingClassAdapter ( cv , lineNumbers ) ; } methodNode . accept ( new ContractFixingClassAdapter ( cv ) ) ; handle . setInjected ( true ) ; } return methodNode ;
public class Lookahead { /** * Consumes ( removes ) < tt > numberOfItems < / tt > at once . * Removes the given number of items from the stream . * @ param numberOfItems the number of items to remove */ public void consume ( int numberOfItems ) { } }
if ( numberOfItems < 0 ) { throw new IllegalArgumentException ( "numberOfItems < 0" ) ; } while ( numberOfItems -- > 0 ) { if ( ! itemBuffer . isEmpty ( ) ) { itemBuffer . remove ( 0 ) ; } else { if ( endReached ) { return ; } T item = fetch ( ) ; if ( item == null ) { endReached = true ; } } }
public class LazyUserTransaction { protected static String buildLazyTxExp ( ) { } }
final int status ; try { final TransactionManager manager = ContainerUtil . getComponent ( TransactionManager . class ) ; // for static use status = manager . getStatus ( ) ; } catch ( SystemException e ) { throw new IllegalStateException ( "Failed to get status from transaction manager." , e ) ; } final String statusExp ; if ( status == Status . STATUS_ACTIVE ) { statusExp = "Active" ; } else if ( status == Status . STATUS_MARKED_ROLLBACK ) { statusExp = "MarkedRollback" ; } else if ( status == Status . STATUS_PREPARED ) { statusExp = "Prepared" ; } else if ( status == Status . STATUS_COMMITTED ) { statusExp = "Committed" ; } else if ( status == Status . STATUS_ROLLEDBACK ) { statusExp = "RolledBack" ; } else if ( status == Status . STATUS_UNKNOWN ) { statusExp = "Unknown" ; } else if ( status == Status . STATUS_NO_TRANSACTION ) { statusExp = "NoTransaction" ; } else if ( status == Status . STATUS_PREPARING ) { statusExp = "Preparing" ; } else if ( status == Status . STATUS_COMMITTING ) { statusExp = "Committing" ; } else if ( status == Status . STATUS_ROLLING_BACK ) { statusExp = "RollingBack" ; } else { statusExp = String . valueOf ( status ) ; } final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "[" ) . append ( statusExp ) . append ( "]" ) ; boolean secondOrMore = false ; if ( isLazyTransactionReadyLazy ( ) ) { sb . append ( secondOrMore ? ", " : "" ) . append ( "readyLazy" ) ; secondOrMore = true ; } if ( isLazyTransactionLazyBegun ( ) ) { sb . append ( secondOrMore ? ", " : "" ) . append ( "lazyBegun" ) ; secondOrMore = true ; } if ( isLazyTransactionRealBegun ( ) ) { sb . append ( secondOrMore ? ", " : "" ) . append ( "realBegun" ) ; secondOrMore = true ; } final Integer hierarchyLevel = getCurrentHierarchyLevel ( ) ; if ( hierarchyLevel != null ) { sb . append ( secondOrMore ? ", " : "" ) . append ( "hierarchy=" ) . append ( hierarchyLevel ) ; secondOrMore = true ; } final List < IndependentProcessor > lazyProcessList = getLazyProcessList ( ) ; if ( ! lazyProcessList . isEmpty ( ) ) { sb . append ( secondOrMore ? ", " : "" ) . append ( "lazyProcesses=" ) . append ( lazyProcessList . size ( ) ) ; secondOrMore = true ; } final ForcedlyBegunResumer resumer = getForcedlyBegunResumer ( ) ; if ( resumer != null ) { sb . append ( secondOrMore ? ", " : "" ) . append ( "resumer=" ) . append ( DfTypeUtil . toClassTitle ( resumer ) ) ; secondOrMore = true ; } return sb . toString ( ) ;
public class Scheduler { /** * Submit a task to the ActiveContext . */ public synchronized void submitTask ( final ActiveContext context ) { } }
final TaskEntity task = taskQueue . poll ( ) ; final Integer taskId = task . getId ( ) ; final String command = task . getCommand ( ) ; final Configuration taskConf = TaskConfiguration . CONF . set ( TaskConfiguration . TASK , ShellTask . class ) . set ( TaskConfiguration . IDENTIFIER , taskId . toString ( ) ) . build ( ) ; final Configuration commandConf = Tang . Factory . getTang ( ) . newConfigurationBuilder ( ) . bindNamedParameter ( Command . class , command ) . build ( ) ; final Configuration merged = Configurations . merge ( taskConf , commandConf ) ; context . submitTask ( merged ) ; runningTasks . add ( task ) ;
public class XMemberFeatureCallImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setTypeLiteral ( boolean newTypeLiteral ) { } }
boolean oldTypeLiteral = typeLiteral ; typeLiteral = newTypeLiteral ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , XbasePackage . XMEMBER_FEATURE_CALL__TYPE_LITERAL , oldTypeLiteral , typeLiteral ) ) ;
public class ControllerLinkRelationProvider { /** * ( non - Javadoc ) * @ see org . springframework . hateoas . server . LinkRelationProvider # getItemResourceRelFor ( java . lang . Class ) */ @ Override public LinkRelation getItemResourceRelFor ( Class < ? > resource ) { } }
LookupContext context = LookupContext . forItemResourceRelLookup ( entityType ) ; return providers . getRequiredPluginFor ( context ) . getItemResourceRelFor ( resource ) ;
public class ComponentList { /** * Returns a list containing all components with specified name . * @ param name name of components to return * @ return a list of components with the matching name */ @ SuppressWarnings ( "unchecked" ) public final < C extends T > ComponentList < C > getComponents ( final String name ) { } }
final ComponentList < C > components = new ComponentList < C > ( ) ; for ( final T c : this ) { if ( c . getName ( ) . equals ( name ) ) { components . add ( ( C ) c ) ; } } return components ;
public class HBaseClient { /** * ( non - Javadoc ) * @ see com . impetus . kundera . persistence . api . Batcher # executeBatch ( ) */ @ Override public int executeBatch ( ) { } }
Map < String , List < Row > > batchData = new HashMap < String , List < Row > > ( ) ; try { for ( Node node : nodes ) { if ( node . isDirty ( ) ) { Row action = null ; node . handlePreEvent ( ) ; Object rowKey = node . getEntityId ( ) ; Object entity = node . getData ( ) ; EntityMetadata m = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , node . getDataClass ( ) ) ; String tableName = HBaseUtils . getHTableName ( m . getSchema ( ) , m . getTableName ( ) ) ; if ( node . isInState ( RemovedState . class ) ) { action = handler . prepareDelete ( rowKey ) ; } else { HBaseRow hbaseRow = ( ( HBaseDataHandler ) handler ) . createHbaseRow ( m , entity , rowKey , null ) ; action = handler . preparePut ( hbaseRow ) ; } node . handlePostEvent ( ) ; if ( ! batchData . containsKey ( tableName ) ) { batchData . put ( tableName , new ArrayList < Row > ( ) ) ; } batchData . get ( tableName ) . add ( action ) ; } } if ( ! batchData . isEmpty ( ) ) { ( ( HBaseDataHandler ) handler ) . batchProcess ( batchData ) ; } return batchData . size ( ) ; } catch ( IOException ioex ) { log . error ( "Error while executing batch insert/update, Caused by: ." , ioex ) ; throw new KunderaException ( ioex ) ; }
public class VMath { /** * Computes component - wise v1 = v1 + v2, * overwriting the vector v1. * @ param v1 first vector ( overwritten ) * @ param v2 second vector * @ return v1 = v1 + v2 */ public static double [ ] plusEquals ( final double [ ] v1 , final double [ ] v2 ) { } }
assert v1 . length == v2 . length : ERR_VEC_DIMENSIONS ; for ( int i = 0 ; i < v1 . length ; i ++ ) { v1 [ i ] += v2 [ i ] ; } return v1 ;
public class GenericWordSpace { /** * Returns the current semantic vector for the provided word , or if the word * is not currently in the semantic space , a vector is added for it and * returned . * @ param word a word * @ return the { @ code SemanticVector } for the provide word . */ private SparseIntegerVector getSemanticVector ( String word ) { } }
SparseIntegerVector v = wordToSemantics . get ( word ) ; if ( v == null ) { // lock on the word in case multiple threads attempt to add it at // once synchronized ( this ) { // recheck in case another thread added it while we were waiting // for the lock v = wordToSemantics . get ( word ) ; if ( v == null ) { v = new CompactSparseIntegerVector ( Integer . MAX_VALUE ) ; wordToSemantics . put ( word , v ) ; } } } return v ;
public class ClosableCharArrayWriter { /** * Writes the designated portion of the designated character array < p > . * @ param c the source character sequence . * @ param off the start offset in the source character sequence . * @ param len the number of characters to write . * @ throws java . io . IOException if an I / O error occurs . * In particular , an < tt > IOException < / tt > may be thrown * if this writer has been { @ link # close ( ) closed } . */ public synchronized void write ( char c [ ] , int off , int len ) throws IOException { } }
checkClosed ( ) ; if ( ( off < 0 ) || ( off > c . length ) || ( len < 0 ) || ( ( off + len ) > c . length ) || ( ( off + len ) < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return ; } int newcount = count + len ; if ( newcount > buf . length ) { buf = copyOf ( buf , Math . max ( buf . length << 1 , newcount ) ) ; } System . arraycopy ( c , off , buf , count , len ) ; count = newcount ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link VendorType } { @ code > } } */ @ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "VendorType" , substitutionHeadNamespace = "http://schema.intuit.com/finance/v3" , substitutionHeadName = "IntuitObject" ) public JAXBElement < VendorType > createVendorType ( VendorType value ) { } }
return new JAXBElement < VendorType > ( _VendorType_QNAME , VendorType . class , null , value ) ;
public class Builder { /** * - - create methods */ public static void add ( Element parent , NodeList list ) { } }
int size ; int i ; size = list . getLength ( ) ; for ( i = 0 ; i < size ; i ++ ) { addNode ( parent , list . item ( i ) ) ; }
public class Score { /** * scoring chunks are those chunks that make the input to one of the scoring functions */ private Chunk [ ] getScoringChunks ( Chunk [ ] allChunks ) { } }
if ( _preds == null ) return allChunks ; Chunk [ ] chks = new Chunk [ allChunks . length - _preds . numCols ( ) ] ; System . arraycopy ( allChunks , 0 , chks , 0 , chks . length ) ; return chks ;
public class NotificationBoard { /** * Set the y translation of this board . * @ param y */ public void setBoardTranslationY ( float y ) { } }
if ( mListeners != null ) { for ( StateListener l : mListeners ) { l . onBoardTranslationY ( this , y ) ; } } mContentView . setTranslationY ( y ) ;
public class DescribeAgentVersionsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeAgentVersionsRequest describeAgentVersionsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeAgentVersionsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeAgentVersionsRequest . getStackId ( ) , STACKID_BINDING ) ; protocolMarshaller . marshall ( describeAgentVersionsRequest . getConfigurationManager ( ) , CONFIGURATIONMANAGER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class IntHashMap { /** * Reconstitute the < tt > IntHashMap < / tt > instance from a stream ( i . e . , * deserialize it ) . */ private void readObject ( java . io . ObjectInputStream s ) throws IOException , ClassNotFoundException { } }
// Read in the threshold , loadfactor , and any hidden stuff s . defaultReadObject ( ) ; // Read in number of buckets and allocate the bucket array ; int numBuckets = s . readInt ( ) ; table = new Entry [ numBuckets ] ; // Read in size ( number of Mappings ) int size = s . readInt ( ) ; // Read the keys and values , and put the mappings in the IntHashMap for ( int i = 0 ; i < size ; i ++ ) { int key = s . readInt ( ) ; V value = ( V ) s . readObject ( ) ; put ( key , value ) ; }
public class ActionPathResolver { protected void buildUrlParts ( StringBuilder sb , UrlChain chain ) { } }
// also contains path variables final Object [ ] urlParts = chain != null ? chain . getUrlParts ( ) : null ; boolean existsParts = false ; if ( urlParts != null ) { for ( Object param : urlParts ) { if ( param != null ) { sb . append ( param ) . append ( URL_DELIMITER ) ; existsParts = true ; } } } if ( existsParts ) { sb . delete ( sb . length ( ) - 1 , sb . length ( ) ) ; // e . g . member / edit / 3 / to member / edit / 3 }
public class SynchronizedIO { /** * Write binary file data * @ param filePath the file path to write * @ param data the write * @ throws IOException when IO error occurs */ public void writeFile ( String filePath , byte [ ] data ) throws IOException { } }
Object lock = retrieveLock ( filePath ) ; synchronized ( lock ) { IO . writeFile ( filePath , data ) ; }
public class SpringApplicationBuilder { /** * Create an application context ( and its parent if specified ) with the command line * args provided . The parent is run first with the same arguments if has not yet been * started . * @ param args the command line arguments * @ return an application context created from the current state */ public ConfigurableApplicationContext run ( String ... args ) { } }
if ( this . running . get ( ) ) { // If already created we just return the existing context return this . context ; } configureAsChildIfNecessary ( args ) ; if ( this . running . compareAndSet ( false , true ) ) { synchronized ( this . running ) { // If not already running copy the sources over and then run . this . context = build ( ) . run ( args ) ; } } return this . context ;
public class Matth { /** * Returns the base - 2 logarithm of { @ code x } , rounded according to the specified rounding mode . * @ throws IllegalArgumentException if { @ code x < = 0} * @ throws ArithmeticException if { @ code mode } is { @ link RoundingMode # UNNECESSARY } and { @ code x } * is not a power of two */ @ SuppressWarnings ( "fallthrough" ) // TODO ( kevinb ) : remove after this warning is disabled globally public static int log2 ( BigInteger x , RoundingMode mode ) { } }
checkPositive ( "x" , N . checkArgNotNull ( x ) ) ; int logFloor = x . bitLength ( ) - 1 ; switch ( mode ) { case UNNECESSARY : checkRoundingUnnecessary ( isPowerOfTwo ( x ) ) ; // fall through case DOWN : case FLOOR : return logFloor ; case UP : case CEILING : return isPowerOfTwo ( x ) ? logFloor : logFloor + 1 ; case HALF_DOWN : case HALF_UP : case HALF_EVEN : if ( logFloor < SQRT2_PRECOMPUTE_THRESHOLD ) { BigInteger halfPower = SQRT2_PRECOMPUTED_BITS . shiftRight ( SQRT2_PRECOMPUTE_THRESHOLD - logFloor ) ; if ( x . compareTo ( halfPower ) <= 0 ) { return logFloor ; } else { return logFloor + 1 ; } } // Since sqrt ( 2 ) is irrational , log2 ( x ) - logFloor cannot be exactly 0.5 // To determine which side of logFloor . 5 the logarithm is , // we compare x ^ 2 to 2 ^ ( 2 * logFloor + 1 ) . BigInteger x2 = x . pow ( 2 ) ; int logX2Floor = x2 . bitLength ( ) - 1 ; return ( logX2Floor < 2 * logFloor + 1 ) ? logFloor : logFloor + 1 ; default : throw new AssertionError ( ) ; }
public class SAMLConfigurerBean { /** * Returns The { @ link ServiceProviderBuilder } for customization of the SAML Service Provider * @ param serviceProviderConfigurers A list { @ link ServiceProviderConfigurer } to apply to the { @ link * ServiceProviderBuilder } * before it is returned . * @ return The { @ link ServiceProviderBuilder } for customization of the SAML Service Provider */ public ServiceProviderBuilder serviceProvider ( List < ServiceProviderConfigurer > serviceProviderConfigurers ) { } }
serviceProviderConfigurers . forEach ( unchecked ( spc -> spc . configure ( serviceProvider ( ) ) ) ) ; return serviceProviderBuilder ;
public class Status { /** * Create a derived instance of { @ link Status } with the given cause . * However , the cause is not transmitted from server to client . */ public Status withCause ( Throwable cause ) { } }
if ( Objects . equal ( this . cause , cause ) ) { return this ; } return new Status ( this . code , this . description , cause ) ;
public class Layer { /** * The layer attributes . * For the < code > HaproxyStatsPassword < / code > , < code > MysqlRootPassword < / code > , and < code > GangliaPassword < / code > * attributes , AWS OpsWorks Stacks returns < code > * * * * * FILTERED * * * * * < / code > instead of the actual value * For an ECS Cluster layer , AWS OpsWorks Stacks the < code > EcsClusterArn < / code > attribute is set to the cluster ' s * ARN . * @ param attributes * The layer attributes . < / p > * For the < code > HaproxyStatsPassword < / code > , < code > MysqlRootPassword < / code > , and * < code > GangliaPassword < / code > attributes , AWS OpsWorks Stacks returns < code > * * * * * FILTERED * * * * * < / code > * instead of the actual value * For an ECS Cluster layer , AWS OpsWorks Stacks the < code > EcsClusterArn < / code > attribute is set to the * cluster ' s ARN . * @ return Returns a reference to this object so that method calls can be chained together . */ public Layer withAttributes ( java . util . Map < String , String > attributes ) { } }
setAttributes ( attributes ) ; return this ;
public class JPAEMPool { /** * Prohibit access to the criteria builder via the pool . * @ throws UnsupportedOperationException */ @ Override public CriteriaBuilder getCriteriaBuilder ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getCriteriaBuilder : " + this ) ; throw new UnsupportedOperationException ( "This operation is not supported on a pooling EntityManagerFactory." ) ;
public class DbHelperBase { /** * List of references with multiplicity = 1 */ private List < Reference > getAllOneReferences ( DomainObject domainObject ) { } }
List < Reference > allReferences = domainObject . getReferences ( ) ; List < Reference > allOneReferences = new ArrayList < Reference > ( ) ; for ( Reference ref : allReferences ) { if ( ! ref . isMany ( ) ) { allOneReferences . add ( ref ) ; } } return allOneReferences ;
public class CmsXmlContentEditor { /** * Performs the copy locale action . < p > * @ throws JspException if something goes wrong */ public void actionCopyElementLocale ( ) throws JspException { } }
try { setEditorValues ( getElementLocale ( ) ) ; if ( ! hasValidationErrors ( ) ) { // save content of the editor only to the temporary file writeContent ( ) ; CmsObject cloneCms = getCloneCms ( ) ; CmsUUID tempProjectId = OpenCms . getWorkplaceManager ( ) . getTempFileProjectId ( ) ; cloneCms . getRequestContext ( ) . setCurrentProject ( getCms ( ) . readProject ( tempProjectId ) ) ; // remove eventual release & expiration date from temporary file to make preview work cloneCms . setDateReleased ( getParamTempfile ( ) , CmsResource . DATE_RELEASED_DEFAULT , false ) ; cloneCms . setDateExpired ( getParamTempfile ( ) , CmsResource . DATE_EXPIRED_DEFAULT , false ) ; } } catch ( CmsException e ) { // show error page showErrorPage ( this , e ) ; }
public class JodaBeanSer { /** * Returns a copy of this serializer with the specified include derived flag . * The default deserializers can be modified . * This is used to set the output to include derived properties . * @ param includeDerived whether to include derived properties on output * @ return a copy of this object with the converter changed , not null */ public JodaBeanSer withIncludeDerived ( boolean includeDerived ) { } }
return new JodaBeanSer ( indent , newLine , converter , iteratorFactory , shortTypes , deserializers , includeDerived ) ;
public class JmxUtilities { /** * Attempt to find a locally running < code > MBeanServer < / code > . Fails if no * < code > MBeanServer < / code > can be found . If multiple servers are found , * simply returns the first one from the list . * @ param agent the agent identifier of the MBeanServer to retrieve . * If this parameter is < code > null < / code > , all registered MBeanServers are * considered . * @ return the < code > MBeanServer < / code > if any are found * @ throws io . pcp . parfait . MBeanServerException * if no < code > MBeanServer < / code > could be found * @ see javax . management . MBeanServerFactory # findMBeanServer ( String ) */ public static MBeanServer locateMBeanServer ( String agent ) throws MBeanServerException { } }
List servers = MBeanServerFactory . findMBeanServer ( agent ) ; MBeanServer server = null ; if ( servers != null && servers . size ( ) > 0 ) { server = ( MBeanServer ) servers . get ( 0 ) ; } if ( server == null && agent == null ) { // Attempt to load the PlatformMBeanServer . try { server = ManagementFactory . getPlatformMBeanServer ( ) ; } catch ( SecurityException ex ) { throw new MBeanServerException ( "No MBeanServer found, " + "and cannot obtain the Java platform MBeanServer" , ex ) ; } } if ( server == null ) { throw new MBeanServerException ( "Unable to locate an MBeanServer instance" + ( agent != null ? " with agent id [" + agent + "]" : "" ) ) ; } return server ;
public class GBSIterator { /** * Find the left - most child of the tree by following all of the * left children down to the bottom of the tree . * @ param stack The DeleteStack that is used to record the traversal . * @ return The left most child at the bottom of the tree or null * if the tree is empty . * @ exception OptimisticDepthException if the depth of the traversal * exceeds GBSTree . maxDepth . */ private GBSNode leftMostChild ( DeleteStack stack ) { } }
GBSNode p ; p = _index . root ( ) ; /* Root of tree */ GBSNode lastl = null ; /* Will point to left - most child */ if ( p != null ) /* Root is not null , we have a tree */ { /* Remember father of root */ stack . start ( _index . dummyTopNode ( ) , "GBSIterator.leftMostChild" ) ; lastl = leftMostChild ( stack , p ) ; } return lastl ;
public class GZipUtils { /** * 文件解压缩 * @ param path * @ param delete 是否删除原始文件 * @ throws Exception */ public static void decompress ( String path , boolean delete ) throws Exception { } }
File file = new File ( path ) ; decompress ( file , delete ) ;
public class WValidationErrorsRenderer { /** * Paints the given { @ link WValidationErrors } component . * @ param component The { @ link WValidationErrors } component to paint . * @ param renderContext the RenderContext to paint to . */ @ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } }
WValidationErrors errors = ( WValidationErrors ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; if ( errors . hasErrors ( ) ) { xml . appendTagOpen ( "ui:validationerrors" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalAttribute ( "title" , errors . getTitleText ( ) ) ; xml . appendClose ( ) ; for ( GroupedDiagnositcs nextGroup : errors . getGroupedErrors ( ) ) { // Render each diagnostic message in this group . for ( Diagnostic nextMessage : nextGroup . getDiagnostics ( ) ) { xml . appendTagOpen ( "ui:error" ) ; WComponent forComponent = nextMessage . getComponent ( ) ; if ( forComponent != null ) { UIContextHolder . pushContext ( nextMessage . getContext ( ) ) ; try { xml . appendAttribute ( "for" , forComponent . getId ( ) ) ; } finally { UIContextHolder . popContext ( ) ; } } xml . appendClose ( ) ; // DiagnosticImpl has been extended to support rendering // of a WComponent as the message . if ( nextMessage instanceof DiagnosticImpl ) { WComponent messageComponent = ( ( DiagnosticImpl ) nextMessage ) . createDiagnosticErrorComponent ( ) ; // We add the component to a throw - away container so that it renders with the correct ID . WContainer container = new WContainer ( ) { @ Override public String getId ( ) { return component . getId ( ) ; } } ; container . add ( messageComponent ) ; messageComponent . paint ( renderContext ) ; container . remove ( messageComponent ) ; container . reset ( ) ; } else { xml . append ( nextMessage . getDescription ( ) ) ; } xml . appendEndTag ( "ui:error" ) ; } } xml . appendEndTag ( "ui:validationerrors" ) ; }
public class CmsPublishScheduledDialog { /** * Submits the dialog action . < p > */ void submit ( ) { } }
// if ( ! m _ dateField . isValid ( ) ) { // return ; long current = System . currentTimeMillis ( ) ; Date dateValue = m_dateField . getDate ( ) ; long publishTime = dateValue . getTime ( ) ; if ( current > publishTime ) { m_context . error ( new CmsException ( Messages . get ( ) . container ( Messages . ERR_PUBLISH_SCHEDULED_DATE_IN_PAST_1 , dateValue ) ) ) ; } else { try { // make copies from the admin cmsobject and the user cmsobject // get the admin cms object CmsWorkplaceAction action = CmsWorkplaceAction . getInstance ( ) ; CmsObject cmsAdmin = action . getCmsAdminObject ( ) ; // get the user cms object CmsObject cms = OpenCms . initCmsObject ( m_context . getCms ( ) ) ; // set the current user site to the admin cms object cmsAdmin . getRequestContext ( ) . setSiteRoot ( cms . getRequestContext ( ) . getSiteRoot ( ) ) ; CmsProject tmpProject = createTempProject ( cmsAdmin , m_context . getResources ( ) , dateValue ) ; // set project as current project cmsAdmin . getRequestContext ( ) . setCurrentProject ( tmpProject ) ; cms . getRequestContext ( ) . setCurrentProject ( tmpProject ) ; Set < CmsUUID > changeIds = new HashSet < CmsUUID > ( ) ; for ( CmsResource resource : m_context . getResources ( ) ) { addToTempProject ( cmsAdmin , cms , resource , tmpProject ) ; if ( resource . isFolder ( ) && m_includeSubResources . getValue ( ) . booleanValue ( ) ) { List < CmsResource > subResources = cms . readResources ( resource , CmsResourceFilter . ONLY_VISIBLE . addExcludeState ( CmsResourceState . STATE_UNCHANGED ) , true ) ; for ( CmsResource sub : subResources ) { // check publish permissions on sub resource if ( cms . hasPermissions ( sub , CmsPermissionSet . ACCESS_DIRECT_PUBLISH , false , CmsResourceFilter . ALL ) ) { addToTempProject ( cmsAdmin , cms , sub , tmpProject ) ; } } } changeIds . add ( resource . getStructureId ( ) ) ; } // create a new scheduled job CmsScheduledJobInfo job = new CmsScheduledJobInfo ( ) ; // the job name String jobName = tmpProject . getName ( ) ; jobName = jobName . replace ( "&#47;" , "/" ) ; // set the job parameters job . setJobName ( jobName ) ; job . setClassName ( "org.opencms.scheduler.jobs.CmsPublishScheduledJob" ) ; // create the cron expression Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( dateValue ) ; String cronExpr = "" + calendar . get ( Calendar . SECOND ) + " " + calendar . get ( Calendar . MINUTE ) + " " + calendar . get ( Calendar . HOUR_OF_DAY ) + " " + calendar . get ( Calendar . DAY_OF_MONTH ) + " " + ( calendar . get ( Calendar . MONTH ) + 1 ) + " " + "?" + " " + calendar . get ( Calendar . YEAR ) ; // set the cron expression job . setCronExpression ( cronExpr ) ; // set the job active job . setActive ( true ) ; // create the context info CmsContextInfo contextInfo = new CmsContextInfo ( ) ; contextInfo . setProjectName ( tmpProject . getName ( ) ) ; contextInfo . setUserName ( cmsAdmin . getRequestContext ( ) . getCurrentUser ( ) . getName ( ) ) ; // create the job schedule parameter SortedMap < String , String > params = new TreeMap < String , String > ( ) ; // the user to send mail to String userName = m_context . getCms ( ) . getRequestContext ( ) . getCurrentUser ( ) . getName ( ) ; params . put ( CmsPublishScheduledJob . PARAM_USER , userName ) ; // the job name params . put ( CmsPublishScheduledJob . PARAM_JOBNAME , jobName ) ; // the link check params . put ( CmsPublishScheduledJob . PARAM_LINKCHECK , "true" ) ; // add the job schedule parameter job . setParameters ( params ) ; // add the context info to the scheduled job job . setContextInfo ( contextInfo ) ; // add the job to the scheduled job list OpenCms . getScheduleManager ( ) . scheduleJob ( cmsAdmin , job ) ; // update the XML configuration OpenCms . writeConfiguration ( CmsSchedulerConfiguration . class ) ; m_context . finish ( changeIds ) ; } catch ( CmsException ex ) { LOG . error ( "Error performing publish scheduled dialog operation." , ex ) ; m_context . error ( ex ) ; } }
public class FaultTolerantBlockPlacementPolicy { /** * A function to be used by unit tests only */ public static void setBadHostsAndRacks ( Set < String > racks , Set < String > hosts ) { } }
badRacks = racks ; badHosts = hosts ;
public class DnDManager { /** * Add the appropriate target listeners to this component * and all its children . */ protected void addTargetListeners ( Component comp ) { } }
comp . addMouseListener ( _targetListener ) ; comp . addMouseMotionListener ( _targetListener ) ; if ( comp instanceof Container ) { // hm , always true for JComp . . Container cont = ( Container ) comp ; cont . addContainerListener ( _childListener ) ; for ( int ii = 0 , nn = cont . getComponentCount ( ) ; ii < nn ; ii ++ ) { addTargetListeners ( cont . getComponent ( ii ) ) ; } }
public class ClassPropertyUsageAnalyzer { /** * Prints a list of classes to the given output . The list is encoded as a * single CSV value , using " @ " as a separator . Miga can decode this . * Standard CSV processors do not support lists of entries as values , * however . * @ param out * the output to write to * @ param classes * the list of class items */ private void printClassList ( PrintStream out , Iterable < EntityIdValue > classes ) { } }
out . print ( ",\"" ) ; boolean first = true ; for ( EntityIdValue superClass : classes ) { if ( first ) { first = false ; } else { out . print ( "@" ) ; } // makeshift escaping for Miga : out . print ( getClassLabel ( superClass ) . replace ( "@" , "@" ) ) ; } out . print ( "\"" ) ;
public class Calendrical { /** * < p > Definiert eine rein zeitliche Ordnung . < / p > * < p > Diese Implementierung wertet die zeitliche Position auf dem * gemeinsamen Zeitstrahl aus , also die Epochentage . < / p > * @ param date another date to be compared with * @ return negative , zero or positive integer if this instance is earlier , * simultaneous or later than given date */ protected int compareByTime ( CalendarDate date ) { } }
long d1 = this . getDaysSinceEpochUTC ( ) ; long d2 = date . getDaysSinceEpochUTC ( ) ; return ( ( d1 < d2 ) ? - 1 : ( ( d1 == d2 ) ? 0 : 1 ) ) ;
public class NfsRequestBase { /** * ( non - Javadoc ) * @ see com . emc . ecs . nfsclient . rpc . RpcRequest # startToString ( java . lang . String ) */ protected final StringBuilder startToString ( String requestlabel ) { } }
return super . startToString ( requestlabel ) . append ( " fileHandle:" ) . append ( Arrays . toString ( _fileHandle ) ) ;
public class ModifyRawHelper { /** * Checks if is in . * @ param value * the value * @ param classes * the classes * @ return true , if is in */ static boolean isIn ( TypeName value , Class < ? > ... classes ) { } }
for ( Class < ? > item : classes ) { if ( value . toString ( ) . equals ( TypeName . get ( item ) . toString ( ) ) ) { return true ; } } return false ;
public class JsonStreamWriter { /** * Write an int attribute . * @ param name attribute name * @ param value attribute value */ public void writeNameValuePair ( String name , int value ) throws IOException { } }
internalWriteNameValuePair ( name , Integer . toString ( value ) ) ;
public class Span { /** * Finds the index of the row in which the given timestamp should be . * @ param timestamp A strictly positive 32 - bit integer . * @ return A strictly positive index in the { @ code rows } array . */ private int seekRow ( final long timestamp ) { } }
checkRowOrder ( ) ; int row_index = 0 ; iRowSeq row = null ; final int nrows = rows . size ( ) ; for ( int i = 0 ; i < nrows ; i ++ ) { row = rows . get ( i ) ; final int sz = row . size ( ) ; if ( sz < 1 ) { row_index ++ ; } else if ( row . timestamp ( sz - 1 ) < timestamp ) { row_index ++ ; // The last DP in this row is before ' timestamp ' . } else { break ; } } if ( row_index == nrows ) { // If this timestamp was too large for the -- row_index ; // last row , return the last row . } return row_index ;
public class JobConf { /** * Use MRAsyncDiskService . moveAndDeleteAllVolumes instead . * @ see org . apache . hadoop . util . MRAsyncDiskService # cleanupAllVolumes ( ) */ @ Deprecated public void deleteLocalFiles ( ) throws IOException { } }
String [ ] localDirs = getLocalDirs ( ) ; for ( int i = 0 ; i < localDirs . length ; i ++ ) { FileSystem . getLocal ( this ) . delete ( new Path ( localDirs [ i ] ) ) ; }
public class Tracer { /** * Get the ThreadTrace for the current thread , creating one if necessary . */ static ThreadTrace getThreadTrace ( ) { } }
ThreadTrace t = traces . get ( ) ; if ( t == null ) { t = new ThreadTrace ( ) ; t . prettyPrint = defaultPrettyPrint ; traces . set ( t ) ; } return t ;
public class ProductSegmentation { /** * Gets the geoSegment value for this ProductSegmentation . * @ return geoSegment * The geographic segmentation . Segments should be set on the * { @ link GeoTargeting # targetedLocations } field . * < p > This attribute is optional . */ public com . google . api . ads . admanager . axis . v201808 . GeoTargeting getGeoSegment ( ) { } }
return geoSegment ;
public class DoublesSketch { /** * This is a more efficient multiple - query version of getQuantile ( ) . * < p > This returns an array that could have been generated by using getQuantile ( ) with many * different fractional ranks , but would be very inefficient . * This method incurs the internal set - up overhead once and obtains multiple quantile values in * a single query . It is strongly recommend that this method be used instead of multiple calls * to getQuantile ( ) . * < p > If the sketch is empty this returns null . * @ param fRanks the given array of fractional ( or normalized ) ranks in the hypothetical * sorted stream of all the input values seen so far . * These fRanks must all be in the interval [ 0.0 , 1.0 ] inclusively . * @ return array of approximate quantiles of the given fRanks in the same order as in the given * fRanks array . */ public double [ ] getQuantiles ( final double [ ] fRanks ) { } }
if ( isEmpty ( ) ) { return null ; } DoublesAuxiliary aux = null ; final double [ ] quantiles = new double [ fRanks . length ] ; for ( int i = 0 ; i < fRanks . length ; i ++ ) { final double fRank = fRanks [ i ] ; if ( fRank == 0.0 ) { quantiles [ i ] = getMinValue ( ) ; } else if ( fRank == 1.0 ) { quantiles [ i ] = getMaxValue ( ) ; } else { if ( aux == null ) { aux = new DoublesAuxiliary ( this ) ; } quantiles [ i ] = aux . getQuantile ( fRank ) ; } } return quantiles ;
public class MsgChecker { /** * Replace callback msg checker . * @ param type the type * @ param cb the cb * @ return the msg checker */ public MsgChecker replaceCallback ( BasicCheckRule type , ValidationInvalidCallback cb ) { } }
this . callbackMap . put ( type . name ( ) , cb ) ; return this ;
public class InterceptedStreamMap { /** * Closes the given stream , logging any errors that occur during closure . * The monitor of the stream is notified via a single call to notify ( ) once * the attempt to close has been made . * @ param stream * The stream to close and notify . */ private void close ( T stream ) { } }
// Attempt to close stream try { stream . close ( ) ; } catch ( IOException e ) { logger . warn ( "Unable to close intercepted stream: {}" , e . getMessage ( ) ) ; logger . debug ( "I/O error prevented closure of intercepted stream." , e ) ; } // Notify waiting threads that the stream has ended synchronized ( stream ) { stream . notify ( ) ; }
public class JobMaster { /** * - - job starting and stopping - - - - - */ private Acknowledge startJobExecution ( JobMasterId newJobMasterId ) throws Exception { } }
validateRunsInMainThread ( ) ; checkNotNull ( newJobMasterId , "The new JobMasterId must not be null." ) ; if ( Objects . equals ( getFencingToken ( ) , newJobMasterId ) ) { log . info ( "Already started the job execution with JobMasterId {}." , newJobMasterId ) ; return Acknowledge . get ( ) ; } setNewFencingToken ( newJobMasterId ) ; startJobMasterServices ( ) ; log . info ( "Starting execution of job {} ({}) under job master id {}." , jobGraph . getName ( ) , jobGraph . getJobID ( ) , newJobMasterId ) ; resetAndScheduleExecutionGraph ( ) ; return Acknowledge . get ( ) ;
public class CmsWebdavServlet { /** * Check to see if a resource is currently write locked . < p > * @ param path the path where to find the resource to check the lock * @ return true if the resource is locked otherwise false */ private boolean isLocked ( String path ) { } }
// get lock for path CmsRepositoryLockInfo lock = m_session . getLock ( path ) ; if ( lock == null ) { return false ; } // check if found lock fits to the lock token from request // String currentToken = " < opaquelocktoken : " + generateLockToken ( req , lock ) + " > " ; // if ( currentToken . equals ( parseLockTokenHeader ( req ) ) ) { // return false ; if ( lock . getUsername ( ) . equals ( m_username ) ) { return false ; } return true ;
public class Transformer { /** * Change view height using the LayoutParams of the view . * @ param newHeight to change . . */ public void setViewHeight ( int newHeight ) { } }
if ( newHeight > 0 ) { originalHeight = newHeight ; RelativeLayout . LayoutParams layoutParams = ( RelativeLayout . LayoutParams ) view . getLayoutParams ( ) ; layoutParams . height = newHeight ; view . setLayoutParams ( layoutParams ) ; }
public class GuildController { /** * Modifies the { @ link net . dv8tion . jda . core . entities . Role Roles } of the specified { @ link net . dv8tion . jda . core . entities . Member Member } * by adding and removing a collection of roles . * < br > None of the provided roles may be the < u > Public Role < / u > of the current Guild . * < br > If a role is both in { @ code rolesToAdd } and { @ code rolesToRemove } it will be removed . * < p > None of the provided collections may be null * < br > To only add or remove roles use either { @ link # removeRolesFromMember ( Member , Collection ) } or { @ link # addRolesToMember ( Member , Collection ) } * < h1 > Warning < / h1 > * < b > This may < u > not < / u > be used together with any other role add / remove / modify methods for the same Member * within one event listener cycle ! The changes made by this require cache updates which are triggered by * lifecycle events which are received later . This may only be called again once the specific Member has been updated * by a { @ link net . dv8tion . jda . core . events . guild . member . GenericGuildMemberEvent GenericGuildMemberEvent } targeting the same Member . < / b > * < p > Possible { @ link net . dv8tion . jda . core . requests . ErrorResponse ErrorResponses } caused by * the returned { @ link net . dv8tion . jda . core . requests . RestAction RestAction } include the following : * < ul > * < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # MISSING _ PERMISSIONS MISSING _ PERMISSIONS } * < br > The Members Roles could not be modified due to a permission discrepancy < / li > * < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # MISSING _ ACCESS MISSING _ ACCESS } * < br > We were removed from the Guild before finishing the task < / li > * < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # UNKNOWN _ MEMBER UNKNOWN _ MEMBER } * < br > The target Member was removed from the Guild before finishing the task < / li > * < / ul > * @ param member * The { @ link net . dv8tion . jda . core . entities . Member Member } that should be modified * @ param rolesToAdd * A { @ link java . util . Collection Collection } of { @ link net . dv8tion . jda . core . entities . Role Roles } * to add to the current Roles the specified { @ link net . dv8tion . jda . core . entities . Member Member } already has * @ param rolesToRemove * A { @ link java . util . Collection Collection } of { @ link net . dv8tion . jda . core . entities . Role Roles } * to remove from the current Roles the specified { @ link net . dv8tion . jda . core . entities . Member Member } already has * @ throws net . dv8tion . jda . core . exceptions . InsufficientPermissionException * If the currently logged in account does not have { @ link net . dv8tion . jda . core . Permission # MANAGE _ ROLES Permission . MANAGE _ ROLES } * @ throws net . dv8tion . jda . core . exceptions . HierarchyException * If the provided roles are higher in the Guild ' s hierarchy * and thus cannot be modified by the currently logged in account * @ throws IllegalArgumentException * < ul > * < li > If any of the provided arguments is { @ code null } < / li > * < li > If any of the specified Roles is managed or is the { @ code Public Role } of the Guild < / li > * < / ul > * @ return { @ link net . dv8tion . jda . core . requests . restaction . AuditableRestAction AuditableRestAction } */ @ CheckReturnValue public AuditableRestAction < Void > modifyMemberRoles ( Member member , Collection < Role > rolesToAdd , Collection < Role > rolesToRemove ) { } }
Checks . notNull ( member , "Member" ) ; Checks . notNull ( rolesToAdd , "Collection containing roles to be added to the member" ) ; Checks . notNull ( rolesToRemove , "Collection containing roles to be removed from the member" ) ; checkGuild ( member . getGuild ( ) , "Member" ) ; checkPermission ( Permission . MANAGE_ROLES ) ; rolesToAdd . forEach ( role -> { Checks . notNull ( role , "Role in rolesToAdd" ) ; checkGuild ( role . getGuild ( ) , "Role: " + role . toString ( ) ) ; checkPosition ( role ) ; Checks . check ( ! role . isManaged ( ) , "Cannot add a Managed role to a Member. Role: %s" , role . toString ( ) ) ; } ) ; rolesToRemove . forEach ( role -> { Checks . notNull ( role , "Role in rolesToRemove" ) ; checkGuild ( role . getGuild ( ) , "Role: " + role . toString ( ) ) ; checkPosition ( role ) ; Checks . check ( ! role . isManaged ( ) , "Cannot remove a Managed role from a Member. Role: %s" , role . toString ( ) ) ; } ) ; Set < Role > currentRoles = new HashSet < > ( ( ( MemberImpl ) member ) . getRoleSet ( ) ) ; Set < Role > newRolesToAdd = new HashSet < > ( rolesToAdd ) ; newRolesToAdd . removeAll ( rolesToRemove ) ; // If no changes have been made we return an EmptyRestAction instead if ( currentRoles . addAll ( newRolesToAdd ) ) currentRoles . removeAll ( rolesToRemove ) ; else if ( ! currentRoles . removeAll ( rolesToRemove ) ) return new AuditableRestAction . EmptyRestAction < > ( getGuild ( ) . getJDA ( ) ) ; Checks . check ( ! currentRoles . contains ( getGuild ( ) . getPublicRole ( ) ) , "Cannot add the PublicRole of a Guild to a Member. All members have this role by default!" ) ; JSONObject body = new JSONObject ( ) . put ( "roles" , currentRoles . stream ( ) . map ( Role :: getId ) . collect ( Collectors . toList ( ) ) ) ; Route . CompiledRoute route = Route . Guilds . MODIFY_MEMBER . compile ( getGuild ( ) . getId ( ) , member . getUser ( ) . getId ( ) ) ; return new AuditableRestAction < Void > ( getGuild ( ) . getJDA ( ) , route , body ) { @ Override protected void handleResponse ( Response response , Request < Void > request ) { if ( response . isOk ( ) ) request . onSuccess ( null ) ; else request . onFailure ( response ) ; } } ;
public class CollectionAssert { /** * Checks whether size is between the provided value . * @ param lowerBound - the collection should have size greater than or equal to this * value * @ param higherBound - the collection should have size less than or equal to this * value * @ return this */ public CollectionAssert hasSizeBetween ( int lowerBound , int higherBound ) { } }
isNotNull ( ) ; int size = size ( this . actual ) ; if ( ! ( size >= lowerBound && size <= higherBound ) ) { failWithMessage ( "The size <%s> is not between <%s> and <%s>" , size , lowerBound , higherBound ) ; } return this ;
public class LoaderUtil { /** * Determines if a named Class can be loaded or not . * @ param className The class name . * @ return { @ code true } if the class could be found or { @ code false } otherwise . * @ since 2.7 */ public static boolean isClassAvailable ( final String className ) { } }
try { final Class < ? > clazz = loadClass ( className ) ; return clazz != null ; } catch ( final ClassNotFoundException | LinkageError e ) { return false ; } catch ( final Throwable e ) { LowLevelLogUtil . logException ( "Unknown error checking for existence of class: " + className , e ) ; return false ; }
public class UADetectorServiceFactory { /** * Returns an implementation of { @ link UserAgentStringParser } which checks at regular intervals for new versions of * < em > UAS data < / em > ( also known as database ) . When newer data available , it automatically loads and updates it . * Additionally the loaded data are stored in a cache file . * At initialization time the returned parser will be loaded with the < em > UAS data < / em > of the cache file . If the * cache file doesn ' t exist or is empty the data of this module will be loaded . The initialization is started only * when this method is called the first time . * The update of the data store runs as background task . With this feature we try to reduce the initialization time * of this < code > UserAgentStringParser < / code > , because a network connection is involved and the remote system can be * not available or slow . * The static class definition { @ code CachingAndUpdatingParserHolder } within this factory class is < em > not < / em > * initialized until the JVM determines that { @ code CachingAndUpdatingParserHolder } must be executed . The static * class { @ code CachingAndUpdatingParserHolder } is only executed when the static method * { @ code getOnlineUserAgentStringParser } is invoked on the class { @ code UADetectorServiceFactory } , and the first * time this happens the JVM will load and initialize the { @ code CachingAndUpdatingParserHolder } class . * If during the operation the Internet connection gets lost , then this instance continues to work properly ( and * under correct log level settings you will get an corresponding log messages ) . * @ param dataUrl * @ param versionUrl * @ return an user agent string parser with updating service */ public static UserAgentStringParser getCachingAndUpdatingParser ( final URL dataUrl , final URL versionUrl ) { } }
return CachingAndUpdatingParserHolder . getParser ( dataUrl , versionUrl , RESOURCE_MODULE ) ;
public class WebServiceRefProcessor { /** * This method will be responsible for validating all of the rules that govern injection through member level WebServiceRef annotation . * It will also be responsible for setting the appropriate values on the WebServiceRefInfo instance . */ private void validateAndSetMemberLevelWebServiceRef ( WebServiceRef webServiceRef , Member member , WebServiceRefInfo wsrInfo ) throws InjectionException { } }
// Save off these annotation attributes for use later . Class < ? > typeClass = webServiceRef . type ( ) ; Class < ? > valueClass = webServiceRef . value ( ) ; // If the @ WebServiceRef ' s lookup is specified , then no other attributes should be present . Only name can be specified with lookup . if ( webServiceRef . lookup ( ) != null && ! webServiceRef . lookup ( ) . isEmpty ( ) ) { if ( ! typeClass . getName ( ) . equals ( Object . class . getName ( ) ) || ! valueClass . getName ( ) . equals ( Service . class . getName ( ) ) || ! webServiceRef . wsdlLocation ( ) . isEmpty ( ) || ! webServiceRef . mappedName ( ) . isEmpty ( ) ) { Tr . error ( tc , "error.service.ref.annotation.lookup.redundant.attributes" ) ; throw new InjectionException ( Tr . formatMessage ( tc , "error.service.ref.annotation.lookup.redundant.attributes" ) ) ; } } else { // Otherwise , no ' lookup ' attribute is present , then do our normal validations . // get the effective type from the member type and WebServiceRef . type Class < ? > memberType = InjectionHelper . getTypeFromMember ( member ) ; Class < ? > effectiveType ; if ( memberType . getName ( ) . equals ( Object . class . getName ( ) ) ) { // memberType is Object . class effectiveType = typeClass ; // effectiveType could be Object here if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) && typeClass . getName ( ) . equals ( Object . class . getName ( ) ) ) { Tr . debug ( tc , "The member type and the @WebServiceRef.type on the " + member . getName ( ) + " in " + member . getDeclaringClass ( ) . getName ( ) + "are all Object.class, so can not infer one. Will try service type injection if the @WebServiceRef.value is a subclass of Service.class." ) ; } } else { // memberType is not Object . class // we prefer subclass if ( memberType . isAssignableFrom ( typeClass ) ) { effectiveType = typeClass ; } else if ( typeClass . isAssignableFrom ( memberType ) ) { effectiveType = memberType ; } else { Tr . error ( tc , "error.service.ref.member.level.annotation.type.not.compatible" , member . getName ( ) , member . getDeclaringClass ( ) . getName ( ) , typeClass . getName ( ) , memberType . getName ( ) ) ; throw new InjectionException ( Tr . formatMessage ( tc , "error.service.ref.member.level.annotation.type.not.compatible" , member . getName ( ) , member . getDeclaringClass ( ) . getName ( ) , typeClass . getName ( ) , memberType . getName ( ) ) ) ; } } // validate and set value and type in WebServiceRefInfo if ( effectiveType . getName ( ) . equals ( Object . class . getName ( ) ) ) { // effectiveType can not be determined above , so try service type injection // in this case the ' value ' attribute MUST specify a subclass of javax . xml . ws . Service if ( ! Service . class . isAssignableFrom ( valueClass ) || valueClass . getName ( ) . equals ( Service . class . getName ( ) ) ) { Tr . error ( tc , "error.service.ref.member.level.annotation.type.not.inferred" , member . getName ( ) , member . getDeclaringClass ( ) . getName ( ) ) ; throw new InjectionException ( Tr . formatMessage ( tc , "error.service.ref.member.level.annotation.type.not.inferred" , member . getName ( ) , member . getDeclaringClass ( ) . getName ( ) ) ) ; } wsrInfo . setServiceRefTypeClassName ( valueClass . getName ( ) ) ; wsrInfo . setServiceInterfaceClassName ( valueClass . getName ( ) ) ; } else if ( Service . class . isAssignableFrom ( effectiveType ) ) { // service type injection case if ( effectiveType . getName ( ) . equals ( Service . class . getName ( ) ) ) { // effectiveType is javax . xml . ws . Service // in this case the ' value ' attribute MUST specify a subclass of javax . xml . ws . Service if ( ! Service . class . isAssignableFrom ( valueClass ) || valueClass . getName ( ) . equals ( Service . class . getName ( ) ) ) { Tr . error ( tc , "error.service.ref.member.level.annotation.wrong.value" , member . getName ( ) , member . getDeclaringClass ( ) , valueClass . getName ( ) ) ; throw new InjectionException ( Tr . formatMessage ( tc , "error.service.ref.member.level.annotation.wrong.value" , member . getName ( ) , member . getDeclaringClass ( ) , valueClass . getName ( ) ) ) ; } wsrInfo . setServiceInterfaceClassName ( valueClass . getName ( ) ) ; wsrInfo . setServiceRefTypeClassName ( valueClass . getName ( ) ) ; } else { // effectiveType is a subclass of javax . xml . ws . Service // in this case the ' value ' attribute MUST be the same as ' type ' or use default javax . xml . ws . Service if ( ! valueClass . getName ( ) . equals ( effectiveType . getName ( ) ) && ! valueClass . getName ( ) . equals ( Service . class . getName ( ) ) ) { Tr . error ( tc , "error.service.ref.member.level.annotation.value.and.type.not.same" , member . getName ( ) , member . getDeclaringClass ( ) . getName ( ) ) ; throw new InjectionException ( Tr . formatMessage ( tc , "error.service.ref.member.level.annotation.value.and.type.not.same" , member . getName ( ) , member . getDeclaringClass ( ) . getName ( ) ) ) ; } wsrInfo . setServiceInterfaceClassName ( effectiveType . getName ( ) ) ; wsrInfo . setServiceRefTypeClassName ( effectiveType . getName ( ) ) ; } } else { // port type injection case // in this case the ' value ' attribute MUST specify a subclass of javax . xml . ws . Service if ( ! Service . class . isAssignableFrom ( valueClass ) || valueClass . getName ( ) . equals ( Service . class . getName ( ) ) ) { Tr . error ( tc , "error.service.ref.member.level.annotation.wrong.value" , member . getName ( ) , member . getDeclaringClass ( ) , valueClass . getName ( ) ) ; throw new InjectionException ( Tr . formatMessage ( tc , "error.service.ref.member.level.annotation.wrong.value" , member . getName ( ) , member . getDeclaringClass ( ) , valueClass . getName ( ) ) ) ; } wsrInfo . setServiceRefTypeClassName ( effectiveType . getName ( ) ) ; wsrInfo . setServiceInterfaceClassName ( valueClass . getName ( ) ) ; } }
public class ConfigurationPropertyName { /** * Return a { @ link ConfigurationPropertyName } for the specified string . * @ param name the source name * @ param returnNullIfInvalid if null should be returned if the name is not valid * @ return a { @ link ConfigurationPropertyName } instance * @ throws InvalidConfigurationPropertyNameException if the name is not valid and * { @ code returnNullIfInvalid } is { @ code false } */ static ConfigurationPropertyName of ( CharSequence name , boolean returnNullIfInvalid ) { } }
Elements elements = elementsOf ( name , returnNullIfInvalid ) ; return ( elements != null ) ? new ConfigurationPropertyName ( elements ) : null ;
import java . lang . * ; class CalculateSumAndAverage { /** * This function computes the sum and average of the first n natural numbers . * @ param n Represents ' n ' natural numbers * @ return A double array containing the sum and the average of ' n ' natural numbers * Examples : * calculateSumAndAverage ( 10) * [ 55.0 , 5.5] * calculateSumAndAverage ( 15) * [ 120.0 , 8.0] * calculateSumAndAverage ( 20) * [ 210.0 , 10.5] */ public static double [ ] calculateSumAndAverage ( int n ) { } }
double totalSum = 0.0 ; for ( int i = 1 ; i <= n ; i ++ ) { totalSum += i ; } double avg = totalSum / n ; return new double [ ] { totalSum , avg } ;
public class CFIRGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . CFIRG__FCS_NAME : setFCSName ( ( String ) newValue ) ; return ; case AfplibPackage . CFIRG__CP_NAME : setCPName ( ( String ) newValue ) ; return ; case AfplibPackage . CFIRG__SV_SIZE : setSVSize ( ( Integer ) newValue ) ; return ; case AfplibPackage . CFIRG__SH_SCALE : setSHScale ( ( Integer ) newValue ) ; return ; case AfplibPackage . CFIRG__RESERVED : setReserved ( ( byte [ ] ) newValue ) ; return ; case AfplibPackage . CFIRG__SECTION : setSection ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class FloatingActionButton { /** * Update the location of this button . This method only work if it ' s already attached to a parent view . * @ param x The x value of anchor point . * @ param y The y value of anchor point . * @ param gravity The gravity apply with this button . * @ see Gravity */ public void updateLocation ( int x , int y , int gravity ) { } }
if ( getParent ( ) != null ) updateParams ( x , y , gravity , getLayoutParams ( ) ) ; else Log . v ( FloatingActionButton . class . getSimpleName ( ) , "updateLocation() is called without parent" ) ;
public class AbstractController { /** * Link an User Interface action to an event triggered on a node . * Don ' t forget to add a placeholder to indicate where to attach the model node created * @ param node the node to follow * @ param eventType the type of the event to follow * @ param modelClass the model to display * @ param callback the call back to use to check if the ui can be attached * @ param waveData additional Wave data , Must contain either # JRebirthWaves . ATTACH _ UI _ NODE _ PLACEHOLDER or # JRebirthWaves . ADD _ UI _ CHILDREN _ PLACEHOLDER wave data to indicate where to attach the * created model * @ param < E > The type of JavaFX Event to track */ protected < E extends Event > void linkUi ( final Node node , final javafx . event . EventType < E > eventType , final Class < ? extends Model > modelClass , final Callback < E , Boolean > callback , final WaveData < ? > ... waveData ) { } }
boolean noHookFound = true ; // Check if the contract is respected by searching a placeholder from WaveData WaveData < ? > wd ; for ( int i = 0 ; i < waveData . length && noHookFound ; i ++ ) { wd = waveData [ i ] ; if ( ( JRebirthWaves . ATTACH_UI_NODE_PLACEHOLDER . equals ( wd . key ( ) ) || JRebirthWaves . ADD_UI_CHILDREN_PLACEHOLDER . equals ( wd . key ( ) ) ) && wd . value ( ) != null ) { noHookFound = false ; } } // Stop the process if no placeholder have been found to attach the model - view created if ( noHookFound ) { throw new CoreRuntimeException ( "LinkUi must be called with either JRebirthWaves.ATTACH_UI_NODE_PLACEHOLDER or JRebirthWaves.ADD_UI_CHILDREN_PLACEHOLDER Wave Data provided" ) ; } // LinkUi node . addEventHandler ( eventType , event -> { if ( callback == null || callback . call ( event ) ) { model ( ) . attachUi ( modelClass , waveData ) ; } } ) ;
public class HttpsFileUploaderConfig { /** * Sets additional overall HTTP headers to add to the upload POST request . There ' s * rarely a need to use this method . * < p > The following header fields are automatically set : * < pre > * " Connection " * " Cache - Control " * " Content - Type " * " Content - Length " * " Authorization " * < / pre > and you must < i > never < / i > set these here . ( if you do they will be * ignored ) * < p > However you might want to use this method to * explicitly set e . g . { @ code User - Agent } or non - standard header fields that * are required for your particular endpoint . For example by overriding * { @ code User - Agent } you can make the upload operation look to the * endpoint as if it comes from a browser . * @ param additionalHeaders Map of HTTP request headers . The key is the header field * name and the value is the header field value . */ public void setAdditionalHeaders ( Map < String , String > additionalHeaders ) { } }
Map < String , String > newMap = new HashMap < > ( ) ; for ( Entry < String , String > e : additionalHeaders . entrySet ( ) ) { boolean found = false ; for ( String restrictedHeaderField : RESTRICTED_HTTP_HEADERS ) { if ( e . getKey ( ) . equalsIgnoreCase ( restrictedHeaderField ) ) { found = true ; break ; } } if ( ! found ) { newMap . put ( e . getKey ( ) , e . getValue ( ) ) ; } } this . additionalHeaders = newMap ;
public class AbstractController { /** * Gets the user data . * @ param node the node * @ param waveItem the wave item * @ return the user data * @ param < T > the generic type */ protected < T > Optional < T > getUserData ( Optional < ? extends Node > node , WaveItem < T > waveItem ) { } }
if ( node . isPresent ( ) ) { final Node n = node . get ( ) ; return getValue ( n , n :: getUserData , waveItem ) ; } return Optional . empty ( ) ;
public class Analyser { /** * Analyse a single folder entity . Results are stored into * mAnalysedEntityTable . * @ param node the node that will be analysed * @ throws Exception if an error occurred while analysing the node ( for example , failed to send the message ) */ private void analyse ( StructuralNode node ) throws Exception { } }
// if analysed already , return ; // move to host part if ( node . getHistoryReference ( ) == null ) { return ; } if ( ! parent . nodeInScope ( node . getName ( ) ) ) { return ; } // ZAP : Removed unnecessary cast . HttpMessage baseMsg = node . getHistoryReference ( ) . getHttpMessage ( ) ; URI baseUri = ( URI ) baseMsg . getRequestHeader ( ) . getURI ( ) . clone ( ) ; baseUri . setQuery ( null ) ; // System . out . println ( " analysing : " + baseUri . toString ( ) ) ; // already exist one . no need to test if ( mapVisited . get ( baseUri . toString ( ) ) != null ) { return ; } String path = getRandomPathSuffix ( node , baseUri ) ; HttpMessage msg = baseMsg . cloneRequest ( ) ; URI uri = ( URI ) baseUri . clone ( ) ; uri . setPath ( path ) ; msg . getRequestHeader ( ) . setURI ( uri ) ; // System . out . println ( " analysing 2 : " + uri ) ; sendAndReceive ( msg ) ; // standard RFC response , no further check is needed if ( msg . getResponseHeader ( ) . getStatusCode ( ) == HttpStatusCode . NOT_FOUND ) { addAnalysedHost ( baseUri , msg , SampleResponse . ERROR_PAGE_RFC ) ; return ; } if ( HttpStatusCode . isRedirection ( msg . getResponseHeader ( ) . getStatusCode ( ) ) ) { addAnalysedHost ( baseUri , msg , SampleResponse . ERROR_PAGE_REDIRECT ) ; return ; } if ( msg . getResponseHeader ( ) . getStatusCode ( ) != HttpStatusCode . OK ) { addAnalysedHost ( baseUri , msg , SampleResponse . ERROR_PAGE_NON_RFC ) ; return ; } HttpMessage msg2 = baseMsg . cloneRequest ( ) ; URI uri2 = msg2 . getRequestHeader ( ) . getURI ( ) ; String path2 = getRandomPathSuffix ( node , uri2 ) ; uri2 = ( URI ) baseUri . clone ( ) ; uri2 . setPath ( path2 ) ; msg2 . getRequestHeader ( ) . setURI ( uri2 ) ; sendAndReceive ( msg2 ) ; // remove HTML HEAD as this may contain expiry time which dynamic changes String resBody1 = msg . getResponseBody ( ) . toString ( ) . replaceAll ( p_REMOVE_HEADER , "" ) ; String resBody2 = msg2 . getResponseBody ( ) . toString ( ) . replaceAll ( p_REMOVE_HEADER , "" ) ; // check if page is static . If so , remember this static page if ( resBody1 . equals ( resBody2 ) ) { msg . getResponseBody ( ) . setBody ( resBody1 ) ; addAnalysedHost ( baseUri , msg , SampleResponse . ERROR_PAGE_STATIC ) ; return ; } // else check if page is dynamic but deterministic resBody1 = resBody1 . replaceAll ( getPathRegex ( uri ) , "" ) . replaceAll ( "\\s[012]\\d:[0-5]\\d:[0-5]\\d\\s" , "" ) ; resBody2 = resBody2 . replaceAll ( getPathRegex ( uri2 ) , "" ) . replaceAll ( "\\s[012]\\d:[0-5]\\d:[0-5]\\d\\s" , "" ) ; if ( resBody1 . equals ( resBody2 ) ) { msg . getResponseBody ( ) . setBody ( resBody1 ) ; addAnalysedHost ( baseUri , msg , SampleResponse . ERROR_PAGE_DYNAMIC_BUT_DETERMINISTIC ) ; return ; } // else mark app " undeterministic " . addAnalysedHost ( baseUri , msg , SampleResponse . ERROR_PAGE_UNDETERMINISTIC ) ;
public class DefaultConverter { /** * Converts the string to an object of the given type . * @ param pString the string to convert * @ param pType the type to convert to * @ param pFormat ignored . * @ return the object created from the given string . * @ throws ConversionException if the type is null , or if the string cannot * be converted into the given type , using a string constructor or static * { @ code valueOf } method . */ public Object toObject ( final String pString , final Class pType , final String pFormat ) throws ConversionException { } }
if ( pString == null ) { return null ; } if ( pType == null ) { throw new MissingTypeException ( ) ; } if ( pType . isArray ( ) ) { return toArray ( pString , pType , pFormat ) ; } // TODO : Separate CollectionConverter ? // should however , be simple to wrap array using Arrays . asList // But what about generic type ? ! It ' s erased . . . // Primitive - > wrapper Class type = unBoxType ( pType ) ; try { // Try to create instance from < Constructor > ( String ) Object value = BeanUtil . createInstance ( type , pString ) ; if ( value == null ) { // createInstance failed for some reason // Try to invoke the static method valueOf ( String ) value = BeanUtil . invokeStaticMethod ( type , "valueOf" , pString ) ; if ( value == null ) { // If the value is still null , well , then I cannot help . . . throw new ConversionException ( String . format ( "Could not convert String to %1$s: No constructor %1$s(String) or static %1$s.valueOf(String) method found!" , type . getName ( ) ) ) ; } } return value ; } catch ( InvocationTargetException ite ) { throw new ConversionException ( ite . getTargetException ( ) ) ; } catch ( ConversionException ce ) { throw ce ; } catch ( RuntimeException rte ) { throw new ConversionException ( rte ) ; }
public class ContainerAS { /** * This method is called before the activity session this * < code > ContainerAS < / code > is associated with is completed * ( reset or completed ) . < p > */ public void beforeCompletion ( ) { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "beforeCompletion" ) ; becomePreparing ( ) ; // Change the state to PREPARRING if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "beforeCompletion" ) ;