signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class PasswordCheckUtil { /** * Method which performs strength checks on password . It returns outcome which can be used by CLI .
* @ param isAdminitrative - administrative checks are less restrictive . This means that weak password or one which violates restrictions is not indicated as failure .
* Administrative checks are usually performed by admin changing / setting default password for user .
* @ param userName - the name of user for which password is set .
* @ param password - password .
* @ return */
public PasswordCheckResult check ( boolean isAdminitrative , String userName , String password ) { } } | // TODO : allow custom restrictions ?
List < PasswordRestriction > passwordValuesRestrictions = getPasswordRestrictions ( ) ; final PasswordStrengthCheckResult strengthResult = this . passwordStrengthChecker . check ( userName , password , passwordValuesRestrictions ) ; final int failedRestrictions = strengthResult . getRestrictionFailures ( ) . size ( ) ; final PasswordStrength strength = strengthResult . getStrength ( ) ; final boolean strongEnough = assertStrength ( strength ) ; PasswordCheckResult . Result resultAction ; String resultMessage = null ; if ( isAdminitrative ) { if ( strongEnough ) { if ( failedRestrictions > 0 ) { resultAction = Result . WARN ; resultMessage = strengthResult . getRestrictionFailures ( ) . get ( 0 ) . getMessage ( ) ; } else { resultAction = Result . ACCEPT ; } } else { resultAction = Result . WARN ; resultMessage = ROOT_LOGGER . passwordNotStrongEnough ( strength . toString ( ) , this . acceptable . toString ( ) ) ; } } else { if ( strongEnough ) { if ( failedRestrictions > 0 ) { resultAction = Result . REJECT ; resultMessage = strengthResult . getRestrictionFailures ( ) . get ( 0 ) . getMessage ( ) ; } else { resultAction = Result . ACCEPT ; } } else { if ( failedRestrictions > 0 ) { resultAction = Result . REJECT ; resultMessage = strengthResult . getRestrictionFailures ( ) . get ( 0 ) . getMessage ( ) ; } else { resultAction = Result . REJECT ; resultMessage = ROOT_LOGGER . passwordNotStrongEnough ( strength . toString ( ) , this . acceptable . toString ( ) ) ; } } } return new PasswordCheckResult ( resultAction , resultMessage ) ; |
public class TokenList { /** * Checks whether this token list contains a { @ link de . codecentric . zucchini . bdd . resolver . token . VariableToken } with
* the specified name .
* @ param name The name to check .
* @ return { @ literal true } if this token list contains a
* { @ link de . codecentric . zucchini . bdd . resolver . token . VariableToken } with the specified name , and { @ literal false }
* otherwise . */
public boolean containsVariableWithName ( String name ) { } } | for ( Token token : this ) { if ( token instanceof VariableToken && token . getText ( ) . equals ( name ) ) { return true ; } } return false ; |
public class MultipartStream { /** * Reads the < code > header - part < / code > of the current
* < code > encapsulation < / code > .
* Headers are returned verbatim to the input stream , including the trailing
* < code > CRLF < / code > marker . Parsing is left to the application .
* @ return The < code > header - part < / code > of the current encapsulation .
* @ throws MultipartMalformedStreamException
* if the stream ends unexpectedly . */
public String readHeaders ( ) throws MultipartMalformedStreamException { } } | // to support multi - byte characters
try ( final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream ( ) ) { int nHeaderSepIndex = 0 ; int nSize = 0 ; while ( nHeaderSepIndex < HEADER_SEPARATOR . length ) { byte b ; try { b = readByte ( ) ; } catch ( final IOException e ) { throw new MultipartMalformedStreamException ( "Stream ended unexpectedly after " + nSize + " bytes" , e ) ; } if ( ++ nSize > HEADER_PART_SIZE_MAX ) { throw new MultipartMalformedStreamException ( "Header section has more than " + HEADER_PART_SIZE_MAX + " bytes (maybe it is not properly terminated)" ) ; } if ( b == HEADER_SEPARATOR [ nHeaderSepIndex ] ) nHeaderSepIndex ++ ; else nHeaderSepIndex = 0 ; aBAOS . write ( b ) ; } final Charset aCharsetToUse = CharsetHelper . getCharsetFromNameOrDefault ( m_sHeaderEncoding , SystemHelper . getSystemCharset ( ) ) ; return aBAOS . getAsString ( aCharsetToUse ) ; } |
public class MediaServicesInner { /** * Creates a Media Service .
* @ param resourceGroupName Name of the resource group within the Azure subscription .
* @ param mediaServiceName Name of the Media Service .
* @ param parameters Media Service properties needed for creation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ApiErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the MediaServiceInner object if successful . */
public MediaServiceInner create ( String resourceGroupName , String mediaServiceName , MediaServiceInner parameters ) { } } | return createWithServiceResponseAsync ( resourceGroupName , mediaServiceName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class CookieUtil { /** * | " { " | " } " | SP | HT */
private static BitSet validCookieNameOctets ( BitSet validCookieValueOctets ) { } } | BitSet bits = new BitSet ( 8 ) ; bits . or ( validCookieValueOctets ) ; bits . set ( '(' , false ) ; bits . set ( ')' , false ) ; bits . set ( '<' , false ) ; bits . set ( '>' , false ) ; bits . set ( '@' , false ) ; bits . set ( ':' , false ) ; bits . set ( '/' , false ) ; bits . set ( '[' , false ) ; bits . set ( ']' , false ) ; bits . set ( '?' , false ) ; bits . set ( '=' , false ) ; bits . set ( '{' , false ) ; bits . set ( '}' , false ) ; bits . set ( ' ' , false ) ; bits . set ( '\t' , false ) ; return bits ; |
public class Optimizer { /** * Multiple adjacent start anchors can be reduced to a single start anchor . */
static Matcher combineAdjacentStart ( Matcher matcher ) { } } | if ( matcher instanceof SeqMatcher ) { List < Matcher > matchers = matcher . < SeqMatcher > as ( ) . matchers ( ) ; if ( ! matchers . isEmpty ( ) && matchers . get ( 0 ) instanceof StartMatcher ) { List < Matcher > ms = new ArrayList < > ( ) ; ms . add ( StartMatcher . INSTANCE ) ; int pos = 0 ; for ( Matcher m : matchers ) { if ( m instanceof StartMatcher ) { ++ pos ; } else { break ; } } ms . addAll ( matchers . subList ( pos , matchers . size ( ) ) ) ; return SeqMatcher . create ( ms ) ; } } return matcher ; |
public class AbstractConnection { /** * Create a link between the local node and the specified process on the
* remote node . If the link is still active when the remote process
* terminates , an exit signal will be sent to this connection . Use
* { @ link # sendUnlink unlink ( ) } to remove the link .
* @ param dest
* the Erlang PID of the remote process .
* @ exception java . io . IOException
* if the connection is not active or a communication error
* occurs . */
protected void sendLink ( final OtpErlangPid from , final OtpErlangPid dest ) throws IOException { } } | if ( ! connected ) { throw new IOException ( "Not connected" ) ; } @ SuppressWarnings ( "resource" ) final OtpOutputStream header = new OtpOutputStream ( headerLen ) ; // preamble : 4 byte length + " passthrough " tag
header . write4BE ( 0 ) ; // reserve space for length
header . write1 ( passThrough ) ; header . write1 ( version ) ; // header
header . write_tuple_head ( 3 ) ; header . write_long ( linkTag ) ; header . write_any ( from ) ; header . write_any ( dest ) ; // fix up length in preamble
header . poke4BE ( 0 , header . size ( ) - 4 ) ; do_send ( header ) ; |
public class WSUtilImpl { /** * Overridden to allow objects to be replaced prior to being written . */
@ Override public void writeRemoteObject ( OutputStream out , @ Sensitive Object obj ) throws org . omg . CORBA . SystemException { } } | WSUtilService service = WSUtilService . getInstance ( ) ; if ( service != null ) { obj = service . replaceObject ( obj ) ; } super . writeRemoteObject ( out , obj ) ; |
public class Record { /** * Get this field in the table / record .
* @ param strTableName the name of the table this field is in ( for query records ) .
* @ param The field name .
* @ return The field . */
public BaseField getField ( String strTableName , String strFieldName ) // Lookup this field
{ } } | if ( this . getRecord ( strTableName ) != this ) return null ; return this . getField ( strFieldName ) ; |
public class VideoTrackerObjectQuadApp { public static void main ( String [ ] args ) { } } | // Class type = GrayF32 . class ;
Class type = GrayU8 . class ; // app . setBaseDirectory ( UtilIO . pathExample ( " " ) ;
// app . loadInputData ( UtilIO . pathExample ( " tracking / file _ list . txt " ) ;
List < PathLabel > examples = new ArrayList < > ( ) ; examples . add ( new PathLabel ( "WildCat" , UtilIO . pathExample ( "tracking/wildcat_robot.mjpeg" ) ) ) ; examples . add ( new PathLabel ( "Tree" , UtilIO . pathExample ( "tracking/tree.mjpeg" ) ) ) ; examples . add ( new PathLabel ( "Book" , UtilIO . pathExample ( "tracking/track_book.mjpeg" ) ) ) ; examples . add ( new PathLabel ( "Face" , UtilIO . pathExample ( "tracking/track_peter.mjpeg" ) ) ) ; examples . add ( new PathLabel ( "Chipmunk" , UtilIO . pathExample ( "tracking/chipmunk.mjpeg" ) ) ) ; examples . add ( new PathLabel ( "Balls" , UtilIO . pathExample ( "tracking/balls_blue_red.mjpeg" ) ) ) ; examples . add ( new PathLabel ( "Driving Snow" , UtilIO . pathExample ( "tracking/snow_follow_car.mjpeg" ) ) ) ; examples . add ( new PathLabel ( "Driving Night" , UtilIO . pathExample ( "tracking/night_follow_car.mjpeg" ) ) ) ; VideoTrackerObjectQuadApp app = new VideoTrackerObjectQuadApp ( examples , type ) ; app . openFile ( new File ( examples . get ( 0 ) . getPath ( ) ) ) ; app . display ( "Tracking Rectangle" ) ; |
public class RequestHelper { /** * Get the passed string without an eventually contained session ID like in
* " test . html ; JSESSIONID = 1234 ? param = value " .
* @ param aURL
* The value to strip the session ID from the path
* @ return The value without a session ID or the original string . */
@ Nonnull public static SimpleURL getWithoutSessionID ( @ Nonnull final ISimpleURL aURL ) { } } | ValueEnforcer . notNull ( aURL , "URL" ) ; // Strip the parameter from the path , but keep parameters and anchor intact !
// Note : using URLData avoid parsing , since the data was already parsed !
return new SimpleURL ( new URLData ( getWithoutSessionID ( aURL . getPath ( ) ) , aURL . params ( ) , aURL . getAnchor ( ) ) ) ; |
public class MultimapUtils { /** * This will take a multimap which in fact has a single value map for each key and return a copy
* of it as an { @ link com . google . common . collect . ImmutableMap } . If the same key if mapped to
* multiple values in the input multimap , an { @ link java . lang . IllegalArgumentException } is thrown ,
* so this should generally not be used on multimaps built from user input unless this property is
* guaranteed to hold . This is mostly useful for statically building maps which are more
* naturally represented as inverted multimaps .
* Preserves iteration order . */
public static < K , V > Map < K , V > copyAsMap ( Multimap < K , V > multimap ) { } } | final Map < K , Collection < V > > inputAsMap = multimap . asMap ( ) ; final ImmutableMap . Builder < K , V > ret = ImmutableMap . builder ( ) ; for ( final Map . Entry < K , Collection < V > > mapping : inputAsMap . entrySet ( ) ) { ret . put ( mapping . getKey ( ) , Iterables . getOnlyElement ( mapping . getValue ( ) ) ) ; } return ret . build ( ) ; |
public class ElasticSearchRestDAOV5 { /** * Roll the tasklog index daily . */
private void updateIndexName ( ) { } } | this . logIndexName = this . logIndexPrefix + "_" + SIMPLE_DATE_FORMAT . format ( new Date ( ) ) ; try { addIndex ( logIndexName ) ; } catch ( IOException e ) { logger . error ( "Failed to update log index name: {}" , logIndexName , e ) ; } |
public class SegmentManager { /** * Inserts a segment .
* @ param segment The segment to insert .
* @ throws IllegalStateException if the segment is unknown */
public synchronized void replaceSegments ( Collection < Segment > segments , Segment segment ) { } } | // Update the segment descriptor and lock the segment .
segment . descriptor ( ) . update ( System . currentTimeMillis ( ) ) ; segment . descriptor ( ) . lock ( ) ; // Iterate through old segments and remove them from the segments list .
for ( Segment oldSegment : segments ) { if ( ! this . segments . containsKey ( oldSegment . index ( ) ) ) { throw new IllegalArgumentException ( "unknown segment at index: " + oldSegment . index ( ) ) ; } this . segments . remove ( oldSegment . index ( ) ) ; } // Put the new segment in the segments list .
this . segments . put ( segment . index ( ) , segment ) ; resetCurrentSegment ( ) ; |
public class JSONSummariser { /** * Returns a function that can be used as a summary function , using the given
* start time for timing analysis .
* @ param emptyCounts
* A { @ link JDefaultDict } used to store counts of non - empty fields ,
* based on { @ link String # trim ( ) } and { @ link String # isEmpty ( ) } .
* @ param nonEmptyCounts
* A { @ link JDefaultDict } used to store counts of non - empty fields ,
* based on { @ link String # trim ( ) } and { @ link String # isEmpty ( ) } .
* @ param possibleIntegerFields
* A { @ link JDefaultDict } used to store possible integer fields
* @ param possibleDoubleFields
* A { @ link JDefaultDict } used to store possible double fields
* @ param valueCounts
* A { @ link JDefaultDict } used to store value counts
* @ param rowCount
* The row count variable
* @ param startTime
* The start time reference , obtained using
* { @ link System # currentTimeMillis ( ) } , for the timing analysis .
* @ return A function which can be passed to
* { @ link # parseForSummarise ( Reader , ObjectMapper , JDefaultDict , JDefaultDict , JDefaultDict , JDefaultDict , JDefaultDict , AtomicInteger , Map , JsonPointer , Map ) } */
public static TriFunction < JsonNode , List < String > , List < String > , List < String > > getSummaryFunctionWithStartTime ( final JDefaultDict < String , AtomicInteger > emptyCounts , final JDefaultDict < String , AtomicInteger > nonEmptyCounts , final JDefaultDict < String , AtomicBoolean > possibleIntegerFields , final JDefaultDict < String , AtomicBoolean > possibleDoubleFields , final JDefaultDict < String , JDefaultDict < String , AtomicInteger > > valueCounts , final AtomicInteger rowCount , final long startTime ) { } } | return ( node , header , line ) -> { int nextLineNumber = rowCount . incrementAndGet ( ) ; if ( nextLineNumber % 10000 == 0 ) { double secondsSinceStart = ( System . currentTimeMillis ( ) - startTime ) / 1000.0d ; System . out . printf ( "%d\tSeconds since start: %f\tRecords per second: %f%n" , nextLineNumber , secondsSinceStart , nextLineNumber / secondsSinceStart ) ; } for ( int i = 0 ; i < header . size ( ) ; i ++ ) { if ( line . get ( i ) . trim ( ) . isEmpty ( ) ) { emptyCounts . get ( header . get ( i ) ) . incrementAndGet ( ) ; } else { nonEmptyCounts . get ( header . get ( i ) ) . incrementAndGet ( ) ; valueCounts . get ( header . get ( i ) ) . get ( line . get ( i ) ) . incrementAndGet ( ) ; try { Integer . parseInt ( line . get ( i ) ) ; } catch ( NumberFormatException nfe ) { possibleIntegerFields . get ( header . get ( i ) ) . set ( false ) ; } try { Double . parseDouble ( line . get ( i ) ) ; } catch ( NumberFormatException nfe ) { possibleDoubleFields . get ( header . get ( i ) ) . set ( false ) ; } } } return line ; } ; |
public class RestClientUtil { /** * 创建索引文档 , 根据elasticsearch . xml中指定的日期时间格式 , 生成对应时间段的索引表名称
* @ param indexName
* @ param indexType
* @ param bean
* @ return
* @ throws ElasticSearchException */
public String addDocumentWithParentId ( String indexName , String indexType , Object bean , Object parentId ) throws ElasticSearchException { } } | return addDocument ( indexName , indexType , bean , ( Object ) null , parentId , ( String ) null ) ; |
public class StringGroovyMethods { /** * Determine if a CharSequence can be parsed as a Double .
* @ param self a CharSequence
* @ return true if the CharSequence can be parsed
* @ see # isDouble ( String )
* @ since 1.8.2 */
public static boolean isDouble ( CharSequence self ) { } } | try { Double . valueOf ( self . toString ( ) . trim ( ) ) ; return true ; } catch ( NumberFormatException nfe ) { return false ; } |
public class DbRemoteConfigLoader { /** * 销毁 */
@ Override public void destroy ( ) { } } | executor . shutdownNow ( ) ; try { dataSource . close ( ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; } |
public class CouchDBQuery { /** * Gets the columns to output .
* @ param m
* the m
* @ param kunderaQuery
* the kundera query
* @ return the columns to output */
private List < Map < String , Object > > getColumnsToOutput ( EntityMetadata m , KunderaQuery kunderaQuery ) { } } | if ( kunderaQuery . isSelectStatement ( ) ) { SelectStatement selectStatement = kunderaQuery . getSelectStatement ( ) ; SelectClause selectClause = ( SelectClause ) selectStatement . getSelectClause ( ) ; return KunderaQueryUtils . readSelectClause ( selectClause . getSelectExpression ( ) , m , false , kunderaMetadata ) ; } return new ArrayList ( ) ; |
public class ODatabaseObjectTx { /** * Create a new POJO by its class name . Assure to have called the registerEntityClasses ( ) declaring the packages that are part of
* entity classes .
* @ see OEntityManager . registerEntityClasses ( String ) */
public < RET extends Object > RET newInstance ( final String iClassName ) { } } | checkSecurity ( ODatabaseSecurityResources . CLASS , ORole . PERMISSION_CREATE , iClassName ) ; try { return ( RET ) entityManager . createPojo ( iClassName ) ; } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Error on creating object of class " + iClassName , e , ODatabaseException . class ) ; } return null ; |
public class FrameworkUtils { /** * Construct data map from inputting jackson json object */
public static Map < String , String > json2map ( String prefix , JsonNode json ) { } } | logger . trace ( "json to map - prefix: {}" , prefix ) ; if ( json . isArray ( ) ) { Map < String , String > result = new HashMap < > ( ) ; for ( int i = 0 ; i < json . size ( ) ; i ++ ) { result . putAll ( json2map ( prefix + "[" + i + "]" , json . get ( i ) ) ) ; } return result ; } else if ( json . isObject ( ) ) { Map < String , String > result = new HashMap < > ( ) ; json . fields ( ) . forEachRemaining ( e -> { String newPrefix = isEmptyStr ( prefix ) ? e . getKey ( ) : prefix + "." + e . getKey ( ) ; result . putAll ( json2map ( newPrefix , e . getValue ( ) ) ) ; } ) ; return result ; } else { return newmap ( entry ( prefix , json . asText ( ) ) ) ; } |
public class ResourceIdentifierMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ResourceIdentifier resourceIdentifier , ProtocolMarshaller protocolMarshaller ) { } } | if ( resourceIdentifier == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resourceIdentifier . getResourceArn ( ) , RESOURCEARN_BINDING ) ; protocolMarshaller . marshall ( resourceIdentifier . getResourceType ( ) , RESOURCETYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RecordChangedHandler { /** * Set the date field to the current time .
* Also make sure the time is not the same as it is currently . */
public void setTheDate ( ) { } } | boolean [ ] rgbEnabled = m_field . setEnableListeners ( false ) ; Calendar calAfter = m_field . getCalendar ( ) ; Calendar calBefore = m_field . getCalendar ( ) ; m_field . setValue ( DateTimeField . currentTime ( ) , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; // File written or updated , set the update date
calAfter = m_field . getCalendar ( ) ; if ( calBefore != null ) if ( calAfter . before ( calBefore ) ) calAfter = calBefore ; // If this was set with a different computer ( clock ) , make sure it always increases !
if ( calAfter != null ) if ( calAfter . equals ( calBefore ) ) { calAfter . add ( Calendar . SECOND , 1 ) ; // Can ' t be the same as last time .
m_field . setCalendar ( calAfter , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; } Utility . getLogger ( ) . info ( "Set date: " + m_field . toString ( ) ) ; m_field . setEnableListeners ( rgbEnabled ) ; |
public class Statement { /** * Returns a new { @ link Statement } with the source location attached . */
public final Statement withSourceLocation ( SourceLocation location ) { } } | checkNotNull ( location ) ; if ( location . equals ( this . location ) ) { return this ; } return new Statement ( location ) { @ Override protected void doGen ( CodeBuilder adapter ) { Statement . this . gen ( adapter ) ; } } ; |
public class FileUtils { /** * Sanitize relative paths against " zip slip " vulnerability , by removing path segments if " . . " is found in the
* URL , but without allowing navigation above the path hierarchy root . Treats each " ! " character as a new path
* hierarchy root . Also removes " . " and empty path segments ( " / / " ) .
* @ param path
* The path to sanitize .
* @ param removeInitialSlash
* If true , additionally removes any " / " character ( s ) from the beginning of the returned path .
* @ return The sanitized path . */
public static String sanitizeEntryPath ( final String path , final boolean removeInitialSlash ) { } } | if ( path . isEmpty ( ) ) { return "" ; } // Find all ' / ' and ' ! ' character positions , which split a path into segments
boolean foundSegmentToSanitize = false ; { int lastSepIdx = - 1 ; char prevC = '\0' ; for ( int i = 0 ; i < path . length ( ) + 1 ; i ++ ) { final char c = i == path . length ( ) ? '\0' : path . charAt ( i ) ; if ( c == '/' || c == '!' || c == '\0' ) { final int segmentLength = i - ( lastSepIdx + 1 ) ; if ( // Found empty segment " / / " or " ! ! "
( segmentLength == 0 && prevC == c ) // Found segment " . "
|| ( segmentLength == 1 && path . charAt ( i - 1 ) == '.' ) // Found segment " . . "
|| ( segmentLength == 2 && path . charAt ( i - 2 ) == '.' && path . charAt ( i - 1 ) == '.' ) ) { foundSegmentToSanitize = true ; } lastSepIdx = i ; } prevC = c ; } } // Handle " . . " , " . " and empty path segments , if any were found
String pathSanitized = path ; if ( foundSegmentToSanitize ) { // Sanitize between " ! " section markers separately ( " . . " should not apply past preceding " ! " )
final List < List < String > > allSectionSegments = new ArrayList < > ( ) ; List < String > currSectionSegments = new ArrayList < > ( ) ; allSectionSegments . add ( currSectionSegments ) ; int lastSepIdx = - 1 ; for ( int i = 0 ; i < path . length ( ) + 1 ; i ++ ) { final char c = i == path . length ( ) ? '\0' : path . charAt ( i ) ; if ( c == '/' || c == '!' || c == '\0' ) { final String segment = path . substring ( lastSepIdx + 1 , i ) ; if ( segment . equals ( "." ) || segment . isEmpty ( ) ) { // Ignore " / . / " or empty segment " / / "
} else if ( segment . equals ( ".." ) ) { // Remove one segment if " . . " encountered , but do not allow " . . " above top of hierarchy
if ( ! currSectionSegments . isEmpty ( ) ) { currSectionSegments . remove ( currSectionSegments . size ( ) - 1 ) ; } } else { // Encountered normal path segment
currSectionSegments . add ( segment ) ; } if ( c == '!' && ! currSectionSegments . isEmpty ( ) ) { // Begin new section
currSectionSegments = new ArrayList < > ( ) ; allSectionSegments . add ( currSectionSegments ) ; } lastSepIdx = i ; } } // Turn sections and segments back into path string
final StringBuilder buf = new StringBuilder ( ) ; for ( final List < String > sectionSegments : allSectionSegments ) { if ( ! sectionSegments . isEmpty ( ) ) { // Delineate segments with " ! "
if ( buf . length ( ) > 0 ) { buf . append ( '!' ) ; } for ( final String sectionSegment : sectionSegments ) { buf . append ( '/' ) ; buf . append ( sectionSegment ) ; } } } pathSanitized = buf . toString ( ) ; if ( pathSanitized . isEmpty ( ) && path . startsWith ( "/" ) ) { pathSanitized = "/" ; } } if ( removeInitialSlash || ! path . startsWith ( "/" ) ) { // Strip off leading " / " if it needs to be removed , or if it wasn ' t present in the original path
// ( the string - building code above prepends " / " to every segment ) . Note that " / " is always added
// after " ! " , since " jar : " URLs expect this .
while ( pathSanitized . startsWith ( "/" ) ) { pathSanitized = pathSanitized . substring ( 1 ) ; } } return pathSanitized ; |
public class ArrayUtils { /** * 判定给定的数组是否为空 。 < / br > Returns true if given object is an not null array and it
* is length = = 0 ; false otherwise .
* @ param array 用来测试的数组 。 < / br > the array to be tested .
* @ return 如果给定的是数组并且为null或长度为0则返回true , 否则返回false 。 < / br > true if given object is
* an array and it is null or length = = 0 ; false otherwise . */
public static boolean isEmpty ( final Object array ) { } } | if ( array == null ) { return true ; } boolean isArray = array . getClass ( ) . isArray ( ) ; if ( isArray ) { int length = Array . getLength ( array ) ; return length == 0 ; } return isArray ; |
public class OrcSerDeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( OrcSerDe orcSerDe , ProtocolMarshaller protocolMarshaller ) { } } | if ( orcSerDe == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( orcSerDe . getStripeSizeBytes ( ) , STRIPESIZEBYTES_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getBlockSizeBytes ( ) , BLOCKSIZEBYTES_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getRowIndexStride ( ) , ROWINDEXSTRIDE_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getEnablePadding ( ) , ENABLEPADDING_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getPaddingTolerance ( ) , PADDINGTOLERANCE_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getCompression ( ) , COMPRESSION_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getBloomFilterColumns ( ) , BLOOMFILTERCOLUMNS_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getBloomFilterFalsePositiveProbability ( ) , BLOOMFILTERFALSEPOSITIVEPROBABILITY_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getDictionaryKeyThreshold ( ) , DICTIONARYKEYTHRESHOLD_BINDING ) ; protocolMarshaller . marshall ( orcSerDe . getFormatVersion ( ) , FORMATVERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ActionValidator { protected ValidationSuccess doValidate ( Object form , VaMore < MESSAGES > moreValidationLambda , VaErrorHook validationErrorLambda ) { } } | verifyFormType ( form ) ; return actuallyValidate ( wrapAsValidIfNeeds ( form ) , moreValidationLambda , validationErrorLambda ) ; |
public class DataFileCache { /** * Writes out all the rows to a new file without fragmentation . */
public void defrag ( ) { } } | if ( cacheReadonly ) { return ; } if ( fileFreePosition == INITIAL_FREE_POS ) { return ; } database . logger . appLog . logContext ( SimpleLog . LOG_NORMAL , "start" ) ; try { boolean wasNio = dataFile . wasNio ( ) ; cache . saveAll ( ) ; DataFileDefrag dfd = new DataFileDefrag ( database , this , fileName ) ; dfd . process ( ) ; close ( false ) ; deleteFile ( wasNio ) ; renameDataFile ( wasNio ) ; backupFile ( ) ; database . getProperties ( ) . setProperty ( HsqlDatabaseProperties . hsqldb_cache_version , HsqlDatabaseProperties . THIS_CACHE_VERSION ) ; database . getProperties ( ) . save ( ) ; cache . clear ( ) ; cache = new Cache ( this ) ; open ( cacheReadonly ) ; dfd . updateTableIndexRoots ( ) ; dfd . updateTransactionRowIDs ( ) ; } catch ( Throwable e ) { database . logger . appLog . logContext ( e , null ) ; if ( e instanceof HsqlException ) { throw ( HsqlException ) e ; } else { throw new HsqlException ( e , Error . getMessage ( ErrorCode . GENERAL_IO_ERROR ) , ErrorCode . GENERAL_IO_ERROR ) ; } } database . logger . appLog . logContext ( SimpleLog . LOG_NORMAL , "end" ) ; |
public class PatternBox { /** * Pattern for an entity is producing a small molecule , and the small molecule controls state
* change of another molecule .
* @ param blacklist a skip - list of ubiquitous molecules
* @ return the pattern */
public static Pattern controlsStateChangeThroughControllerSmallMolecule ( Blacklist blacklist ) { } } | Pattern p = new Pattern ( SequenceEntityReference . class , "upper controller ER" ) ; p . add ( linkedER ( true ) , "upper controller ER" , "upper controller generic ER" ) ; p . add ( erToPE ( ) , "upper controller generic ER" , "upper controller simple PE" ) ; p . add ( linkToComplex ( ) , "upper controller simple PE" , "upper controller PE" ) ; p . add ( peToControl ( ) , "upper controller PE" , "upper Control" ) ; p . add ( controlToConv ( ) , "upper Control" , "upper Conversion" ) ; p . add ( new NOT ( participantER ( ) ) , "upper Conversion" , "upper controller ER" ) ; p . add ( new Participant ( RelType . OUTPUT , blacklist ) , "upper Conversion" , "controller PE" ) ; p . add ( type ( SmallMolecule . class ) , "controller PE" ) ; if ( blacklist != null ) p . add ( new NonUbique ( blacklist ) , "controller PE" ) ; // the linker small mol is at also an input
p . add ( new NOT ( new ConstraintChain ( new ConversionSide ( ConversionSide . Type . OTHER_SIDE ) , linkToSpecific ( ) ) ) , "controller PE" , "upper Conversion" , "controller PE" ) ; p . add ( peToControl ( ) , "controller PE" , "Control" ) ; p . add ( controlToConv ( ) , "Control" , "Conversion" ) ; p . add ( equal ( false ) , "upper Conversion" , "Conversion" ) ; // p . add ( nextInteraction ( ) , " upper Conversion " , " Conversion " ) ;
stateChange ( p , "Control" ) ; p . add ( type ( SequenceEntityReference . class ) , "changed ER" ) ; p . add ( equal ( false ) , "upper controller ER" , "changed ER" ) ; p . add ( new NOT ( participantER ( ) ) , "Conversion" , "upper controller ER" ) ; return p ; |
public class Menu { /** * This function will return all the menu and sub - menu items that can
* be directly ( the shortcut directly corresponds ) and indirectly
* ( the ALT - enabled char corresponds to the shortcut ) associated
* with the keyCode . */
@ SuppressWarnings ( "deprecation" ) void findItemsWithShortcutForKey ( List < MenuItem > items , int keyCode , KeyEvent event ) { } } | final boolean qwerty = isQwertyMode ( ) ; final int metaState = event . getMetaState ( ) ; final KeyCharacterMap . KeyData possibleChars = new KeyCharacterMap . KeyData ( ) ; // Get the chars associated with the keyCode ( i . e using any chording combo )
final boolean isKeyCodeMapped = event . getKeyData ( possibleChars ) ; // The delete key is not mapped to ' \ b ' so we treat it specially
if ( ! isKeyCodeMapped && ( keyCode != KeyEvent . KEYCODE_DEL ) ) { return ; } // Look for an item whose shortcut is this key .
final int N = mItems . size ( ) ; for ( int i = 0 ; i < N ; i ++ ) { MenuItem item = mItems . get ( i ) ; if ( item . hasSubMenu ( ) ) { ( ( Menu ) item . getSubMenu ( ) ) . findItemsWithShortcutForKey ( items , keyCode , event ) ; } final char shortcutChar = qwerty ? item . getAlphabeticShortcut ( ) : item . getNumericShortcut ( ) ; if ( ( ( metaState & ( KeyEvent . META_SHIFT_ON | KeyEvent . META_SYM_ON ) ) == 0 ) && ( shortcutChar != 0 ) && ( shortcutChar == possibleChars . meta [ 0 ] || shortcutChar == possibleChars . meta [ 2 ] || ( qwerty && shortcutChar == '\b' && keyCode == KeyEvent . KEYCODE_DEL ) ) && item . isEnabled ( ) ) { items . add ( item ) ; } } |
public class SQSSession { /** * Creates a < code > MessageProducer < / code > for the specified destination .
* Only queue destinations are supported at this time .
* @ param destination
* a queue destination
* @ return new message producer
* @ throws JMSException
* If session is closed or queue destination is not used */
@ Override public MessageProducer createProducer ( Destination destination ) throws JMSException { } } | checkClosed ( ) ; if ( destination != null && ! ( destination instanceof SQSQueueDestination ) ) { throw new JMSException ( "Actual type of Destination/Queue has to be SQSQueueDestination" ) ; } SQSMessageProducer messageProducer ; synchronized ( stateLock ) { checkClosing ( ) ; messageProducer = new SQSMessageProducer ( amazonSQSClient , this , ( SQSQueueDestination ) destination ) ; messageProducers . add ( messageProducer ) ; } return messageProducer ; |
public class UniqueBondMatches { /** * Convert a mapping to a bitset .
* @ param mapping an atom mapping
* @ return a bit set of the mapped vertices ( values in array ) */
private Set < Tuple > toEdgeSet ( int [ ] mapping ) { } } | Set < Tuple > edges = new HashSet < Tuple > ( mapping . length * 2 ) ; for ( int u = 0 ; u < g . length ; u ++ ) { for ( int v : g [ u ] ) { edges . add ( new Tuple ( mapping [ u ] , mapping [ v ] ) ) ; } } return edges ; |
public class Expression { /** * Validates the expression
* @ throws IllegalArgumentException if one or more parameters were invalid */
public void validate ( ) { } } | if ( id == null || id . isEmpty ( ) ) { throw new IllegalArgumentException ( "missing or empty id" ) ; } Query . validateId ( id ) ; if ( expr == null || expr . isEmpty ( ) ) { throw new IllegalArgumentException ( "missing or empty expr" ) ; } // parse it just to make sure we ' re happy and extract the variable names .
// Will throw JexlException
parsed_expression = ExpressionIterator . JEXL_ENGINE . createScript ( expr ) ; variables = new HashSet < String > ( ) ; for ( final List < String > exp_list : ExpressionIterator . JEXL_ENGINE . getVariables ( parsed_expression ) ) { for ( final String variable : exp_list ) { variables . add ( variable ) ; } } // others are optional
if ( join == null ) { join = Join . Builder ( ) . setOperator ( SetOperator . UNION ) . build ( ) ; } |
public class UcsApi { /** * Search for interactions based on search query , using lucene search
* @ param luceneSearchInteractionData ( required )
* @ return ApiResponse & lt ; ApiSuccessResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < ApiSuccessResponse > searchInteractionsWithHttpInfo ( LuceneSearchInteractionData luceneSearchInteractionData ) throws ApiException { } } | com . squareup . okhttp . Call call = searchInteractionsValidateBeforeCall ( luceneSearchInteractionData , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class ProjectiveStructureByFactorization { /** * Sets depths for a particular value to the values in the passed in array
* @ param view
* @ param featureDepths */
public void setDepths ( int view , double featureDepths [ ] ) { } } | if ( featureDepths . length < depths . numCols ) throw new IllegalArgumentException ( "Pixel count must be constant and match " + pixels . numCols ) ; int N = depths . numCols ; for ( int i = 0 ; i < N ; i ++ ) { depths . set ( view , i , featureDepths [ i ] ) ; } |
public class DatabasesInner { /** * Returns the list of databases of the given Kusto cluster .
* @ param resourceGroupName The name of the resource group containing the Kusto cluster .
* @ param clusterName The name of the Kusto cluster .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; DatabaseInner & gt ; object */
public Observable < List < DatabaseInner > > listByClusterAsync ( String resourceGroupName , String clusterName ) { } } | return listByClusterWithServiceResponseAsync ( resourceGroupName , clusterName ) . map ( new Func1 < ServiceResponse < List < DatabaseInner > > , List < DatabaseInner > > ( ) { @ Override public List < DatabaseInner > call ( ServiceResponse < List < DatabaseInner > > response ) { return response . body ( ) ; } } ) ; |
public class CppReader { /** * Defines the given name as a macro .
* This is a convnience method . */
public void addMacro ( @ Nonnull String name , @ Nonnull String value ) throws LexerException { } } | cpp . addMacro ( name , value ) ; |
public class ParserFJTask { /** * Took a crash / NPE somewhere in the parser . Attempt cleanup . */
@ Override public boolean onExceptionalCompletion ( Throwable ex , CountedCompleter caller ) { } } | Futures fs = new Futures ( ) ; if ( _job != null ) { UKV . remove ( _job . destination_key , fs ) ; UKV . remove ( _job . _progress , fs ) ; // Find & remove all partially - built output vecs & chunks
if ( _job . _mfpt != null ) _job . _mfpt . onExceptionCleanup ( fs ) ; } // Assume the input is corrupt - or already partially deleted after
// parsing . Nuke it all - no partial Vecs lying around .
for ( Key k : _keys ) UKV . remove ( k , fs ) ; fs . blockForPending ( ) ; // As soon as the job is canceled , threads blocking on the job will
// wake up . Better have all cleanup done first !
if ( _job != null ) _job . cancel ( ex ) ; return true ; |
public class JavacParser { /** * Resources = Resource { " ; " Resources } */
List < JCTree > resources ( ) { } } | ListBuffer < JCTree > defs = new ListBuffer < > ( ) ; defs . append ( resource ( ) ) ; while ( token . kind == SEMI ) { // All but last of multiple declarators must subsume a semicolon
storeEnd ( defs . last ( ) , token . endPos ) ; int semiColonPos = token . pos ; nextToken ( ) ; if ( token . kind == RPAREN ) { // Optional trailing semicolon
// after last resource
break ; } defs . append ( resource ( ) ) ; } return defs . toList ( ) ; |
public class TemplateDrivenMultiBranchProject { /** * Triggered by different listeners to enforce state for multi - branch projects and their sub - projects .
* < ul >
* < li > Watches for changes to the template project and corrects the SCM and enabled / disabled state if modified . < / li >
* < li > Looks for rogue template project in the branches directory and removes it if no such sub - project exists . < / li >
* < li > Re - disables sub - projects if they were enabled when the parent project was disabled . < / li >
* < / ul >
* @ param item the item that was just updated */
public static void enforceProjectStateOnUpdated ( Item item ) { } } | if ( item . getParent ( ) instanceof TemplateDrivenMultiBranchProject ) { TemplateDrivenMultiBranchProject parent = ( TemplateDrivenMultiBranchProject ) item . getParent ( ) ; AbstractProject template = parent . getTemplate ( ) ; if ( item . equals ( template ) ) { try { if ( ! ( template . getScm ( ) instanceof NullSCM ) ) { template . setScm ( new NullSCM ( ) ) ; } if ( ! template . isDisabled ( ) ) { template . disable ( ) ; } } catch ( IOException e ) { LOGGER . log ( Level . WARNING , "Unable to correct template configuration." , e ) ; } } // Don ' t allow sub - projects to be enabled if parent is disabled
AbstractProject project = ( AbstractProject ) item ; if ( parent . isDisabled ( ) && ! project . isDisabled ( ) ) { try { project . disable ( ) ; } catch ( IOException e ) { LOGGER . log ( Level . WARNING , "Unable to keep sub-project disabled." , e ) ; } } } |
public class CmsRestoreView { /** * Click handler for the OK button . < p >
* @ param e the click event */
@ UiHandler ( "m_okButton" ) protected void onClickOk ( ClickEvent e ) { } } | final boolean undoMove = m_undoMoveCheckbox . getFormValue ( ) . booleanValue ( ) ; m_popup . hide ( ) ; CmsRpcAction < Void > action = new CmsRpcAction < Void > ( ) { @ Override public void execute ( ) { start ( 200 , true ) ; I_CmsVfsServiceAsync service = CmsCoreProvider . getVfsService ( ) ; service . undoChanges ( m_restoreInfo . getStructureId ( ) , undoMove , this ) ; } @ Override protected void onResponse ( Void result ) { stop ( false ) ; if ( m_afterRestoreAction != null ) { m_afterRestoreAction . run ( ) ; } } } ; action . execute ( ) ; |
public class ByteBufQueue { /** * Returns the number of ByteBufs in this queue . */
@ Contract ( pure = true ) public int remainingBufs ( ) { } } | return last >= first ? last - first : bufs . length + ( last - first ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcOwnerHistory ( ) { } } | if ( ifcOwnerHistoryEClass == null ) { ifcOwnerHistoryEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 405 ) ; } return ifcOwnerHistoryEClass ; |
public class DirectoryWatcher { /** * 为指定目录及其所有子目录注册监控事件
* @ param path 目录 */
private void registerDirectoryTree ( Path path ) { } } | try { Files . walkFileTree ( path , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult preVisitDirectory ( Path dir , BasicFileAttributes attrs ) throws IOException { registerDirectory ( dir ) ; return FileVisitResult . CONTINUE ; } } ) ; } catch ( IOException ex ) { LOGGER . error ( "监控目录失败:" + path . toAbsolutePath ( ) , ex ) ; } |
public class RootDocumentRepositoryMongoImpl { /** * { @ inheritDoc } */
@ Override public final RootDocument findByFileAndString ( final String filename , final String string ) { } } | final Query searchQuery = new Query ( Criteria . where ( "string" ) . is ( string ) . and ( "filename" ) . is ( filename ) ) ; final RootDocument rootDocument = mongoTemplate . findOne ( searchQuery , RootDocumentMongo . class ) ; if ( rootDocument == null ) { return null ; } final Root root = ( Root ) toObjConverter . createRoot ( rootDocument , finder ) ; rootDocument . setGedObject ( root ) ; return rootDocument ; |
public class Leaf { /** * Writes the leaf to a JSON object for storage . This is necessary for the CAS
* calls and to reduce storage costs since we don ' t need to store UID names
* ( particularly as someone may rename a UID )
* @ return The byte array to store */
private byte [ ] toStorageJson ( ) { } } | final ByteArrayOutputStream output = new ByteArrayOutputStream ( display_name . length ( ) + tsuid . length ( ) + 30 ) ; try { final JsonGenerator json = JSON . getFactory ( ) . createGenerator ( output ) ; json . writeStartObject ( ) ; // we only need to write a small amount of information
json . writeObjectField ( "displayName" , display_name ) ; json . writeObjectField ( "tsuid" , tsuid ) ; json . writeEndObject ( ) ; json . close ( ) ; // TODO zero copy ?
return output . toByteArray ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } |
public class VectorUtil { /** * Compute the minimum angle between two rectangles .
* @ param v1 first rectangle
* @ param v2 second rectangle
* @ return Angle */
public static double minCosAngle ( SpatialComparable v1 , SpatialComparable v2 ) { } } | if ( v1 instanceof NumberVector && v2 instanceof NumberVector ) { return cosAngle ( ( NumberVector ) v1 , ( NumberVector ) v2 ) ; } final int dim1 = v1 . getDimensionality ( ) , dim2 = v2 . getDimensionality ( ) ; final int mindim = ( dim1 <= dim2 ) ? dim1 : dim2 ; // Essentially , we want to compute this :
// absmax ( v1 . transposeTimes ( v2 ) ) / ( min ( v1 . euclideanLength ( ) ) * min ( v2 . euclideanLength ( ) ) ) ;
// We can just compute all three in parallel .
double s1 = 0 , s2 = 0 , l1 = 0 , l2 = 0 ; for ( int k = 0 ; k < mindim ; k ++ ) { final double min1 = v1 . getMin ( k ) , max1 = v1 . getMax ( k ) ; final double min2 = v2 . getMin ( k ) , max2 = v2 . getMax ( k ) ; final double p1 = min1 * min2 , p2 = min1 * max2 ; final double p3 = max1 * min2 , p4 = max1 * max2 ; s1 += Math . max ( Math . max ( p1 , p2 ) , Math . max ( p3 , p4 ) ) ; s2 += Math . min ( Math . min ( p1 , p2 ) , Math . min ( p3 , p4 ) ) ; if ( max1 < 0 ) { l1 += max1 * max1 ; } else if ( min1 > 0 ) { l1 += min1 * min1 ; } // else : 0
if ( max2 < 0 ) { l2 += max2 * max2 ; } else if ( min2 > 0 ) { l2 += min2 * min2 ; } // else : 0
} for ( int k = mindim ; k < dim1 ; k ++ ) { final double min1 = v1 . getMin ( k ) , max1 = v1 . getMax ( k ) ; if ( max1 < 0. ) { l1 += max1 * max1 ; } else if ( min1 > 0. ) { l1 += min1 * min1 ; } // else : 0
} for ( int k = mindim ; k < dim2 ; k ++ ) { final double min2 = v2 . getMin ( k ) , max2 = v2 . getMax ( k ) ; if ( max2 < 0. ) { l2 += max2 * max2 ; } else if ( min2 > 0. ) { l2 += min2 * min2 ; } // else : 0
} final double cross = Math . max ( Math . abs ( s1 ) , Math . abs ( s2 ) ) ; final double a = ( cross == 0. ) ? 0. : ( l1 == 0. || l2 == 0. ) ? 1. : FastMath . sqrt ( ( cross / l1 ) * ( cross / l2 ) ) ; return ( a < 1. ) ? a : 1. ; |
public class Periodic { /** * Call from a procedure that gets a < code > @ Context GraphDatbaseAPI db ; < / code > injected and provide that db to the runnable . */
public static < T > JobInfo submit ( String name , Runnable task ) { } } | JobInfo info = new JobInfo ( name ) ; Future < T > future = list . remove ( info ) ; if ( future != null && ! future . isDone ( ) ) future . cancel ( false ) ; Future newFuture = Pools . SCHEDULED . submit ( task ) ; list . put ( info , newFuture ) ; return info ; |
public class GlobalSecondaryIndexDescriptionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GlobalSecondaryIndexDescription globalSecondaryIndexDescription , ProtocolMarshaller protocolMarshaller ) { } } | if ( globalSecondaryIndexDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( globalSecondaryIndexDescription . getIndexName ( ) , INDEXNAME_BINDING ) ; protocolMarshaller . marshall ( globalSecondaryIndexDescription . getKeySchema ( ) , KEYSCHEMA_BINDING ) ; protocolMarshaller . marshall ( globalSecondaryIndexDescription . getProjection ( ) , PROJECTION_BINDING ) ; protocolMarshaller . marshall ( globalSecondaryIndexDescription . getIndexStatus ( ) , INDEXSTATUS_BINDING ) ; protocolMarshaller . marshall ( globalSecondaryIndexDescription . getBackfilling ( ) , BACKFILLING_BINDING ) ; protocolMarshaller . marshall ( globalSecondaryIndexDescription . getProvisionedThroughput ( ) , PROVISIONEDTHROUGHPUT_BINDING ) ; protocolMarshaller . marshall ( globalSecondaryIndexDescription . getIndexSizeBytes ( ) , INDEXSIZEBYTES_BINDING ) ; protocolMarshaller . marshall ( globalSecondaryIndexDescription . getItemCount ( ) , ITEMCOUNT_BINDING ) ; protocolMarshaller . marshall ( globalSecondaryIndexDescription . getIndexArn ( ) , INDEXARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MultipleAlignmentScorer { /** * Calculates the RMSD of all - to - all structure comparisons ( distances ) ,
* given a set of superimposed atoms .
* @ param transformed
* @ return double RMSD
* @ see # getRMSD ( MultipleAlignment ) */
public static double getRMSD ( List < Atom [ ] > transformed ) { } } | double sumSqDist = 0 ; int comparisons = 0 ; for ( int r1 = 0 ; r1 < transformed . size ( ) ; r1 ++ ) { for ( int c = 0 ; c < transformed . get ( r1 ) . length ; c ++ ) { Atom refAtom = transformed . get ( r1 ) [ c ] ; if ( refAtom == null ) continue ; double nonNullSqDist = 0 ; int nonNullLength = 0 ; for ( int r2 = r1 + 1 ; r2 < transformed . size ( ) ; r2 ++ ) { Atom atom = transformed . get ( r2 ) [ c ] ; if ( atom != null ) { nonNullSqDist += Calc . getDistanceFast ( refAtom , atom ) ; nonNullLength ++ ; } } if ( nonNullLength > 0 ) { comparisons ++ ; sumSqDist += nonNullSqDist / nonNullLength ; } } } return Math . sqrt ( sumSqDist / comparisons ) ; |
public class JDBCStorageConnection { /** * Read property data without value data . For listChildPropertiesData ( NodeData ) .
* @ param parentPath
* - parent path
* @ param item
* database - ResultSet with Item record ( s )
* @ return PropertyData instance
* @ throws RepositoryException
* Repository error
* @ throws SQLException
* database error
* @ throws IOException
* I / O error */
private PropertyData propertyData ( QPath parentPath , ResultSet item ) throws RepositoryException , SQLException , IOException { } } | String cid = item . getString ( COLUMN_ID ) ; String cname = item . getString ( COLUMN_NAME ) ; int cversion = item . getInt ( COLUMN_VERSION ) ; String cpid = item . getString ( COLUMN_PARENTID ) ; int cptype = item . getInt ( COLUMN_PTYPE ) ; boolean cpmultivalued = item . getBoolean ( COLUMN_PMULTIVALUED ) ; try { InternalQName qname = InternalQName . parse ( cname ) ; QPath qpath = QPath . makeChildPath ( parentPath == null ? traverseQPath ( cpid ) : parentPath , qname ) ; PersistedPropertyData pdata = new PersistedPropertyData ( getIdentifier ( cid ) , qpath , getIdentifier ( cpid ) , cversion , cptype , cpmultivalued , new ArrayList < ValueData > ( ) , new SimplePersistedSize ( 0 ) ) ; return pdata ; } catch ( InvalidItemStateException e ) { throw new InvalidItemStateException ( "FATAL: Can't build property path for name " + cname + " id: " + getIdentifier ( cid ) + ". " + e ) ; } catch ( IllegalNameException e ) { throw new RepositoryException ( e ) ; } |
public class GosuParserFactory { /** * Creates an IGosuParser appropriate for parsing and executing Gosu .
* @ param strSource The text of the the rule source
* @ param symTable The symbol table the parser uses to parse and execute the rule
* @ param scriptabilityConstraint Specifies the types of methods / properties that are visible
* @ return A parser appropriate for parsing Gosu source . */
public static IGosuParser createParser ( String strSource , ISymbolTable symTable , IScriptabilityModifier scriptabilityConstraint ) { } } | return CommonServices . getGosuParserFactory ( ) . createParser ( strSource , symTable , scriptabilityConstraint ) ; |
public class StreamEx { /** * Returns a { @ code Map < Boolean , C > } which contains two partitions of the
* input elements according to a { @ code Predicate } .
* This is a < a href = " package - summary . html # StreamOps " > terminal < / a >
* operation .
* There are no guarantees on the type , mutability , serializability , or
* thread - safety of the { @ code Map } returned .
* @ param < C > the type of { @ code Collection } used as returned { @ code Map }
* values .
* @ param predicate a predicate used for classifying input elements
* @ param collectionFactory a function which returns a new empty
* { @ code Collection } which will be used to store the stream
* elements .
* @ return a { @ code Map < Boolean , C > } which { @ link Boolean # TRUE } key is
* mapped to the collection of the stream elements for which
* predicate is true and { @ link Boolean # FALSE } key is mapped to the
* collection of all other stream elements .
* @ see # partitioningBy ( Predicate , Collector )
* @ see Collectors # partitioningBy ( Predicate )
* @ since 0.2.2 */
public < C extends Collection < T > > Map < Boolean , C > partitioningTo ( Predicate < ? super T > predicate , Supplier < C > collectionFactory ) { } } | return collect ( Collectors . partitioningBy ( predicate , Collectors . toCollection ( collectionFactory ) ) ) ; |
public class RouteMatcher { /** * Specify a handler that will be called for all HTTP methods
* @ param regex A regular expression
* @ param handler The handler to call */
public RouteMatcher allWithRegEx ( String regex , Handler < HttpServerRequest > handler ) { } } | addRegEx ( regex , handler , getBindings ) ; addRegEx ( regex , handler , putBindings ) ; addRegEx ( regex , handler , postBindings ) ; addRegEx ( regex , handler , deleteBindings ) ; addRegEx ( regex , handler , optionsBindings ) ; addRegEx ( regex , handler , headBindings ) ; addRegEx ( regex , handler , traceBindings ) ; addRegEx ( regex , handler , connectBindings ) ; addRegEx ( regex , handler , patchBindings ) ; return this ; |
public class ExtractBlast { /** * Main .
* @ param args command line args */
public static void main ( final String [ ] args ) { } } | Switch about = new Switch ( "a" , "about" , "display about message" ) ; Switch help = new Switch ( "h" , "help" , "display help message" ) ; IntegerArgument alleleCutoff = new IntegerArgument ( "c" , "allele-cutoff" , "allele cutoff value" , false ) ; StringArgument imgtHlaDb = new StringArgument ( "d" , "imgt-db-version" , "imgt hla database version" , false ) ; FileArgument inputBlastFile = new FileArgument ( "i" , "input-blast-file" , "input blast file, default stdin" , false ) ; FileArgument inputFastaFile = new FileArgument ( "f" , "input-fasta-file" , "input fastq file, default stdin" , false ) ; FileArgument outputFile = new FileArgument ( "o" , "output-file" , "output file, default stdout" , false ) ; ArgumentList arguments = new ArgumentList ( about , help , inputBlastFile , inputFastaFile , outputFile , imgtHlaDb ) ; CommandLine commandLine = new CommandLine ( args ) ; ExtractBlast extractBlast = null ; try { CommandLineParser . parse ( commandLine , arguments ) ; if ( about . wasFound ( ) ) { About . about ( System . out ) ; System . exit ( 0 ) ; } if ( help . wasFound ( ) ) { Usage . usage ( USAGE , null , commandLine , arguments , System . out ) ; System . exit ( 0 ) ; } int cutoff = alleleCutoff . getValue ( ) == null ? 10 : alleleCutoff . getValue ( ) ; String imgt = imgtHlaDb . getValue ( ) == null ? "N/A" : imgtHlaDb . getValue ( ) ; extractBlast = new ExtractBlast ( inputBlastFile . getValue ( ) , inputFastaFile . getValue ( ) , outputFile . getValue ( ) , cutoff , imgt ) ; } catch ( CommandLineParseException | IllegalArgumentException e ) { Usage . usage ( USAGE , e , commandLine , arguments , System . err ) ; System . exit ( - 1 ) ; } try { System . exit ( extractBlast . call ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } |
public class ParentEditController { @ Override public void onMouseDown ( MouseDownEvent event ) { } } | if ( controller != null ) { controller . onMouseDown ( event ) ; if ( ! controller . isBusy ( ) ) { panController . onMouseDown ( event ) ; } } else { panController . onMouseDown ( event ) ; } |
public class PoolManager { /** * QuisceIfPossible should be called when a connection pool is no longer needed ,
* instead of directly calling quiesce ( ) . This method should be invoked the
* first time by ConnectionFactoryDetailsImpl . stop ( ) . Subsequently it will
* be invoked at the end of PoolManager . release ( ) .
* This method does three things
* < UL >
* < LI > If _ quiesce = = false , set it to true and set _ quiesceTime . < / LI >
* < LI > If _ quiesce = = false , increment the fatal error value for every
* FreePool and purge any existing connections . < / LI >
* < LI > If the connection pool is empty , call quiesce to completely clean up . < / LI >
* < / UL > */
public void quiesceIfPossible ( ) throws ResourceException { } } | if ( tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "quiesceIfPossible" , _quiesce ) ; } if ( ! _quiesce ) { // only do this the first time we ' re called
_quiesce = true ; _quiesceTime = new Date ( System . currentTimeMillis ( ) ) ; // Begin block copied from serverShutdown ( )
for ( int j = 0 ; j < maxFreePoolHashSize ; ++ j ) { synchronized ( freePool [ j ] . freeConnectionLockObject ) { /* * If a connection gets away , by setting fatalErrorNotificationTime will
* guaranty when the connection is returned to the free pool , it will be */
freePool [ j ] . incrementFatalErrorValue ( j ) ; /* * Destroy as many connections as we can in the free pool */
if ( freePool [ j ] . mcWrapperList . size ( ) > 0 ) { freePool [ j ] . cleanupAndDestroyAllFreeConnections ( ) ; } } // end free lock
} // end for j
// End block copied from serverShutdown ( )
} if ( totalConnectionCount . get ( ) == 0 ) { quiesce ( ) ; } if ( tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "quiesceIfPossible" ) ; } |
public class ApkBuilder { /** * Adds the content from a zip file .
* All file keep the same path inside the archive .
* @ param zipFile the zip File .
* @ throws ApkCreationException if an error occurred
* @ throws SealedApkException if the APK is already sealed .
* @ throws DuplicateFileException if a file conflicts with another already added to the APK
* at the same location inside the APK archive . */
public void addZipFile ( File zipFile ) throws ApkCreationException , SealedApkException , DuplicateFileException { } } | if ( mIsSealed ) { throw new SealedApkException ( "APK is already sealed" ) ; } try { verbosePrintln ( "%s:" , zipFile ) ; // reset the filter with this input .
mNullFilter . reset ( zipFile ) ; // ask the builder to add the content of the file .
FileInputStream fis = new FileInputStream ( zipFile ) ; mBuilder . writeZip ( fis , mNullFilter ) ; fis . close ( ) ; } catch ( DuplicateFileException e ) { mBuilder . cleanUp ( ) ; throw e ; } catch ( Exception e ) { mBuilder . cleanUp ( ) ; throw new ApkCreationException ( e , "Failed to add %s" , zipFile ) ; } |
public class SelectorRefresher { /** * Refreshable */
@ Override public void prepare ( FeatureProvider provider ) { } } | super . prepare ( provider ) ; collidable = provider . getFeature ( Collidable . class ) ; |
public class SimpleRender { /** * Prints standard information about entry .
* Example :
* < pre >
* = = = Algorithm MyAlgorithm used on problem Knapsack , settings default = = =
* CPU Time : 16 [ ms ]
* System Time : 0 [ ms ]
* User Time : 15 [ ms ]
* Clock Time : 31 [ ms ]
* Optimize counter : 28 [ - ]
* Optimize / sec ( CPU ) : 1750 [ 1 / s ]
* Optimize / sec ( Clock ) : 903 [ 1 / s ]
* Best solution : Configuration { attributes = [ 0 , 0 , 0 , 0 , 0 , 0 , 0,
* 0 , 1 , 1 , 0 , 0 , 1 , 1 , 1 ] , operationHistory = { 23 items } }
* Depth : 23 [ - ]
* Fitness : 454,0 [ - ]
* Ended without exception
* < / pre >
* @ param resultEntry result entry to be printed */
protected void printStandard ( ResultEntry resultEntry ) { } } | PreciseTimestamp start = resultEntry . getStartTimestamp ( ) ; PreciseTimestamp stop = resultEntry . getStopTimestamp ( ) ; printStream . println ( ) ; printStream . printf ( "=== Algorithm %s used on problem %s ===\n" , resultEntry . getAlgorithm ( ) , resultEntry . getProblem ( ) ) ; printStream . printf ( " CPU Time: %10d [ms]\n" , start . getCpuTimeSpent ( stop ) ) ; printStream . printf ( " System Time: %10d [ms]\n" , start . getSystemTimeSpent ( stop ) ) ; printStream . printf ( " User Time: %10d [ms]\n" , start . getUserTimeSpent ( stop ) ) ; printStream . printf ( " Clock Time: %10d [ms]\n" , start . getClockTimeSpent ( stop ) ) ; printStream . printf ( " Optimize counter: %10d [-]\n" , resultEntry . getOptimizeCounter ( ) ) ; printStream . printf ( " Optimize/sec (CPU): %10d [1/s]\n" , resultEntry . getOptimizeCounter ( ) * 1000 / start . getCpuTimeSpent ( stop ) ) ; printStream . printf ( " Optimize/sec (Clock): %10d [1/s]\n" , resultEntry . getOptimizeCounter ( ) * 1000 / start . getClockTimeSpent ( stop ) ) ; printStream . printf ( " Best solution: %10s\n" , resultEntry . getBestConfiguration ( ) ) ; if ( resultEntry . getBestConfiguration ( ) != null ) { printStream . printf ( " Depth: %10d [-]\n" , resultEntry . getBestConfiguration ( ) . getOperationHistory ( ) . getCounter ( ) ) ; printStream . printf ( " Fitness: %10.1f [-]\n" , resultEntry . getBestFitness ( ) ) ; } if ( resultEntry . getException ( ) == null ) printStream . println ( " Ended without exception" ) ; else printStream . printf ( " Ended with exception: %10s\n" , resultEntry . getException ( ) ) ; |
public class DefaultSwidProcessor { /** * Identifies the licensor of the software ( tag : software _ licensor ) .
* @ param softwareLicensorName
* software licensor name
* @ param softwareLicensorRegId
* software licensor registration ID
* @ return a reference to this object . */
public DefaultSwidProcessor setSoftwareLicensor ( final String softwareLicensorName , final String softwareLicensorRegId ) { } } | swidTag . setSoftwareLicensor ( new EntityComplexType ( new Token ( softwareLicensorName , idGenerator . nextId ( ) ) , new RegistrationId ( softwareLicensorRegId , idGenerator . nextId ( ) ) , idGenerator . nextId ( ) ) ) ; return this ; |
public class QueryAtomContainer { /** * Create a query from a molecule and a provided set of expressions . The
* molecule is converted and any features specified in the { @ code opts }
* will be matched . < br > < br >
* A good starting point is the following options :
* < pre > { @ code
* / / [ nH ] 1ccc ( = O ) cc1 = > n1 : c : c : c ( = O ) : c : c : 1
* QueryAtomContainer . create ( mol , ALIPHATIC _ ELEMENT ,
* AROMATIC _ ELEMENT ,
* SINGLE _ OR _ AROMATIC ,
* ALIPHATIC _ ORDER ,
* STEREOCHEMISTRY ) ;
* } < / pre >
* < br >
* Specifying { @ link Expr . Type # DEGREE } ( or { @ link Expr . Type # TOTAL _ DEGREE } +
* { @ link Expr . Type # IMPL _ H _ COUNT } ) means the molecule will not match as a
* substructure .
* < br >
* < pre > { @ code
* / / [ nH ] 1ccc ( = O ) cc1 = > [ nD2]1 : [ cD2 ] : [ cD2 ] : [ cD2 ] ( = [ OD1 ] ) : [ cD2 ] : [ cD2 ] : 1
* QueryAtomContainer . create ( mol , ALIPHATIC _ ELEMENT ,
* AROMATIC _ ELEMENT ,
* DEGREE ,
* SINGLE _ OR _ AROMATIC ,
* ALIPHATIC _ ORDER ) ;
* } < / pre >
* < br >
* The { @ link Expr . Type # RING _ BOND _ COUNT } property is useful for locking in
* ring systems . Specifying the ring bond count on benzene means it will
* not match larger ring systems ( e . g . naphthalenee ) but can still be
* substituted .
* < br >
* < pre > { @ code
* / / [ nH ] 1ccc ( = O ) cc1 = >
* / / [ nx2 + 0]1 : [ cx2 + 0 ] : [ cx2 + 0 ] : [ cx2 + 0 ] ( = [ O & x0 + 0 ] ) : [ cx2 + 0 ] : [ cx2 + 0 ] : 1
* / / IMPORTANT ! use Cycles . markRingAtomsAndBonds ( mol ) to set ring status
* QueryAtomContainer . create ( mol , ALIPHATIC _ ELEMENT ,
* AROMATIC _ ELEMENT ,
* FORMAL _ CHARGE ,
* ISOTOPE ,
* RING _ BOND _ COUNT ,
* SINGLE _ OR _ AROMATIC ,
* ALIPHATIC _ ORDER ) ;
* } < / pre >
* < br >
* Note that { @ link Expr . Type # FORMAL _ CHARGE } ,
* { @ link Expr . Type # IMPL _ H _ COUNT } , and { @ link Expr . Type # ISOTOPE } are ignored
* if null . Explicitly setting these to zero ( only required for Isotope from
* SMILES ) forces their inclusion .
* < br >
* < pre > { @ code
* / / [ nH ] 1ccc ( = O ) cc1 = >
* / / [ 0n + 0]1 : [ 0c + 0 ] : [ 0c + 0 ] : [ 0c + 0 ] ( = [ O + 0 ] ) : [ 0c + 0 ] : [ 0c + 0 ] : 1
* QueryAtomContainer . create ( mol , ALIPHATIC _ ELEMENT ,
* AROMATIC _ ELEMENT ,
* FORMAL _ CHARGE ,
* ISOTOPE ,
* RING _ BOND _ COUNT ,
* SINGLE _ OR _ AROMATIC ,
* ALIPHATIC _ ORDER ) ;
* } < / pre >
* Please note not all { @ link Expr . Type } s are currently supported , if you
* require a specific type that you think is useful please open an issue .
* @ param mol the molecule
* @ param opts set of the expr types to match
* @ return the query molecule */
public static QueryAtomContainer create ( IAtomContainer mol , Expr . Type ... opts ) { } } | Set < Expr . Type > optset = EnumSet . noneOf ( Expr . Type . class ) ; optset . addAll ( Arrays . asList ( opts ) ) ; QueryAtomContainer query = new QueryAtomContainer ( mol . getBuilder ( ) ) ; Map < IChemObject , IChemObject > mapping = new HashMap < > ( ) ; Map < IChemObject , IStereoElement > stereos = new HashMap < > ( ) ; for ( IStereoElement se : mol . stereoElements ( ) ) stereos . put ( se . getFocus ( ) , se ) ; List < IStereoElement > qstereo = new ArrayList < > ( ) ; for ( IAtom atom : mol . atoms ( ) ) { Expr expr = new Expr ( ) ; // isotope first
if ( optset . contains ( ISOTOPE ) && atom . getMassNumber ( ) != null ) expr . and ( new Expr ( ISOTOPE , atom . getMassNumber ( ) ) ) ; if ( atom . getAtomicNumber ( ) != null && atom . getAtomicNumber ( ) != 0 ) { if ( atom . isAromatic ( ) ) { if ( optset . contains ( AROMATIC_ELEMENT ) ) { expr . and ( new Expr ( AROMATIC_ELEMENT , atom . getAtomicNumber ( ) ) ) ; } else { if ( optset . contains ( IS_AROMATIC ) ) { if ( optset . contains ( ELEMENT ) ) expr . and ( new Expr ( AROMATIC_ELEMENT , atom . getAtomicNumber ( ) ) ) ; else expr . and ( new Expr ( Expr . Type . IS_AROMATIC ) ) ; } else if ( optset . contains ( ELEMENT ) ) { expr . and ( new Expr ( ELEMENT , atom . getAtomicNumber ( ) ) ) ; } } } else { if ( optset . contains ( ALIPHATIC_ELEMENT ) ) { expr . and ( new Expr ( ALIPHATIC_ELEMENT , atom . getAtomicNumber ( ) ) ) ; } else { if ( optset . contains ( IS_ALIPHATIC ) ) { if ( optset . contains ( ELEMENT ) ) expr . and ( new Expr ( ALIPHATIC_ELEMENT , atom . getAtomicNumber ( ) ) ) ; else expr . and ( new Expr ( Expr . Type . IS_ALIPHATIC ) ) ; } else if ( optset . contains ( ELEMENT ) ) { expr . and ( new Expr ( ELEMENT , atom . getAtomicNumber ( ) ) ) ; } } } } if ( optset . contains ( DEGREE ) ) expr . and ( new Expr ( DEGREE , atom . getBondCount ( ) ) ) ; if ( optset . contains ( TOTAL_DEGREE ) ) expr . and ( new Expr ( DEGREE , atom . getBondCount ( ) + atom . getImplicitHydrogenCount ( ) ) ) ; if ( optset . contains ( IS_IN_RING ) || optset . contains ( IS_IN_CHAIN ) ) expr . and ( new Expr ( atom . isInRing ( ) ? IS_IN_RING : IS_IN_CHAIN ) ) ; if ( optset . contains ( IMPL_H_COUNT ) ) expr . and ( new Expr ( IMPL_H_COUNT ) ) ; if ( optset . contains ( RING_BOND_COUNT ) ) { int rbonds = 0 ; for ( IBond bond : mol . getConnectedBondsList ( atom ) ) if ( bond . isInRing ( ) ) rbonds ++ ; expr . and ( new Expr ( RING_BOND_COUNT , rbonds ) ) ; } if ( optset . contains ( FORMAL_CHARGE ) && atom . getFormalCharge ( ) != null ) expr . and ( new Expr ( FORMAL_CHARGE , atom . getFormalCharge ( ) ) ) ; IStereoElement se = stereos . get ( atom ) ; if ( se != null && se . getConfigClass ( ) == IStereoElement . TH && optset . contains ( STEREOCHEMISTRY ) ) { expr . and ( new Expr ( STEREOCHEMISTRY , se . getConfigOrder ( ) ) ) ; qstereo . add ( se ) ; } QueryAtom qatom = new QueryAtom ( expr ) ; // backward compatibility for naughty methods that are expecting
// these to be set for a query !
if ( optset . contains ( Expr . Type . ELEMENT ) || optset . contains ( Expr . Type . AROMATIC_ELEMENT ) || optset . contains ( Expr . Type . ALIPHATIC_ELEMENT ) ) qatom . setSymbol ( atom . getSymbol ( ) ) ; if ( optset . contains ( Expr . Type . AROMATIC_ELEMENT ) || optset . contains ( Expr . Type . IS_AROMATIC ) ) qatom . setIsAromatic ( atom . isAromatic ( ) ) ; mapping . put ( atom , qatom ) ; query . addAtom ( qatom ) ; } for ( IBond bond : mol . bonds ( ) ) { Expr expr = new Expr ( ) ; if ( bond . isAromatic ( ) && ( optset . contains ( SINGLE_OR_AROMATIC ) || optset . contains ( DOUBLE_OR_AROMATIC ) || optset . contains ( IS_AROMATIC ) ) ) expr . and ( new Expr ( Expr . Type . IS_AROMATIC ) ) ; else if ( ( optset . contains ( SINGLE_OR_AROMATIC ) || optset . contains ( DOUBLE_OR_AROMATIC ) || optset . contains ( ALIPHATIC_ORDER ) ) && ! bond . isAromatic ( ) ) expr . and ( new Expr ( ALIPHATIC_ORDER , bond . getOrder ( ) . numeric ( ) ) ) ; else if ( bond . isAromatic ( ) && optset . contains ( IS_ALIPHATIC ) ) expr . and ( new Expr ( IS_ALIPHATIC ) ) ; else if ( optset . contains ( ORDER ) ) expr . and ( new Expr ( ORDER , bond . getOrder ( ) . numeric ( ) ) ) ; if ( optset . contains ( IS_IN_RING ) && bond . isInRing ( ) ) expr . and ( new Expr ( IS_IN_RING ) ) ; else if ( optset . contains ( IS_IN_CHAIN ) && ! bond . isInRing ( ) ) expr . and ( new Expr ( IS_IN_CHAIN ) ) ; IStereoElement se = stereos . get ( bond ) ; if ( se != null && optset . contains ( STEREOCHEMISTRY ) ) { expr . and ( new Expr ( STEREOCHEMISTRY , se . getConfigOrder ( ) ) ) ; qstereo . add ( se ) ; } QueryBond qbond = new QueryBond ( ( IAtom ) mapping . get ( bond . getBegin ( ) ) , ( IAtom ) mapping . get ( bond . getEnd ( ) ) , expr ) ; // backward compatibility for naughty methods that are expecting
// these to be set for a query !
if ( optset . contains ( Expr . Type . ALIPHATIC_ORDER ) || optset . contains ( Expr . Type . ORDER ) ) qbond . setOrder ( bond . getOrder ( ) ) ; if ( optset . contains ( Expr . Type . SINGLE_OR_AROMATIC ) || optset . contains ( Expr . Type . DOUBLE_OR_AROMATIC ) || optset . contains ( Expr . Type . IS_AROMATIC ) ) qbond . setIsAromatic ( bond . isAromatic ( ) ) ; mapping . put ( bond , qbond ) ; query . addBond ( qbond ) ; } for ( IStereoElement se : qstereo ) query . addStereoElement ( se . map ( mapping ) ) ; return query ; |
public class CalendarParsedResult { /** * Parses a string as a date . RFC 2445 allows the start and end fields to be of type DATE ( e . g . 20081021)
* or DATE - TIME ( e . g . 20081021T123000 for local time , or 20081021T123000Z for UTC ) .
* @ param when The string to parse
* @ throws ParseException if not able to parse as a date */
private static long parseDate ( String when ) throws ParseException { } } | if ( ! DATE_TIME . matcher ( when ) . matches ( ) ) { throw new ParseException ( when , 0 ) ; } if ( when . length ( ) == 8 ) { // Show only year / month / day
DateFormat format = new SimpleDateFormat ( "yyyyMMdd" , Locale . ENGLISH ) ; // For dates without a time , for purposes of interacting with Android , the resulting timestamp
// needs to be midnight of that day in GMT . See :
// http : / / code . google . com / p / android / issues / detail ? id = 8330
format . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; return format . parse ( when ) . getTime ( ) ; } // The when string can be local time , or UTC if it ends with a Z
if ( when . length ( ) == 16 && when . charAt ( 15 ) == 'Z' ) { long milliseconds = parseDateTimeString ( when . substring ( 0 , 15 ) ) ; Calendar calendar = new GregorianCalendar ( ) ; // Account for time zone difference
milliseconds += calendar . get ( Calendar . ZONE_OFFSET ) ; // Might need to correct for daylight savings time , but use target time since
// now might be in DST but not then , or vice versa
calendar . setTime ( new Date ( milliseconds ) ) ; return milliseconds + calendar . get ( Calendar . DST_OFFSET ) ; } return parseDateTimeString ( when ) ; |
public class NgramExtractor { /** * This is trying to be smart .
* It also depends on script ( alphabet less than ideographic ) .
* So I ' m not sure how good it really is . Just trying to prevent array copies . . . and for Latin it seems to work fine . */
private static int guessNumDistinctiveGrams ( int textLength , int gramLength ) { } } | switch ( gramLength ) { case 1 : return Math . min ( 80 , textLength ) ; case 2 : if ( textLength < 40 ) return textLength ; if ( textLength < 100 ) return ( int ) ( textLength * 0.8 ) ; if ( textLength < 1000 ) return ( int ) ( textLength * 0.6 ) ; return ( int ) ( textLength * 0.5 ) ; case 3 : if ( textLength < 40 ) return textLength ; if ( textLength < 100 ) return ( int ) ( textLength * 0.9 ) ; if ( textLength < 1000 ) return ( int ) ( textLength * 0.8 ) ; return ( int ) ( textLength * 0.6 ) ; case 4 : case 5 : default : if ( textLength < 100 ) return textLength ; if ( textLength < 1000 ) return ( int ) ( textLength * 0.95 ) ; return ( int ) ( textLength * 0.9 ) ; } |
public class ApiOvhDedicatedserver { /** * List the availability of dedicated server
* REST : GET / dedicated / server / availabilities
* @ param country [ required ] The subsidiary company where the availability is requested
* @ param hardware [ required ] The kind of hardware which is requested
* API beta */
public ArrayList < OvhAvailabilities > availabilities_GET ( OvhOvhSubsidiaryEnum country , String hardware ) throws IOException { } } | String qPath = "/dedicated/server/availabilities" ; StringBuilder sb = path ( qPath ) ; query ( sb , "country" , country ) ; query ( sb , "hardware" , hardware ) ; String resp = execN ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t17 ) ; |
public class InheritanceTransformer { /** * Convenience method to reuse the super constructor .
* @ param components
* @ return a non - null collection */
static Collection < AbstractType > asList ( Collection < Component > components ) { } } | Collection < AbstractType > result = new ArrayList < AbstractType > ( ) ; result . addAll ( components ) ; return result ; |
public class Wireframe { /** * Create a wire frame plot canvas .
* @ param vertices a n - by - 2 or n - by - 3 array which are coordinates of n vertices . */
public static PlotCanvas plot ( double [ ] [ ] vertices , int [ ] [ ] edges ) { } } | double [ ] lowerBound = Math . colMin ( vertices ) ; double [ ] upperBound = Math . colMax ( vertices ) ; PlotCanvas canvas = new PlotCanvas ( lowerBound , upperBound ) ; Wireframe frame = new Wireframe ( vertices , edges ) ; canvas . add ( frame ) ; return canvas ; |
public class StringUtil { /** * Note : copy rights : Google Guava .
* Returns the longest string { @ code suffix } such that
* { @ code a . toString ( ) . endsWith ( suffix ) & & b . toString ( ) . endsWith ( suffix ) } ,
* taking care not to split surrogate pairs . If { @ code a } and { @ code b } have
* no common suffix , returns the empty string . */
public static String commonSuffix ( final String a , final String b ) { } } | if ( N . isNullOrEmpty ( a ) || N . isNullOrEmpty ( b ) ) { return N . EMPTY_STRING ; } final int aLength = a . length ( ) ; final int bLength = b . length ( ) ; int maxSuffixLength = Math . min ( aLength , bLength ) ; int s = 0 ; while ( s < maxSuffixLength && a . charAt ( aLength - s - 1 ) == b . charAt ( bLength - s - 1 ) ) { s ++ ; } if ( validSurrogatePairAt ( a , aLength - s - 1 ) || validSurrogatePairAt ( b , bLength - s - 1 ) ) { s -- ; } if ( s == aLength ) { return a . toString ( ) ; } else if ( s == bLength ) { return b . toString ( ) ; } else { return a . subSequence ( aLength - s , aLength ) . toString ( ) ; } |
public class AbstractRemoteClient { /** * { @ inheritDoc }
* @ throws InterruptedException { @ inheritDoc }
* @ throws CouldNotPerformException { @ inheritDoc } */
@ Override public void activate ( final Object maintainer ) throws InterruptedException , CouldNotPerformException { } } | if ( ! isLocked ( ) || this . maintainer . equals ( maintainer ) ) { synchronized ( maintainerLock ) { unlock ( maintainer ) ; activate ( ) ; lock ( maintainer ) ; } } else { throw new VerificationFailedException ( "[" + maintainer + "] is not the current maintainer of this remote" ) ; } |
public class BtcFormat { /** * Formats a bitcoin monetary value and returns an { @ link AttributedCharacterIterator } .
* By iterating , you can examine what fields apply to each character . This can be useful
* since a character may be part of more than one field , for example a grouping separator
* that is also part of the integer field .
* @ see AttributedCharacterIterator */
@ Override public AttributedCharacterIterator formatToCharacterIterator ( Object obj ) { } } | synchronized ( numberFormat ) { DecimalFormatSymbols anteSigns = numberFormat . getDecimalFormatSymbols ( ) ; BigDecimal units = denominateAndRound ( inSatoshis ( obj ) , minimumFractionDigits , decimalGroups ) ; List < Integer > anteDigits = setFormatterDigits ( numberFormat , units . scale ( ) , units . scale ( ) ) ; AttributedCharacterIterator i = numberFormat . formatToCharacterIterator ( units ) ; numberFormat . setDecimalFormatSymbols ( anteSigns ) ; setFormatterDigits ( numberFormat , anteDigits . get ( 0 ) , anteDigits . get ( 1 ) ) ; return i ; } |
public class DeleteGatewayResponseRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteGatewayResponseRequest deleteGatewayResponseRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteGatewayResponseRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteGatewayResponseRequest . getRestApiId ( ) , RESTAPIID_BINDING ) ; protocolMarshaller . marshall ( deleteGatewayResponseRequest . getResponseType ( ) , RESPONSETYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StringUtils { /** * If both string arguments are non - null , this method concatenates them with ' and ' .
* If only one of the arguments is non - null , this method returns the non - null argument .
* If both arguments are null , this method returns null .
* @ param s1 The first string argument
* @ param s2 The second string argument
* @ return The concatenated string , or non - null argument , or null */
@ Nullable public static String concatenateWithAnd ( @ Nullable String s1 , @ Nullable String s2 ) { } } | if ( s1 != null ) { return s2 == null ? s1 : s1 + " and " + s2 ; } else { return s2 ; } |
public class AbstractEncoderProxy { /** * Creates a new instance of
* { @ link org . apache . commons . codec . EncoderException } with given
* { @ code message } and { @ code cause } .
* @ param message the message
* @ param cause the cause
* @ return a new instance of
* { @ link org . apache . commons . codec . EncoderException } */
protected static Throwable newEncoderException ( final String message , final Throwable cause ) { } } | try { return ENCODER_EXCEPTION . getConstructor ( String . class , Throwable . class ) . newInstance ( message , cause ) ; } catch ( final NoSuchMethodException nsme ) { throw new RuntimeException ( nsme ) ; } catch ( final InstantiationException ie ) { throw new RuntimeException ( ie ) ; } catch ( final IllegalAccessException iae ) { throw new RuntimeException ( iae ) ; } catch ( final InvocationTargetException ite ) { throw new RuntimeException ( ite ) ; } |
public class StreamService { /** * Dynamic streaming play method .
* The following properties are supported on the play options :
* < pre >
* streamName : String . The name of the stream to play or the new stream to switch to .
* oldStreamName : String . The name of the initial stream that needs to be switched out . This is not needed and ignored
* when play2 is used for just playing the stream and not switching to a new stream .
* start : Number . The start time of the new stream to play , just as supported by the existing play API . and it has the
* same defaults . This is ignored when the method is called for switching ( in other words , the transition
* is either NetStreamPlayTransition . SWITCH or NetStreamPlayTransitions . SWAP )
* len : Number . The duration of the playback , just as supported by the existing play API and has the same defaults .
* transition : String . The transition mode for the playback command . It could be one of the following :
* NetStreamPlayTransitions . RESET
* NetStreamPlayTransitions . APPEND
* NetStreamPlayTransitions . SWITCH
* NetStreamPlayTransitions . SWAP
* < / pre >
* NetStreamPlayTransitions :
* < pre >
* APPEND : String = " append " - Adds the stream to a playlist and begins playback with the first stream .
* APPEND _ AND _ WAIT : String = " appendAndWait " - Builds a playlist without starting to play it from the first stream .
* RESET : String = " reset " - Clears any previous play calls and plays the specified stream immediately .
* RESUME : String = " resume " - Requests data from the new connection starting from the point at which the previous connection ended .
* STOP : String = " stop " - Stops playing the streams in a playlist .
* SWAP : String = " swap " - Replaces a content stream with a different content stream and maintains the rest of the playlist .
* SWITCH : String = " switch " - Switches from playing one stream to another stream , typically with streams of the same content .
* < / pre >
* @ see < a href = " http : / / www . adobe . com / devnet / flashmediaserver / articles / dynstream _ actionscript . html " > ActionScript guide to dynamic
* streaming < / a >
* @ see < a href = " http : / / www . adobe . com / devnet / flashmediaserver / articles / dynstream _ advanced _ pt1 . html " > Dynamic streaming in Flash Media
* Server - Part 1 : Overview of the new capabilities < / a >
* @ see < a
* href = " http : / / help . adobe . com / en _ US / FlashPlatform / reference / actionscript / 3 / flash / net / NetStreamPlayTransitions . html " > NetStreamPlayTransitions < / a >
* @ param playOptions
* play options */
public void play2 ( Map < String , ? > playOptions ) { } } | log . debug ( "play2 options: {}" , playOptions . toString ( ) ) ; /* { streamName = streams / new . flv , oldStreamName = streams / old . flv ,
start = 0 , len = - 1 , offset = 12.195 , transition = switch } */
// get the transition type
String transition = ( String ) playOptions . get ( "transition" ) ; String streamName = ( String ) playOptions . get ( "streamName" ) ; String oldStreamName = ( String ) playOptions . get ( "oldStreamName" ) ; // now initiate new playback
int start = ( Integer ) playOptions . get ( "start" ) ; int length = ( Integer ) playOptions . get ( "len" ) ; // get the clients connection
IConnection conn = Red5 . getConnectionLocal ( ) ; if ( conn != null && conn instanceof IStreamCapableConnection ) { // get the stream id
Number streamId = conn . getStreamId ( ) ; IStreamCapableConnection streamConn = ( IStreamCapableConnection ) conn ; if ( "stop" . equals ( transition ) ) { play ( Boolean . FALSE ) ; } else if ( "reset" . equals ( transition ) ) { // just reset the currently playing stream
play ( streamName ) ; } else if ( "switch" . equals ( transition ) ) { try { // set the playback type
simplePlayback . set ( Boolean . FALSE ) ; // send the " start " of transition
sendNSStatus ( conn , StatusCodes . NS_PLAY_TRANSITION , String . format ( "Transitioning from %s to %s." , oldStreamName , streamName ) , streamName , streamId ) ; // support offset ?
// playOptions . get ( " offset " )
play ( streamName , start , length ) ; } finally { // clean up
simplePlayback . remove ( ) ; } } else if ( "append" . equals ( transition ) || "appendAndWait" . equals ( transition ) ) { IPlaylistSubscriberStream playlistStream = ( IPlaylistSubscriberStream ) streamConn . getStreamById ( streamId ) ; IPlayItem item = SimplePlayItem . build ( streamName ) ; playlistStream . addItem ( item ) ; if ( "append" . equals ( transition ) ) { play ( streamName , start , length , false ) ; } } else if ( "swap" . equals ( transition ) ) { IPlaylistSubscriberStream playlistStream = ( IPlaylistSubscriberStream ) streamConn . getStreamById ( streamId ) ; IPlayItem item = SimplePlayItem . build ( streamName ) ; int itemCount = playlistStream . getItemSize ( ) ; for ( int i = 0 ; i < itemCount ; i ++ ) { IPlayItem tmpItem = playlistStream . getItem ( i ) ; if ( tmpItem . getName ( ) . equals ( oldStreamName ) ) { if ( ! playlistStream . replace ( tmpItem , item ) ) { log . warn ( "Playlist item replacement failed" ) ; sendNSFailed ( streamConn , StatusCodes . NS_PLAY_FAILED , "Playlist swap failed." , streamName , streamId ) ; } break ; } } } else { log . warn ( "Unhandled transition: {}" , transition ) ; sendNSFailed ( conn , StatusCodes . NS_FAILED , "Transition type not supported" , streamName , streamId ) ; } } else { log . info ( "Connection was null ?" ) ; } |
public class RootMetricContext { /** * Add a shutwon hook that first invokes { @ link # stopReporting ( ) } and then closes the { @ link RootMetricContext } . This
* ensures all reporting started on the { @ link RootMetricContext } stops properly and any resources obtained by the
* { @ link RootMetricContext } are released . */
private void addShutdownHook ( ) { } } | Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { @ Override public void run ( ) { stopReporting ( ) ; try { close ( ) ; } catch ( IOException e ) { log . warn ( "Unable to close " + this . getClass ( ) . getCanonicalName ( ) , e ) ; } } } ) ; |
public class TypeRegistry { /** * Process some type pattern objects from the supplied value . For example the value might be
* ' com . foo . Bar , ! com . foo . Goo '
* @ param value string defining a comma separated list of type patterns
* @ return list of TypePatterns */
private List < TypePattern > getPatternsFrom ( String value ) { } } | if ( value == null ) { return Collections . emptyList ( ) ; } List < TypePattern > typePatterns = new ArrayList < TypePattern > ( ) ; StringTokenizer st = new StringTokenizer ( value , "," ) ; while ( st . hasMoreElements ( ) ) { String typepattern = st . nextToken ( ) ; TypePattern typePattern = null ; if ( typepattern . endsWith ( "..*" ) ) { typePattern = new PrefixTypePattern ( typepattern ) ; if ( GlobalConfiguration . isRuntimeLogging && log . isLoggable ( Level . INFO ) ) { log . info ( "registered package prefix '" + typepattern + "'" ) ; } } else if ( typepattern . equals ( "*" ) ) { typePattern = new AnyTypePattern ( ) ; } else { typePattern = new ExactTypePattern ( typepattern ) ; } typePatterns . add ( typePattern ) ; } return typePatterns ; |
public class ULocale { /** * < strong > [ icu ] < / strong > Returns a locale ' s script localized for display in the provided locale .
* This is a cover for the ICU4C API .
* @ param localeID the id of the locale whose script will be displayed
* @ param displayLocaleID the id of the locale in which to display the name .
* @ return the localized script name .
* @ deprecated This API is ICU internal only .
* @ hide original deprecated declaration
* @ hide draft / provisional / internal are hidden on Android */
@ Deprecated public static String getDisplayScriptInContext ( String localeID , String displayLocaleID ) { } } | return getDisplayScriptInContextInternal ( new ULocale ( localeID ) , new ULocale ( displayLocaleID ) ) ; |
public class ProjectAnalyzer { /** * Converts the given file name of a class - file to the fully - qualified class name .
* @ param fileName The file name ( e . g . a / package / AClass . class )
* @ return The fully - qualified class name ( e . g . a . package . AClass ) */
private static String toQualifiedClassName ( final String fileName ) { } } | final String replacedSeparators = fileName . replace ( File . separatorChar , '.' ) ; return replacedSeparators . substring ( 0 , replacedSeparators . length ( ) - ".class" . length ( ) ) ; |
public class StringUtils { /** * Returns true if given source string start with target string ignore case
* sensitive ; false otherwise .
* @ param source string to be tested .
* @ param target string to be tested .
* @ return true if given source string start with target string ignore case
* sensitive ; false otherwise . */
public static boolean startsWithIgnoreCase ( final String source , final String target ) { } } | if ( source . startsWith ( target ) ) { return true ; } if ( source . length ( ) < target . length ( ) ) { return false ; } return source . substring ( 0 , target . length ( ) ) . equalsIgnoreCase ( target ) ; |
public class CurveFittedDistanceCalculator { /** * Calculated the estimated distance in meters to the beacon based on a reference rssi at 1m
* and the known actual rssi at the current location
* @ param txPower
* @ param rssi
* @ return estimated distance */
@ Override public double calculateDistance ( int txPower , double rssi ) { } } | if ( rssi == 0 ) { return - 1.0 ; // if we cannot determine accuracy , return - 1.
} LogManager . d ( TAG , "calculating distance based on mRssi of %s and txPower of %s" , rssi , txPower ) ; double ratio = rssi * 1.0 / txPower ; double distance ; if ( ratio < 1.0 ) { distance = Math . pow ( ratio , 10 ) ; } else { distance = ( mCoefficient1 ) * Math . pow ( ratio , mCoefficient2 ) + mCoefficient3 ; } LogManager . d ( TAG , "avg mRssi: %s distance: %s" , rssi , distance ) ; return distance ; |
public class HttpUrl { /** * Returns the entire path of this URL encoded for use in HTTP resource resolution . The returned
* path will start with { @ code " / " } .
* < p > < table summary = " " >
* < tr > < th > URL < / th > < th > { @ code encodedPath ( ) } < / th > < / tr >
* < tr > < td > { @ code http : / / host / } < / td > < td > { @ code " / " } < / td > < / tr >
* < tr > < td > { @ code http : / / host / a / b / c } < / td > < td > { @ code " / a / b / c " } < / td > < / tr >
* < tr > < td > { @ code http : / / host / a / b % 20c / d } < / td > < td > { @ code " / a / b % 20c / d " } < / td > < / tr >
* < / table > */
public String encodedPath ( ) { } } | int pathStart = url . indexOf ( '/' , scheme . length ( ) + 3 ) ; // " : / / " . length ( ) = = 3.
int pathEnd = delimiterOffset ( url , pathStart , url . length ( ) , "?#" ) ; return url . substring ( pathStart , pathEnd ) ; |
public class DiscoveryUtils { /** * Get the ClassLoader from which implementor classes will be discovered and loaded . */
public static ClassLoader getClassLoader ( ) { } } | try { ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( cl != null ) return cl ; } catch ( SecurityException e ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( "Could not get thread context classloader." , e ) ; } } if ( _log . isTraceEnabled ( ) ) { _log . trace ( "Can't use thread context classloader; using classloader for " + DiscoveryUtils . class . getName ( ) ) ; } return DiscoveryUtils . class . getClassLoader ( ) ; |
public class StyleUtils { /** * Set the feature row style ( icon or style ) into the marker options
* @ param markerOptions marker options
* @ param featureStyleExtension feature style extension
* @ param featureRow feature row
* @ param density display density : { @ link android . util . DisplayMetrics # density }
* @ return true if icon or style was set into the marker options */
public static boolean setFeatureStyle ( MarkerOptions markerOptions , FeatureStyleExtension featureStyleExtension , FeatureRow featureRow , float density ) { } } | return setFeatureStyle ( markerOptions , featureStyleExtension , featureRow , density , null ) ; |
public class ConcurrentMultiCache { /** * Releases the specified item from the cache . If it is still in the persistent
* store , it will be retrieved back into the cache on next query . Otherwise ,
* subsequent attempts to search for it in the cache will result in < code > null < / code > .
* @ param item the item to be released from the cache . */
public void release ( T item ) { } } | HashMap < String , Object > keys = getKeys ( item ) ; synchronized ( this ) { for ( String key : order ) { ConcurrentCache < Object , T > cache = caches . get ( key ) ; cache . remove ( keys . get ( key ) ) ; } } |
public class TextUtils { /** * / * package */
static boolean doesNotNeedBidi ( char [ ] text , int start , int len ) { } } | for ( int i = start , e = i + len ; i < e ; i ++ ) { if ( text [ i ] >= FIRST_RIGHT_TO_LEFT ) { return false ; } } return true ; |
public class Links { /** * Returns the list of links having the specified link - relation type .
* If CURIs are used to shorten custom link - relation types , it is possible to either use expanded link - relation types ,
* or the CURI of the link - relation type . Using CURIs to retrieve links is not recommended , because it
* requires that the name of the CURI is known by clients .
* @ param rel the link - relation type of the retrieved link .
* @ return list of matching link
* @ see < a href = " https : / / tools . ietf . org / html / draft - kelly - json - hal - 08 # section - 8.2 " > draft - kelly - json - hal - 08 # section - 8.2 < / a >
* @ since 0.1.0 */
@ SuppressWarnings ( "unchecked" ) public List < Link > getLinksBy ( final String rel ) { } } | final String curiedRel = curies . resolve ( rel ) ; if ( this . links . containsKey ( curiedRel ) ) { final Object links = this . links . get ( curiedRel ) ; return links instanceof List ? ( List < Link > ) links : singletonList ( ( Link ) links ) ; } else { return emptyList ( ) ; } |
public class Firmata { /** * Remove a generic messageListener from the Firmata object which will stop the listener from responding to message
* received events over the SerialPort .
* @ param channel Integer channel to remove the listener from .
* @ param messageClass Class indicating the message type to listen to .
* @ param messageListener ( Generic ) MessageListener to be removed . */
public void removeMessageListener ( Integer channel , Class < ? extends Message > messageClass , MessageListener < Message > messageListener ) { } } | removeListener ( channel , messageClass , messageListener ) ; |
public class CmsSearchManager { /** * Returns < code > true < / code > if the index for the given name is a Lucene index , < code > false < / code > otherwise . < p >
* @ param indexName the name of the index to check
* @ return < code > true < / code > if the index for the given name is a Lucene index */
public static boolean isLuceneIndex ( String indexName ) { } } | I_CmsSearchIndex i = OpenCms . getSearchManager ( ) . getIndex ( indexName ) ; return ( i instanceof CmsSearchIndex ) && ( ! ( i instanceof CmsSolrIndex ) ) ; |
public class DescribeAccountAttributesResult { /** * A list of attributes assigned to an account .
* @ return A list of attributes assigned to an account . */
public java . util . List < AccountAttribute > getAccountAttributes ( ) { } } | if ( accountAttributes == null ) { accountAttributes = new com . amazonaws . internal . SdkInternalList < AccountAttribute > ( ) ; } return accountAttributes ; |
public class CreateServerRequest { /** * The IDs of subnets in which to launch the server EC2 instance .
* Amazon EC2 - Classic customers : This field is required . All servers must run within a VPC . The VPC must have
* " Auto Assign Public IP " enabled .
* EC2 - VPC customers : This field is optional . If you do not specify subnet IDs , your EC2 instances are created in a
* default subnet that is selected by Amazon EC2 . If you specify subnet IDs , the VPC must have
* " Auto Assign Public IP " enabled .
* For more information about supported Amazon EC2 platforms , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / UserGuide / ec2 - supported - platforms . html " > Supported Platforms < / a > .
* @ param subnetIds
* The IDs of subnets in which to launch the server EC2 instance . < / p >
* Amazon EC2 - Classic customers : This field is required . All servers must run within a VPC . The VPC must have
* " Auto Assign Public IP " enabled .
* EC2 - VPC customers : This field is optional . If you do not specify subnet IDs , your EC2 instances are
* created in a default subnet that is selected by Amazon EC2 . If you specify subnet IDs , the VPC must have
* " Auto Assign Public IP " enabled .
* For more information about supported Amazon EC2 platforms , see < a
* href = " https : / / docs . aws . amazon . com / AWSEC2 / latest / UserGuide / ec2 - supported - platforms . html " > Supported
* Platforms < / a > . */
public void setSubnetIds ( java . util . Collection < String > subnetIds ) { } } | if ( subnetIds == null ) { this . subnetIds = null ; return ; } this . subnetIds = new java . util . ArrayList < String > ( subnetIds ) ; |
public class FstInputOutput { /** * Deserializes a symbol map from an java . io . ObjectInput
* @ param in the java . io . ObjectInput . It should be already be initialized by the caller .
* @ return the deserialized symbol map */
public static MutableSymbolTable readStringMap ( ObjectInput in ) throws IOException , ClassNotFoundException { } } | int mapSize = in . readInt ( ) ; MutableSymbolTable syms = new MutableSymbolTable ( ) ; for ( int i = 0 ; i < mapSize ; i ++ ) { String sym = in . readUTF ( ) ; int index = in . readInt ( ) ; syms . put ( sym , index ) ; } return syms ; |
public class AmqpConfiguration { /** * Create AMQP handler service bean .
* @ param rabbitTemplate
* for converting messages
* @ param amqpMessageDispatcherService
* to sending events to DMF client
* @ param controllerManagement
* for target repo access
* @ param entityFactory
* to create entities
* @ return handler service bean */
@ Bean public AmqpMessageHandlerService amqpMessageHandlerService ( final RabbitTemplate rabbitTemplate , final AmqpMessageDispatcherService amqpMessageDispatcherService , final ControllerManagement controllerManagement , final EntityFactory entityFactory ) { } } | return new AmqpMessageHandlerService ( rabbitTemplate , amqpMessageDispatcherService , controllerManagement , entityFactory ) ; |
public class NumberFormatterBase { /** * Format a unit value . */
public void formatUnit ( UnitValue value , StringBuilder destination , UnitFormatOptions options ) { } } | BigDecimal n = value . amount ( ) ; boolean grouping = orDefault ( options . grouping ( ) , false ) ; NumberFormatContext ctx = new NumberFormatContext ( options , NumberFormatMode . DEFAULT ) ; NumberPattern numberPattern = select ( n , unitStandard ) ; ctx . set ( numberPattern ) ; BigDecimal q = ctx . adjust ( n ) ; NumberOperands operands = new NumberOperands ( q . toPlainString ( ) ) ; PluralCategory category = PLURAL_RULES . evalCardinal ( bundleId . language ( ) , operands ) ; Unit unit = value . unit ( ) ; List < FieldPattern . Node > unitPattern = null ; // We allow unit to be null to accomodate the caller as a last resort .
// If the unit is not available we still format a number .
if ( unit != null ) { switch ( options . format ( ) ) { case LONG : unitPattern = getPattern_UNITS_LONG ( unit , category ) ; break ; case NARROW : unitPattern = getPattern_UNITS_NARROW ( unit , category ) ; break ; case SHORT : default : unitPattern = getPattern_UNITS_SHORT ( unit , category ) ; break ; } } DigitBuffer number = new DigitBuffer ( ) ; NumberFormattingUtils . format ( q , number , params , false , grouping , ctx . minIntDigits ( ) , numberPattern . format . primaryGroupingSize ( ) , numberPattern . format . secondaryGroupingSize ( ) ) ; if ( unitPattern == null ) { number . appendTo ( destination ) ; } else { DigitBuffer dbuf = new DigitBuffer ( ) ; for ( FieldPattern . Node node : unitPattern ) { if ( node instanceof FieldPattern . Text ) { dbuf . append ( ( ( FieldPattern . Text ) node ) . text ( ) ) ; } else if ( node instanceof Field ) { Field field = ( Field ) node ; if ( field . ch ( ) == '0' ) { format ( numberPattern , number , dbuf , null , null ) ; } } } dbuf . appendTo ( destination ) ; } |
public class PathImpl { /** * Returns true for windows security issues . */
public boolean isWindowsInsecure ( ) { } } | String lower = getPath ( ) . toLowerCase ( Locale . ENGLISH ) ; int lastCh ; if ( ( lastCh = lower . charAt ( lower . length ( ) - 1 ) ) == '.' || lastCh == ' ' || lastCh == '*' || lastCh == '?' || ( ( lastCh == '/' || lastCh == '\\' ) && ! isDirectory ( ) ) || lower . endsWith ( "::$data" ) || isWindowsSpecial ( lower , "/con" ) || isWindowsSpecial ( lower , "/aux" ) || isWindowsSpecial ( lower , "/prn" ) || isWindowsSpecial ( lower , "/nul" ) || isWindowsSpecial ( lower , "/com1" ) || isWindowsSpecial ( lower , "/com2" ) || isWindowsSpecial ( lower , "/com3" ) || isWindowsSpecial ( lower , "/com4" ) || isWindowsSpecial ( lower , "/lpt1" ) || isWindowsSpecial ( lower , "/lpt2" ) || isWindowsSpecial ( lower , "/lpt3" ) ) { return true ; } return false ; |
public class AnycastOutputHandler { /** * Callback when the Item that records that flush has been started has been committed to persistent storage
* @ param stream The stream making this call
* @ param startedFlushItem The item written */
public final void writtenStartedFlush ( AOStream stream , Item startedFlushItem ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "writtenStartedFlush" ) ; String key = SIMPUtils . getRemoteGetKey ( stream . getRemoteMEUuid ( ) , stream . getGatheringTargetDestUuid ( ) ) ; StreamInfo sinfo = streamTable . get ( key ) ; if ( ( sinfo != null ) && sinfo . streamId . equals ( stream . streamId ) ) { synchronized ( sinfo ) { sinfo . item = ( AOStartedFlushItem ) startedFlushItem ; } } else { // this should not occur
// log error and throw exception
SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:2858:1.89.4.1" } , null ) ) ; // FFDC
FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writtenStartedFlush" , "1:2865:1.89.4.1" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.AnycastOutputHandler" , "1:2872:1.89.4.1" } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writtenStartedFlush" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writtenStartedFlush" ) ; |
public class Polarizability { /** * calculate effective atom polarizability .
* @ param atomContainer IAtomContainer
* @ param atom atom for which effective atom polarizability should be calculated
* @ param addExplicitH if set to true , then explicit H ' s will be added , otherwise it assumes that they have
* been added to the molecule before being called
* @ param distanceMatrix an n x n matrix of topological distances between all the atoms in the molecule .
* if this argument is non - null , then BFS will not be used and instead path lengths will be looked up . This
* form of the method is useful , if it is being called for multiple atoms in the same molecule
* @ return polarizabilitiy */
public double calculateGHEffectiveAtomPolarizability ( IAtomContainer atomContainer , IAtom atom , boolean addExplicitH , int [ ] [ ] distanceMatrix ) { } } | double polarizabilitiy = 0 ; IAtomContainer acH ; if ( addExplicitH ) { acH = atomContainer . getBuilder ( ) . newInstance ( IAtomContainer . class , atomContainer ) ; addExplicitHydrogens ( acH ) ; } else { acH = atomContainer ; } double bond ; polarizabilitiy += getKJPolarizabilityFactor ( acH , atom ) ; for ( int i = 0 ; i < acH . getAtomCount ( ) ; i ++ ) { if ( ! acH . getAtom ( i ) . equals ( atom ) ) { int atomIndex = atomContainer . indexOf ( atom ) ; bond = distanceMatrix [ atomIndex ] [ i ] ; if ( bond == 1 ) { polarizabilitiy += getKJPolarizabilityFactor ( acH , acH . getAtom ( i ) ) ; } else { polarizabilitiy += ( Math . pow ( 0.5 , bond - 1 ) * getKJPolarizabilityFactor ( acH , acH . getAtom ( i ) ) ) ; } // if bond = = 0
} // if ! = atom
} // for
return polarizabilitiy ; |
public class IfcOrganizationImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcPersonAndOrganization > getEngages ( ) { } } | return ( EList < IfcPersonAndOrganization > ) eGet ( Ifc2x3tc1Package . Literals . IFC_ORGANIZATION__ENGAGES , true ) ; |
public class MiniSatBackbone { /** * Tests the given literal whether it is unit in the given clause .
* @ param lit literal to test
* @ param clause clause containing the literal
* @ return { @ code true } if the literal is unit , { @ code false } otherwise */
private boolean isUnit ( final int lit , final MSClause clause ) { } } | for ( int i = 0 ; i < clause . size ( ) ; ++ i ) { final int clauseLit = clause . get ( i ) ; if ( lit != clauseLit && this . model . get ( var ( clauseLit ) ) != sign ( clauseLit ) ) { return false ; } } return true ; |
public class EmojiParser { /** * Returns end index of a unicode emoji if it is found in text starting at
* index startPos , - 1 if not found .
* This returns the longest matching emoji , for example , in
* " \ uD83D \ uDC68 \ u200D \ uD83D \ uDC69 \ u200D \ uD83D \ uDC66"
* it will find alias : family _ man _ woman _ boy , NOT alias : man
* @ param text the current text where we are looking for an emoji
* @ param startPos the position in the text where we should start looking for
* an emoji end
* @ return the end index of the unicode emoji starting at startPos . - 1 if not
* found */
protected static int getEmojiEndPos ( char [ ] text , int startPos ) { } } | int best = - 1 ; for ( int j = startPos + 1 ; j <= text . length ; j ++ ) { EmojiTrie . Matches status = EmojiManager . isEmoji ( Arrays . copyOfRange ( text , startPos , j ) ) ; if ( status . exactMatch ( ) ) { best = j ; } else if ( status . impossibleMatch ( ) ) { return best ; } } return best ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.