signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ResourceProcessor { /** * d543514 */
static AuthenticationType convertAuthToEnum ( int resAuthType ) { } } | AuthenticationType authType = AuthenticationType . CONTAINER ; if ( resAuthType == ResourceRef . AUTH_APPLICATION ) { authType = AuthenticationType . APPLICATION ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "convertAuthToEnum : " + resAuthType + " -> " + authType ) ; return authType ; |
public class CloseCallbacks { /** * Returns a { @ link CloseCallback } that shows a confirmation dialog that
* asks the given question
* @ param question The question
* @ return The { @ link CloseCallback } */
public static CloseCallback confirming ( String question ) { } } | return new CloseCallback ( ) { @ Override public boolean mayClose ( Component componentInTab ) { int option = JOptionPane . showConfirmDialog ( componentInTab , question , "Confirm" , JOptionPane . YES_NO_OPTION ) ; return option == JOptionPane . YES_OPTION ; } } ; |
public class CmsLogFileApp { /** * Button to refresh the file view . < p > */
private void addRefreshButton ( ) { } } | Button button = CmsToolBar . createButton ( FontOpenCms . RESET , CmsVaadinUtils . getMessageText ( Messages . GUI_LOGFILE_REFRESH_FILEVIEW_0 ) ) ; button . addClickListener ( new ClickListener ( ) { private static final long serialVersionUID = 1L ; public void buttonClick ( ClickEvent event ) { m_fileView . updateView ( ) ; } } ) ; m_uiContext . addToolbarButton ( button ) ; |
public class JavacHandlerUtil { /** * Creates an expression that reads the field . Will either be { @ code this . field } or { @ code this . getField ( ) } depending on whether or not there ' s a getter . */
static JCExpression createFieldAccessor ( JavacTreeMaker maker , JavacNode field , FieldAccess fieldAccess ) { } } | return createFieldAccessor ( maker , field , fieldAccess , null ) ; |
public class RuntimeConfiguration { /** * Converts a string specifying an IPv4 address into an integer . The string can be either a single integer ( representing
* the address ) or a dot - separated 4 - tuple of bytes .
* @ param s the string to be converted .
* @ return the integer representing the IP address specified by s .
* @ throws ConfigurationException */
private int handleIPv4 ( final String s ) throws ConfigurationException { } } | try { if ( ! RuntimeConfiguration . DOTTED_ADDRESS . matcher ( s ) . matches ( ) ) throw new ConfigurationException ( "Malformed IPv4 " + s + " for blacklisting" ) ; // Note that since we ' re sure this is a dotted - notation address , we pass directly through InetAddress .
final byte [ ] address = InetAddress . getByName ( s ) . getAddress ( ) ; if ( address . length > 4 ) throw new UnknownHostException ( "Not IPv4" ) ; return Ints . fromByteArray ( address ) ; } catch ( final UnknownHostException e ) { throw new ConfigurationException ( "Malformed IPv4 " + s + " for blacklisting" , e ) ; } |
public class TTextProtocol { /** * Helper to write out the beginning of a Thrift type ( either struct or map ) ,
* both of which are written as JsonObjects . */
private void writeJsonObjectBegin ( BaseContext context ) throws TException { } } | getCurrentContext ( ) . write ( ) ; if ( getCurrentContext ( ) . isMapKey ( ) ) { pushWriter ( new ByteArrayOutputStream ( ) ) ; } pushContext ( context ) ; try { getCurrentWriter ( ) . writeStartObject ( ) ; } catch ( IOException ex ) { throw new TException ( ex ) ; } |
public class Strings { /** * A more human - friendly version of Arrays # toString ( byte [ ] ) that uses hex representation . */
private static String byteArrayToString ( byte [ ] bytes ) { } } | StringBuilder builder = new StringBuilder ( "[" ) ; for ( int i = 0 ; i < bytes . length ; i ++ ) { if ( i > 0 ) { builder . append ( ", " ) ; } builder . append ( byteToString ( bytes [ i ] ) ) ; } return builder . append ( ']' ) . toString ( ) ; |
public class HashIntMap { /** * documentation inherited */
public V get ( int key ) { } } | Record < V > rec = getImpl ( key ) ; return ( rec == null ) ? null : rec . value ; |
public class WhileyFileParser { /** * Parse a switch statement , which has the form :
* < pre >
* SwitchStmt : : = " switch " Expr ' : ' NewLine CaseStmt +
* CaseStmt : : = " case " UnitExpr ( ' , ' UnitExpr ) * ' : ' NewLine Block
* < / pre >
* @ see wyc . lang . Stmt . Switch
* @ param scope
* The enclosing scope for this statement , which determines the
* set of visible ( i . e . declared ) variables and also the current
* indentation level .
* @ return
* @ author David J . Pearce */
private Stmt parseSwitchStatement ( EnclosingScope scope ) { } } | int start = index ; match ( Switch ) ; // NOTE : expression terminated by ' : '
Expr condition = parseExpression ( scope , true ) ; match ( Colon ) ; int end = index ; matchEndLine ( ) ; // Match case block
Tuple < Stmt . Case > cases = parseCaseBlock ( scope ) ; // Done
return annotateSourceLocation ( new Stmt . Switch ( condition , cases ) , start , end - 1 ) ; |
public class ConfigUtils { /** * Returns the specified Boolean property from the configuration
* @ param config the configuration
* @ param key the key of the property
* @ return the Boolean value of the property , or null if not found
* @ throws DeployerConfigurationException if an error occurred */
public static Boolean getBooleanProperty ( Configuration config , String key ) throws DeployerConfigurationException { } } | return getBooleanProperty ( config , key , null ) ; |
public class ReflectUtil { /** * Gets the new instance .
* @ param clazz the clazz
* @ return the new instance */
public I getNewInstance ( Class < I > clazz ) { } } | Constructor < I > ctor ; try { ctor = clazz . getConstructor ( ) ; return ctor . newInstance ( ) ; } catch ( NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { throw new InitializationException ( "Given class not found" , e ) ; } |
public class DateTimePatternGenerator { /** * Used by CLDR tooling ; not in ICU4C .
* Note , this will not work correctly with normal skeletons , since fields
* that should be related in the two skeletons being compared - like EEE and
* ccc , or y and U - will not be sorted in the same relative place as each
* other when iterating over both TreeSets being compare , using TreeSet ' s
* " natural " code point ordering ( this could be addressed by initializing
* the TreeSet with a comparator that compares fields first by their index
* from getCanonicalIndex ( ) ) . However if comparing canonical skeletons from
* getCanonicalSkeletonAllowingDuplicates it will be OK regardless , since
* in these skeletons all fields are normalized to the canonical pattern
* char for those fields - M or L to M , E or c to E , y or U to y , etc . -
* so corresponding fields will sort in the same way for both TreeMaps .
* @ deprecated This API is ICU internal only .
* @ hide original deprecated declaration
* @ hide draft / provisional / internal are hidden on Android */
@ Deprecated public boolean skeletonsAreSimilar ( String id , String skeleton ) { } } | if ( id . equals ( skeleton ) ) { return true ; // fast path
} // must clone array , make sure items are in same order .
TreeSet < String > parser1 = getSet ( id ) ; TreeSet < String > parser2 = getSet ( skeleton ) ; if ( parser1 . size ( ) != parser2 . size ( ) ) { return false ; } Iterator < String > it2 = parser2 . iterator ( ) ; for ( String item : parser1 ) { int index1 = getCanonicalIndex ( item , false ) ; String item2 = it2 . next ( ) ; // same length so safe
int index2 = getCanonicalIndex ( item2 , false ) ; if ( types [ index1 ] [ 1 ] != types [ index2 ] [ 1 ] ) { return false ; } } return true ; |
public class ThreadGroup { /** * Tests if this thread group is either the thread group
* argument or one of its ancestor thread groups .
* @ param g a thread group .
* @ return < code > true < / code > if this thread group is the thread group
* argument or one of its ancestor thread groups ;
* < code > false < / code > otherwise .
* @ since JDK1.0 */
public final boolean parentOf ( ThreadGroup g ) { } } | for ( ; g != null ; g = g . parent ) { if ( g == this ) { return true ; } } return false ; |
public class HashOrderIndependent { /** * ( non - Javadoc )
* @ see
* com . netflix . videometadata . serializer . blob . HashAlgorithm # write ( java . lang
* . String ) */
@ Override public void write ( String b ) throws IOException { } } | long code = 0 ; for ( int i = 0 ; i < b . length ( ) ; i ++ ) { code = 31 * code + b . charAt ( i ) ; } hashCode += hash ( code ) ; |
public class PropertyUtils { /** * Get an integer property from the properties .
* @ param properties the provided properties
* @ return the integer property */
public static Integer getIntegerProperty ( Properties properties , String key ) { } } | String property = getStringProperty ( properties , key ) ; if ( property == null ) { return null ; } Integer value ; try { value = Integer . parseInt ( property ) ; } catch ( RuntimeException e ) { throw new ODataClientRuntimeException ( "Unable to parse property. " + property , e ) ; } return value ; |
public class JTSPolygonExpression { /** * Returns the N th interior ring for this Polygon as a LineString .
* @ param idx one based index
* @ return interior ring at index */
public JTSLineStringExpression < LineString > interiorRingN ( int idx ) { } } | return JTSGeometryExpressions . lineStringOperation ( SpatialOps . INTERIOR_RINGN , mixin , ConstantImpl . create ( idx ) ) ; |
public class EmailMessageTransport { /** * Send the message and ( optionally ) get the reply .
* @ param nodeMessage The XML tree to send .
* @ param strDest The destination URL string .
* @ return The reply message ( or null if none ) . */
public BaseMessage sendMessageRequest ( BaseMessage messageOut ) { } } | // create some properties and get the default Session
TrxMessageHeader trxMessageHeader = ( TrxMessageHeader ) messageOut . getMessageHeader ( ) ; String strFrom = ( String ) trxMessageHeader . get ( TrxMessageHeader . REPLY_TO_PARAM ) ; if ( strFrom == null ) strFrom = this . getProperty ( ( TrxMessageHeader ) messageOut . getMessageHeader ( ) , TrxMessageHeader . REPLY_TO_PARAM ) ; // See if there is an email default .
String strSubject = ( String ) trxMessageHeader . get ( SUBJECT_PARAM ) ; String strTrxID = ( String ) trxMessageHeader . get ( TrxMessageHeader . LOG_TRX_ID ) ; if ( strSubject == null ) strSubject = "Message" ; // Lame
if ( strTrxID != null ) strSubject = strSubject + " (" + strTrxID + ")" ; Properties props = new Properties ( ) ; String strSendBy = ( String ) trxMessageHeader . get ( SEND_TRANSPORT ) ; if ( strSendBy == null ) strSendBy = "smtp" ; String strHost = ( String ) trxMessageHeader . get ( SMTP_HOST ) ; if ( strHost == null ) strHost = ( String ) trxMessageHeader . get ( HOST_PARAM ) ; props . put ( SMTP_HOST , strHost ) ; String strAuth = ( String ) trxMessageHeader . get ( SMTP_AUTH ) ; // " true " ?
if ( strAuth != null ) props . put ( SMTP_AUTH , strAuth ) ; if ( ( String ) trxMessageHeader . get ( SMTP_TLS ) != null ) // " true " ?
props . put ( SMTP_TLS , ( String ) trxMessageHeader . get ( SMTP_TLS ) ) ; if ( ( String ) trxMessageHeader . get ( "mail.smtp.socketFactory.port" ) != null ) props . put ( "mail.smtp.socketFactory.port" , ( String ) trxMessageHeader . get ( "mail.smtp.socketFactory.port" ) ) ; if ( ( String ) trxMessageHeader . get ( "mail.smtp.socketFactory.class" ) != null ) props . put ( "mail.smtp.socketFactory.class" , ( String ) trxMessageHeader . get ( "mail.smtp.socketFactory.class" ) ) ; if ( ( String ) trxMessageHeader . get ( "mail.smtp.socketFactory.fallback" ) != null ) props . put ( "mail.smtp.socketFactory.fallback" , ( String ) trxMessageHeader . get ( "mail.smtp.socketFactory.fallback" ) ) ; Session session = Session . getDefaultInstance ( props ) ; Properties sessionProp = session . getProperties ( ) ; if ( ! sessionProp . equals ( props ) ) session = Session . getInstance ( props ) ; session . setDebug ( DEBUG ) ; String username = ( String ) trxMessageHeader . get ( SMTP_USERNAME ) ; if ( username == null ) if ( DBConstants . TRUE . equalsIgnoreCase ( strAuth ) ) username = strFrom ; String password = ( String ) trxMessageHeader . get ( SMTP_PASSWORD ) ; password = PasswordPropertiesField . decrypt ( password ) ; Transport transport = null ; String strDest = this . getDestination ( trxMessageHeader ) ; MimeMessage msg = new MimeMessage ( session ) ; try { InternetAddress sender = new InternetAddress ( strFrom ) ; InternetAddress [ ] address = { new InternetAddress ( strDest ) } ; msg . setFrom ( sender ) ; msg . setRecipients ( Message . RecipientType . TO , address ) ; msg . setSubject ( strSubject ) ; msg . setSentDate ( new Date ( ) ) ; String msgHtml = ( String ) messageOut . get ( ManualMessage . MESSAGE_PARAM ) ; // The physical message
if ( msgHtml == null ) msgHtml = ( String ) messageOut . getExternalMessage ( ) . getRawData ( ) ; if ( msgHtml == null ) msgHtml = "" ; // add the Multipart to the message
String strContentType = ( String ) trxMessageHeader . get ( CONTENT_TYPE_PARAM ) ; if ( strContentType == null ) strContentType = "text/html" ; msg . setContent ( msgHtml , strContentType ) ; msg . saveChanges ( ) ; transport = session . getTransport ( strSendBy ) ; // if ( DBConstants . TRUE . equalsIgnoreCase ( strAuth ) )
transport . connect ( strHost , username , password ) ; // xaddress = msg . getAllRecipients ( ) ; / / Don ' t do this - bug in javax . mail
transport . sendMessage ( msg , address ) ; // send the message
this . logMessage ( strTrxID , messageOut , MessageInfoTypeModel . REQUEST , MessageTypeModel . MESSAGE_OUT , MessageStatusModel . SENT , null , null , null , - 1 , - 1 , msg , strDest ) ; } catch ( MessagingException mex ) { mex . printStackTrace ( ) ; String strError = mex . getMessage ( ) ; Exception ex = null ; if ( ( ex = mex . getNextException ( ) ) != null ) { strError = strError + ", " + ex . getMessage ( ) ; ex . printStackTrace ( ) ; } this . logMessage ( strTrxID , messageOut , MessageInfoTypeModel . REQUEST , MessageTypeModel . MESSAGE_OUT , MessageStatusModel . ERROR , null , null , strError , - 1 , - 1 , msg , strDest ) ; } finally { try { transport . close ( ) ; } catch ( Exception e ) { } } return null ; // You never have an ( immediate ) reply from an email request . |
public class JsonArray { /** * Convenience method to prevent casting JsonElement to Long when iterating in the common case that you have
* an array of longs .
* @ return iterable that iterates over Longs instead of JsonElements . */
public @ Nonnull Iterable < Long > longs ( ) { } } | final JsonArray parent = this ; return ( ) -> { final Iterator < JsonElement > iterator = parent . iterator ( ) ; return new Iterator < Long > ( ) { @ Override public boolean hasNext ( ) { return iterator . hasNext ( ) ; } @ Override public Long next ( ) { return iterator . next ( ) . asLong ( ) ; } @ Override public void remove ( ) { iterator . remove ( ) ; } } ; } ; |
public class DocumentSubscriptions { /** * Creates a data subscription in a database . The subscription will expose all documents that match the specified subscription options for a given type .
* @ param options Subscription options
* @ param clazz Document class
* @ param < T > Document class
* @ param database Target database
* @ return created subscription */
public < T > String createForRevisions ( Class < T > clazz , SubscriptionCreationOptions options , String database ) { } } | options = ObjectUtils . firstNonNull ( options , new SubscriptionCreationOptions ( ) ) ; return create ( ensureCriteria ( options , clazz , true ) , database ) ; |
public class UnicodeEncoding { /** * onigenc _ unicode _ apply _ all _ case _ fold */
@ Override public void applyAllCaseFold ( int flag , ApplyAllCaseFoldFunction fun , Object arg ) { } } | /* if ( CaseFoldInited = = 0 ) init _ case _ fold _ table ( ) ; */
int [ ] code = new int [ ] { 0 } ; for ( int i = 0 ; i < CaseUnfold11 . From . length ; i ++ ) { int from = CaseUnfold11 . From [ i ] ; CodeList to = CaseUnfold11 . To [ i ] ; for ( int j = 0 ; j < to . codes . length ; j ++ ) { code [ 0 ] = from ; fun . apply ( to . codes [ j ] , code , 1 , arg ) ; code [ 0 ] = to . codes [ j ] ; fun . apply ( from , code , 1 , arg ) ; for ( int k = 0 ; k < j ; k ++ ) { code [ 0 ] = to . codes [ k ] ; fun . apply ( to . codes [ j ] , code , 1 , arg ) ; code [ 0 ] = to . codes [ j ] ; fun . apply ( to . codes [ k ] , code , 1 , arg ) ; } } } if ( Config . USE_UNICODE_CASE_FOLD_TURKISH_AZERI && ( flag & Config . CASE_FOLD_TURKISH_AZERI ) != 0 ) { code [ 0 ] = DOTLESS_i ; fun . apply ( 'I' , code , 1 , arg ) ; code [ 0 ] = 'I' ; fun . apply ( DOTLESS_i , code , 1 , arg ) ; code [ 0 ] = I_WITH_DOT_ABOVE ; fun . apply ( 'i' , code , 1 , arg ) ; code [ 0 ] = 'i' ; fun . apply ( I_WITH_DOT_ABOVE , code , 1 , arg ) ; } else { for ( int i = 0 ; i < CaseUnfold11 . Locale_From . length ; i ++ ) { int from = CaseUnfold11 . Locale_From [ i ] ; CodeList to = CaseUnfold11 . Locale_To [ i ] ; for ( int j = 0 ; j < to . codes . length ; j ++ ) { code [ 0 ] = from ; fun . apply ( to . codes [ j ] , code , 1 , arg ) ; code [ 0 ] = to . codes [ j ] ; fun . apply ( from , code , 1 , arg ) ; for ( int k = 0 ; k < j ; k ++ ) { code [ 0 ] = to . codes [ k ] ; fun . apply ( to . codes [ j ] , code , 1 , arg ) ; code [ 0 ] = to . codes [ j ] ; fun . apply ( to . codes [ k ] , code , 1 , arg ) ; } } } } // USE _ UNICODE _ CASE _ FOLD _ TURKISH _ AZERI
if ( ( flag & Config . INTERNAL_ENC_CASE_FOLD_MULTI_CHAR ) != 0 ) { for ( int i = 0 ; i < CaseUnfold12 . From . length ; i ++ ) { int [ ] from = CaseUnfold12 . From [ i ] ; CodeList to = CaseUnfold12 . To [ i ] ; for ( int j = 0 ; j < to . codes . length ; j ++ ) { fun . apply ( to . codes [ j ] , from , 2 , arg ) ; for ( int k = 0 ; k < to . codes . length ; k ++ ) { if ( k == j ) continue ; code [ 0 ] = to . codes [ k ] ; fun . apply ( to . codes [ j ] , code , 1 , arg ) ; } } } if ( ! Config . USE_UNICODE_CASE_FOLD_TURKISH_AZERI || ( flag & Config . CASE_FOLD_TURKISH_AZERI ) == 0 ) { for ( int i = 0 ; i < CaseUnfold12 . Locale_From . length ; i ++ ) { int [ ] from = CaseUnfold12 . Locale_From [ i ] ; CodeList to = CaseUnfold12 . Locale_To [ i ] ; for ( int j = 0 ; j < to . codes . length ; j ++ ) { fun . apply ( to . codes [ j ] , from , 2 , arg ) ; for ( int k = 0 ; k < to . codes . length ; k ++ ) { if ( k == j ) continue ; code [ 0 ] = to . codes [ k ] ; fun . apply ( to . codes [ j ] , code , 1 , arg ) ; } } } } // ! USE _ UNICODE _ CASE _ FOLD _ TURKISH _ AZERI
for ( int i = 0 ; i < CaseUnfold13 . From . length ; i ++ ) { int [ ] from = CaseUnfold13 . From [ i ] ; CodeList to = CaseUnfold13 . To [ i ] ; for ( int j = 0 ; j < to . codes . length ; j ++ ) { fun . apply ( to . codes [ j ] , from , 3 , arg ) ; for ( int k = 0 ; k < to . codes . length ; k ++ ) { if ( k == j ) continue ; code [ 0 ] = to . codes [ k ] ; fun . apply ( to . codes [ j ] , code , 1 , arg ) ; } } } } // INTERNAL _ ENC _ CASE _ FOLD _ MULTI _ CHAR |
public class ChemModelManipulator { /** * Sets the AtomProperties of all Atoms inside an IChemModel .
* @ param chemModel The IChemModel object .
* @ param propKey The key of the property .
* @ param propVal The value of the property . */
public static void setAtomProperties ( IChemModel chemModel , Object propKey , Object propVal ) { } } | if ( chemModel . getMoleculeSet ( ) != null ) { MoleculeSetManipulator . setAtomProperties ( chemModel . getMoleculeSet ( ) , propKey , propVal ) ; } if ( chemModel . getReactionSet ( ) != null ) { ReactionSetManipulator . setAtomProperties ( chemModel . getReactionSet ( ) , propKey , propVal ) ; } if ( chemModel . getCrystal ( ) != null ) { AtomContainerManipulator . setAtomProperties ( chemModel . getCrystal ( ) , propKey , propVal ) ; } |
public class BitmapUtil { /** * Compresses a specific bitmap and returns it as a byte array .
* @ param bitmap
* The bitmap , which should be compressed , as an instance of the class { @ link Bitmap } .
* The bitmap may not be null
* @ param format
* The format , which should be used to compress the bitmap , as a value of the enum
* { @ link CompressFormat } . The format must either be < code > JPEG < / code > , < code > PNG < / code >
* or < code > WEBP < / code >
* @ param quality
* The quality , which should be used to compress the bitmap , as an { @ link Integer }
* value . The quality must be at least 0 ( lowest quality ) and at maximum 100 ( highest
* quality )
* @ return The byte array , the given bitmap has been compressed to , as a { @ link Byte } array
* @ throws IOException
* The exception , which is thrown , if an error occurs while compressing the bitmap */
public static byte [ ] compressToByteArray ( @ NonNull final Bitmap bitmap , @ NonNull final CompressFormat format , final int quality ) throws IOException { } } | Condition . INSTANCE . ensureNotNull ( bitmap , "The bitmap may not be null" ) ; Condition . INSTANCE . ensureNotNull ( format , "The format may not be null" ) ; Condition . INSTANCE . ensureAtLeast ( quality , 0 , "The quality must be at least 0" ) ; Condition . INSTANCE . ensureAtMaximum ( quality , 100 , "The quality must be at maximum 100" ) ; ByteArrayOutputStream outputStream = null ; try { outputStream = new ByteArrayOutputStream ( ) ; boolean result = bitmap . compress ( format , quality , outputStream ) ; if ( result ) { return outputStream . toByteArray ( ) ; } throw new IOException ( "Failed to compress bitmap to byte array using format " + format + " and quality " + quality ) ; } finally { StreamUtil . INSTANCE . close ( outputStream ) ; } |
public class AmazonElastiCacheWaiters { /** * Builds a CacheClusterAvailable waiter by using custom parameters waiterParameters and other parameters defined in
* the waiters specification , and then polls until it determines whether the resource entered the desired state or
* not , where polling criteria is bound by either default polling strategy or custom polling strategy . */
public Waiter < DescribeCacheClustersRequest > cacheClusterAvailable ( ) { } } | return new WaiterBuilder < DescribeCacheClustersRequest , DescribeCacheClustersResult > ( ) . withSdkFunction ( new DescribeCacheClustersFunction ( client ) ) . withAcceptors ( new CacheClusterAvailable . IsAvailableMatcher ( ) , new CacheClusterAvailable . IsDeletedMatcher ( ) , new CacheClusterAvailable . IsDeletingMatcher ( ) , new CacheClusterAvailable . IsIncompatiblenetworkMatcher ( ) , new CacheClusterAvailable . IsRestorefailedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; |
public class PdfPatternPainter { /** * Gets a duplicate of this < CODE > PdfPatternPainter < / CODE > . All
* the members are copied by reference but the buffer stays different .
* @ return a copy of this < CODE > PdfPatternPainter < / CODE > */
public PdfContentByte getDuplicate ( ) { } } | PdfPatternPainter tpl = new PdfPatternPainter ( ) ; tpl . writer = writer ; tpl . pdf = pdf ; tpl . thisReference = thisReference ; tpl . pageResources = pageResources ; tpl . bBox = new Rectangle ( bBox ) ; tpl . xstep = xstep ; tpl . ystep = ystep ; tpl . matrix = matrix ; tpl . stencil = stencil ; tpl . defaultColor = defaultColor ; return tpl ; |
public class Files { /** * return a reference to a temp file that contains the written + flushed + fsynced + closed data */
@ Nonnull private static File writeDataToTempFileOrDie ( @ Nonnull final OutputStreamCallback callback , @ Nonnull final File targetFile , @ Nonnull final Logger log ) throws IOException { } } | Preconditions . checkNotNull ( callback , "callback argument is required!" ) ; Preconditions . checkNotNull ( log , "log argument is required!" ) ; Preconditions . checkNotNull ( targetFile , "targetFile argument is required!" ) ; FileOutputStream fileOut = null ; FileChannel fileChannel = null ; try { final String targetFinalName = targetFile . getName ( ) ; final File targetDirectory = targetFile . getParentFile ( ) ; // open temporary file
final File tmpFile = File . createTempFile ( targetFinalName , ".tmp" , targetDirectory ) ; fileOut = new FileOutputStream ( tmpFile ) ; fileChannel = fileOut . getChannel ( ) ; // make sure to use an output stream that flows THROUGH the FileChannel , so that FileChannel . force ( true )
// can do what it ' s supposed to
// write the data AND flush it
callback . writeAndFlushData ( Channels . newOutputStream ( fileChannel ) ) ; return tmpFile ; } finally { try { // fsync to disk ( both data AND length )
if ( fileChannel != null ) { fileChannel . force ( true ) ; } } finally { // close the open file ( if during an EXC ,
if ( fileOut != null ) { fileOut . close ( ) ; } } } |
public class EnvVars { /** * Obtains the environment variables of a remote peer .
* @ param channel
* Can be null , in which case the map indicating " N / A " will be returned .
* @ return
* A fresh copy that can be owned and modified by the caller . */
public static EnvVars getRemote ( VirtualChannel channel ) throws IOException , InterruptedException { } } | if ( channel == null ) return new EnvVars ( "N/A" , "N/A" ) ; return channel . call ( new GetEnvVars ( ) ) ; |
public class StatementExecutor { /** * Create and return a SelectIterator for the class using the default mapped query for all statement . */
public SelectIterator < T , ID > buildIterator ( BaseDaoImpl < T , ID > classDao , ConnectionSource connectionSource , int resultFlags , ObjectCache objectCache ) throws SQLException { } } | prepareQueryForAll ( ) ; return buildIterator ( classDao , connectionSource , preparedQueryForAll , objectCache , resultFlags ) ; |
public class ContextXmlReader { /** * Read the context no - op flag from XML . */
private boolean readContextNoOp ( XMLEventReader reader ) throws XMLStreamException , JournalException { } } | readStartTag ( reader , QNAME_TAG_NOOP ) ; String value = readCharactersUntilEndTag ( reader , QNAME_TAG_NOOP ) ; return Boolean . valueOf ( value ) . booleanValue ( ) ; |
public class Matrix4f { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4fc # arcball ( float , float , float , float , float , float , org . joml . Matrix4f ) */
public Matrix4f arcball ( float radius , float centerX , float centerY , float centerZ , float angleX , float angleY , Matrix4f dest ) { } } | float m30 = m20 * - radius + this . m30 ; float m31 = m21 * - radius + this . m31 ; float m32 = m22 * - radius + this . m32 ; float m33 = m23 * - radius + this . m33 ; float sin = ( float ) Math . sin ( angleX ) ; float cos = ( float ) Math . cosFromSin ( sin , angleX ) ; float nm10 = m10 * cos + m20 * sin ; float nm11 = m11 * cos + m21 * sin ; float nm12 = m12 * cos + m22 * sin ; float nm13 = m13 * cos + m23 * sin ; float m20 = this . m20 * cos - m10 * sin ; float m21 = this . m21 * cos - m11 * sin ; float m22 = this . m22 * cos - m12 * sin ; float m23 = this . m23 * cos - m13 * sin ; sin = ( float ) Math . sin ( angleY ) ; cos = ( float ) Math . cosFromSin ( sin , angleY ) ; float nm00 = m00 * cos - m20 * sin ; float nm01 = m01 * cos - m21 * sin ; float nm02 = m02 * cos - m22 * sin ; float nm03 = m03 * cos - m23 * sin ; float nm20 = m00 * sin + m20 * cos ; float nm21 = m01 * sin + m21 * cos ; float nm22 = m02 * sin + m22 * cos ; float nm23 = m03 * sin + m23 * cos ; dest . _m30 ( - nm00 * centerX - nm10 * centerY - nm20 * centerZ + m30 ) ; dest . _m31 ( - nm01 * centerX - nm11 * centerY - nm21 * centerZ + m31 ) ; dest . _m32 ( - nm02 * centerX - nm12 * centerY - nm22 * centerZ + m32 ) ; dest . _m33 ( - nm03 * centerX - nm13 * centerY - nm23 * centerZ + m33 ) ; dest . _m20 ( nm20 ) ; dest . _m21 ( nm21 ) ; dest . _m22 ( nm22 ) ; dest . _m23 ( nm23 ) ; dest . _m10 ( nm10 ) ; dest . _m11 ( nm11 ) ; dest . _m12 ( nm12 ) ; dest . _m13 ( nm13 ) ; dest . _m00 ( nm00 ) ; dest . _m01 ( nm01 ) ; dest . _m02 ( nm02 ) ; dest . _m03 ( nm03 ) ; dest . _properties ( properties & ~ ( PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION ) ) ; return dest ; |
public class BootstrapConfig { /** * Allocate a file in the user output directory , e . g .
* WLP _ OUTPUT _ DIR / relativePath
* @ param relativePath
* relative path of file to create in the WLP _ OUTPUT _ DIR directory
* @ return File object for relative path , or for the WLP _ OUTPUT _ DIR directory itself
* if the relative path argument is null */
public File getUserOutputFile ( String relativePath ) { } } | if ( relativePath == null ) return outputRoot ; else return new File ( outputRoot , relativePath ) ; |
public class ClientFactory { /** * 添加用户事件
* @ param pUserName
* @ param pClient */
protected void onAddClient ( String pUserName , WebSocketSession pClient ) { } } | if ( null != mClientFactoryListener ) { mClientFactoryListener . addClient ( this , new AddClientEvent ( pUserName , pClient ) ) ; } |
public class FileUtil { /** * 获得相对子路径 , 忽略大小写
* 栗子 :
* < pre >
* dirPath : d : / aaa / bbb filePath : d : / aaa / bbb / ccc = 》 ccc
* dirPath : d : / Aaa / bbb filePath : d : / aaa / bbb / ccc . txt = 》 ccc . txt
* dirPath : d : / Aaa / bbb filePath : d : / aaa / bbb / = 》 " "
* < / pre >
* @ param dirPath 父路径
* @ param filePath 文件路径
* @ return 相对子路径 */
public static String subPath ( String dirPath , String filePath ) { } } | if ( StrUtil . isNotEmpty ( dirPath ) && StrUtil . isNotEmpty ( filePath ) ) { dirPath = StrUtil . removeSuffix ( normalize ( dirPath ) , "/" ) ; filePath = normalize ( filePath ) ; final String result = StrUtil . removePrefixIgnoreCase ( filePath , dirPath ) ; return StrUtil . removePrefix ( result , "/" ) ; } return filePath ; |
public class Binder { /** * Cast the incoming arguments to the given MethodType . The casts
* applied are equivalent to those in MethodHandle . explicitCastArguments ( MethodType ) .
* @ param returnType the target return type
* @ param argTypes the target argument types
* @ return a new Binder */
public Binder cast ( Class < ? > returnType , Class < ? > ... argTypes ) { } } | return new Binder ( this , new Cast ( type ( ) ) , MethodType . methodType ( returnType , argTypes ) ) ; |
public class DRL5Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 710:1 : instanceof _ key : { . . . } ? = > id = ID ; */
public final DRL5Expressions . instanceof_key_return instanceof_key ( ) throws RecognitionException { } } | DRL5Expressions . instanceof_key_return retval = new DRL5Expressions . instanceof_key_return ( ) ; retval . start = input . LT ( 1 ) ; Token id = null ; try { // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 711:5 : ( { . . . } ? = > id = ID )
// src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 711:12 : { . . . } ? = > id = ID
{ if ( ! ( ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . INSTANCEOF ) ) ) ) ) { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } throw new FailedPredicateException ( input , "instanceof_key" , "(helper.validateIdentifierKey(DroolsSoftKeywords.INSTANCEOF))" ) ; } id = ( Token ) match ( input , ID , FOLLOW_ID_in_instanceof_key4364 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { helper . emit ( id , DroolsEditorType . KEYWORD ) ; } } retval . stop = input . LT ( - 1 ) ; } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving
} return retval ; |
public class CmsEntityAttribute { /** * Returns the list of complex values . < p >
* @ return the list of complex values */
public List < CmsEntity > getComplexValues ( ) { } } | List < CmsEntity > result = new ArrayList < CmsEntity > ( ) ; result . addAll ( m_entityValues ) ; return Collections . unmodifiableList ( result ) ; |
public class SequentialReader { /** * Returns a signed 32 - bit integer from four bytes of data .
* @ return the signed 32 bit int value , between 0x00000 and 0xFFFFF
* @ throws IOException the buffer does not contain enough bytes to service the request */
public int getInt32 ( ) throws IOException { } } | if ( _isMotorolaByteOrder ) { // Motorola - MSB first ( big endian )
return ( getByte ( ) << 24 & 0xFF000000 ) | ( getByte ( ) << 16 & 0xFF0000 ) | ( getByte ( ) << 8 & 0xFF00 ) | ( getByte ( ) & 0xFF ) ; } else { // Intel ordering - LSB first ( little endian )
return ( getByte ( ) & 0xFF ) | ( getByte ( ) << 8 & 0xFF00 ) | ( getByte ( ) << 16 & 0xFF0000 ) | ( getByte ( ) << 24 & 0xFF000000 ) ; } |
public class Element { /** * Blurs ( focuses and then unfocuses ) the element , but only if the element
* is present , displayed , enabled , and an input . If those conditions are not
* met , the blur action will be logged , but skipped and the test will
* continue . */
public void blur ( ) { } } | String cantFocus = "Unable to focus on " ; String action = "Focusing, then unfocusing (blurring) on " + prettyOutput ( ) ; String expected = prettyOutputStart ( ) + " is present, displayed, and enabled to be blurred" ; try { if ( isNotPresentDisplayedEnabledInput ( action , expected , cantFocus ) ) { return ; } WebElement webElement = getWebElement ( ) ; webElement . sendKeys ( Keys . TAB ) ; } catch ( Exception e ) { log . warn ( e ) ; reporter . fail ( action , expected , cantFocus + prettyOutputEnd ( ) + e . getMessage ( ) ) ; return ; } reporter . pass ( action , expected , "Focused, then unfocused (blurred) on " + prettyOutputEnd ( ) . trim ( ) ) ; |
public class CEMIDevMgmt { /** * Returns a descriptive error message for the supplied error code parameter .
* If the error code is not known , the string " unknown error code " is returned .
* @ param errorCode error code to get message for , < code > 0 & le ; errorCode < / code >
* @ return error status message as string */
public static String getErrorMessage ( final int errorCode ) { } } | if ( errorCode < 0 ) throw new KNXIllegalArgumentException ( "error code has to be >= 0" ) ; if ( errorCode > errors . length - 1 ) return "unknown error code" ; return errors [ errorCode ] ; |
public class OracleNoSQLValidationClassMapper { /** * Gets the valid Id type .
* @ param type
* the type
* @ return the valid Id type */
public static String getValidIdType ( String type ) { } } | if ( validationClassMapperforId . get ( type ) == null ) { throw new KunderaException ( "ID of type: " + type + " is not supported for Kundera Oracle NOSQL." ) ; } return validationClassMapperforId . get ( type ) ; |
public class ActionResourceImpl { /** * De - registers an client that is currently registered with the gateway .
* @ param action */
private void unregisterClient ( ActionBean action ) throws ActionException { } } | if ( ! securityContext . hasPermission ( PermissionType . clientAdmin , action . getOrganizationId ( ) ) ) throw ExceptionFactory . notAuthorizedException ( ) ; ClientVersionBean versionBean ; List < ContractSummaryBean > contractBeans ; try { versionBean = orgs . getClientVersion ( action . getOrganizationId ( ) , action . getEntityId ( ) , action . getEntityVersion ( ) ) ; } catch ( ClientVersionNotFoundException e ) { throw ExceptionFactory . actionException ( Messages . i18n . format ( "ClientNotFound" ) ) ; // $ NON - NLS - 1 $
} try { contractBeans = query . getClientContracts ( action . getOrganizationId ( ) , action . getEntityId ( ) , action . getEntityVersion ( ) ) ; } catch ( StorageException e ) { throw ExceptionFactory . actionException ( Messages . i18n . format ( "ClientNotFound" ) , e ) ; // $ NON - NLS - 1 $
} // Validate that it ' s ok to perform this action - client must be Ready .
if ( versionBean . getStatus ( ) != ClientStatus . Registered ) { throw ExceptionFactory . actionException ( Messages . i18n . format ( "InvalidClientStatus" ) ) ; // $ NON - NLS - 1 $
} Client client = new Client ( ) ; client . setOrganizationId ( versionBean . getClient ( ) . getOrganization ( ) . getId ( ) ) ; client . setClientId ( versionBean . getClient ( ) . getId ( ) ) ; client . setVersion ( versionBean . getVersion ( ) ) ; // Next , unregister the client from * all * relevant gateways . This is done by
// looking up all referenced APIs and getting the gateway information for them .
// Each of those gateways must be told about the client .
try { storage . beginTx ( ) ; Map < String , IGatewayLink > links = new HashMap < > ( ) ; for ( ContractSummaryBean contractBean : contractBeans ) { ApiVersionBean svb = storage . getApiVersion ( contractBean . getApiOrganizationId ( ) , contractBean . getApiId ( ) , contractBean . getApiVersion ( ) ) ; Set < ApiGatewayBean > gateways = svb . getGateways ( ) ; if ( gateways == null ) { throw new PublishingException ( "No gateways specified for API: " + svb . getApi ( ) . getName ( ) ) ; // $ NON - NLS - 1 $
} for ( ApiGatewayBean apiGatewayBean : gateways ) { if ( ! links . containsKey ( apiGatewayBean . getGatewayId ( ) ) ) { IGatewayLink gatewayLink = createGatewayLink ( apiGatewayBean . getGatewayId ( ) ) ; links . put ( apiGatewayBean . getGatewayId ( ) , gatewayLink ) ; } } } storage . commitTx ( ) ; for ( IGatewayLink gatewayLink : links . values ( ) ) { gatewayLink . unregisterClient ( client ) ; gatewayLink . close ( ) ; } } catch ( Exception e ) { storage . rollbackTx ( ) ; throw ExceptionFactory . actionException ( Messages . i18n . format ( "UnregisterError" ) , e ) ; // $ NON - NLS - 1 $
} versionBean . setStatus ( ClientStatus . Retired ) ; versionBean . setRetiredOn ( new Date ( ) ) ; try { storage . beginTx ( ) ; storage . updateClientVersion ( versionBean ) ; storage . createAuditEntry ( AuditUtils . clientUnregistered ( versionBean , securityContext ) ) ; storage . commitTx ( ) ; } catch ( Exception e ) { storage . rollbackTx ( ) ; throw ExceptionFactory . actionException ( Messages . i18n . format ( "UnregisterError" ) , e ) ; // $ NON - NLS - 1 $
} log . debug ( String . format ( "Successfully registered Client %s on specified gateways: %s" , // $ NON - NLS - 1 $
versionBean . getClient ( ) . getName ( ) , versionBean . getClient ( ) ) ) ; |
public class FileExtensions { /** * Gets the current absolut path without the dot and slash .
* @ return ' s the current absolut path without the dot and slash . */
public static String getCurrentAbsolutPathWithoutDotAndSlash ( ) { } } | final File currentAbsolutPath = new File ( "." ) ; return currentAbsolutPath . getAbsolutePath ( ) . substring ( 0 , currentAbsolutPath . getAbsolutePath ( ) . length ( ) - 2 ) ; |
public class ChannelSpecification { /** * The allowed compression types , if data compression is used .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSupportedCompressionTypes ( java . util . Collection ) } or
* { @ link # withSupportedCompressionTypes ( java . util . Collection ) } if you want to override the existing values .
* @ param supportedCompressionTypes
* The allowed compression types , if data compression is used .
* @ return Returns a reference to this object so that method calls can be chained together .
* @ see CompressionType */
public ChannelSpecification withSupportedCompressionTypes ( String ... supportedCompressionTypes ) { } } | if ( this . supportedCompressionTypes == null ) { setSupportedCompressionTypes ( new java . util . ArrayList < String > ( supportedCompressionTypes . length ) ) ; } for ( String ele : supportedCompressionTypes ) { this . supportedCompressionTypes . add ( ele ) ; } return this ; |
public class TypeChecker { /** * Checks and casts an object to the specified type . If casting fails , a default value is returned .
* @ param object The object to be checked
* @ param defaultValue The default value to be returned if casting fails
* @ return The same object , cast to the specified class , or the default value , if casting fails */
public final T check ( Object object , T defaultValue ) { } } | try { return check ( object ) ; } catch ( ClassCastException e ) { return defaultValue ; } |
public class FastDtoa { /** * Precondition : ( 1 < < number _ bits ) < = number < ( 1 < < ( number _ bits + 1 ) ) . */
static long biggestPowerTen ( int number , int number_bits ) { } } | int power , exponent ; switch ( number_bits ) { case 32 : case 31 : case 30 : if ( kTen9 <= number ) { power = kTen9 ; exponent = 9 ; break ; } // else fallthrough
case 29 : case 28 : case 27 : if ( kTen8 <= number ) { power = kTen8 ; exponent = 8 ; break ; } // else fallthrough
case 26 : case 25 : case 24 : if ( kTen7 <= number ) { power = kTen7 ; exponent = 7 ; break ; } // else fallthrough
case 23 : case 22 : case 21 : case 20 : if ( kTen6 <= number ) { power = kTen6 ; exponent = 6 ; break ; } // else fallthrough
case 19 : case 18 : case 17 : if ( kTen5 <= number ) { power = kTen5 ; exponent = 5 ; break ; } // else fallthrough
case 16 : case 15 : case 14 : if ( kTen4 <= number ) { power = kTen4 ; exponent = 4 ; break ; } // else fallthrough
case 13 : case 12 : case 11 : case 10 : if ( 1000 <= number ) { power = 1000 ; exponent = 3 ; break ; } // else fallthrough
case 9 : case 8 : case 7 : if ( 100 <= number ) { power = 100 ; exponent = 2 ; break ; } // else fallthrough
case 6 : case 5 : case 4 : if ( 10 <= number ) { power = 10 ; exponent = 1 ; break ; } // else fallthrough
case 3 : case 2 : case 1 : if ( 1 <= number ) { power = 1 ; exponent = 0 ; break ; } // else fallthrough
case 0 : power = 0 ; exponent = - 1 ; break ; default : // Following assignments are here to silence compiler warnings .
power = 0 ; exponent = 0 ; // UNREACHABLE ( ) ;
} return ( ( long ) power << 32 ) | ( 0xffffffffL & exponent ) ; |
public class SimpleHttpClientFactoryBean { /** * Build a HTTP client based on the current properties .
* @ return the built HTTP client */
@ SneakyThrows private CloseableHttpClient buildHttpClient ( ) { } } | val plainSocketFactory = PlainConnectionSocketFactory . getSocketFactory ( ) ; val registry = RegistryBuilder . < ConnectionSocketFactory > create ( ) . register ( "http" , plainSocketFactory ) . register ( "https" , this . sslSocketFactory ) . build ( ) ; val connectionManager = new PoolingHttpClientConnectionManager ( registry ) ; connectionManager . setMaxTotal ( this . maxPooledConnections ) ; connectionManager . setDefaultMaxPerRoute ( this . maxConnectionsPerRoute ) ; connectionManager . setValidateAfterInactivity ( DEFAULT_TIMEOUT ) ; val httpHost = new HttpHost ( InetAddress . getLocalHost ( ) ) ; val httpRoute = new HttpRoute ( httpHost ) ; connectionManager . setMaxPerRoute ( httpRoute , MAX_CONNECTIONS_PER_ROUTE ) ; val requestConfig = RequestConfig . custom ( ) . setSocketTimeout ( this . readTimeout ) . setConnectTimeout ( ( int ) this . connectionTimeout ) . setConnectionRequestTimeout ( ( int ) this . connectionTimeout ) . setCircularRedirectsAllowed ( this . circularRedirectsAllowed ) . setRedirectsEnabled ( this . redirectsEnabled ) . setAuthenticationEnabled ( this . authenticationEnabled ) . build ( ) ; val builder = HttpClients . custom ( ) . setConnectionManager ( connectionManager ) . setDefaultRequestConfig ( requestConfig ) . setSSLSocketFactory ( this . sslSocketFactory ) . setSSLHostnameVerifier ( this . hostnameVerifier ) . setRedirectStrategy ( this . redirectionStrategy ) . setDefaultCredentialsProvider ( this . credentialsProvider ) . setDefaultCookieStore ( this . cookieStore ) . setConnectionReuseStrategy ( this . connectionReuseStrategy ) . setConnectionBackoffStrategy ( this . connectionBackoffStrategy ) . setServiceUnavailableRetryStrategy ( this . serviceUnavailableRetryStrategy ) . setProxyAuthenticationStrategy ( this . proxyAuthenticationStrategy ) . setDefaultHeaders ( this . defaultHeaders ) . useSystemProperties ( ) ; return builder . build ( ) ; |
public class InternalXbaseParser { /** * InternalXbase . g : 4823:1 : entryRuleXTypeLiteral returns [ EObject current = null ] : iv _ ruleXTypeLiteral = ruleXTypeLiteral EOF ; */
public final EObject entryRuleXTypeLiteral ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleXTypeLiteral = null ; try { // InternalXbase . g : 4823:53 : ( iv _ ruleXTypeLiteral = ruleXTypeLiteral EOF )
// InternalXbase . g : 4824:2 : iv _ ruleXTypeLiteral = ruleXTypeLiteral EOF
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXTypeLiteralRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleXTypeLiteral = ruleXTypeLiteral ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleXTypeLiteral ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class HTCashbillServiceImp { /** * ( non - Javadoc )
* @ see com . popbill . api . HTCashbillService # requestJob ( java . lang . String , com . popbill . api . hometaxcashbill . QueryType , java . lang . String , java . lang . String ) */
@ Override public String requestJob ( String CorpNum , QueryType queryType , String SDate , String EDate ) throws PopbillException { } } | return requestJob ( CorpNum , queryType , SDate , EDate , null ) ; |
public class SimonConnectionConfiguration { /** * Loads { @ code driver . properties } file . */
private static Properties initProperties ( ) { } } | InputStream stream = null ; try { // TODO : limited to known drivers , better find driver later based on JDBC connection URL without " simon " word
Properties properties = new Properties ( ) ; stream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( "org/javasimon/jdbc4/drivers.properties" ) ; if ( stream != null ) { properties . load ( stream ) ; } return properties ; } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( IOException e ) { // Doesn ' t matter
} } } |
public class KTypeArrayDeque { /** * { @ inheritDoc } */
@ Override public < T extends KTypeProcedure < ? super KType > > T forEach ( T procedure ) { } } | forEach ( procedure , head , tail ) ; return procedure ; |
public class Matchers { /** * Matches an AST node if its type is a primitive type . */
public static < T extends Tree > Matcher < T > isPrimitiveType ( ) { } } | return new Matcher < T > ( ) { @ Override public boolean matches ( Tree t , VisitorState state ) { Type type = getType ( t ) ; return type != null && type . isPrimitive ( ) ; } } ; |
public class SAMkNN { /** * Makes sure that the STM and LTM combined doe not surpass the maximum size . */
private void memorySizeCheck ( ) { } } | if ( this . stm . numInstances ( ) + this . ltm . numInstances ( ) > this . maxSTMSize + this . maxLTMSize ) { if ( this . ltm . numInstances ( ) > this . maxLTMSize ) { this . clusterDown ( ) ; } else { // shift values from STM directly to LTM since STM is full
int numShifts = this . maxLTMSize - this . ltm . numInstances ( ) + 1 ; for ( int i = 0 ; i < numShifts ; i ++ ) { this . ltm . add ( this . stm . get ( 0 ) . copy ( ) ) ; this . stm . delete ( 0 ) ; this . stmHistory . remove ( 0 ) ; this . ltmHistory . remove ( 0 ) ; this . cmHistory . remove ( 0 ) ; } this . clusterDown ( ) ; this . predictionHistories . clear ( ) ; for ( int i = 0 ; i < this . stm . numInstances ( ) ; i ++ ) { for ( int j = 0 ; j < this . stm . numInstances ( ) ; j ++ ) { this . distanceMatrixSTM [ i ] [ j ] = this . distanceMatrixSTM [ numShifts + i ] [ numShifts + j ] ; } } } } |
public class GDDImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . GDD__GOC_ADES : return GOC_ADES_EDEFAULT == null ? gocAdes != null : ! GOC_ADES_EDEFAULT . equals ( gocAdes ) ; case AfplibPackage . GDD__COMMANDS : return commands != null && ! commands . isEmpty ( ) ; } return super . eIsSet ( featureID ) ; |
public class IsProtonInConjugatedPiSystemDescriptor { /** * The method is a proton descriptor that evaluates if a proton is joined to a conjugated system .
* @ param atom The IAtom for which the DescriptorValue is requested
* @ param atomContainer AtomContainer
* @ return true if the proton is bonded to a conjugated system */
@ Override public DescriptorValue calculate ( IAtom atom , IAtomContainer atomContainer ) { } } | IAtomContainer clonedAtomContainer ; try { clonedAtomContainer = ( IAtomContainer ) atomContainer . clone ( ) ; } catch ( CloneNotSupportedException e ) { return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new BooleanResult ( false ) , NAMES , e ) ; } IAtom clonedAtom = clonedAtomContainer . getAtom ( atomContainer . indexOf ( atom ) ) ; boolean isProtonInPiSystem = false ; IAtomContainer mol = clonedAtom . getBuilder ( ) . newInstance ( IAtomContainer . class , clonedAtomContainer ) ; if ( checkAromaticity ) { try { AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( mol ) ; Aromaticity . cdkLegacy ( ) . apply ( mol ) ; } catch ( CDKException e ) { return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new BooleanResult ( false ) , NAMES , e ) ; } } if ( atom . getSymbol ( ) . equals ( "H" ) ) { if ( acold != clonedAtomContainer ) { acold = clonedAtomContainer ; acSet = ConjugatedPiSystemsDetector . detect ( mol ) ; } Iterator < IAtomContainer > detected = acSet . atomContainers ( ) . iterator ( ) ; List < IAtom > neighboors = mol . getConnectedAtomsList ( clonedAtom ) ; for ( IAtom neighboor : neighboors ) { while ( detected . hasNext ( ) ) { IAtomContainer detectedAC = detected . next ( ) ; if ( ( detectedAC != null ) && ( detectedAC . contains ( neighboor ) ) ) { isProtonInPiSystem = true ; break ; } } } } return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new BooleanResult ( isProtonInPiSystem ) , NAMES ) ; |
public class SetLabelsForNumbersBot { /** * Fetches the current online data for the given item , and adds numerical
* labels if necessary .
* @ param itemIdValue
* the id of the document to inspect */
protected void addLabelForNumbers ( ItemIdValue itemIdValue ) { } } | String qid = itemIdValue . getId ( ) ; try { // Fetch the online version of the item to make sure we edit the
// current version :
ItemDocument currentItemDocument = ( ItemDocument ) dataFetcher . getEntityDocument ( qid ) ; if ( currentItemDocument == null ) { System . out . println ( "*** " + qid + " could not be fetched. Maybe it has been deleted." ) ; return ; } // Check if we still have exactly one numeric value :
QuantityValue number = currentItemDocument . findStatementQuantityValue ( "P1181" ) ; if ( number == null ) { System . out . println ( "*** No unique numeric value for " + qid ) ; return ; } // Check if the item is in a known numeric class :
if ( ! currentItemDocument . hasStatementValue ( "P31" , numberClasses ) ) { System . out . println ( "*** " + qid + " is not in a known class of integer numbers. Skipping." ) ; return ; } // Check if the value is integer and build label string :
String numberString ; try { BigInteger intValue = number . getNumericValue ( ) . toBigIntegerExact ( ) ; numberString = intValue . toString ( ) ; } catch ( ArithmeticException e ) { System . out . println ( "*** Numeric value for " + qid + " is not an integer: " + number . getNumericValue ( ) ) ; return ; } // Construct data to write :
ItemDocumentBuilder itemDocumentBuilder = ItemDocumentBuilder . forItemId ( itemIdValue ) . withRevisionId ( currentItemDocument . getRevisionId ( ) ) ; ArrayList < String > languages = new ArrayList < > ( arabicNumeralLanguages . length ) ; for ( int i = 0 ; i < arabicNumeralLanguages . length ; i ++ ) { if ( ! currentItemDocument . getLabels ( ) . containsKey ( arabicNumeralLanguages [ i ] ) ) { itemDocumentBuilder . withLabel ( numberString , arabicNumeralLanguages [ i ] ) ; languages . add ( arabicNumeralLanguages [ i ] ) ; } } if ( languages . size ( ) == 0 ) { System . out . println ( "*** Labels already complete for " + qid ) ; return ; } logEntityModification ( currentItemDocument . getEntityId ( ) , numberString , languages ) ; dataEditor . editItemDocument ( itemDocumentBuilder . build ( ) , false , "Set labels to numeric value (Task MB1)" ) ; } catch ( MediaWikiApiErrorException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } |
public class ExceptAxis { /** * { @ inheritDoc } */
@ Override public boolean hasNext ( ) { } } | // first all items of the second operand are stored in the set .
while ( mOp2 . hasNext ( ) ) { if ( getNode ( ) . getDataKey ( ) < 0 ) { // only nodes are
// allowed
throw new XPathError ( ErrorType . XPTY0004 ) ; } mDupSet . add ( getNode ( ) . getDataKey ( ) ) ; } while ( mOp1 . hasNext ( ) ) { if ( getNode ( ) . getDataKey ( ) < 0 ) { // only nodes are
// allowed
throw new XPathError ( ErrorType . XPTY0004 ) ; } // return true , if node is not already in the set , which means , that
// it is
// not also an item of the result set of the second operand
// sequence .
if ( mDupSet . add ( getNode ( ) . getDataKey ( ) ) ) { return true ; } } return false ; |
public class FlexiBean { /** * Puts the properties in the specified map into this bean .
* This creates properties if they do not exist .
* @ param map the map of properties to add , not null */
public void putAll ( Map < String , ? extends Object > map ) { } } | if ( map . size ( ) > 0 ) { for ( String key : map . keySet ( ) ) { if ( VALID_KEY . matcher ( key ) . matches ( ) == false ) { throw new IllegalArgumentException ( "Invalid key for FlexiBean: " + key ) ; } } if ( data == Collections . EMPTY_MAP ) { data = new LinkedHashMap < > ( map ) ; } else { data . putAll ( map ) ; } } |
public class RowReaderDefaultImpl { /** * @ see RowReader # readPkValuesFrom ( ResultSet , ClassDescriptor , Map )
* @ throws PersistenceBrokerException if there is an error accessing the access layer */
public void readPkValuesFrom ( ResultSetAndStatement rs_stmt , Map row ) { } } | String ojbClass = SqlHelper . getOjbClassName ( rs_stmt . m_rs ) ; ClassDescriptor cld ; if ( ojbClass != null ) { cld = m_cld . getRepository ( ) . getDescriptorFor ( ojbClass ) ; } else { cld = m_cld ; } FieldDescriptor [ ] pkFields = cld . getPkFields ( ) ; readValuesFrom ( rs_stmt , row , pkFields ) ; |
public class appfwxmlerrorpage { /** * Use this API to fetch appfwxmlerrorpage resource of given name . */
public static appfwxmlerrorpage get ( nitro_service service , String name ) throws Exception { } } | appfwxmlerrorpage obj = new appfwxmlerrorpage ( ) ; obj . set_name ( name ) ; appfwxmlerrorpage response = ( appfwxmlerrorpage ) obj . get_resource ( service ) ; return response ; |
public class ReloadablePropertiesFactoryBean { /** * 定义资源文件
* @ param fileNames */
public void setLocation ( final String fileNames ) { } } | List < String > list = new ArrayList < String > ( ) ; list . add ( fileNames ) ; setLocations ( list ) ; |
public class Session { /** * This method invokes the same called method of the current < code > IPhase < / code > instance .
* @ param src Write the remaining bytes to the device .
* @ param logicalBlockAddress The logical block address of the device to begin the write operation .
* @ param transferLength The number of bytes to write to the device .
* @ throws Exception if any error occurs .
* @ return The Future object .
* @ throws TaskExecutionException if execution fails */
public final Future < Void > write ( final ByteBuffer src , final int logicalBlockAddress , final long transferLength ) throws TaskExecutionException { } } | return executeTask ( new WriteTask ( this , src , logicalBlockAddress , transferLength ) ) ; |
public class OffsetGroup { /** * Returns whether , for all offsets present in both groups , this { @ code OffsetGroup } ' s
* offset { @ link Offset # precedes ( Offset ) } ( Offset ) } the other ' s . */
public boolean precedesForAllOffsetTypesInBoth ( final OffsetGroup other ) { } } | return charOffset ( ) . precedes ( other . charOffset ( ) ) && edtOffset ( ) . precedes ( other . edtOffset ( ) ) && ( ! byteOffset ( ) . isPresent ( ) || ! other . byteOffset ( ) . isPresent ( ) || byteOffset ( ) . get ( ) . precedes ( other . byteOffset ( ) . get ( ) ) ) && ( ! asrTime ( ) . isPresent ( ) || ! other . asrTime ( ) . isPresent ( ) || asrTime ( ) . get ( ) . precedes ( other . asrTime ( ) . get ( ) ) ) ; |
public class AbstractConnection { /** * Close the connection to the remote node . */
public void close ( ) { } } | done = true ; connected = false ; synchronized ( this ) { try { if ( socket != null ) { if ( traceLevel >= ctrlThreshold ) { System . out . println ( "-> CLOSE" ) ; } socket . close ( ) ; } } catch ( final IOException e ) { /* ignore socket close errors */
} finally { socket = null ; } } |
public class TreeNode { /** * Returns the TreeNode ( or null if not found ) for the given key
* starting at given root . */
final TreeNode < K , V > findTreeNode ( int h , Object k , Class < ? > kc ) { } } | if ( k != null ) { TreeNode < K , V > p = this ; do { int ph , dir ; K pk ; TreeNode < K , V > q ; TreeNode < K , V > pl = p . left , pr = p . right ; if ( ( ph = p . hash ) > h ) p = pl ; else if ( ph < h ) p = pr ; else if ( ( pk = p . key ) == k || ( pk != null && k . equals ( pk ) ) ) return p ; else if ( pl == null ) p = pr ; else if ( pr == null ) p = pl ; else if ( ( kc != null || ( kc = comparableClassFor ( k ) ) != null ) && ( dir = compareComparables ( kc , k , pk ) ) != 0 ) p = ( dir < 0 ) ? pl : pr ; else if ( ( q = pr . findTreeNode ( h , k , kc ) ) != null ) return q ; else p = pl ; } while ( p != null ) ; } return null ; |
public class HttpRequestHandler { /** * Execute a single { @ link JmxRequest } . If a checked exception occurs ,
* this gets translated into the appropriate JSON object which will get returned .
* Note , that these exceptions gets * not * translated into an HTTP error , since they are
* supposed < em > Jolokia < / em > specific errors above the transport layer .
* @ param pJmxReq the request to execute
* @ return the JSON representation of the answer . */
private JSONObject executeRequest ( JmxRequest pJmxReq ) { } } | // Call handler and retrieve return value
try { return backendManager . handleRequest ( pJmxReq ) ; } catch ( ReflectionException e ) { return getErrorJSON ( 404 , e , pJmxReq ) ; } catch ( InstanceNotFoundException e ) { return getErrorJSON ( 404 , e , pJmxReq ) ; } catch ( MBeanException e ) { return getErrorJSON ( 500 , e . getTargetException ( ) , pJmxReq ) ; } catch ( AttributeNotFoundException e ) { return getErrorJSON ( 404 , e , pJmxReq ) ; } catch ( UnsupportedOperationException e ) { return getErrorJSON ( 500 , e , pJmxReq ) ; } catch ( IOException e ) { return getErrorJSON ( 500 , e , pJmxReq ) ; } catch ( IllegalArgumentException e ) { return getErrorJSON ( 400 , e , pJmxReq ) ; } catch ( SecurityException e ) { // Wipe out stacktrace
return getErrorJSON ( 403 , new Exception ( e . getMessage ( ) ) , pJmxReq ) ; } catch ( RuntimeMBeanException e ) { // Use wrapped exception
return errorForUnwrappedException ( e , pJmxReq ) ; } |
public class Humanize { /** * Converts a list of items to a human readable string with an optional
* limit .
* @ param items
* The items array
* @ param limit
* The number of items to print . - 1 for unbounded .
* @ param limitStr
* The string to be appended after extra items . Null or " " for
* default .
* @ return human readable representation of a bounded list of items */
public static String oxford ( final Object [ ] items , final int limit , final String limitStr ) { } } | if ( items == null || items . length == 0 ) { return "" ; } int itemsNum = items . length ; if ( itemsNum == 1 ) { return items [ 0 ] . toString ( ) ; } ResourceBundle bundle = context . get ( ) . getBundle ( ) ; if ( itemsNum == 2 ) { return format ( bundle . getString ( "oxford.pair" ) , items [ 0 ] , items [ 1 ] ) ; } int limitIndex ; String append ; int extra = itemsNum - limit ; if ( limit > 0 && extra > 1 ) { limitIndex = limit ; String pattern = Strings . isNullOrEmpty ( limitStr ) ? bundle . getString ( "oxford.extra" ) : limitStr ; append = format ( pattern , extra ) ; } else { limitIndex = itemsNum - 1 ; append = items [ limitIndex ] . toString ( ) ; } String pattern = bundle . getString ( "oxford" ) ; return format ( pattern , commaJoiner . join ( Arrays . copyOf ( items , limitIndex ) ) , append ) ; |
public class CmsDialogCopyLanguage { /** * Copies the contents from a source locale to a number of destination locales by overwriting them . < p >
* @ param content the xml content
* @ param sourceLocale the source locale
* @ param destLocales a list of destination locales
* @ throws CmsException if something goes wrong */
protected void transferContents ( CmsXmlContent content , Locale sourceLocale , List < Locale > destLocales ) throws CmsException { } } | for ( Iterator < Locale > i = destLocales . iterator ( ) ; i . hasNext ( ) ; ) { Locale to = i . next ( ) ; if ( content . hasLocale ( to ) ) { content . removeLocale ( to ) ; } content . copyLocale ( sourceLocale , to ) ; } |
public class JwtSsoBuilderComponent { /** * { @ inheritDoc } */
@ Override public long getValidTime ( ) { } } | long result = 0 ; if ( isDefaultBuilder ) { result = 2 * 3600 ; } else { boolean haveNull = jwtServiceMapRef . getReference ( jwtBuilderRef ) == null || jwtServiceMapRef . getReference ( jwtBuilderRef ) . getProperty ( JwtUtils . CFG_KEY_VALID ) == null ; result = ( haveNull ) ? 0 : ( ( Long ) jwtServiceMapRef . getReference ( jwtBuilderRef ) . getProperty ( JwtUtils . CFG_KEY_VALID ) ) . longValue ( ) ; } return result ; |
public class ListStreamsResult { /** * The names of the streams that are associated with the AWS account making the < code > ListStreams < / code > request .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setStreamNames ( java . util . Collection ) } or { @ link # withStreamNames ( java . util . Collection ) } if you want to
* override the existing values .
* @ param streamNames
* The names of the streams that are associated with the AWS account making the < code > ListStreams < / code >
* request .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListStreamsResult withStreamNames ( String ... streamNames ) { } } | if ( this . streamNames == null ) { setStreamNames ( new com . amazonaws . internal . SdkInternalList < String > ( streamNames . length ) ) ; } for ( String ele : streamNames ) { this . streamNames . add ( ele ) ; } return this ; |
public class UnmodifiableHttpParameters { /** * Wraps the given parameters to ensure they are unmodifiable .
* @ return { @ code null } when wrapped is { @ code null } , otherwise unmodifiable parameters */
public static HttpParameters wrap ( HttpParameters wrapped ) { } } | // null remains null
if ( wrapped == null ) return null ; // Empty are unmodifiable
if ( wrapped == EmptyParameters . getInstance ( ) ) return wrapped ; // ServletRequest parameters are unmodifiable already
if ( wrapped instanceof ServletRequestParameters ) return wrapped ; // Already wrapped
if ( wrapped instanceof UnmodifiableHttpParameters ) return wrapped ; // Wrapping necessary
return new UnmodifiableHttpParameters ( wrapped ) ; |
public class CPDefinitionLinkUtil { /** * Returns the cp definition links before and after the current cp definition link in the ordered set where CPDefinitionId = & # 63 ; .
* @ param CPDefinitionLinkId the primary key of the current cp definition link
* @ param CPDefinitionId the cp definition ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next cp definition link
* @ throws NoSuchCPDefinitionLinkException if a cp definition link with the primary key could not be found */
public static CPDefinitionLink [ ] findByCPDefinitionId_PrevAndNext ( long CPDefinitionLinkId , long CPDefinitionId , OrderByComparator < CPDefinitionLink > orderByComparator ) throws com . liferay . commerce . product . exception . NoSuchCPDefinitionLinkException { } } | return getPersistence ( ) . findByCPDefinitionId_PrevAndNext ( CPDefinitionLinkId , CPDefinitionId , orderByComparator ) ; |
public class Matrix3 { /** * Sets the matrix element at the specified row and column . */
public void setElement ( int row , int col , float value ) { } } | switch ( col ) { case 0 : switch ( row ) { case 0 : m00 = value ; return ; case 1 : m01 = value ; return ; case 2 : m02 = value ; return ; } break ; case 1 : switch ( row ) { case 0 : m10 = value ; return ; case 1 : m11 = value ; return ; case 2 : m12 = value ; return ; } break ; case 2 : switch ( row ) { case 0 : m20 = value ; return ; case 1 : m21 = value ; return ; case 2 : m22 = value ; return ; } break ; } throw new ArrayIndexOutOfBoundsException ( ) ; |
public class H2ONode { /** * same answer back . */
void record_task_answer ( RPC . RPCCall rpcall ) { } } | // assert rpcall . _ started = = 0 | | rpcall . _ dt . hasException ( ) ;
rpcall . _started = System . currentTimeMillis ( ) ; rpcall . _retry = RPC . RETRY_MS ; // Start the timer on when to resend
// AckAckTimeOutThread . PENDING . add ( rpcall ) ; |
public class SourceStream { /** * This method uses a Value message to write Silence into the stream ,
* because a message has been rolled back
* @ param m The value message
* @ exception GDException Can be thrown from the writeCompletedRange method
* @ return boolean true if the message can be sent downstream
* this is determined by the sendWindow */
public boolean writeSilence ( SIMPMessage m ) throws SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeSilence" , new Object [ ] { m } ) ; boolean sendMessage = true ; JsMessage jsMsg = m . getMessage ( ) ; // There may be Completed ticks after the Value , if so then
// write these into the stream too
long stamp = jsMsg . getGuaranteedValueValueTick ( ) ; long start = jsMsg . getGuaranteedValueStartTick ( ) ; long end = jsMsg . getGuaranteedValueEndTick ( ) ; if ( end < stamp ) end = stamp ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilence from: " + start + " to " + end + " on Stream " + stream ) ; } TickRange tr = new TickRange ( TickRange . Completed , start , end ) ; // used to send message if it moves inside inDoubt window
List sendList = null ; synchronized ( this ) { oststream . writeCompletedRange ( tr ) ; sendMessage = msgCanBeSent ( stamp , false ) ; if ( sendMessage ) { if ( stamp > lastMsgSent ) lastMsgSent = stamp ; } // Check whether removing this message means we have
// a message to send
TickRange tr1 = null ; if ( ( tr1 = msgRemoved ( stamp , oststream , null ) ) != null ) { sendList = new ArrayList ( ) ; sendList . add ( tr1 ) ; if ( tr1 . valuestamp > lastMsgSent ) lastMsgSent = tr1 . valuestamp ; } // SIB0105
// Message silenced so reset the health state if we ' ve solved a blocking problem
if ( blockedStreamAlarm != null ) blockedStreamAlarm . checkState ( false ) ; } // synchronized
// Do the send outside of the synchronise
if ( sendList != null ) { sendMsgs ( sendList , false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilence" ) ; return sendMessage ; |
public class ManagementClientAsync { /** * Retrieves information related to the namespace .
* Works with any claim ( Send / Listen / Manage ) .
* @ return - { @ link NamespaceInfo } containing namespace information . */
public CompletableFuture < NamespaceInfo > getNamespaceInfoAsync ( ) { } } | CompletableFuture < String > contentFuture = getEntityAsync ( "$namespaceinfo" , null , false ) ; CompletableFuture < NamespaceInfo > nsInfoFuture = new CompletableFuture < > ( ) ; contentFuture . handleAsync ( ( content , ex ) -> { if ( ex != null ) { nsInfoFuture . completeExceptionally ( ex ) ; } else { try { nsInfoFuture . complete ( NamespaceInfoSerializer . parseFromContent ( content ) ) ; } catch ( ServiceBusException e ) { nsInfoFuture . completeExceptionally ( e ) ; } } return null ; } , MessagingFactory . INTERNAL_THREAD_POOL ) ; return nsInfoFuture ; |
public class ThriftClient { /** * Loads super columns from database .
* @ param keyspace
* the keyspace
* @ param columnFamily
* the column family
* @ param rowId
* the row id
* @ param superColumnNames
* the super column names
* @ return the list */
@ Override protected final List < SuperColumn > loadSuperColumns ( String keyspace , String columnFamily , String rowId , String ... superColumnNames ) { } } | // TODO : : : super column abstract entity and discriminator column
if ( ! isOpen ( ) ) throw new PersistenceException ( "ThriftClient is closed." ) ; byte [ ] rowKey = rowId . getBytes ( ) ; SlicePredicate predicate = new SlicePredicate ( ) ; List < ByteBuffer > columnNames = new ArrayList < ByteBuffer > ( ) ; for ( String superColumnName : superColumnNames ) { KunderaCoreUtils . printQuery ( "Fetch superColumn:" + superColumnName , showQuery ) ; columnNames . add ( ByteBuffer . wrap ( superColumnName . getBytes ( ) ) ) ; } predicate . setColumn_names ( columnNames ) ; ColumnParent parent = new ColumnParent ( columnFamily ) ; List < ColumnOrSuperColumn > coscList ; Connection conn = null ; try { conn = getConnection ( ) ; coscList = conn . getClient ( ) . get_slice ( ByteBuffer . wrap ( rowKey ) , parent , predicate , getConsistencyLevel ( ) ) ; } catch ( InvalidRequestException e ) { log . error ( "Error while getting super columns for row Key {} , Caused by: ." , rowId , e ) ; throw new EntityReaderException ( e ) ; } catch ( UnavailableException e ) { log . error ( "Error while getting super columns for row Key {} , Caused by: ." , rowId , e ) ; throw new EntityReaderException ( e ) ; } catch ( TimedOutException e ) { log . error ( "Error while getting super columns for row Key {} , Caused by: ." , rowId , e ) ; throw new EntityReaderException ( e ) ; } catch ( TException e ) { log . error ( "Error while getting super columns for row Key {} , Caused by: ." , rowId , e ) ; throw new EntityReaderException ( e ) ; } finally { releaseConnection ( conn ) ; } List < SuperColumn > superColumns = ThriftDataResultHelper . transformThriftResult ( coscList , ColumnFamilyType . SUPER_COLUMN , null ) ; return superColumns ; |
public class Script { /** * Invoke a method ( or closure in the binding ) defined .
* @ param name method to call
* @ param args arguments to pass to the method
* @ return value */
public Object invokeMethod ( String name , Object args ) { } } | try { return super . invokeMethod ( name , args ) ; } // if the method was not found in the current scope ( the script ' s methods )
// let ' s try to see if there ' s a method closure with the same name in the binding
catch ( MissingMethodException mme ) { try { if ( name . equals ( mme . getMethod ( ) ) ) { Object boundClosure = getProperty ( name ) ; if ( boundClosure != null && boundClosure instanceof Closure ) { return ( ( Closure ) boundClosure ) . call ( ( Object [ ] ) args ) ; } else { throw mme ; } } else { throw mme ; } } catch ( MissingPropertyException mpe ) { throw mme ; } } |
public class GenericTypeResolver { /** * Determine the target type for the generic return type of the given method ,
* where formal type variables are declared on the given class .
* @ param method the method to introspect
* @ param clazz the class to resolve type variables against
* @ return the corresponding generic parameter or return type
* @ see # resolveReturnTypeForGenericMethod */
public static Class < ? > resolveReturnType ( Method method , Class < ? > clazz ) { } } | Assert . notNull ( method , "Method must not be null" ) ; Type genericType = method . getGenericReturnType ( ) ; Assert . notNull ( clazz , "Class must not be null" ) ; Map < TypeVariable , Type > typeVariableMap = getTypeVariableMap ( clazz ) ; Type rawType = getRawType ( genericType , typeVariableMap ) ; return ( rawType instanceof Class ? ( Class < ? > ) rawType : method . getReturnType ( ) ) ; |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertGSLTLINETYPEToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class Geomajas { /** * Returns a list of locales that can be used in this version of Geomajas . The default is english , and ' native '
* means that your browsers locale should be used ( if supported - default otherwise ) .
* @ return supported locales */
public static Map < String , String > getSupportedLocales ( ) { } } | Map < String , String > locales = new HashMap < String , String > ( ) ; for ( String localeName : LocaleInfo . getAvailableLocaleNames ( ) ) { String displayName = LocaleInfo . getLocaleNativeDisplayName ( localeName ) ; locales . put ( localeName , displayName ) ; } return locales ; |
public class DialectFactory { /** * 根据驱动名创建方言 < br >
* 驱动名是不分区大小写完全匹配的
* @ param driverName JDBC驱动类名
* @ return 方言 */
public static Dialect newDialect ( String driverName ) { } } | final Dialect dialect = internalNewDialect ( driverName ) ; StaticLog . debug ( "Use Dialect: [{}]." , dialect . getClass ( ) . getSimpleName ( ) ) ; return dialect ; |
public class ReadMatrixCsv { /** * Reads in a { @ link CMatrixRMaj } from the IO stream where the user specifies the matrix dimensions .
* @ param numRows Number of rows in the matrix
* @ param numCols Number of columns in the matrix
* @ return CMatrixRMaj
* @ throws IOException */
public CMatrixRMaj readCDRM ( int numRows , int numCols ) throws IOException { } } | CMatrixRMaj A = new CMatrixRMaj ( numRows , numCols ) ; int wordsCol = numCols * 2 ; for ( int i = 0 ; i < numRows ; i ++ ) { List < String > words = extractWords ( ) ; if ( words == null ) throw new IOException ( "Too few rows found. expected " + numRows + " actual " + i ) ; if ( words . size ( ) != wordsCol ) throw new IOException ( "Unexpected number of words in column. Found " + words . size ( ) + " expected " + wordsCol ) ; for ( int j = 0 ; j < wordsCol ; j += 2 ) { float real = Float . parseFloat ( words . get ( j ) ) ; float imaginary = Float . parseFloat ( words . get ( j + 1 ) ) ; A . set ( i , j , real , imaginary ) ; } } return A ; |
public class DisplayUtils { /** * This method is use to determine if the current Android device is a tablet
* or phone .
* @ param context
* @ return */
public boolean isTablet ( Context context ) { } } | boolean xlarge = ( ( context . getResources ( ) . getConfiguration ( ) . screenLayout & Configuration . SCREENLAYOUT_SIZE_MASK ) == 4 ) ; boolean large = ( ( context . getResources ( ) . getConfiguration ( ) . screenLayout & Configuration . SCREENLAYOUT_SIZE_MASK ) == Configuration . SCREENLAYOUT_SIZE_LARGE ) ; return ( xlarge || large ) ; |
public class ExpandoMetaClass { /** * / * ( non - Javadoc )
* @ see groovy . lang . MetaClassImpl # invokeConstructor ( java . lang . Object [ ] ) */
public Object invokeConstructor ( Object [ ] arguments ) { } } | // TODO This is the only area where this MetaClass needs to do some interception because Groovy ' s current
// MetaClass uses hard coded references to the java . lang . reflect . Constructor class so you can ' t simply
// inject Constructor like you can do properties , methods and fields . When Groovy ' s MetaClassImpl is
// refactored we can fix this
Class [ ] argClasses = MetaClassHelper . convertToTypeArray ( arguments ) ; MetaMethod method = pickMethod ( GROOVY_CONSTRUCTOR , argClasses ) ; if ( method != null && method . getParameterTypes ( ) . length == arguments . length ) { return method . invoke ( theClass , arguments ) ; } return super . invokeConstructor ( arguments ) ; |
public class CoNLLDependencyExtractor { /** * Extracts a dependency parse tree from the provided reader . The tree is
* assumed to be in the CoNLL format .
* The CoNNLL features that are of interest are ID , LEMMA or FORM , POSTAG ,
* HEAD , and DEPREL which are the id of the node , the string for the word at
* this position , the part of speech tag , the parent of this node , and the
* relation to the parent , respectively . These features will be extracted
* and returned as an array based tree structure ordered by the occurrence
* of the words in the sentence .
* @ param reader a reader containing one or more parse trees in the CoNLL
* format
* @ return an array of { @ link DependencyTreeNode } s that compose a dependency
* tree , or { @ code null } if no tree is present in the reader .
* @ throws IOException when errors are encountered during reading */
public DependencyTreeNode [ ] readNextTree ( BufferedReader reader ) throws IOException { } } | List < SimpleDependencyTreeNode > nodes = new ArrayList < SimpleDependencyTreeNode > ( ) ; // When building the tree , keep track of all the relations seen between
// the nodes . The nodes need to be linked by DependencyRelations , which
// need DependencyTreeNode instances . However , during parsing , we may
// encounter a forward reference to a Node not yet created , so the map
// ensures that the relation will still be added .
MultiMap < Integer , Duple < Integer , String > > relationsToAdd = new HashMultiMap < Integer , Duple < Integer , String > > ( ) ; StringBuilder sb = new StringBuilder ( ) ; // Read each line in the document to extract the feature set for each
// word in the sentence .
int id = 0 ; int offset = 0 ; for ( String line = null ; ( ( line = reader . readLine ( ) ) != null ) ; ) { line = line . trim ( ) ; // If a new line is encountered and no lines have been handled yet ,
// skip all new lines .
if ( line . length ( ) == 0 && nodes . size ( ) == 0 ) continue ; // If a new line is encountered and lines have already been
// processed , we have finished processing the entire sentence and
// can stop .
if ( line . length ( ) == 0 ) break ; sb . append ( line ) . append ( "\n" ) ; // CoNLL formats using tabs between features .
String [ ] nodeFeatures = line . split ( "\t" ) ; // Sanity check that we have enough columns to support parsing
if ( nodeFeatures . length - 1 < idIndex ) { reader . close ( ) ; throw new IllegalStateException ( "While parsing, found line with" + " too few columns. Missing node id columns. Offending " + "line:\n" + line ) ; } // Multiple parse trees may be within the same set of lines , so in
// order for the later parse trees to be linked correctly , we need
// to create an offset for the parent ids .
int realId = Integer . parseInt ( nodeFeatures [ idIndex ] ) ; if ( ( realId == 0 && nodes . size ( ) != offset ) || ( realId == 1 && nodes . size ( ) != offset && nodes . size ( ) != offset + 1 ) ) offset = nodes . size ( ) ; // Get the node id and the parent node id .
int parent = Integer . parseInt ( nodeFeatures [ parentIndex ] ) - 1 + offset ; String word = getWord ( nodeFeatures ) ; String lemma = getLemma ( nodeFeatures , word ) ; // Get the part of speech of the node .
String pos = nodeFeatures [ posIndex ] ; // Get the relation between this node and it ' s head node .
String rel = nodeFeatures [ relationIndex ] ; // Create the new relation .
SimpleDependencyTreeNode curNode = new SimpleDependencyTreeNode ( word , pos , lemma , id ) ; // Set the dependency link between this node and it ' s parent node .
// If the parent ' s real index is negative then the node itself is a
// root node and has no parent .
if ( parent - offset > 0 ) { // If the parent has already been seen , add the relation
// directly .
if ( parent < nodes . size ( ) ) { SimpleDependencyTreeNode parentNode = nodes . get ( parent ) ; DependencyRelation r = new SimpleDependencyRelation ( parentNode , rel , curNode ) ; parentNode . addNeighbor ( r ) ; curNode . addNeighbor ( r ) ; } // Otherwise , we ' ll fill in this link once the tree is has been
// fully seen .
else { relationsToAdd . put ( id , new Duple < Integer , String > ( parent , rel ) ) ; } } // Finally , add the current node to the
nodes . add ( curNode ) ; id ++ ; } if ( nodes . size ( ) == 0 ) return null ; if ( relationsToAdd . size ( ) > 0 ) { // Process all the child links that were not handled during the
// processing of the words .
for ( Map . Entry < Integer , Duple < Integer , String > > parentAndRel : relationsToAdd . entrySet ( ) ) { SimpleDependencyTreeNode dep = nodes . get ( parentAndRel . getKey ( ) ) ; Duple < Integer , String > d = parentAndRel . getValue ( ) ; SimpleDependencyTreeNode head = nodes . get ( d . x ) ; DependencyRelation r = new SimpleDependencyRelation ( head , d . y , dep ) ; head . addNeighbor ( r ) ; dep . addNeighbor ( r ) ; } } return nodes . toArray ( new SimpleDependencyTreeNode [ nodes . size ( ) ] ) ; |
public class Facebook { /** * Allows the user to set a Session for the Facebook class to use .
* If a Session is set here , then one should not use the authorize , logout ,
* or extendAccessToken methods which alter the Session object since that may
* result in undefined behavior . Using those methods after setting the
* session here will result in exceptions being thrown .
* @ param session the Session object to use , cannot be null */
@ Deprecated public void setSession ( Session session ) { } } | if ( session == null ) { throw new IllegalArgumentException ( "session cannot be null" ) ; } synchronized ( this . lock ) { this . userSetSession = session ; } |
public class RelatedTablesExtension { /** * Determine if the base id and related id mapping exists
* @ param tableName
* mapping table name
* @ param baseId
* base id
* @ param relatedId
* related id
* @ return true if mapping exists
* @ since 3.2.0 */
public boolean hasMapping ( String tableName , long baseId , long relatedId ) { } } | UserMappingDao userMappingDao = getMappingDao ( tableName ) ; return userMappingDao . countByIds ( baseId , relatedId ) > 0 ; |
public class RestService { /** * @ param method the method to check
* @ return the Produces annotation found or null if the method does not have one */
private String [ ] getProduces ( Produces baseProduces , ExecutableElement method ) { } } | Produces localProduces = method . getAnnotation ( Produces . class ) ; return localProduces != null ? localProduces . value ( ) : baseProduces != null ? baseProduces . value ( ) : null ; |
public class JsonWriterUtil { /** * Write the given primitive value to the JSON stream by using the given JSON generator .
* @ param primitiveValue The given primitive value to write .
* @ param jsonGenerator The given JSON generator .
* @ throws IOException If unable to write to the json output stream */
public static void writePrimitiveValue ( Object primitiveValue , JsonGenerator jsonGenerator ) throws IOException { } } | Class < ? > primitiveClass = PrimitiveUtil . wrap ( primitiveValue . getClass ( ) ) ; if ( String . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeString ( String . valueOf ( primitiveValue ) ) ; } else if ( Byte . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeObject ( primitiveValue ) ; } else if ( Short . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeNumber ( ( short ) primitiveValue ) ; } else if ( Integer . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeNumber ( ( int ) primitiveValue ) ; } else if ( Float . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeNumber ( ( float ) primitiveValue ) ; } else if ( Double . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeNumber ( ( double ) primitiveValue ) ; } else if ( Long . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeNumber ( ( long ) primitiveValue ) ; } else if ( Boolean . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeBoolean ( ( boolean ) primitiveValue ) ; } else if ( UUID . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeString ( primitiveValue . toString ( ) ) ; } else if ( BigDecimal . class . isAssignableFrom ( primitiveClass ) ) { jsonGenerator . writeNumber ( ( BigDecimal ) primitiveValue ) ; } else { jsonGenerator . writeObject ( primitiveValue . toString ( ) ) ; } |
public class FeaturesInner { /** * Gets the preview feature with the specified name .
* @ param resourceProviderNamespace The resource provider namespace for the feature .
* @ param featureName The name of the feature to get .
* @ 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 FeatureResultInner object if successful . */
public FeatureResultInner get ( String resourceProviderNamespace , String featureName ) { } } | return getWithServiceResponseAsync ( resourceProviderNamespace , featureName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Schema { /** * Returns the record { @ link Field } of the given name .
* @ param name Name of the field
* @ return A { @ link Field } or { @ code null } if there is no such field in this record
* or this is not a { @ link Type # RECORD RECORD } schema . */
public Field getField ( String name ) { } } | if ( fieldMap == null ) { return null ; } return fieldMap . get ( name ) ; |
public class EbeanQueryChannelService { /** * Return an object relational query for finding a List , Set , Map or single entity bean .
* @ return the Query . */
public static < T > Query < T > query ( Class < T > entityType ) { } } | Assert . notNull ( entityType , "entityType must not null" ) ; return Ebean . find ( entityType ) ; |
public class RemoteQueuePointIterator { /** * / * ( non - Javadoc )
* @ see java . util . Iterator # remove ( ) */
public void remove ( ) { } } | InvalidOperationException finalE = new InvalidOperationException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0005" , new Object [ ] { "RemoteQueuePointIterator.remove" , "1:152:1.14" , this } , null ) ) ; SibTr . exception ( tc , finalE ) ; throw finalE ; |
public class LoggingFraction { /** * Add a CustomFormatter to this logger
* @ param name the name of the formatter
* @ param module the module that the logging handler depends on
* @ param className the logging handler class to be used
* @ return This fraction . */
public LoggingFraction customFormatter ( String name , String module , String className ) { } } | return customFormatter ( name , module , className , null ) ; |
public class RottenTomatoesApi { /** * Retrieves current release DVDs
* @ param country Provides localized data for the selected country
* @ return
* @ throws RottenTomatoesException */
public List < RTMovie > getUpcomingDvds ( String country ) throws RottenTomatoesException { } } | return getUpcomingDvds ( country , DEFAULT_PAGE , DEFAULT_PAGE_LIMIT ) ; |
public class Vector3d { /** * Returns the dot product of this vector and v1.
* @ param v1
* right - hand vector
* @ return dot product */
public double dot ( Vector3d v1 ) { } } | return x * v1 . x + y * v1 . y + z * v1 . z ; |
public class ParserDQL { /** * Retrieves a SELECT or other query expression Statement from this parse context . */
StatementDMQL compileCursorSpecification ( ) { } } | QueryExpression queryExpression = XreadQueryExpression ( ) ; queryExpression . setAsTopLevel ( ) ; queryExpression . resolve ( session ) ; if ( token . tokenType == Tokens . FOR ) { read ( ) ; if ( token . tokenType == Tokens . READ ) { read ( ) ; readThis ( Tokens . ONLY ) ; } else { readThis ( Tokens . UPDATE ) ; if ( token . tokenType == Tokens . OF ) { readThis ( Tokens . OF ) ; OrderedHashSet colNames = readColumnNameList ( null , false ) ; } } } StatementDMQL cs = new StatementQuery ( session , queryExpression , compileContext ) ; return cs ; |
public class PersistablePropertiesRealm { /** * Dump properties file backed with this Realms Users and roles .
* @ return */
public Properties getProperties ( ) { } } | Properties props = new Properties ( ) ; for ( String name : this . users . keySet ( ) ) { SimpleAccount acct = this . users . get ( name ) ; props . setProperty ( USERNAME_PREFIX + name , acct . getCredentials ( ) . toString ( ) ) ; } return props ; |
public class Utils { /** * Determines if the primitive type is boxed as the boxed type
* @ param primitive the primitive type to check if boxed is the boxed type
* @ param boxed the possible boxed type of the primitive
* @ return true if boxed is the boxed type of primitive , false otherwise . */
public static boolean isBoxedType ( Class < ? > primitive , Class < ? > boxed ) { } } | return ( primitive . equals ( boolean . class ) && boxed . equals ( Boolean . class ) ) || ( primitive . equals ( byte . class ) && boxed . equals ( Byte . class ) ) || ( primitive . equals ( char . class ) && boxed . equals ( Character . class ) ) || ( primitive . equals ( double . class ) && boxed . equals ( Double . class ) ) || ( primitive . equals ( float . class ) && boxed . equals ( Float . class ) ) || ( primitive . equals ( int . class ) && boxed . equals ( Integer . class ) ) || ( primitive . equals ( long . class ) && boxed . equals ( Long . class ) ) || ( primitive . equals ( short . class ) && boxed . equals ( Short . class ) ) || ( primitive . equals ( void . class ) && boxed . equals ( Void . class ) ) ; |
public class Property { /** * < pre >
* The type of this property .
* < / pre >
* < code > . google . api . Property . PropertyType type = 2 ; < / code > */
public com . google . api . Property . PropertyType getType ( ) { } } | @ SuppressWarnings ( "deprecation" ) com . google . api . Property . PropertyType result = com . google . api . Property . PropertyType . valueOf ( type_ ) ; return result == null ? com . google . api . Property . PropertyType . UNRECOGNIZED : result ; |
public class GerritJsonEventFactory { /** * Returns the value of a JSON property as a String if it exists otherwise returns null .
* Same as calling { @ link # getString ( net . sf . json . JSONObject , java . lang . String , java . lang . String ) }
* with null as defaultValue .
* @ param json the JSONObject to check .
* @ param key the key .
* @ return the value for the key as a string . */
public static String getString ( JSONObject json , String key ) { } } | return getString ( json , key , null ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.