signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ImageLoader { /** * Adds load image task to execution pool . Image will be returned with * { @ link ImageLoadingListener # onLoadingComplete ( String , android . view . View , android . graphics . Bitmap ) } callback } . * < br / > * < b > NOTE : < / b > { @ link # init ( ImageLoaderConfiguration ) } method must be called before this method call * @ param uri Image URI ( i . e . " http : / / site . com / image . png " , " file : / / / mnt / sdcard / image . png " ) * @ param targetImageSize Minimal size for { @ link Bitmap } which will be returned in * { @ linkplain ImageLoadingListener # onLoadingComplete ( String , android . view . View , * android . graphics . Bitmap ) } callback } . Downloaded image will be decoded * and scaled to { @ link Bitmap } of the size which is < b > equal or larger < / b > ( usually a bit * larger ) than incoming targetImageSize . * @ param listener { @ linkplain ImageLoadingListener Listener } for image loading process . Listener fires * events on UI thread if this method is called on UI thread . * @ throws IllegalStateException if { @ link # init ( ImageLoaderConfiguration ) } method wasn ' t called before */ public void loadImage ( String uri , ImageSize targetImageSize , ImageLoadingListener listener ) { } }
loadImage ( uri , targetImageSize , null , listener , null ) ;
public class MessageBatcher { /** * Processes the messages sent to the batcher . This method just writes the * message to the queue and returns immediately . If the queue is full , the * messages are dropped immediately and corresponding counter is * incremented . * @ param message * - The messages to be processed */ public void process ( List < T > objects ) { } }
for ( T message : objects ) { // If this batcher has been shutdown , do not accept any more // messages if ( isShutDown ) { return ; } process ( message ) ; }
public class AttrPolling { /** * Creates a new attribute instance from the provided String . * @ param str string representation of the attribute * @ return instance of the attribute for the specified string , or * { @ code null } if input string is { @ code null } * @ throws BOSHException on parse or validation failure */ static AttrPolling createFromString ( final String str ) throws BOSHException { } }
if ( str == null ) { return null ; } else { return new AttrPolling ( str ) ; }
public class HprofHeap { /** * ~ Methods - - - - - */ public List < JavaClass > getAllClasses ( ) { } }
ClassDumpSegment classDumpBounds ; if ( heapDumpSegment == null ) { return Collections . emptyList ( ) ; } classDumpBounds = getClassDumpSegment ( ) ; if ( classDumpBounds == null ) { return Collections . emptyList ( ) ; } return classDumpBounds . createClassCollection ( ) ;
public class AuthManager { /** * Used to determine if a user is logged in localy , if not remote operations can not be performed . * @ return authentication token for logged in user . * @ throws RuntimeException Execption thrown if if remote operaton is requested but no user is logged in . */ private String isLoggedIn ( ) throws RuntimeException { } }
if ( this . getUser ( ) != null && this . getUser ( ) . getAuthToken ( ) != null ) { return "CUSTOM " + this . getUser ( ) . getAuthToken ( ) ; } else { throw new RuntimeException ( "User state error." ) ; }
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcDraughtingCalloutRelationship ( ) { } }
if ( ifcDraughtingCalloutRelationshipEClass == null ) { ifcDraughtingCalloutRelationshipEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 175 ) ; } return ifcDraughtingCalloutRelationshipEClass ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcPointOnSurface ( ) { } }
if ( ifcPointOnSurfaceEClass == null ) { ifcPointOnSurfaceEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 433 ) ; } return ifcPointOnSurfaceEClass ;
public class BasicStreamReader { /** * Method called to parse through most of DOCTYPE declaration ; excluding * optional internal subset . */ private void startDTD ( ) throws XMLStreamException { } }
/* 21 - Nov - 2004 , TSa : Let ' s make sure that the buffer gets cleared * at this point . Need not start branching yet , however , since * DTD event is often skipped . */ mTextBuffer . resetInitialized ( ) ; /* So , what we need is : < code > * < ! DOCTYPE ' S Name ( S ExternalID ) ? S ? ( ' [ ' intSubset ' ] ' S ? ) ? ' > * < / code > . And we have already read the DOCTYPE token . */ char c = getNextInCurrAfterWS ( SUFFIX_IN_DTD ) ; if ( mCfgNsEnabled ) { String str = parseLocalName ( c ) ; c = getNextChar ( SUFFIX_IN_DTD ) ; if ( c == ':' ) { // Ok , got namespace and local name mRootPrefix = str ; mRootLName = parseLocalName ( getNextChar ( SUFFIX_EOF_EXP_NAME ) ) ; } else if ( c <= CHAR_SPACE || c == '[' || c == '>' ) { // ok to get white space or ' [ ' , or closing ' > ' -- mInputPtr ; // pushback mRootPrefix = null ; mRootLName = str ; } else { throwUnexpectedChar ( c , " in DOCTYPE declaration; expected '[' or white space." ) ; } } else { mRootLName = parseFullName ( c ) ; mRootPrefix = null ; } // Ok , fine , what next ? c = getNextInCurrAfterWS ( SUFFIX_IN_DTD ) ; if ( c != '[' && c != '>' ) { String keyw = null ; if ( c == 'P' ) { keyw = checkKeyword ( getNextChar ( SUFFIX_IN_DTD ) , "UBLIC" ) ; if ( keyw != null ) { keyw = "P" + keyw ; } else { if ( ! skipWS ( getNextChar ( SUFFIX_IN_DTD ) ) ) { throwUnexpectedChar ( c , SUFFIX_IN_DTD + "; expected a space between PUBLIC keyword and public id" ) ; } c = getNextCharFromCurrent ( SUFFIX_IN_DTD ) ; if ( c != '"' && c != '\'' ) { throwUnexpectedChar ( c , SUFFIX_IN_DTD + "; expected a public identifier." ) ; } mDtdPublicId = parsePublicId ( c , SUFFIX_IN_DTD ) ; if ( mDtdPublicId . length ( ) == 0 ) { // According to XML specs , this isn ' t illegal ? // however , better report it as empty , not null . // mDtdPublicId = null ; } if ( ! skipWS ( getNextChar ( SUFFIX_IN_DTD ) ) ) { throwUnexpectedChar ( c , SUFFIX_IN_DTD + "; expected a space between public and system identifiers" ) ; } c = getNextCharFromCurrent ( SUFFIX_IN_DTD ) ; if ( c != '"' && c != '\'' ) { throwParseError ( SUFFIX_IN_DTD + "; expected a system identifier." ) ; } mDtdSystemId = parseSystemId ( c , mNormalizeLFs , SUFFIX_IN_DTD ) ; if ( mDtdSystemId . length ( ) == 0 ) { // According to XML specs , this isn ' t illegal ? // however , better report it as empty , not null . // mDtdSystemId = null ; } } } else if ( c == 'S' ) { mDtdPublicId = null ; keyw = checkKeyword ( getNextChar ( SUFFIX_IN_DTD ) , "YSTEM" ) ; if ( keyw != null ) { keyw = "S" + keyw ; } else { c = getNextInCurrAfterWS ( SUFFIX_IN_DTD ) ; if ( c != '"' && c != '\'' ) { throwUnexpectedChar ( c , SUFFIX_IN_DTD + "; expected a system identifier." ) ; } mDtdSystemId = parseSystemId ( c , mNormalizeLFs , SUFFIX_IN_DTD ) ; if ( mDtdSystemId . length ( ) == 0 ) { // According to XML specs , this isn ' t illegal ? mDtdSystemId = null ; } } } else { if ( ! isNameStartChar ( c ) ) { throwUnexpectedChar ( c , SUFFIX_IN_DTD + "; expected keywords 'PUBLIC' or 'SYSTEM'." ) ; } else { -- mInputPtr ; keyw = checkKeyword ( c , "SYSTEM" ) ; // keyword passed in doesn ' t matter } } if ( keyw != null ) { // error : throwParseError ( "Unexpected keyword '" + keyw + "'; expected 'PUBLIC' or 'SYSTEM'" ) ; } // Ok , should be done with external DTD identifier : c = getNextInCurrAfterWS ( SUFFIX_IN_DTD ) ; } if ( c == '[' ) { // internal subset ; } else { if ( c != '>' ) { throwUnexpectedChar ( c , SUFFIX_IN_DTD + "; expected closing '>'." ) ; } } /* Actually , let ' s just push whatever char it is , back ; this way * we can lazily initialize text buffer with DOCTYPE declaration * if / as necessary , even if there ' s no internal subset . */ -- mInputPtr ; // pushback mTokenState = TOKEN_STARTED ;
public class WebSocketServerHandshakeHandler { /** * Check the basic headers needed for WebSocket upgrade are contained in the request . * @ param httpRequest { @ link HttpRequest } which is checked for WebSocket upgrade . * @ return true if basic headers needed for WebSocket upgrade are contained in the request . */ private boolean containsUpgradeHeaders ( HttpRequest httpRequest ) { } }
HttpHeaders headers = httpRequest . headers ( ) ; return headers . containsValue ( HttpHeaderNames . CONNECTION , HttpHeaderValues . UPGRADE , true ) && headers . containsValue ( HttpHeaderNames . UPGRADE , HttpHeaderValues . WEBSOCKET , true ) ;
public class MailService { /** * Sends to a mailbox */ public void sendWithAttachment ( String subject , String textBody , String attachmentType , String attachmentName , InputStream is ) { } }
try { MimeMessage msg = new MimeMessage ( getSession ( ) ) ; if ( _from . length > 0 ) msg . addFrom ( _from ) ; msg . addRecipients ( RecipientType . TO , _to ) ; if ( subject != null ) msg . setSubject ( subject ) ; // msg . setContent ( textBody , " multipart / mime " ) ; MimeMultipart multipart = new MimeMultipart ( ) ; MimeBodyPart textBodyPart = new MimeBodyPart ( ) ; textBodyPart . setText ( textBody ) ; multipart . addBodyPart ( textBodyPart ) ; ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; TempBuffer tb = TempBuffer . create ( ) ; byte [ ] buffer = tb . buffer ( ) ; int len ; while ( ( len = is . read ( buffer , 0 , buffer . length ) ) >= 0 ) { bos . write ( buffer , 0 , len ) ; } bos . close ( ) ; byte [ ] content = bos . toByteArray ( ) ; TempBuffer . free ( tb ) ; DataSource dataSource = new ByteArrayDataSource ( content , attachmentType ) ; MimeBodyPart pdfBodyPart = new MimeBodyPart ( ) ; pdfBodyPart . setDataHandler ( new DataHandler ( dataSource ) ) ; pdfBodyPart . setFileName ( attachmentName ) ; multipart . addBodyPart ( pdfBodyPart ) ; msg . setContent ( multipart ) ; send ( msg ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class Attachment { /** * Creates an attachment from a given array of bytes . * The bytes will be Base64 encoded . * @ throws java . lang . IllegalArgumentException if mediaType is not binary */ public static Attachment fromBinaryBytes ( byte [ ] bytes , MediaType mediaType ) { } }
if ( ! mediaType . isBinary ( ) ) { throw new IllegalArgumentException ( "MediaType must be binary" ) ; } return new Attachment ( BaseEncoding . base64 ( ) . encode ( bytes ) , mediaType , null ) ;
public class HttpClientNIOResourceAdaptor { /** * ( non - Javadoc ) * @ see javax . slee . resource . ResourceAdaptor # raConfigure ( javax . slee . resource . * ConfigProperties ) */ @ SuppressWarnings ( "unchecked" ) public void raConfigure ( ConfigProperties properties ) { } }
String httpClientFactoryClassName = ( String ) properties . getProperty ( CFG_PROPERTY_HTTP_CLIENT_FACTORY ) . getValue ( ) ; if ( ! httpClientFactoryClassName . isEmpty ( ) ) { try { httpClientFactory = ( ( Class < ? extends HttpAsyncClientFactory > ) Class . forName ( httpClientFactoryClassName ) ) . newInstance ( ) ; } catch ( Exception e ) { tracer . severe ( "failed to load http client factory class" , e ) ; } } else { this . maxTotal = ( Integer ) properties . getProperty ( CFG_PROPERTY_MAX_CONNECTIONS_TOTAL ) . getValue ( ) ; this . defaultMaxPerRoute = ( Integer ) properties . getProperty ( CFG_PROPERTY_DEFAULT_MAX_CONNECTIONS_PER_ROUTE ) . getValue ( ) ; this . connectTimeout = ( Integer ) properties . getProperty ( CFG_PROPERTY_DEFAULT_CONNECT_TIMEOUT ) . getValue ( ) ; this . socketTimeout = ( Integer ) properties . getProperty ( CFG_PROPERTY_DEFAULT_SOCKET_TIMEOUT ) . getValue ( ) ; }
public class ToStream { /** * If available , when the disable - output - escaping attribute is used , * output raw text without escaping . * @ param ch The characters from the XML document . * @ param start The start position in the array . * @ param length The number of characters to read from the array . * @ throws org . xml . sax . SAXException */ protected void charactersRaw ( char ch [ ] , int start , int length ) throws org . xml . sax . SAXException { } }
if ( m_inEntityRef ) return ; try { if ( m_elemContext . m_startTagOpen ) { closeStartTag ( ) ; m_elemContext . m_startTagOpen = false ; } m_ispreserve = true ; m_writer . write ( ch , start , length ) ; } catch ( IOException e ) { throw new SAXException ( e ) ; }
public class StreamSegmentReadIndex { /** * Returns a CacheReadResultEntry that matches the specified search parameters , but only if the data is readily available * in the cache and if there is an index entry that starts at that location . . As opposed from getSingleReadResultEntry ( ) , * this method will return null if the requested data is not available . * @ param resultStartOffset The Offset within the StreamSegment where to start returning data from . * @ param maxLength The maximum number of bytes to return . * @ return A CacheReadResultEntry representing the data to return . */ private CacheReadResultEntry getSingleMemoryReadResultEntry ( long resultStartOffset , int maxLength ) { } }
Exceptions . checkNotClosed ( this . closed , this ) ; if ( maxLength > 0 && checkReadAvailability ( resultStartOffset , false ) == ReadAvailability . Available ) { // Look up an entry in the index that contains our requested start offset . synchronized ( this . lock ) { ReadIndexEntry indexEntry = this . indexEntries . get ( resultStartOffset ) ; if ( indexEntry != null && indexEntry . isDataEntry ( ) ) { // We found an entry ; return a result for it . return createMemoryRead ( indexEntry , resultStartOffset , maxLength , true ) ; } } } // Nothing could be found in the cache at the given offset . return null ;
public class Trie2Writable { /** * / * Compact the data and then populate an optimized read - only Trie . */ private void freeze ( Trie2 dest , ValueWidth valueBits ) { } }
int i ; int allIndexesLength ; int dataMove ; /* > 0 if the data is moved to the end of the index array */ /* compact if necessary */ if ( ! isCompacted ) { compactTrie ( ) ; } if ( highStart <= 0x10000 ) { allIndexesLength = UTRIE2_INDEX_1_OFFSET ; } else { allIndexesLength = index2Length ; } if ( valueBits == ValueWidth . BITS_16 ) { dataMove = allIndexesLength ; } else { dataMove = 0 ; } /* are indexLength and dataLength within limits ? */ if ( /* for unshifted indexLength */ allIndexesLength > UTRIE2_MAX_INDEX_LENGTH || /* for unshifted dataNullOffset */ ( dataMove + dataNullOffset ) > 0xffff || /* for unshifted 2 - byte UTF - 8 index - 2 values */ ( dataMove + UNEWTRIE2_DATA_0800_OFFSET ) > 0xffff || /* for shiftedDataLength */ ( dataMove + dataLength ) > UTRIE2_MAX_DATA_LENGTH ) { throw new UnsupportedOperationException ( "Trie2 data is too large." ) ; } /* calculate the sizes of , and allocate , the index and data arrays */ int indexLength = allIndexesLength ; if ( valueBits == ValueWidth . BITS_16 ) { indexLength += dataLength ; } else { dest . data32 = new int [ dataLength ] ; } dest . index = new char [ indexLength ] ; dest . indexLength = allIndexesLength ; dest . dataLength = dataLength ; if ( highStart <= 0x10000 ) { dest . index2NullOffset = 0xffff ; } else { dest . index2NullOffset = UTRIE2_INDEX_2_OFFSET + index2NullOffset ; } dest . initialValue = initialValue ; dest . errorValue = errorValue ; dest . highStart = highStart ; dest . highValueIndex = dataMove + dataLength - UTRIE2_DATA_GRANULARITY ; dest . dataNullOffset = ( dataMove + dataNullOffset ) ; // Create a header and set the its fields . // ( This is only used in the event that we serialize the Trie , but is // convenient to do here . ) dest . header = new Trie2 . UTrie2Header ( ) ; dest . header . signature = 0x54726932 ; /* " Tri2" */ dest . header . options = valueBits == ValueWidth . BITS_16 ? 0 : 1 ; dest . header . indexLength = dest . indexLength ; dest . header . shiftedDataLength = dest . dataLength >> UTRIE2_INDEX_SHIFT ; dest . header . index2NullOffset = dest . index2NullOffset ; dest . header . dataNullOffset = dest . dataNullOffset ; dest . header . shiftedHighStart = dest . highStart >> UTRIE2_SHIFT_1 ; /* write the index - 2 array values shifted right by UTRIE2 _ INDEX _ SHIFT , after adding dataMove */ int destIdx = 0 ; for ( i = 0 ; i < UTRIE2_INDEX_2_BMP_LENGTH ; i ++ ) { dest . index [ destIdx ++ ] = ( char ) ( ( index2 [ i ] + dataMove ) >> UTRIE2_INDEX_SHIFT ) ; } if ( UTRIE2_DEBUG ) { System . out . println ( "\n\nIndex2 for BMP limit is " + Integer . toHexString ( destIdx ) ) ; } /* write UTF - 8 2 - byte index - 2 values , not right - shifted */ for ( i = 0 ; i < ( 0xc2 - 0xc0 ) ; ++ i ) { /* C0 . . C1 */ dest . index [ destIdx ++ ] = ( char ) ( dataMove + UTRIE2_BAD_UTF8_DATA_OFFSET ) ; } for ( ; i < ( 0xe0 - 0xc0 ) ; ++ i ) { /* C2 . . DF */ dest . index [ destIdx ++ ] = ( char ) ( dataMove + index2 [ i << ( 6 - UTRIE2_SHIFT_2 ) ] ) ; } if ( UTRIE2_DEBUG ) { System . out . println ( "Index2 for UTF-8 2byte values limit is " + Integer . toHexString ( destIdx ) ) ; } if ( highStart > 0x10000 ) { int index1Length = ( highStart - 0x10000 ) >> UTRIE2_SHIFT_1 ; int index2Offset = UTRIE2_INDEX_2_BMP_LENGTH + UTRIE2_UTF8_2B_INDEX_2_LENGTH + index1Length ; /* write 16 - bit index - 1 values for supplementary code points */ // p = ( uint32 _ t * ) newTrie - > index1 + UTRIE2 _ OMITTED _ BMP _ INDEX _ 1 _ LENGTH ; for ( i = 0 ; i < index1Length ; i ++ ) { // * dest16 + + = ( uint16 _ t ) ( UTRIE2 _ INDEX _ 2 _ OFFSET + * p + + ) ; dest . index [ destIdx ++ ] = ( char ) ( UTRIE2_INDEX_2_OFFSET + index1 [ i + UTRIE2_OMITTED_BMP_INDEX_1_LENGTH ] ) ; } if ( UTRIE2_DEBUG ) { System . out . println ( "Index 1 for supplementals, limit is " + Integer . toHexString ( destIdx ) ) ; } /* * write the index - 2 array values for supplementary code points , * shifted right by UTRIE2 _ INDEX _ SHIFT , after adding dataMove */ for ( i = 0 ; i < index2Length - index2Offset ; i ++ ) { dest . index [ destIdx ++ ] = ( char ) ( ( dataMove + index2 [ index2Offset + i ] ) >> UTRIE2_INDEX_SHIFT ) ; } if ( UTRIE2_DEBUG ) { System . out . println ( "Index 2 for supplementals, limit is " + Integer . toHexString ( destIdx ) ) ; } } /* write the 16/32 - bit data array */ switch ( valueBits ) { case BITS_16 : /* write 16 - bit data values */ assert ( destIdx == dataMove ) ; dest . data16 = destIdx ; for ( i = 0 ; i < dataLength ; i ++ ) { dest . index [ destIdx ++ ] = ( char ) data [ i ] ; } break ; case BITS_32 : /* write 32 - bit data values */ for ( i = 0 ; i < dataLength ; i ++ ) { dest . data32 [ i ] = this . data [ i ] ; } break ; } // The writable , but compressed , Trie2 stays around unless the caller drops its references to it .
public class FctBnAccEntitiesProcessors { /** * < p > Get PrcPurchaseReturnLineCreate ( create and put into map ) . < / p > * @ param pAddParam additional param * @ return requested PrcPurchaseReturnLineCreate * @ throws Exception - an exception */ protected final PrcPurchaseReturnLineCreate < RS > lazyGetPrcPurchaseReturnLineCreate ( final Map < String , Object > pAddParam ) throws Exception { } }
@ SuppressWarnings ( "unchecked" ) PrcPurchaseReturnLineCreate < RS > proc = ( PrcPurchaseReturnLineCreate < RS > ) this . processorsMap . get ( PrcPurchaseReturnLineCreate . class . getSimpleName ( ) ) ; if ( proc == null ) { proc = new PrcPurchaseReturnLineCreate < RS > ( ) ; @ SuppressWarnings ( "unchecked" ) PrcEntityCreate < RS , PurchaseReturnLine , Long > procDlg = ( PrcEntityCreate < RS , PurchaseReturnLine , Long > ) this . fctBnEntitiesProcessors . lazyGet ( pAddParam , PrcEntityCreate . class . getSimpleName ( ) ) ; proc . setPrcEntityCreate ( procDlg ) ; // assigning fully initialized object : this . processorsMap . put ( PrcPurchaseReturnLineCreate . class . getSimpleName ( ) , proc ) ; } return proc ;
public class MemorySize { /** * Parses string representation of a memory size value . * Value may end with one of suffixes ; * < ul > * < li > ' k ' or ' K ' for ' kilo ' , < / li > * < li > ' m ' or ' M ' for ' mega ' , < / li > * < li > ' g ' or ' G ' for ' giga ' . < / li > * < / ul > * Uses default unit if value does not contain unit information . * Examples : * 12345 , 12345m , 12345K , 123456G */ public static MemorySize parse ( String value , MemoryUnit defaultUnit ) { } }
if ( value == null || value . length ( ) == 0 ) { return new MemorySize ( 0 , MemoryUnit . BYTES ) ; } MemoryUnit unit = defaultUnit ; final char last = value . charAt ( value . length ( ) - 1 ) ; if ( ! Character . isDigit ( last ) ) { value = value . substring ( 0 , value . length ( ) - 1 ) ; switch ( last ) { case 'g' : case 'G' : unit = MemoryUnit . GIGABYTES ; break ; case 'm' : case 'M' : unit = MemoryUnit . MEGABYTES ; break ; case 'k' : case 'K' : unit = MemoryUnit . KILOBYTES ; break ; default : throw new IllegalArgumentException ( "Could not determine memory unit of " + value + last ) ; } } return new MemorySize ( Long . parseLong ( value ) , unit ) ;
public class WorkspacesInner { /** * Creates a Workspace . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param workspaceName The name of the workspace . Workspace names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long . * @ param parameters Workspace creation parameters . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < WorkspaceInner > createAsync ( String resourceGroupName , String workspaceName , WorkspaceCreateParameters parameters ) { } }
return createWithServiceResponseAsync ( resourceGroupName , workspaceName , parameters ) . map ( new Func1 < ServiceResponse < WorkspaceInner > , WorkspaceInner > ( ) { @ Override public WorkspaceInner call ( ServiceResponse < WorkspaceInner > response ) { return response . body ( ) ; } } ) ;
public class RoadNetworkLayerConstants { /** * Replies the color of the internal data structures used when they * are drawn on the displayers . * @ return the color of the internal data structures , never < code > null < / code > . */ @ Pure public static int getPreferredRoadInternColor ( ) { } }
final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkLayerConstants . class ) ; if ( prefs != null ) { final String color = prefs . get ( "ROAD_INTERN_COLOR" , null ) ; // $ NON - NLS - 1 $ if ( color != null ) { try { return Integer . valueOf ( color ) ; } catch ( Throwable exception ) { } } } return DEFAULT_ROAD_INTERN_COLOR ;
public class MetaDataServiceImpl { /** * Retrieves EntityType , bypassing the { @ link * org . molgenis . data . meta . system . SystemEntityTypeRegistry } * < p > package - private for testability */ EntityType getEntityTypeBypassingRegistry ( String entityTypeId ) { } }
return entityTypeId != null ? dataService . findOneById ( ENTITY_TYPE_META_DATA , entityTypeId , getEntityTypeFetch ( ) , EntityType . class ) : null ;
public class SearchHelper { /** * Set up an exists filter for attribute name . Consider the following example . * < table border = " 1 " > < caption > Example Values < / caption > * < tr > < td > < b > Value < / b > < / td > < / tr > * < tr > < td > givenName < / td > < / tr > * < tr > < td > sn < / td > < / tr > * < / table > * < p > < i > Result < / i > < / p > * < code > ( & amp ; ( givenName = * ) ( sn = * ) ) < / code > * @ param attributeNames A valid set of attribute names */ public void setFilterExists ( final Set < String > attributeNames ) { } }
final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "(&" ) ; for ( final String name : attributeNames ) { sb . append ( "(" ) ; sb . append ( new FilterSequence ( name , "*" , FilterSequence . MatchingRuleEnum . EQUALS ) ) ; sb . append ( ")" ) ; } sb . append ( ")" ) ; filter = sb . toString ( ) ;
public class ParameterUtil { /** * Get parameter by name * @ param report next report object * @ param parameterName parameter name * @ return return paramater with the specified name , null if parameter not found */ public static QueryParameter getParameterByName ( Report report , String parameterName ) { } }
return getParameterByName ( report . getParameters ( ) , parameterName ) ;
public class AmazonDirectConnectClient { /** * Deletes the specified link aggregation group ( LAG ) . You cannot delete a LAG if it has active virtual interfaces * or hosted connections . * @ param deleteLagRequest * @ return Result of the DeleteLag operation returned by the service . * @ throws DirectConnectServerException * A server - side error occurred . * @ throws DirectConnectClientException * One or more parameters are not valid . * @ sample AmazonDirectConnect . DeleteLag * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / directconnect - 2012-10-25 / DeleteLag " target = " _ top " > AWS API * Documentation < / a > */ @ Override public DeleteLagResult deleteLag ( DeleteLagRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteLag ( request ) ;
public class ExtViewQuery { /** * Load network image to current ImageView with cache control * @ param url * @ param cache * @ return */ public ExtViewQuery image ( String url , boolean cache ) { } }
if ( cache ) { image ( url ) ; } else { Picasso . with ( context ) . load ( url ) . skipMemoryCache ( ) . into ( ( ImageView ) view ) ; } return this ;
public class ListIndexedIterating { /** * the first pass of the method opcode to collet for loops information * @ param seen * the currently parsed opcode */ private void sawOpcodeLoop ( final int seen ) { } }
try { stack . mergeJumps ( this ) ; switch ( state ) { case SAW_NOTHING : if ( ( seen == Const . IINC ) && ( getIntConstant ( ) == 1 ) ) { loopReg = getRegisterOperand ( ) ; state = State . SAW_IINC ; } break ; case SAW_IINC : if ( ( seen == Const . GOTO ) || ( seen == Const . GOTO_W ) ) { int branchTarget = getBranchTarget ( ) ; int pc = getPC ( ) ; if ( branchTarget < pc ) { possibleForLoops . add ( new ForLoop ( branchTarget , pc , loopReg ) ) ; } } state = State . SAW_NOTHING ; break ; } if ( ( seen == Const . INVOKEINTERFACE ) && Values . SLASHED_JAVA_UTIL_LIST . equals ( getClassConstantOperand ( ) ) && "size" . equals ( getNameConstantOperand ( ) ) && SignatureBuilder . SIG_VOID_TO_INT . equals ( getSigConstantOperand ( ) ) ) { sawListSize = true ; } } finally { stack . sawOpcode ( this , seen ) ; }
public class Descriptor { /** * indexed setter for categories - sets an indexed value - List of Wikipedia categories associated with a Wikipedia page . * @ generated * @ param i index in the array to set * @ param v value to set into the array */ public void setCategories ( int i , Title v ) { } }
if ( Descriptor_Type . featOkTst && ( ( Descriptor_Type ) jcasType ) . casFeat_categories == null ) jcasType . jcas . throwFeatMissing ( "categories" , "de.julielab.jules.types.wikipedia.Descriptor" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Descriptor_Type ) jcasType ) . casFeatCode_categories ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Descriptor_Type ) jcasType ) . casFeatCode_categories ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ;
public class Xmap { /** * Clone a Xmap with all entries in the parameter ' map ' . */ public static < K , V > Xmap < K , V > create ( Map < K , V > map ) { } }
Xmap < K , V > xmap = new Xmap < > ( ) ; xmap . putAll ( map ) ; return xmap ;
public class Element { /** * Add a mouse event callback to a element * @ param callback * mouseEventCallback */ public void addMouseEventCallback ( MouseEventCallback callback ) { } }
if ( mouseEventCallbacks == null ) { mouseEventCallbacks = new ArrayList < MouseEventCallback > ( ) ; } mouseEventCallbacks . add ( callback ) ;
public class UpperCaseRomanNumbering { /** * Format index as upper case Roman numeral . * @ param index index value . * @ return formatted index . */ @ Override public String format ( int index ) { } }
StringBuilder sb = new StringBuilder ( ) ; final RomanNumeral [ ] values = RomanNumeral . values ( ) ; for ( int i = values . length - 1 ; i >= 0 ; i -- ) { while ( index >= values [ i ] . weight ) { sb . append ( values [ i ] ) ; index -= values [ i ] . weight ; } } return sb . toString ( ) ;
public class AnyChromosome { /** * Create a new chromosome of type { @ code A } with the given parameters and * length one . * @ param < A > the allele type * @ param supplier the allele - supplier which is used for creating new , * random alleles * @ param validator the validator used for validating the created gene . This * predicate is used in the { @ link # isValid ( ) } method . * @ return a new chromosome of allele type { @ code A } * @ throws NullPointerException if the { @ code supplier } or { @ code validator } * is { @ code null } */ public static < A > AnyChromosome < A > of ( final Supplier < ? extends A > supplier , final Predicate < ? super A > validator ) { } }
return of ( supplier , validator , 1 ) ;
public class BoundsCalculator { /** * Calculate the bounding rectangle for a chem model . * @ param chemModel the chem model to use * @ return the bounding rectangle of the chem model */ public static Rectangle2D calculateBounds ( IChemModel chemModel ) { } }
IAtomContainerSet moleculeSet = chemModel . getMoleculeSet ( ) ; IReactionSet reactionSet = chemModel . getReactionSet ( ) ; Rectangle2D totalBounds = new Rectangle2D . Double ( ) ; if ( moleculeSet != null ) { totalBounds = totalBounds . createUnion ( calculateBounds ( moleculeSet ) ) ; } if ( reactionSet != null ) { totalBounds = totalBounds . createUnion ( calculateBounds ( reactionSet ) ) ; } return totalBounds ;
public class Utils { /** * do run the runnable */ public static void setMidnightUpdater ( Handler h , Runnable r , String timezone ) { } }
if ( h == null || r == null || timezone == null ) { return ; } long now = System . currentTimeMillis ( ) ; Time time = new Time ( timezone ) ; time . set ( now ) ; long runInMillis = ( 24 * 3600 - time . hour * 3600 - time . minute * 60 - time . second + 1 ) * 1000 ; h . removeCallbacks ( r ) ; h . postDelayed ( r , runInMillis ) ;
public class Type { /** * Returns a source excerpt of a JavaDoc link to a method on this type . */ public JavadocLink javadocMethodLink ( String memberName , Type ... types ) { } }
return new JavadocLink ( "%s#%s(%s)" , getQualifiedName ( ) , memberName , ( Excerpt ) code -> { String separator = "" ; for ( Type type : types ) { code . add ( "%s%s" , separator , type . getQualifiedName ( ) ) ; separator = ", " ; } } ) ;
public class LocaleUtils { /** * TEST METHOD */ public static void main ( String [ ] args ) { } }
isCorrect ( momentToJavaFormat ( "DD/MM/YYYY" ) , "dd/MM/yyyy" ) ; isCorrect ( momentToJavaFormat ( "DD[/]MM[/]YYYY" ) , "dd'/'MM'/'yyyy" ) ; isCorrect ( javaToMomentFormat ( "DD/MM/YYYY" ) , "[(error: DD can't be converted)]/MM/gggg" ) ; isCorrect ( javaToMomentFormat ( "DD[/]MM" ) , "[(error: DD cannot be converted)][(error: cannot ecape escape characters)]/[(error: cannot ecape escape characters)]MM" ) ; isCorrect ( javaToMomentFormat ( "dd/MM/yyyy" ) , "DD/MM/YYYY" ) ;
public class DBInstance { /** * Not supported * @ param domainMemberships * Not supported */ public void setDomainMemberships ( java . util . Collection < DomainMembership > domainMemberships ) { } }
if ( domainMemberships == null ) { this . domainMemberships = null ; return ; } this . domainMemberships = new java . util . ArrayList < DomainMembership > ( domainMemberships ) ;
public class Source { /** * The pattern */ bar . java matches foo / bar . java and zoo / bar . java etc * / static private boolean hasFileMatch ( String path , List < String > patterns ) { } }
path = Util . normalizeDriveLetter ( path ) ; for ( String p : patterns ) { // Exact match if ( p . equals ( path ) ) { return true ; } // Single dot the end matches this package and all its subpackages . if ( p . startsWith ( "*" ) ) { // Remove the wildcard String patsuffix = p . substring ( 1 ) ; // Does the path start with the pattern prefix ? if ( path . endsWith ( patsuffix ) ) { return true ; } } } return false ;
public class UserJoinZoneEventHandler { /** * Create user agent object * @ param sfsUser smartfox user object * @ return user agent object */ protected ApiUser createUserAgent ( User sfsUser ) { } }
ApiUser answer = UserAgentFactory . newUserAgent ( sfsUser . getName ( ) , context . getUserAgentClass ( ) , context . getGameUserAgentClasses ( ) ) ; sfsUser . setProperty ( APIKey . USER , answer ) ; answer . setId ( sfsUser . getId ( ) ) ; answer . setIp ( sfsUser . getIpAddress ( ) ) ; answer . setSession ( new ApiSessionImpl ( sfsUser . getSession ( ) ) ) ; answer . setCommand ( context . command ( UserInfo . class ) . user ( sfsUser . getId ( ) ) ) ; return answer ;
public class AbstractSessionHandler { /** * Adds an event listener for session - related events . * @ param listener the session event listener * @ see # removeEventListener ( EventListener ) */ @ Override public void addEventListener ( EventListener listener ) { } }
if ( listener instanceof SessionListener ) { sessionListeners . add ( ( SessionListener ) listener ) ; } if ( listener instanceof SessionAttributeListener ) { sessionAttributeListeners . add ( ( SessionAttributeListener ) listener ) ; }
public class Reflect { /** * Gets the value of a field . * @ param fieldName The name of the field to get * @ return An instance of Reflect wrapping the result of the field value * @ throws ReflectionException Something went wrong getting the value of field */ public Reflect get ( @ NonNull String fieldName ) throws ReflectionException { } }
Field f = getField ( fieldName ) ; if ( f == null ) { throw new ReflectionException ( new NoSuchFieldException ( fieldName + " is not a valid field for " + clazz ) ) ; } boolean isAccessible = f . isAccessible ( ) ; try { if ( accessAll ) { f . setAccessible ( true ) ; } return onObject ( f . get ( object ) ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; throw new ReflectionException ( e ) ; } finally { f . setAccessible ( isAccessible ) ; }
public class V3ReplicationProtocol { /** * START _ REPLICATION [ SLOT slot _ name ] [ PHYSICAL ] XXX / XXX . */ private String createStartPhysicalQuery ( PhysicalReplicationOptions options ) { } }
StringBuilder builder = new StringBuilder ( ) ; builder . append ( "START_REPLICATION" ) ; if ( options . getSlotName ( ) != null ) { builder . append ( " SLOT " ) . append ( options . getSlotName ( ) ) ; } builder . append ( " PHYSICAL " ) . append ( options . getStartLSNPosition ( ) . asString ( ) ) ; return builder . toString ( ) ;
import java . util . * ; class Node { int val , listIdx , listElIdx ; Node ( int val , int listIdx , int listElIdx ) { this . val = val ; this . listIdx = listIdx ; this . listElIdx = listElIdx ; } } class FindSmallestRange { /** * Function to find the smallest range that includes at least one element from each of the given lists . * find _ smallest _ range ( [ [ 3 , 6 , 8 , 10 , 15 ] , [ 1 , 5 , 12 ] , [ 4 , 8 , 15 , 16 ] , [ 2 , 6 ] ] ) ( 4 , 6) * find _ smallest _ range ( [ [ 2 , 3 , 4 , 8 , 10 , 15 ] , [ 1 , 5 , 12 ] , [ 7 , 8 , 15 , 16 ] , [ 3 , 6 ] ] ) ( 4 , 7) * find _ smallest _ range ( [ [ 4 , 7 , 9 , 11 , 16 ] , [ 2 , 6 , 13 ] , [ 5 , 9 , 16 , 17 ] , [ 3 , 7 ] ] ) ( 5 , 7) */ public static int [ ] findSmallestRange ( List < int [ ] > arrays ) { } }
int k = arrays . size ( ) ; PriorityQueue < Node > minHeap = new PriorityQueue < > ( ( n1 , n2 ) -> n1 . val - n2 . val ) ; int maxVal = Integer . MIN_VALUE ; for ( int i = 0 ; i < k ; ++ i ) { if ( arrays . get ( i ) . length > 0 ) { minHeap . add ( new Node ( arrays . get ( i ) [ 0 ] , i , 0 ) ) ; maxVal = Math . max ( maxVal , arrays . get ( i ) [ 0 ] ) ; } } int range = Integer . MAX_VALUE ; int start = 0 , end = 0 ; while ( minHeap . size ( ) == k ) { Node smallest = minHeap . poll ( ) ; if ( ( maxVal - smallest . val ) < range ) { range = maxVal - smallest . val ; start = smallest . val ; end = maxVal ; } if ( smallest . listElIdx + 1 < arrays . get ( smallest . listIdx ) . length ) { smallest = new Node ( arrays . get ( smallest . listIdx ) [ smallest . listElIdx + 1 ] , smallest . listIdx , smallest . listElIdx + 1 ) ; minHeap . add ( smallest ) ; maxVal = Math . max ( maxVal , smallest . val ) ; } } return new int [ ] { start , end } ;
public class LoggingJBossASClient { /** * Sets the logger to the given level . * If the logger does not exist yet , it will be created . * @ param loggerName the logger name ( this is also known as the category name ) * @ param level the new level of the logger ( e . g . DEBUG , INFO , ERROR , etc . ) * @ throws Exception any error */ public void setLoggerLevel ( String loggerName , String level ) throws Exception { } }
final Address addr = Address . root ( ) . add ( SUBSYSTEM , LOGGING , LOGGER , loggerName ) ; final ModelNode request ; if ( isLogger ( loggerName ) ) { request = createWriteAttributeRequest ( "level" , level , addr ) ; } else { final String dmrTemplate = "" + "{" + "\"category\" => \"%s\" " + ", \"level\" => \"%s\" " + ", \"use-parent-handlers\" => \"true\" " + "}" ; final String dmr = String . format ( dmrTemplate , loggerName , level ) ; request = ModelNode . fromString ( dmr ) ; request . get ( OPERATION ) . set ( ADD ) ; request . get ( ADDRESS ) . set ( addr . getAddressNode ( ) ) ; } final ModelNode response = execute ( request ) ; if ( ! isSuccess ( response ) ) { throw new FailureException ( response ) ; } return ;
public class TcclAwareObjectIputStream { /** * Returns a proxy class that implements the interfaces named in a proxy * class descriptor ; subclasses may implement this method to read custom * data from the stream along with the descriptors for dynamic proxy * classes , allowing them to use an alternate loading mechanism for the * interfaces and the proxy class . * For each interface uses the current class { @ link ClassLoader } and falls back to the { @ link Thread } context { @ link ClassLoader } . */ protected Class resolveProxyClass ( String [ ] interfaces ) throws IOException , ClassNotFoundException { } }
ClassLoader cl = getClass ( ) . getClassLoader ( ) ; Class [ ] cinterfaces = new Class [ interfaces . length ] ; for ( int i = 0 ; i < interfaces . length ; i ++ ) { try { cinterfaces [ i ] = cl . loadClass ( interfaces [ i ] ) ; } catch ( ClassNotFoundException ex ) { ClassLoader tccl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( tccl != null ) { return tccl . loadClass ( interfaces [ i ] ) ; } else { throw ex ; } } } try { return Proxy . getProxyClass ( cinterfaces [ 0 ] . getClassLoader ( ) , cinterfaces ) ; } catch ( IllegalArgumentException e ) { throw new ClassNotFoundException ( null , e ) ; }
public class HtmlTableWriter { /** * Write bottom part of the HTML page * @ param hasNext has next , true if there ' s supposed to be another page following this one */ private void writeBottom ( boolean hasNext ) throws IOException { } }
String template = Template . readResourceAsStream ( "com/btaz/util/templates/html-table-footer.ftl" ) ; Map < String , Object > map = new HashMap < String , Object > ( ) ; String prev = " " ; String next = "" ; if ( currentPageNumber > 1 ) { prev = "<a href=\"" + createFilename ( 1 ) + "\">First</a> &nbsp; " + "<a href=\"" + createFilename ( currentPageNumber - 1 ) + "\">Previous</a> &nbsp; " ; } if ( hasNext ) { next = "<a href=\"" + createFilename ( currentPageNumber + 1 ) + "\">Next</a>" ; } map . put ( "pageNavigation" , prev + next ) ; template = Template . transform ( template , map ) ; writer . write ( template ) ; writer . close ( ) ; writer = null ;
public class VitalTransformer { /** * Check the array for the new element , and if not found , generate a new * array containing all of the old elements plus the new . * @ param oldArray The old array of data * @ param newElement The new element we want * @ return String [ ] An array containing all of the old data */ private String [ ] growArray ( String [ ] oldArray , String newElement ) { } }
// Look for the element first for ( String element : oldArray ) { if ( element . equals ( newElement ) ) { // If it ' s already there , we ' re done return oldArray ; } } log . debug ( "Adding ID: '{}'" , newElement ) ; // Ok , we know we need a new array int length = oldArray . length + 1 ; String [ ] newArray = new String [ length ] ; // Copy the old array contents System . arraycopy ( oldArray , 0 , newArray , 0 , oldArray . length ) ; // And the new element , and return newArray [ length - 1 ] = newElement ; return newArray ;
public class JAltGridScreen { /** * Set a ( new ) model . * @ param model The table model . */ public void setModel ( TableModel model ) { } }
// Column 3 and 4 : ( Scroll Pane Headings ) if ( m_model != null ) m_model . removeTableModelListener ( this ) ; m_model = model ; if ( model != null ) model . addTableModelListener ( this ) ; this . setupPanel ( ) ; // setup a new panel
public class HttpUtil { /** * 下载远程文件 * @ param url 请求的url * @ param out 将下载内容写到输出流中 { @ link OutputStream } * @ param isCloseOut 是否关闭输出流 * @ param streamProgress 进度条 * @ return 文件大小 */ public static long download ( String url , OutputStream out , boolean isCloseOut , StreamProgress streamProgress ) { } }
if ( StrUtil . isBlank ( url ) ) { throw new NullPointerException ( "[url] is null!" ) ; } if ( null == out ) { throw new NullPointerException ( "[out] is null!" ) ; } final HttpResponse response = HttpRequest . get ( url ) . executeAsync ( ) ; if ( false == response . isOk ( ) ) { throw new HttpException ( "Server response error with status code: [{}]" , response . getStatus ( ) ) ; } return response . writeBody ( out , isCloseOut , streamProgress ) ;
public class EntityBeanTypeImpl { /** * Returns all < code > security - role - ref < / code > elements * @ return list of < code > security - role - ref < / code > */ public List < SecurityRoleRefType < EntityBeanType < T > > > getAllSecurityRoleRef ( ) { } }
List < SecurityRoleRefType < EntityBeanType < T > > > list = new ArrayList < SecurityRoleRefType < EntityBeanType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "security-role-ref" ) ; for ( Node node : nodeList ) { SecurityRoleRefType < EntityBeanType < T > > type = new SecurityRoleRefTypeImpl < EntityBeanType < T > > ( this , "security-role-ref" , childNode , node ) ; list . add ( type ) ; } return list ;
public class DefaultDataStore { /** * Resolve a set of changes , returning an interface that includes info about specific change IDs . */ private AnnotatedContent resolveAnnotated ( Record record , final ReadConsistency consistency ) { } }
final Resolved resolved = resolve ( record , consistency ) ; final Table table = record . getKey ( ) . getTable ( ) ; return new AnnotatedContent ( ) { @ Override public Map < String , Object > getContent ( ) { return toContent ( resolved , consistency ) ; } @ Override public boolean isChangeDeltaPending ( UUID changeId ) { long fullConsistencyTimestamp = _dataWriterDao . getFullConsistencyTimestamp ( table ) ; return resolved . isChangeDeltaPending ( changeId , fullConsistencyTimestamp ) ; } @ Override public boolean isChangeDeltaRedundant ( UUID changeId ) { return resolved . isChangeDeltaRedundant ( changeId ) ; } } ;
public class Scte35ReturnToNetworkScheduleActionSettingsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Scte35ReturnToNetworkScheduleActionSettings scte35ReturnToNetworkScheduleActionSettings , ProtocolMarshaller protocolMarshaller ) { } }
if ( scte35ReturnToNetworkScheduleActionSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( scte35ReturnToNetworkScheduleActionSettings . getSpliceEventId ( ) , SPLICEEVENTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Parameters { /** * Set a double value to the query parameter referenced by the given name . A query parameter * is defined by using the Expression ' s parameter ( String name ) function . * @ param name The parameter name . * @ param value The double value . * @ return The self object . */ @ NonNull public Parameters setDouble ( @ NonNull String name , double value ) { } }
return setValue ( name , value ) ;
public class RequestUtil { /** * Appends new key and value pair to query string * @ param key * parameter name * @ param value * value of parameter * @ param queryString * existing query string * @ param ampersand * string to use for ampersand ( e . g . " & " or " & amp ; " ) * @ return query string ( with no leading " ? " ) */ private static StringBuilder append ( Object key , Object value , StringBuilder queryString , String ampersand ) { } }
if ( queryString . length ( ) > 0 ) { queryString . append ( ampersand ) ; } // Use encodeURL from Struts ' RequestUtils class - it ' s JDK 1.3 and 1.4 // compliant queryString . append ( encodeURL ( key . toString ( ) ) ) ; queryString . append ( "=" ) ; queryString . append ( encodeURL ( value . toString ( ) ) ) ; return queryString ;
public class Slice { /** * Transfers the content of the specified source stream to this buffer * starting at the specified absolute { @ code index } . * @ param length the number of bytes to transfer * @ return the actual number of bytes read in from the specified channel . * { @ code - 1 } if the specified channel is closed . * @ throws IndexOutOfBoundsException if the specified { @ code index } is less than { @ code 0 } or * if { @ code index + length } is greater than { @ code this . capacity } * @ throws java . io . IOException if the specified stream threw an exception during I / O */ public int setBytes ( int index , InputStream in , int length ) throws IOException { } }
checkPositionIndexes ( index , index + length , this . length ) ; index += offset ; int readBytes = 0 ; do { int localReadBytes = in . read ( data , index , length ) ; if ( localReadBytes < 0 ) { if ( readBytes == 0 ) { return - 1 ; } else { break ; } } readBytes += localReadBytes ; index += localReadBytes ; length -= localReadBytes ; } while ( length > 0 ) ; return readBytes ;
public class InstructionView { /** * Will slide the reroute view down from the top of the screen * and make it visible * @ since 0.6.0 */ public void showRerouteState ( ) { } }
if ( rerouteLayout . getVisibility ( ) == INVISIBLE ) { rerouteLayout . startAnimation ( rerouteSlideDownTop ) ; rerouteLayout . setVisibility ( VISIBLE ) ; }
public class BaseSingleFieldPeriod { /** * Calculates the number of whole units between the two specified partial datetimes . * The two partials must contain the same fields , for example you can specify * two < code > LocalDate < / code > objects . * @ param start the start partial date , validated to not be null * @ param end the end partial date , validated to not be null * @ param zeroInstance the zero instance constant , must not be null * @ return the period * @ throws IllegalArgumentException if the partials are null or invalid */ protected static int between ( ReadablePartial start , ReadablePartial end , ReadablePeriod zeroInstance ) { } }
if ( start == null || end == null ) { throw new IllegalArgumentException ( "ReadablePartial objects must not be null" ) ; } if ( start . size ( ) != end . size ( ) ) { throw new IllegalArgumentException ( "ReadablePartial objects must have the same set of fields" ) ; } for ( int i = 0 , isize = start . size ( ) ; i < isize ; i ++ ) { if ( start . getFieldType ( i ) != end . getFieldType ( i ) ) { throw new IllegalArgumentException ( "ReadablePartial objects must have the same set of fields" ) ; } } if ( DateTimeUtils . isContiguous ( start ) == false ) { throw new IllegalArgumentException ( "ReadablePartial objects must be contiguous" ) ; } Chronology chrono = DateTimeUtils . getChronology ( start . getChronology ( ) ) . withUTC ( ) ; int [ ] values = chrono . get ( zeroInstance , chrono . set ( start , START_1972 ) , chrono . set ( end , START_1972 ) ) ; return values [ 0 ] ;
public class Mmul { /** * For a 2D matrix of shape ( M , N ) we return ( N , M ) . * For a 3D matrix with leading mini - batch dimension ( mb , M , N ) * we return ( mb , N , M ) * @ param shape input shape array * @ return */ public long [ ] transposeShapeArray ( long [ ] shape ) { } }
if ( shape . length == 2 ) { return ArrayUtil . reverseCopy ( shape ) ; } else if ( shape . length == 3 ) { return new long [ ] { shape [ 0 ] , shape [ 2 ] , shape [ 1 ] } ; } else { throw new IllegalArgumentException ( "Matrix input has to be of length 2 or 3, got: " + shape . length ) ; }
public class LongTermRetentionBackupsInner { /** * Lists the long term retention backups for a given location . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; LongTermRetentionBackupInner & gt ; object */ public Observable < Page < LongTermRetentionBackupInner > > listByLocationNextAsync ( final String nextPageLink ) { } }
return listByLocationNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < LongTermRetentionBackupInner > > , Page < LongTermRetentionBackupInner > > ( ) { @ Override public Page < LongTermRetentionBackupInner > call ( ServiceResponse < Page < LongTermRetentionBackupInner > > response ) { return response . body ( ) ; } } ) ;
public class MongoResponseStore { /** * { @ inheritDoc } */ @ Override public Collection < Response > findResponses ( final SearchCriteria criteria ) { } }
return findResponses ( criteria , loadResponses ( criteria ) ) ;
public class JBBPOut { /** * Start a DSL session for a defined stream with defined parameters . * @ param out the defined stream * @ param byteOrder the byte outOrder for the session * @ param bitOrder the bit outOrder for the session * @ return the new DSL session generated for the stream with parameters */ public static JBBPOut BeginBin ( final OutputStream out , final JBBPByteOrder byteOrder , final JBBPBitOrder bitOrder ) { } }
return new JBBPOut ( out , byteOrder , bitOrder ) ;
public class InstanceClient { /** * Sets the service account on the instance . For more information , read Changing the service * account and access scopes for an instance . * < p > Sample code : * < pre > < code > * try ( InstanceClient instanceClient = InstanceClient . create ( ) ) { * ProjectZoneInstanceName instance = ProjectZoneInstanceName . of ( " [ PROJECT ] " , " [ ZONE ] " , " [ INSTANCE ] " ) ; * InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = InstancesSetServiceAccountRequest . newBuilder ( ) . build ( ) ; * Operation response = instanceClient . setServiceAccountInstance ( instance . toString ( ) , instancesSetServiceAccountRequestResource ) ; * < / code > < / pre > * @ param instance Name of the instance resource to start . * @ param instancesSetServiceAccountRequestResource * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation setServiceAccountInstance ( String instance , InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource ) { } }
SetServiceAccountInstanceHttpRequest request = SetServiceAccountInstanceHttpRequest . newBuilder ( ) . setInstance ( instance ) . setInstancesSetServiceAccountRequestResource ( instancesSetServiceAccountRequestResource ) . build ( ) ; return setServiceAccountInstance ( request ) ;
public class ArrayUtil { /** * Returns the index of b or c in arra . Or - 1 if not found . */ public static int find ( byte [ ] arra , int start , int limit , int b , int c ) { } }
int k = 0 ; for ( ; k < limit ; k ++ ) { if ( arra [ k ] == b || arra [ k ] == c ) { return k ; } } return - 1 ;
public class SystemOutLoggingTool { /** * { @ inheritDoc } */ @ Override public void debug ( Object object , Object ... objects ) { } }
if ( level <= DEBUG ) { StringBuilder result = new StringBuilder ( ) ; result . append ( object ) ; for ( Object obj : objects ) { result . append ( obj ) ; } debugString ( result . toString ( ) ) ; }
public class JawrConfigManager { /** * ( non - Javadoc ) * @ see net . jawr . web . config . jmx . JawrConfigManagerMBean # * setUseContextPathOverrideInDebugMode ( boolean ) */ @ Override public void setUseContextPathOverrideInDebugMode ( boolean useContextPathOverrideInDebugMode ) { } }
configProperties . setProperty ( JawrConfig . JAWR_USE_URL_CONTEXTPATH_OVERRIDE_IN_DEBUG_MODE , Boolean . toString ( useContextPathOverrideInDebugMode ) ) ;
public class ACL { /** * Checks if the current security principal has the permission to create views within the specified view group . * This is just a convenience function . * @ param c the container of the item . * @ param d the descriptor of the view to be created . * @ throws AccessDeniedException if the user doesn ' t have the permission . * @ since 1.607 */ public final void checkCreatePermission ( @ Nonnull ViewGroup c , @ Nonnull ViewDescriptor d ) { } }
Authentication a = Jenkins . getAuthentication ( ) ; if ( a == SYSTEM ) { return ; } if ( ! hasCreatePermission ( a , c , d ) ) { throw new AccessDeniedException ( Messages . AccessDeniedException2_MissingPermission ( a . getName ( ) , View . CREATE . group . title + "/" + View . CREATE . name + View . CREATE + "/" + d . getDisplayName ( ) ) ) ; }
public class MutateInBuilder { /** * Remove an entry in a JSON document ( scalar , array element , dictionary entry , * whole array or dictionary , depending on the path ) . * @ param path the path to remove . * @ param optionsBuilder { @ link SubdocOptionsBuilder } */ public < T > MutateInBuilder remove ( String path , SubdocOptionsBuilder optionsBuilder ) { } }
if ( optionsBuilder . createPath ( ) ) { throw new IllegalArgumentException ( "Options createPath are not supported for remove" ) ; } asyncBuilder . remove ( path , optionsBuilder ) ; return this ;
public class DoubleStreamEx { /** * Return an ordered stream produced by consecutive calls of the supplied * producer until it returns false . * The producer function may call the passed consumer any number of times * and return true if the producer should be called again or false * otherwise . It ' s guaranteed that the producer will not be called anymore , * once it returns false . * This method is particularly useful when producer changes the mutable * object which should be left in known state after the full stream * consumption . Note however that if a short - circuiting operation is used , * then the final state of the mutable object cannot be guaranteed . * @ param producer a predicate which calls the passed consumer to emit * stream element ( s ) and returns true if it producer should be * applied again . * @ return the new stream * @ since 0.6.0 */ public static DoubleStreamEx produce ( Predicate < DoubleConsumer > producer ) { } }
Box < DoubleEmitter > box = new Box < > ( ) ; return ( box . a = action -> producer . test ( action ) ? box . a : null ) . stream ( ) ;
public class EventCategoryGroupMarshaller { /** * Marshall the given parameter object . */ public void marshall ( EventCategoryGroup eventCategoryGroup , ProtocolMarshaller protocolMarshaller ) { } }
if ( eventCategoryGroup == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( eventCategoryGroup . getSourceType ( ) , SOURCETYPE_BINDING ) ; protocolMarshaller . marshall ( eventCategoryGroup . getEventCategories ( ) , EVENTCATEGORIES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DateUtils { /** * Handles the if - modified - since header . returns true if the request should proceed , false otherwise * @ param exchange the exchange * @ param lastModified The last modified date * @ return */ public static boolean handleIfModifiedSince ( final HttpServerExchange exchange , final Date lastModified ) { } }
return handleIfModifiedSince ( exchange . getRequestHeaders ( ) . getFirst ( Headers . IF_MODIFIED_SINCE ) , lastModified ) ;
public class HttpTrackingURLProvider { /** * get tracking URI . * @ return */ @ Override public String getTrackingUrl ( ) { } }
if ( this . httpServer == null ) { return "" ; } try { return InetAddress . getLocalHost ( ) . getHostAddress ( ) + ":" + httpServer . getPort ( ) ; } catch ( final UnknownHostException e ) { LOG . log ( Level . WARNING , "Cannot get host address." , e ) ; throw new RuntimeException ( "Cannot get host address." , e ) ; }
public class MFVec2f { /** * Assign an array subset to this field . * @ param size - number of new values * @ param newValue - array of the new x , y values , must be divisible by 2, * in a single dimensional array */ public void setValue ( int size , float [ ] newValue ) { } }
if ( ( ( newValue . length % 2 ) == 0 ) && ( ( newValue . length / 2 ) == size ) ) { try { for ( int i = 0 ; i < size ; i ++ ) { value . set ( i , new SFVec2f ( newValue [ i * 3 ] , newValue [ i * 3 + 1 ] ) ) ; } } catch ( IndexOutOfBoundsException e ) { Log . e ( TAG , "X3D MFVec2f setValue(size,newValue[]) out of bounds." + e ) ; } catch ( Exception e ) { Log . e ( TAG , "X3D MFVec2f setValue(size, newValue[]) exception " + e ) ; } } else { Log . e ( TAG , "X3D MFVec2f setValue() set with newValue[] length not multiple of 2, or equal to size parameter" ) ; }
public class ResourceGroupsInner { /** * Captures the specified resource group as a template . * @ param resourceGroupName The name of the resource group to export as a template . * @ param parameters Parameters for exporting the template . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the ResourceGroupExportResultInner object if successful . */ public ResourceGroupExportResultInner exportTemplate ( String resourceGroupName , ExportTemplateRequest parameters ) { } }
return exportTemplateWithServiceResponseAsync ( resourceGroupName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class AdminDevice { /** * Init the device * @ throws DevFailed */ @ Init @ StateMachine ( endState = DeviceState . ON ) public void init ( ) throws DevFailed { } }
xlogger . entry ( ) ; TangoCacheManager . setPollSize ( pollingThreadsPoolSize ) ; // logger . debug ( " init admin device with quartzThreadsPoolSize = { } " , // quartzThreadsPoolSize ) ; status = "The device is ON\nThe polling is ON" ; tangoStats = TangoStats . getInstance ( ) ; xlogger . exit ( ) ;
public class EncryptionMaterials { /** * Fluent API to add material description . */ public EncryptionMaterials withDescription ( String name , String value ) { } }
description . put ( name , value ) ; return this ;
public class RangeSets { /** * Intersects a set of rangeSets , or returns null if the set is empty . */ public static < T extends Comparable < T > > RangeSet < T > intersectRangeSets ( final Iterable < RangeSet < T > > rangeSets ) { } }
RangeSet < T > rangeSet = null ; for ( final RangeSet < T > set : rangeSets ) { if ( rangeSet == null ) { rangeSet = TreeRangeSet . create ( ) ; rangeSet . addAll ( set ) ; } else { rangeSet . removeAll ( set . complement ( ) ) ; } } return rangeSet ;
public class ReactorInstrumentation { /** * Initialize instrumentation for reactor with the tracer and factory . * @ param beanContext The bean context * @ param threadFactory The factory to create new threads on - demand */ @ SuppressWarnings ( "unchecked" ) @ PostConstruct void init ( BeanContext beanContext , ThreadFactory threadFactory ) { } }
try { BeanDefinition < ExecutorService > beanDefinition = beanContext . getBeanDefinition ( ExecutorService . class , Qualifiers . byName ( TaskExecutors . SCHEDULED ) ) ; Collection < BeanCreatedEventListener > schedulerCreateListeners = beanContext . getBeansOfType ( BeanCreatedEventListener . class , Qualifiers . byTypeArguments ( ScheduledExecutorService . class ) ) ; Schedulers . addExecutorServiceDecorator ( Environment . MICRONAUT , ( scheduler , scheduledExecutorService ) -> { for ( BeanCreatedEventListener schedulerCreateListener : schedulerCreateListeners ) { Object newBean = schedulerCreateListener . onCreated ( new BeanCreatedEvent ( beanContext , beanDefinition , BeanIdentifier . of ( "reactor-" + scheduler . getClass ( ) . getSimpleName ( ) ) , scheduledExecutorService ) ) ; if ( ! ( newBean instanceof ScheduledExecutorService ) ) { throw new BeanContextException ( "Bean creation listener [" + schedulerCreateListener + "] should return ScheduledExecutorService, but returned " + newBean ) ; } scheduledExecutorService = ( ScheduledExecutorService ) newBean ; } return scheduledExecutorService ; } ) ; } catch ( Exception e ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( "Could not instrument Reactor for Tracing: " + e . getMessage ( ) , e ) ; } }
public class ConfigReadController { /** * 获取某个 * @ param configId * @ return */ @ RequestMapping ( value = "/{configId}" , method = RequestMethod . GET ) @ ResponseBody public JsonObjectBase getConfig ( @ PathVariable long configId ) { } }
// 业务校验 configValidator . valideConfigExist ( configId ) ; ConfListVo config = configMgr . getConfVo ( configId ) ; return buildSuccess ( config ) ;
public class AgreementRule { /** * TODO : improve this so it only returns true for real relative clauses */ private boolean couldBeRelativeOrDependentClause ( AnalyzedTokenReadings [ ] tokens , int pos ) { } }
boolean comma ; boolean relPronoun ; if ( pos >= 1 ) { // avoid false alarm : " Das Wahlrecht , das Frauen zugesprochen bekamen . " etc : comma = tokens [ pos - 1 ] . getToken ( ) . equals ( "," ) ; relPronoun = comma && tokens [ pos ] . hasAnyLemma ( REL_PRONOUN_LEMMAS ) ; if ( relPronoun && pos + 3 < tokens . length ) { return true ; } } if ( pos >= 2 ) { // avoid false alarm : " Der Mann , in dem quadratische Fische schwammen . " // or : " Die Polizei erwischte die Diebin , weil diese Ausweis und Visitenkarte hinterließ . " comma = tokens [ pos - 2 ] . getToken ( ) . equals ( "," ) ; if ( comma ) { boolean prep = tokens [ pos - 1 ] . hasPosTagStartingWith ( "PRP:" ) ; relPronoun = tokens [ pos ] . hasAnyLemma ( REL_PRONOUN_LEMMAS ) ; return prep && relPronoun || ( tokens [ pos - 1 ] . hasPosTag ( "KON:UNT" ) && ( tokens [ pos ] . hasLemma ( "jen" ) || tokens [ pos ] . hasLemma ( "dies" ) ) ) ; } } return false ;
public class CSVFormatter { /** * Format string . * @ param iterable the iterable * @ return the string */ public String format ( Iterable < ? > iterable ) { } }
if ( iterable == null ) { return StringUtils . EMPTY ; } return format ( iterable . iterator ( ) ) ;
public class TreeBuilder { /** * 检查整个树的状况 , 尽可能报告可能存在的问题 * @ param tree * @ param parent * @ param prefix */ private void check ( MappingNode tree , MappingNode parent , String prefix ) { } }
MappingNode child = parent . getLeftMostChild ( ) ; MappingNode sibling = null ; while ( child != null ) { if ( sibling != null ) { if ( child . compareTo ( sibling ) == 0 ) { logger . error ( "mapping conflicts: '" + child . getMapping ( ) . getDefinition ( ) + "' conflicts with '" + sibling . getMapping ( ) . getDefinition ( ) + "' in '" + prefix + "'; here is the mapping tree, " + "you can find the conflict in it:\n" + PrinteHelper . list ( tree ) ) ; throw new IllegalArgumentException ( "mapping conflicts: '" + child . getMapping ( ) . getDefinition ( ) + "' conflicts with '" + sibling . getMapping ( ) . getDefinition ( ) + "' in '" + prefix + "'" ) ; } } check ( tree , child , prefix + child . getMapping ( ) . getDefinition ( ) ) ; sibling = child ; child = child . getSibling ( ) ; }
public class InheritanceHelper { /** * Determines whether the given type is the same or a sub type of the other type . * @ param type The type * @ param baseType The possible base type * @ param checkActualClasses Whether to use the actual classes for the test * @ return < code > true < / code > If < code > type < / code > specifies the same or a sub type of < code > baseType < / code > * @ throws ClassNotFoundException If the two classes are not on the classpath */ public boolean isSameOrSubTypeOf ( XClass type , String baseType , boolean checkActualClasses ) throws ClassNotFoundException { } }
String qualifiedBaseType = baseType . replace ( '$' , '.' ) ; if ( type . getQualifiedName ( ) . equals ( qualifiedBaseType ) ) { return true ; } // first search via XDoclet ArrayList queue = new ArrayList ( ) ; boolean canSpecify = false ; XClass curType ; queue . add ( type ) ; while ( ! queue . isEmpty ( ) ) { curType = ( XClass ) queue . get ( 0 ) ; queue . remove ( 0 ) ; if ( qualifiedBaseType . equals ( curType . getQualifiedName ( ) ) ) { return true ; } if ( curType . getInterfaces ( ) != null ) { for ( Iterator it = curType . getInterfaces ( ) . iterator ( ) ; it . hasNext ( ) ; ) { queue . add ( it . next ( ) ) ; } } if ( ! curType . isInterface ( ) ) { if ( curType . getSuperclass ( ) != null ) { queue . add ( curType . getSuperclass ( ) ) ; } } } // if not found , we try via actual classes return checkActualClasses ? isSameOrSubTypeOf ( type . getQualifiedName ( ) , qualifiedBaseType ) : false ;
public class Validation { /** * method to check if the given polymer id exists in the given list of * polymer ids * @ param str * polymer id * @ param listPolymerIDs * List of polymer ids * @ return true if the polymer id exists , false otherwise * @ throws PolymerIDsException * if the polymer id does not exist */ private static void checkExistenceOfPolymerID ( String str , List < String > listPolymerIDs ) throws PolymerIDsException { } }
if ( ! ( listPolymerIDs . contains ( str ) ) ) { LOG . info ( "Polymer Id does not exist" ) ; throw new PolymerIDsException ( "Polymer ID does not exist" ) ; }
public class ServicesInner { /** * Check service health status . * The services resource is the top - level resource that represents the Data Migration Service . This action performs a health check and returns the status of the service and virtual machine size . * @ param groupName Name of the resource group * @ param serviceName Name of the service * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the DataMigrationServiceStatusResponseInner object */ public Observable < ServiceResponse < DataMigrationServiceStatusResponseInner > > checkStatusWithServiceResponseAsync ( String groupName , String serviceName ) { } }
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( groupName == null ) { throw new IllegalArgumentException ( "Parameter groupName is required and cannot be null." ) ; } if ( serviceName == null ) { throw new IllegalArgumentException ( "Parameter serviceName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . checkStatus ( this . client . subscriptionId ( ) , groupName , serviceName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < DataMigrationServiceStatusResponseInner > > > ( ) { @ Override public Observable < ServiceResponse < DataMigrationServiceStatusResponseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < DataMigrationServiceStatusResponseInner > clientResponse = checkStatusDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class KeyArea { /** * Setup the SQL Key Filter . * This is the special filter that is used to get the next records in a * unique sequential list . Specifically , to position a grid correctly when * the original query is no longer valid . This uses logic to set up the WHERE clause as : * < pre > * ( ( ROW0 > ? ) OR * ( ( ROW0 > ? ) AND ( ROW1 > ? ) ) OR * ( ( ROW0 > = ? ) AND ( ROW1 > = ? ) AND ( ROW2 > = ? ) ) ) - - ROW2 is the counter field . * < / pre > * @ param seekSign The seek sign . * @ param iAreaDesc The key area to select . * @ param bAddOnlyMods Add only the keys which have modified ? * @ param bIncludeFileName Include the file name in the string ? * @ param bUseCurrentValues Use current values ? * @ param vParamList The parameter list . * @ param bForceUniqueKey If params must be unique , if they aren ' t , add the unique key to the end . * @ return The select string . */ public String addGreaterThanParams ( String seekSign , int iAreaDesc , boolean bAddOnlyMods , boolean bIncludeFileName , boolean bUseCurrentValues , Vector < BaseField > vParamList , boolean bForceUniqueKey ) { } }
String strFilter = DBConstants . BLANK ; int iKeyFieldCount = this . getKeyFields ( bForceUniqueKey , false ) ; strFilter += "(" ; for ( int iCount = DBConstants . MAIN_KEY_FIELD ; iCount < iKeyFieldCount ; iCount ++ ) { if ( strFilter . length ( ) > 1 ) strFilter += " OR " ; strFilter += "(" ; for ( int iKeyFieldSeq = DBConstants . MAIN_KEY_FIELD ; iKeyFieldSeq <= iCount ; iKeyFieldSeq ++ ) { KeyField keyField = this . getKeyField ( iKeyFieldSeq , bForceUniqueKey ) ; BaseField pParamField = keyField . getField ( iAreaDesc ) ; BaseField field = keyField . getField ( DBConstants . FILE_KEY_AREA ) ; if ( iKeyFieldSeq > DBConstants . MAIN_KEY_FIELD ) strFilter += " AND " ; String strCompare = null ; strFilter += field . getFieldName ( true , bIncludeFileName ) ; String strSign = seekSign ; if ( iCount < iKeyFieldCount - 1 ) strSign = seekSign . substring ( 0 , 1 ) ; if ( bUseCurrentValues == false ) { strCompare = "?" ; strFilter += strSign + strCompare ; if ( vParamList != null ) vParamList . add ( pParamField ) ; } else strFilter += pParamField . getSQLFilter ( strSign , strCompare , true ) ; } strFilter += ")" ; } strFilter += ")" ; return strFilter ;
public class HandyDateExpressionObject { /** * Get formatted date string . * @ param expression Date expression . ( NullAllowed : if null , returns null ) * @ param objPattern date format pattern . ( NotNull ) * @ return formatted date string . ( NullAllowed : if expression is null . ) */ public String format ( Object expression , Object objPattern ) { } }
if ( objPattern instanceof String ) { final String pattern = filterPattern ( ( String ) objPattern ) ; if ( expression == null ) { return null ; } if ( expression instanceof LocalDate ) { return create ( ( LocalDate ) expression ) . toDisp ( pattern ) ; } if ( expression instanceof LocalDateTime ) { return create ( ( LocalDateTime ) expression ) . toDisp ( pattern ) ; } if ( expression instanceof java . util . Date ) { return create ( ( java . util . Date ) expression ) . toDisp ( pattern ) ; } if ( expression instanceof String ) { return create ( ( String ) expression ) . toDisp ( pattern ) ; } String msg = "First argument as two arguments should be LocalDate or LocalDateTime or Date or String(expression): " + expression ; throw new TemplateProcessingException ( msg ) ; } String msg = "Second argument as two arguments should be String(pattern): objPattern=" + objPattern ; throw new TemplateProcessingException ( msg ) ;
public class BodyDumper { /** * impl of dumping request body to result * @ param result A map you want to put dump information to */ @ Override public void dumpRequest ( Map < String , Object > result ) { } }
String contentType = exchange . getRequestHeaders ( ) . getFirst ( Headers . CONTENT_TYPE ) ; // only dump json info if ( contentType != null && contentType . startsWith ( "application/json" ) ) { // if body info already grab by body handler , get it from attachment directly Object requestBodyAttachment = exchange . getAttachment ( BodyHandler . REQUEST_BODY ) ; if ( requestBodyAttachment != null ) { dumpBodyAttachment ( requestBodyAttachment ) ; } else { // otherwise get it from input stream directly dumpInputStream ( ) ; } } else { logger . info ( "unsupported contentType: {}" , contentType ) ; } this . putDumpInfoTo ( result ) ;
public class Electronegativity { /** * calculate the electronegativity of orbitals sigma . * @ param ac IAtomContainer * @ param atom atom for which effective atom electronegativity should be calculated * @ param maxIterations The maximal number of Iterations * @ param maxResonStruc The maximal number of Resonance Structures * @ return piElectronegativity */ public double calculateSigmaElectronegativity ( IAtomContainer ac , IAtom atom , int maxIterations , int maxResonStruc ) { } }
maxI = maxIterations ; maxRS = maxResonStruc ; double electronegativity = 0 ; try { if ( ! ac . equals ( acOldS ) ) { molSigma = ac . getBuilder ( ) . newInstance ( IAtomContainer . class , ac ) ; peoe . setMaxGasteigerIters ( maxI ) ; peoe . assignGasteigerMarsiliSigmaPartialCharges ( molSigma , true ) ; marsiliFactors = peoe . assignGasteigerSigmaMarsiliFactors ( molSigma ) ; acOldS = ac ; } int stepSize = peoe . getStepSize ( ) ; int atomPosition = ac . indexOf ( atom ) ; int start = ( stepSize * ( atomPosition ) + atomPosition ) ; electronegativity = ( ( marsiliFactors [ start ] ) + ( molSigma . getAtom ( atomPosition ) . getCharge ( ) * marsiliFactors [ start + 1 ] ) + ( marsiliFactors [ start + 2 ] * ( ( molSigma . getAtom ( atomPosition ) . getCharge ( ) * molSigma . getAtom ( atomPosition ) . getCharge ( ) ) ) ) ) ; return electronegativity ; } catch ( Exception e ) { logger . error ( e ) ; } return electronegativity ;
public class PixelMath { /** * Multiply each element by a scalar value . Both input and output images can * be the same instance . * @ param input The input image . Not modified . * @ param value What each element is multiplied by . * @ param output The output image . Modified . */ public static void multiply ( GrayU8 input , double value , GrayU8 output ) { } }
output . reshape ( input . width , input . height ) ; int columns = input . width ; if ( BoofConcurrency . USE_CONCURRENT ) { ImplPixelMath_MT . multiplyU_A ( input . data , input . startIndex , input . stride , value , output . data , output . startIndex , output . stride , input . height , columns ) ; } else { ImplPixelMath . multiplyU_A ( input . data , input . startIndex , input . stride , value , output . data , output . startIndex , output . stride , input . height , columns ) ; }
public class ID3v2Header { /** * Checks to see if there is an id3v2 header in the file provided to the * constructor . * @ return true if an id3v2 header exists in the file * @ exception FileNotFoundException if an error occurs * @ exception IOException if an error occurs */ private boolean checkHeader ( RandomAccessInputStream raf ) throws IOException { } }
raf . seek ( HEAD_LOCATION ) ; byte [ ] buf = new byte [ HEAD_SIZE ] ; if ( raf . read ( buf ) != HEAD_SIZE ) { throw new IOException ( "Error encountered finding id3v2 header" ) ; } String result = new String ( buf , ENC_TYPE ) ; if ( result . substring ( 0 , TAG_START . length ( ) ) . equals ( TAG_START ) ) { if ( ( ( ( int ) buf [ 3 ] & 0xFF ) < 0xff ) && ( ( ( int ) buf [ 4 ] & 0xFF ) < 0xff ) ) { if ( ( ( ( int ) buf [ 6 ] & 0xFF ) < 0x80 ) && ( ( ( int ) buf [ 7 ] & 0xFF ) < 0x80 ) && ( ( ( int ) buf [ 8 ] & 0xFF ) < 0x80 ) && ( ( ( int ) buf [ 9 ] & 0xFF ) < 0x80 ) ) { return true ; } } } return false ;
public class MPXReader { /** * { @ inheritDoc } */ @ Override public ProjectFile read ( InputStream is ) throws MPXJException { } }
int line = 1 ; try { // Test the header and extract the separator . If this is successful , // we reset the stream back as far as we can . The design of the // BufferedInputStream class means that we can ' t get back to character // zero , so the first record we will read will get " PX " rather than // " MPX " in the first field position . BufferedInputStream bis = new BufferedInputStream ( is ) ; byte [ ] data = new byte [ 4 ] ; data [ 0 ] = ( byte ) bis . read ( ) ; bis . mark ( 1024 ) ; data [ 1 ] = ( byte ) bis . read ( ) ; data [ 2 ] = ( byte ) bis . read ( ) ; data [ 3 ] = ( byte ) bis . read ( ) ; if ( ( data [ 0 ] != 'M' ) || ( data [ 1 ] != 'P' ) || ( data [ 2 ] != 'X' ) ) { throw new MPXJException ( MPXJException . INVALID_FILE ) ; } m_projectFile = new ProjectFile ( ) ; m_eventManager = m_projectFile . getEventManager ( ) ; m_projectConfig = m_projectFile . getProjectConfig ( ) ; m_projectConfig . setAutoTaskID ( false ) ; m_projectConfig . setAutoTaskUniqueID ( false ) ; m_projectConfig . setAutoResourceID ( false ) ; m_projectConfig . setAutoResourceUniqueID ( false ) ; m_projectConfig . setAutoOutlineLevel ( false ) ; m_projectConfig . setAutoOutlineNumber ( false ) ; m_projectConfig . setAutoWBS ( false ) ; m_eventManager . addProjectListeners ( m_projectListeners ) ; LocaleUtility . setLocale ( m_projectFile . getProjectProperties ( ) , m_locale ) ; m_delimiter = ( char ) data [ 3 ] ; m_projectFile . getProjectProperties ( ) . setMpxDelimiter ( m_delimiter ) ; m_projectFile . getProjectProperties ( ) . setFileApplication ( "Microsoft" ) ; m_projectFile . getProjectProperties ( ) . setFileType ( "MPX" ) ; m_taskModel = new TaskModel ( m_projectFile , m_locale ) ; m_taskModel . setLocale ( m_locale ) ; m_resourceModel = new ResourceModel ( m_projectFile , m_locale ) ; m_resourceModel . setLocale ( m_locale ) ; m_baseOutlineLevel = - 1 ; m_formats = new MPXJFormats ( m_locale , LocaleData . getString ( m_locale , LocaleData . NA ) , m_projectFile ) ; m_deferredRelationships = new LinkedList < DeferredRelationship > ( ) ; bis . reset ( ) ; // Read the file creation record . At this point we are reading // directly from an input stream so no character set decoding is // taking place . We assume that any text in this record will not // require decoding . Tokenizer tk = new InputStreamTokenizer ( bis ) ; tk . setDelimiter ( m_delimiter ) ; // Add the header record parseRecord ( Integer . valueOf ( MPXConstants . FILE_CREATION_RECORD_NUMBER ) , new Record ( m_locale , tk , m_formats ) ) ; ++ line ; // Now process the remainder of the file in full . As we have read the // file creation record we have access to the field which specifies the // codepage used to encode the character set in this file . We set up // an input stream reader using the appropriate character set , and // create a new tokenizer to read from this Reader instance . InputStreamReader reader = new InputStreamReader ( bis , m_projectFile . getProjectProperties ( ) . getMpxCodePage ( ) . getCharset ( ) ) ; tk = new ReaderTokenizer ( reader ) ; tk . setDelimiter ( m_delimiter ) ; // Read the remainder of the records while ( tk . getType ( ) != Tokenizer . TT_EOF ) { Record record = new Record ( m_locale , tk , m_formats ) ; Integer number = record . getRecordNumber ( ) ; if ( number != null ) { parseRecord ( number , record ) ; } ++ line ; } processDeferredRelationships ( ) ; // Ensure that the structure is consistent m_projectFile . updateStructure ( ) ; // Ensure that the unique ID counters are correct m_projectConfig . updateUniqueCounters ( ) ; m_projectConfig . setAutoCalendarUniqueID ( false ) ; return ( m_projectFile ) ; } catch ( Exception ex ) { throw new MPXJException ( MPXJException . READ_ERROR + " (failed at line " + line + ")" , ex ) ; } finally { m_projectFile = null ; m_lastTask = null ; m_lastResource = null ; m_lastResourceCalendar = null ; m_lastResourceAssignment = null ; m_lastBaseCalendar = null ; m_resourceTableDefinition = false ; m_taskTableDefinition = false ; m_taskModel = null ; m_resourceModel = null ; m_formats = null ; m_deferredRelationships = null ; }
public class TsiHandshakeHandler { /** * Sends as many bytes as are available from the handshaker to the remote peer . */ private void sendHandshake ( ChannelHandlerContext ctx ) { } }
boolean needToFlush = false ; // Iterate until there is nothing left to write . while ( true ) { buffer = getOrCreateBuffer ( ctx . alloc ( ) ) ; try { handshaker . getBytesToSendToPeer ( buffer ) ; } catch ( GeneralSecurityException e ) { throw new RuntimeException ( e ) ; } if ( ! buffer . isReadable ( ) ) { break ; } needToFlush = true ; @ SuppressWarnings ( "unused" ) // go / futurereturn - lsc Future < ? > possiblyIgnoredError = ctx . write ( buffer ) ; buffer = null ; } // If something was written , flush . if ( needToFlush ) { ctx . flush ( ) ; }
public class ClientFactoryBuilder { /** * Adds the specified { @ link Consumer } which customizes the given { @ link DnsNameResolverBuilder } . * This method is useful when you want to change the behavior of the default domain name resolver , such as * changing the DNS server list . * @ throws IllegalStateException if { @ link # addressResolverGroupFactory ( Function ) } was called already . */ public ClientFactoryBuilder domainNameResolverCustomizer ( Consumer < ? super DnsNameResolverBuilder > domainNameResolverCustomizer ) { } }
requireNonNull ( domainNameResolverCustomizer , "domainNameResolverCustomizer" ) ; checkState ( addressResolverGroupFactory == null , "addressResolverGroupFactory() and domainNameResolverCustomizer() are mutually exclusive." ) ; if ( domainNameResolverCustomizers == null ) { domainNameResolverCustomizers = new ArrayList < > ( ) ; } domainNameResolverCustomizers . add ( domainNameResolverCustomizer ) ; return this ;
public class HiveMetaStoreClientCompatibility12x { /** * Copied from Hive 1.2.1 ThriftHiveMetastore . Client # send _ get _ table ( String , String ) - see * https : / / raw . githubusercontent . com / apache / hive / release - 1.2.1 / metastore / src / gen / thrift / gen - javabean / org / apache / hadoop * / hive / metastore / metastore / ThriftHiveMetastore . java */ private void send_get_table ( String dbname , String tbl_name ) throws TException { } }
ThriftHiveMetastore . get_table_args args = new ThriftHiveMetastore . get_table_args ( ) ; args . setDbname ( dbname ) ; args . setTbl_name ( tbl_name ) ; sendBase ( "get_table" , args ) ;
public class Matcher { /** * This method allows to efficiently pass data between matchers . * Note that a matcher may pass data to itself : < pre > * Matcher m = new Pattern ( " \ \ w + " ) . matcher ( myString ) ; * if ( m . find ( ) ) m . setTarget ( m , m . SUFFIX ) ; / / forget all that is not a suffix * < / pre > * Resets current search position to zero . * @ param m - a matcher that is a source of data * @ param groupId - which group to take data from * @ see Matcher # setTarget ( java . lang . CharSequence ) * @ see Matcher # setTarget ( java . lang . CharSequence , int , int ) * @ see Matcher # setTarget ( char [ ] , int , int ) * @ see Matcher # setTarget ( java . io . Reader , int ) */ public final void setTarget ( Matcher m , int groupId ) { } }
MemReg mr = m . bounds ( groupId ) ; if ( mr == null ) throw new IllegalArgumentException ( "group #" + groupId + " is not assigned" ) ; data = m . data ; offset = mr . in ; end = mr . out ; cache = m . cache ; cacheLength = m . cacheLength ; cacheOffset = m . cacheOffset ; if ( m != this ) { shared = true ; m . shared = true ; } init ( ) ;
public class JStormMetrics { /** * reserve for debug purposes */ public static AsmMetric find ( String name ) { } }
for ( AsmMetricRegistry registry : allRegistries ) { AsmMetric metric = registry . getMetric ( name ) ; if ( metric != null ) { return metric ; } } return null ;
public class hqlParser { /** * hql . g : 267:1 : selectObject : OBJECT ^ OPEN ! identifier CLOSE ! ; */ public final hqlParser . selectObject_return selectObject ( ) throws RecognitionException { } }
hqlParser . selectObject_return retval = new hqlParser . selectObject_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; Token OBJECT54 = null ; Token OPEN55 = null ; Token CLOSE57 = null ; ParserRuleReturnScope identifier56 = null ; CommonTree OBJECT54_tree = null ; CommonTree OPEN55_tree = null ; CommonTree CLOSE57_tree = null ; try { // hql . g : 268:4 : ( OBJECT ^ OPEN ! identifier CLOSE ! ) // hql . g : 268:6 : OBJECT ^ OPEN ! identifier CLOSE ! { root_0 = ( CommonTree ) adaptor . nil ( ) ; OBJECT54 = ( Token ) match ( input , OBJECT , FOLLOW_OBJECT_in_selectObject1095 ) ; OBJECT54_tree = ( CommonTree ) adaptor . create ( OBJECT54 ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( OBJECT54_tree , root_0 ) ; OPEN55 = ( Token ) match ( input , OPEN , FOLLOW_OPEN_in_selectObject1098 ) ; pushFollow ( FOLLOW_identifier_in_selectObject1101 ) ; identifier56 = identifier ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , identifier56 . getTree ( ) ) ; CLOSE57 = ( Token ) match ( input , CLOSE , FOLLOW_CLOSE_in_selectObject1103 ) ; } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving } return retval ;
public class WeightBuckets { /** * = = = = = helper method = = = = = */ private int indexedSearch ( List < WeightBucket < T > > list , WeightBucket < T > item ) { } }
int i = 0 ; for ( ; i < list . size ( ) ; i ++ ) { Comparable midVal = list . get ( i ) ; int cmp = midVal . compareTo ( item ) ; if ( cmp == 0 ) { // item等于中间值 return i ; } else if ( cmp > 0 ) { // item比中间值小 return i ; } else if ( cmp < 0 ) { // item比中间值大 // next } } return i ;
public class Assert { /** * Asserts that condition is < code > false < / code > */ public static void assertFalse ( boolean condition , String message ) { } }
if ( imp != null && condition ) { imp . assertFailed ( message ) ; }
public class AbstractInjectionDetector { /** * Once the analysis is completed , all the collected sinks are reported as bugs . */ @ Override public void report ( ) { } }
// collect sinks and report each once Set < InjectionSink > injectionSinksToReport = new HashSet < InjectionSink > ( ) ; for ( Set < InjectionSink > injectionSinkSet : injectionSinks . values ( ) ) { for ( InjectionSink injectionSink : injectionSinkSet ) { injectionSinksToReport . add ( injectionSink ) ; } } for ( InjectionSink injectionSink : injectionSinksToReport ) { bugReporter . reportBug ( injectionSink . generateBugInstance ( false ) ) ; }
public class SimpleTaglet { /** * { @ inheritDoc } */ public Content getTagletOutput ( Tag tag , TagletWriter writer ) { } }
return header == null || tag == null ? null : writer . simpleTagOutput ( tag , header ) ;
public class ProjectTreeController { /** * Add an exception to a calendar . * @ param parentNode parent node * @ param exception calendar exceptions */ private void addCalendarException ( MpxjTreeNode parentNode , final ProjectCalendarException exception ) { } }
MpxjTreeNode exceptionNode = new MpxjTreeNode ( exception , CALENDAR_EXCEPTION_EXCLUDED_METHODS ) { @ Override public String toString ( ) { return m_dateFormat . format ( exception . getFromDate ( ) ) ; } } ; parentNode . add ( exceptionNode ) ; addHours ( exceptionNode , exception ) ;