signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JdbcUtil { /** * queryJsonArray .
* @ param sql sql
* @ param paramList paramList
* @ param connection connection
* @ param tableName tableName
* @ param isDebug the specified debug flag
* @ return JSONArray
* @ throws SQLException SQLException
* @ throws JSONException JSONException
* @ t... | final JSONObject jsonObject = queryJson ( sql , paramList , connection , false , tableName , isDebug ) ; return jsonObject . getJSONArray ( Keys . RESULTS ) ; |
public class HtmlAdaptorServlet { /** * Display a MBeans attributes and operations
* @ param request The HTTP request
* @ param response The HTTP response
* @ exception ServletException Thrown if an error occurs
* @ exception IOException Thrown if an I / O error occurs */
private void inspectMBean ( HttpServlet... | String name = request . getParameter ( "name" ) ; if ( trace ) log . trace ( "inspectMBean, name=" + name ) ; try { MBeanData data = getMBeanData ( name ) ; request . setAttribute ( "mbeanData" , data ) ; RequestDispatcher rd = this . getServletContext ( ) . getRequestDispatcher ( "/inspectmbean.jsp" ) ; rd . forward (... |
public class SynchroData { /** * Extract raw table data from the input stream .
* @ param is input stream */
public void process ( InputStream is ) throws Exception { } } | readHeader ( is ) ; readVersion ( is ) ; readTableData ( readTableHeaders ( is ) , is ) ; |
public class TracyFutureTask { /** * When called from the parent thread to retrieve callable result ,
* it will merge the worker TracyThreadContext into the parent TracyThreadContext */
@ Override public V get ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { } } | V v = super . get ( timeout , unit ) ; this . mergeWorkerTracyTheadContext ( ) ; return v ; |
public class GraphBackedMetadataRepository { /** * Deletes a given trait from an existing entity represented by a guid .
* @ param guid globally unique identifier for the entity
* @ param traitNameToBeDeleted name of the trait
* @ throws RepositoryException */
@ Override @ GraphTransaction public void deleteTrait... | LOG . debug ( "Deleting trait={} from entity={}" , traitNameToBeDeleted , guid ) ; GraphTransactionInterceptor . lockObjectAndReleasePostCommit ( guid ) ; AtlasVertex instanceVertex = graphHelper . getVertexForGUID ( guid ) ; List < String > traitNames = GraphHelper . getTraitNames ( instanceVertex ) ; if ( ! traitName... |
public class LineEndingConversion { /** * Convert line endings of a string to the given type . Default to Unix type .
* @ param input
* The string containing line endings to be converted .
* @ param type
* Type of line endings to convert the string into .
* @ return
* String updated with the new line ending... | if ( null == input || 0 == input . length ( ) ) { return input ; } // Convert line endings to Unix LF ,
// which also sets up the string for other conversions
input = input . replace ( "\r\n" , "\n" ) ; input = input . replace ( "\r" , "\n" ) ; switch ( type ) { case CR : case Mac : // Convert line endings to CR
input ... |
public class MpInitiatorMailbox { /** * when the MpScheduler needs to log the completion of a transaction to its local repair log */
void deliverToRepairLog ( VoltMessage msg ) { } } | assert ( Thread . currentThread ( ) . getId ( ) == m_taskThreadId ) ; m_repairLog . deliver ( msg ) ; |
public class Database { /** * Get a list of all of the columns on a table .
* @ param table
* The table to check .
* @ return A list of all of the columns .
* @ throws DatabaseException
* If a database error occurs . */
public Collection < String > listColumns ( String table ) throws SQLException { } } | Collection < String > result = new ArrayList < String > ( ) ; DatabaseMetaData dbm = connection . getMetaData ( ) ; ResultSet rs = dbm . getColumns ( null , null , table , null ) ; while ( rs . next ( ) ) { result . add ( rs . getString ( "COLUMN_NAME" ) ) ; } return result ; |
public class LifecycleCallbackHelper { /** * Gets the annotated method from the class object .
* @ param clazz the Class to be inspected .
* @ param annotationClass the annotation class object
* @ return a Method object or null if there is no annotated method . */
@ SuppressWarnings ( "rawtypes" ) public Method g... | Method m = null ; Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { Annotation [ ] a = methods [ i ] . getAnnotations ( ) ; if ( a != null ) { for ( int j = 0 ; j < a . length ; j ++ ) { if ( a [ j ] . annotationType ( ) == annotationClass ) { if ( m == null ) { m =... |
public class AtomPairs2DFingerprinter { /** * Encodes name for halogen paths
* @ param dist
* @ param a
* @ param b
* @ return */
private static String encodeHalPath ( int dist , IAtom a , IAtom b ) { } } | return dist + "_" + ( isHalogen ( a ) ? "X" : a . getSymbol ( ) ) + "_" + ( isHalogen ( b ) ? "X" : b . getSymbol ( ) ) ; |
public class JFXSpinnerSkin { /** * { @ inheritDoc } */
@ Override protected void layoutChildren ( double contentX , double contentY , double contentWidth , double contentHeight ) { } } | final double strokeWidth = arc . getStrokeWidth ( ) ; final double radius = Math . min ( contentWidth , contentHeight ) / 2 - strokeWidth / 2 ; final double arcSize = snapSize ( radius * 2 + strokeWidth ) ; arcPane . resizeRelocate ( ( contentWidth - arcSize ) / 2 + 1 , ( contentHeight - arcSize ) / 2 + 1 , arcSize , a... |
public class DescribeMaintenanceWindowExecutionTaskInvocationsRequest { /** * Optional filters used to scope down the returned task invocations . The supported filter key is STATUS with the
* corresponding values PENDING , IN _ PROGRESS , SUCCESS , FAILED , TIMED _ OUT , CANCELLING , and CANCELLED .
* < b > NOTE : ... | if ( this . filters == null ) { setFilters ( new com . amazonaws . internal . SdkInternalList < MaintenanceWindowFilter > ( filters . length ) ) ; } for ( MaintenanceWindowFilter ele : filters ) { this . filters . add ( ele ) ; } return this ; |
public class AbstractEDBService { /** * Runs all registered begin commit hooks on the EDBCommit object . Logs exceptions which occurs in the hooks , except
* for ServiceUnavailableExceptions and EDBExceptions . If an EDBException occurs , it is thrown and so returned to
* the calling instance . */
private void runB... | for ( EDBBeginCommitHook hook : beginCommitHooks ) { try { hook . onStartCommit ( commit ) ; } catch ( ServiceUnavailableException e ) { // Ignore
} catch ( EDBException e ) { throw e ; } catch ( Exception e ) { logger . error ( "Error while performing EDBBeginCommitHook" , e ) ; } } |
public class EditText { /** * Sets font feature settings . The format is the same as the CSS
* font - feature - settings attribute :
* http : / / dev . w3 . org / csswg / css - fonts / # propdef - font - feature - settings
* @ param fontFeatureSettings font feature settings represented as CSS compatible string
... | if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) mInputView . setFontFeatureSettings ( fontFeatureSettings ) ; |
public class ReadFileRecordResponse { /** * addResponse - - add a new record response .
* @ param response Record response to add */
public void addResponse ( RecordResponse response ) { } } | if ( records == null ) { records = new RecordResponse [ 1 ] ; } else { RecordResponse old [ ] = records ; records = new RecordResponse [ old . length + 1 ] ; System . arraycopy ( old , 0 , records , 0 , old . length ) ; } records [ records . length - 1 ] = response ; |
public class LdapHelper { /** * Returns an Sub - Entry of an LDAP User / LDAP Group .
* @ param cn of that Entry .
* @ param owner DN of Parent Node .
* @ return a new Entry . */
public Node getEntry ( final String cn , final String owner ) { } } | // TODO implement me !
Node entry = new LdapEntry ( cn , owner ) ; return entry ; |
public class ServiceRegistry { /** * 获取所有服务描述
* @ return 所有注册的服务的方法描述
* @ throws IllegalStateException */
public Collection < MethodDescriptor < KEY > > getAllServiceDescriptors ( ) throws IllegalStateException { } } | Preconditions . checkNotNull ( serviceDescriptors , "serviceDescriptors cannot be null" ) ; return serviceDescriptors . values ( ) ; |
public class FilterQuery { /** * add a filter with multiple values to build FilterQuery instance
* @ param field
* @ param valueToFilter */
public void addMultipleValuesFilter ( String field , Set < String > valueToFilter ) { } } | if ( ! valueToFilter . isEmpty ( ) ) { filterQueries . put ( field , new FilterFieldValue ( field , valueToFilter ) ) ; } |
public class RedBlackTree { /** * restore red - black tree invariant */
private RedBlackTreeNode < Key , Value > balance ( RedBlackTreeNode < Key , Value > h ) { } } | // assert ( h ! = null ) ;
if ( isRed ( h . getRight ( ) ) ) h = rotateLeft ( h ) ; if ( isRed ( h . getLeft ( ) ) && isRed ( h . getLeft ( ) . getLeft ( ) ) ) h = rotateRight ( h ) ; if ( isRed ( h . getLeft ( ) ) && isRed ( h . getRight ( ) ) ) flipColors ( h ) ; h . setSize ( size ( h . getLeft ( ) ) + size ( h . ge... |
public class RAMJobStore { /** * Retrieve the given < code > { @ link org . quartz . triggers . Trigger } < / code > .
* @ return The desired < code > Trigger < / code > , or null if there is no match . */
@ Override public OperableTrigger retrieveTrigger ( String triggerKey ) { } } | synchronized ( lock ) { TriggerWrapper tw = wrappedTriggersByKey . get ( triggerKey ) ; return ( tw != null ) ? ( OperableTrigger ) tw . getTrigger ( ) . clone ( ) : null ; } |
public class HdfsSpout { /** * renames files and returns the new file path */
private Path renameCompletedFile ( Path file ) throws IOException { } } | String fileName = file . toString ( ) ; String fileNameMinusSuffix = fileName . substring ( 0 , fileName . indexOf ( inprogress_suffix ) ) ; String newName = new Path ( fileNameMinusSuffix ) . getName ( ) ; Path newFile = new Path ( archiveDirPath + Path . SEPARATOR + newName ) ; LOG . info ( "Completed consuming file ... |
public class ProxyBuilder { /** * Add
* < pre >
* abstractMethodErrorMessage = method + " cannot be called " ;
* abstractMethodError = new AbstractMethodError ( abstractMethodErrorMessage ) ;
* throw abstractMethodError ;
* < / pre >
* to the { @ code code } .
* @ param code The code to add to
* @ param... | TypeId < AbstractMethodError > abstractMethodErrorClass = TypeId . get ( AbstractMethodError . class ) ; MethodId < AbstractMethodError , Void > abstractMethodErrorConstructor = abstractMethodErrorClass . getConstructor ( TypeId . STRING ) ; code . loadConstant ( abstractMethodErrorMessage , "'" + method + "' cannot be... |
public class CoverageDataCore { /** * Get the coverage data value for the pixel value
* @ param griddedTile
* gridded tile
* @ param pixelValue
* pixel value
* @ return coverage data value */
public Double getValue ( GriddedTile griddedTile , float pixelValue ) { } } | Double value = null ; if ( ! isDataNull ( pixelValue ) ) { value = pixelValueToValue ( griddedTile , new Double ( pixelValue ) ) ; } return value ; |
public class ReversePurgeItemHashMap { /** * Increments the value mapped to the key if the key is present in the map . Otherwise ,
* the key is inserted with the putAmount .
* @ param key the key of the value to increment
* @ param adjustAmount the amount by which to increment the value */
void adjustOrPutValue (... | final int arrayMask = keys . length - 1 ; int probe = ( int ) hash ( key . hashCode ( ) ) & arrayMask ; int drift = 1 ; while ( states [ probe ] != 0 && ! keys [ probe ] . equals ( key ) ) { probe = ( probe + 1 ) & arrayMask ; drift ++ ; // only used for theoretical analysis
assert ( drift < DRIFT_LIMIT ) : "drift: " +... |
public class Converter { /** * / / / / Author */
static Author convert ( com . linecorp . centraldogma . common . Author author ) { } } | return AuthorConverter . TO_DATA . convert ( author ) ; |
public class RestrictionBuilder { /** * public static BeanRestriction has ( String property ) {
* return new Has ( property ) ; */
public static QualifierRestriction in ( int id , Object ... values ) { } } | return new HBaseIn ( id , Arrays . asList ( values ) ) ; |
public class MFPInternalPushMessage { /** * / * ( non - Javadoc )
* @ see com . ibm . mobile . services . push . IBMMessage # writeToParcel ( android . os . Parcel , int ) */
@ Override public void writeToParcel ( Parcel dest , int flags ) { } } | dest . writeString ( id ) ; dest . writeString ( alert ) ; dest . writeString ( url ) ; dest . writeString ( payload ) ; dest . writeString ( mid ) ; dest . writeString ( sound ) ; dest . writeString ( String . valueOf ( bridge ) ) ; dest . writeString ( priority ) ; dest . writeString ( visibility ) ; dest . writeStri... |
public class Message { /** * Parses a message header . Does not yet process the annotations chunks and message data . */
public static Message from_header ( byte [ ] header ) { } } | if ( header == null || header . length != HEADER_SIZE ) throw new PyroException ( "header data size mismatch" ) ; if ( header [ 0 ] != 'P' || header [ 1 ] != 'Y' || header [ 2 ] != 'R' || header [ 3 ] != 'O' ) throw new PyroException ( "invalid message" ) ; int version = ( ( header [ 4 ] & 0xff ) << 8 ) | ( header [ 5 ... |
public class PatternCriteria { /** * / * ( non - Javadoc )
* @ see org . talend . esb . sam . server . persistence . criterias . Criteria # parseValue ( java . lang . String ) */
@ Override public Criteria [ ] parseValue ( String attribute ) { } } | PatternCriteria result = new PatternCriteria ( this . name , this . columnName , this . condition ) ; result . pattern = toSQLPattern ( attribute ) ; return new Criteria [ ] { result } ; |
public class CommerceDiscountPersistenceImpl { /** * Returns the first commerce discount in the ordered set where displayDate & lt ; & # 63 ; and status = & # 63 ; .
* @ param displayDate the display date
* @ param status the status
* @ param orderByComparator the comparator to order the set by ( optionally < cod... | CommerceDiscount commerceDiscount = fetchByLtD_S_First ( displayDate , status , orderByComparator ) ; if ( commerceDiscount != null ) { return commerceDiscount ; } StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "displayDate=" ) ; msg . append ( displayDate ) ; m... |
public class SeaGlassInternalFrameTitlePane { /** * Set the enable / disabled state for the buttons . */
private void enableActions ( ) { } } | restoreAction . setEnabled ( frame . isMaximum ( ) || frame . isIcon ( ) ) ; maximizeAction . setEnabled ( ( frame . isMaximizable ( ) && ! frame . isMaximum ( ) && ! frame . isIcon ( ) ) || ( frame . isMaximizable ( ) && frame . isIcon ( ) ) ) ; iconifyAction . setEnabled ( frame . isIconifiable ( ) && ! frame . isIco... |
public class DistributedRaidFileSystem { /** * / * Initialize a Raid FileSystem */
public void initialize ( URI name , Configuration conf ) throws IOException { } } | this . conf = conf ; // init the codec from conf .
Codec . initializeCodecs ( conf ) ; Class < ? > clazz = conf . getClass ( "fs.raid.underlyingfs.impl" , DistributedFileSystem . class ) ; if ( clazz == null ) { throw new IOException ( "No FileSystem for fs.raid.underlyingfs.impl." ) ; } String ignoredDirectories = con... |
public class ConditionalObjectResolver { @ Override public Object resolveForObjectAndContext ( Object self , Context context ) { } } | Object result = this . conditionalResolver . resolveForObjectAndContext ( self , context ) ; if ( result == null ) { return "" ; } try { boolean boolResult = ( Boolean ) result ; if ( boolResult ^ this . neg ) { return this . subExpression . renderForContext ( context ) ; } else { return "" ; } } catch ( Throwable t ) ... |
public class StyleUtils { /** * Set the icon into the marker options
* @ param markerOptions marker options
* @ param icon icon row
* @ param density display density : { @ link android . util . DisplayMetrics # density }
* @ param iconCache icon cache
* @ return true if icon was set into the marker options */... | boolean iconSet = false ; if ( icon != null ) { Bitmap iconImage = createIcon ( icon , density , iconCache ) ; markerOptions . icon ( BitmapDescriptorFactory . fromBitmap ( iconImage ) ) ; iconSet = true ; double anchorU = icon . getAnchorUOrDefault ( ) ; double anchorV = icon . getAnchorVOrDefault ( ) ; markerOptions ... |
public class DbfRow { /** * Retrieves the value of the designated field as java . math . BigDecimal .
* @ param fieldName the name of the field
* @ return the field value , or null ( if the dbf value is NULL )
* @ throws DbfException if there ' s no field with name fieldName */
public BigDecimal getBigDecimal ( S... | Object value = get ( fieldName ) ; return value == null ? null : new BigDecimal ( value . toString ( ) ) ; |
public class ParaClient { /** * Searches for objects that have a property with a value matching a wildcard query .
* @ param < P > type of the object
* @ param type the type of object to search for . See { @ link com . erudika . para . core . ParaObject # getType ( ) }
* @ param field the property name of an obje... | MultivaluedMap < String , String > params = new MultivaluedHashMap < > ( ) ; params . putSingle ( "field" , field ) ; params . putSingle ( "q" , wildcard ) ; params . putSingle ( Config . _TYPE , type ) ; params . putAll ( pagerToParams ( pager ) ) ; return getItems ( find ( "wildcard" , params ) , pager ) ; |
public class CheckParameterizables { /** * Check all supertypes of a class .
* @ param cls Class to check .
* @ return { @ code true } when at least one supertype is a known parameterizable
* type . */
private boolean checkSupertypes ( Class < ? > cls ) { } } | for ( Class < ? > c : knownParameterizables ) { if ( c . isAssignableFrom ( cls ) ) { return true ; } } return false ; |
public class RqLive { /** * Builds current read header .
* @ param data Current read character
* @ param baos Current read header
* @ return Read header */
private static Opt < String > newHeader ( final Opt < Integer > data , final ByteArrayOutputStream baos ) { } } | Opt < String > header = new Opt . Empty < > ( ) ; if ( data . get ( ) != ' ' && data . get ( ) != '\t' ) { header = new Opt . Single < > ( new Utf8String ( baos . toByteArray ( ) ) . asString ( ) ) ; baos . reset ( ) ; } return header ; |
public class XmlHelper { /** * 针对没有嵌套节点的简单处理
* @ return map集合 */
public Map < String , String > toMap ( ) { } } | Element root = doc . getDocumentElement ( ) ; Map < String , String > params = new HashMap < String , String > ( ) ; // 将节点封装成map形式
NodeList list = root . getChildNodes ( ) ; for ( int i = 0 ; i < list . getLength ( ) ; i ++ ) { Node node = list . item ( i ) ; params . put ( node . getNodeName ( ) , node . getTextConte... |
public class MalisisFont { /** * Gets the rendering height of strings .
* @ return the string height */
public float getStringHeight ( String text , FontOptions options ) { } } | StringWalker walker = new StringWalker ( text , options ) ; walker . walkToEnd ( ) ; return walker . lineHeight ( ) ; |
public class ContentStoreImpl { /** * { @ inheritDoc } */
@ Override public Map < String , String > getSpaceProperties ( final String spaceId ) throws ContentStoreException { } } | return execute ( new Retriable ( ) { @ Override public Map < String , String > retry ( ) throws ContentStoreException { // The actual method being executed
return doGetSpaceProperties ( spaceId ) ; } } ) ; |
public class Line { /** * Marks this line empty . Also sets previous / next line ' s empty attributes . */
public void setEmpty ( ) { } } | this . value = "" ; this . leading = this . trailing = 0 ; this . isEmpty = true ; if ( this . previous != null ) { this . previous . nextEmpty = true ; } if ( this . next != null ) { this . next . prevEmpty = true ; } |
public class PaymentService { /** * Returns and refresh data of a specific { @ link Payment } .
* @ param payment
* A { @ link Payment } with Id .
* @ return Refreshed instance of the given { @ link Payment } . */
public Payment get ( Payment payment ) { } } | return RestfulUtils . show ( PaymentService . PATH , payment , Payment . class , super . httpClient ) ; |
public class Runner { /** * Setup the Flink job with the graph input , algorithm , and output .
* < p > To then execute the job call { @ link # execute } .
* @ return this
* @ throws Exception on error */
public Runner run ( ) throws Exception { } } | // Set up the execution environment
env = ExecutionEnvironment . getExecutionEnvironment ( ) ; ExecutionConfig config = env . getConfig ( ) ; // should not have any non - Flink data types
config . disableForceAvro ( ) ; config . disableForceKryo ( ) ; config . setGlobalJobParameters ( parameters ) ; parameterize ( this... |
public class ClientAsynchEventThreadPool { /** * This method will send a message to the connection listeners associated
* with this connection .
* @ param conn May be null if invoking an async callback
* @ param session May be null if invoking a connection callback
* @ param exception May be null if invoking a ... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "invokeCallback" , new Object [ ] { conn , session , exception , eventId } ) ; if ( conn != null ) // f174318
{ // f174318
try { final AsyncCallbackSynchronizer asyncCallbackSynchronizer = ( ( ConnectionProxy ) conn ) . getA... |
public class AttributeNodeMapImpl { /** * Exclude namespace declaration */
protected int getNumAttr ( ) { } } | int num = element . tree . elemNodeNumAttributes [ element . tree . nodeRepID [ element . node ] ] ; return num >= 0 ? num : 0 ; |
public class JobTracker { /** * Accept and process a new TaskTracker profile . We might
* have known about the TaskTracker previously , or it might
* be brand - new . All task - tracker structures have already
* been updated . Just process the contained tasks and any
* jobs that might be affected . */
void upda... | String trackerName = status . getTrackerName ( ) ; for ( TaskStatus report : status . getTaskReports ( ) ) { report . setTaskTracker ( trackerName ) ; TaskAttemptID taskId = report . getTaskID ( ) ; // Remove it from the expired task list
if ( report . getRunState ( ) != TaskStatus . State . UNASSIGNED ) { expireLaunch... |
public class ModelUtil { /** * Calculate a collection of all extending types for the given base types
* @ param baseTypes the collection of types to calculate the union of all extending types */
public static Collection < ModelElementType > calculateAllExtendingTypes ( Model model , Collection < ModelElementType > ba... | Set < ModelElementType > allExtendingTypes = new HashSet < ModelElementType > ( ) ; for ( ModelElementType baseType : baseTypes ) { ModelElementTypeImpl modelElementTypeImpl = ( ModelElementTypeImpl ) model . getType ( baseType . getInstanceType ( ) ) ; modelElementTypeImpl . resolveExtendingTypes ( allExtendingTypes )... |
public class PrimitiveValue { /** * Return byte array value for this PrimitiveValue given a particular type
* @ param type of this value
* @ return value expressed as a byte array
* @ throws IllegalStateException if not a byte array value representation */
public byte [ ] byteArrayValue ( final PrimitiveType type... | if ( representation == Representation . BYTE_ARRAY ) { return byteArrayValue ; } else if ( representation == Representation . LONG && size == 1 && type == PrimitiveType . CHAR ) { byteArrayValueForLong [ 0 ] = ( byte ) longValue ; return byteArrayValueForLong ; } throw new IllegalStateException ( "PrimitiveValue is not... |
public class EventReadWriteLock { /** * Temporarily suspend read locks and wait for an event to be posted .
* Block until an event is posted .
* N . B . this blocking method may wake up spuriously , and should be called from a loop that tests for the exit condition .
* @ return < code > true < / code > if an even... | // must get the event count BEFORE releasing the read locks
// to avoid a lost update
final int oldEventCount = eventLock . getEventCount ( ) ; final int readLockCount = releaseReadLocks ( ) ; if ( readLockCount == 0 ) throw new IllegalStateException ( "Must hold read lock" ) ; if ( getWriteHoldCount ( ) > 0 ) throw ne... |
public class ContextualLoggerFactory { /** * Returns a contextual logger .
* @ param name the contextual logger name
* @ param context the logger context
* @ return the logger */
public static ContextualLogger getLogger ( String name , LoggerContext context ) { } } | return new ContextualLogger ( LoggerFactory . getLogger ( name ) , context ) ; |
public class JStormUtils { /** * use launchProcess to execute a command
* @ param command command to be executed
* @ throws ExecuteException
* @ throws IOException */
public static void exec_command ( String command ) throws IOException { } } | launchProcess ( command , new HashMap < String , String > ( ) , false ) ; |
public class NutDataInputStream { /** * Read a simple var int up to 32 bits */
public int readVarInt ( ) throws IOException { } } | boolean more ; int result = 0 ; do { int b = in . readUnsignedByte ( ) ; more = ( b & 0x80 ) == 0x80 ; result = 128 * result + ( b & 0x7F ) ; // TODO Check for int overflow
} while ( more ) ; return result ; |
public class DynamoDBTableMapper { /** * Saves and deletes the objects given using one or more calls to the
* batchWriteItem API .
* @ param objectsToWrite The objects to write .
* @ param objectsToDelete The objects to delete .
* @ return The list of failed batches .
* @ see com . amazonaws . services . dyna... | return mapper . batchWrite ( objectsToWrite , objectsToDelete ) ; |
public class DumpProcessingController { /** * Processes the most recent dump of the sites table to extract information
* about registered sites .
* @ return a Sites objects that contains the extracted information , or null
* if no sites dump was available ( typically in offline mode without
* having any previou... | MwDumpFile sitesTableDump = getMostRecentDump ( DumpContentType . SITES ) ; if ( sitesTableDump == null ) { return null ; } // Create a suitable processor for such dumps and process the file :
MwSitesDumpFileProcessor sitesDumpFileProcessor = new MwSitesDumpFileProcessor ( ) ; sitesDumpFileProcessor . processDumpFileCo... |
public class BaasUser { /** * Checks if this user is the currently logged in user on this device .
* @ return true if < code > this = = BaasUser . current ( ) < / code > */
public boolean isCurrent ( ) { } } | BaasUser current = current ( ) ; if ( current == null ) return false ; Logger . debug ( "Current username is %s and mine is %s" , current . username , username ) ; return current . username . equals ( username ) ; |
public class JaxbPUnit20 { /** * Gets the value of the sharedCacheMode property .
* @ return value of the sharedCacheMode property . */
@ Override public SharedCacheMode getSharedCacheMode ( ) { } } | // Convert this SharedCacheMode from the class defined
// in JAXB ( com . ibm . ws . jpa . pxml20 . PersistenceUnitCachingType )
// to JPA ( javax . persistence . SharedCacheMode ) .
// Per the spec , must return UNSPECIFIED if not in xml
SharedCacheMode rtnMode = SharedCacheMode . UNSPECIFIED ; PersistenceUnitCachingT... |
public class XYMoneyStep { /** * index < 0 means that we emphasize no point at all */
public void emphasizePoint ( int index ) { } } | if ( dots == null || dots . length < ( index - 1 ) ) return ; // impossible !
// if no change , nothing to do
if ( emphasizedPoint == index ) return ; // de - emphasize the current emphasized point
if ( emphasizedPoint >= 0 ) { dots [ emphasizedPoint ] . attr ( "r" , dotNormalSize ) ; emphasizedPoint = - 1 ; } if ( ind... |
public class VcfHeaderParser { /** * Read the VCF header from the specified readable .
* @ param readable readable to read from , must not be null
* @ return the VCF header read from the specified readable
* @ throws IOException if an I / O error occurs */
public static VcfHeader header ( final Readable readable ... | checkNotNull ( readable ) ; ParseListener parseListener = new ParseListener ( ) ; VcfParser . parse ( readable , parseListener ) ; return parseListener . getHeader ( ) ; |
public class LoadBalancerSupportImpl { @ Override public void removeIPEndpoints ( @ Nonnull String fromLoadBalancerId , @ Nonnull String ... addresses ) throws CloudException , InternalException { } } | NovaMethod method = new NovaMethod ( getProvider ( ) ) ; for ( JSONObject member : findAllMembers ( fromLoadBalancerId ) ) { for ( String address : addresses ) { try { if ( address . equals ( member . getString ( "address" ) ) ) { method . deleteNetworks ( getMembersResource ( ) , member . getString ( "id" ) ) ; } } ca... |
public class LongBitSet { /** * this = this XOR other */
void xor ( LongBitSet other ) { } } | assert other . numWords <= numWords : "numWords=" + numWords + ", other.numWords=" + other . numWords ; int pos = Math . min ( numWords , other . numWords ) ; while ( -- pos >= 0 ) { bits [ pos ] ^= other . bits [ pos ] ; } |
public class SecurityPolicyClient { /** * Patches a rule at the specified priority .
* < p > Sample code :
* < pre > < code >
* try ( SecurityPolicyClient securityPolicyClient = SecurityPolicyClient . create ( ) ) {
* Integer priority = 0;
* ProjectGlobalSecurityPolicyName securityPolicy = ProjectGlobalSecuri... | PatchRuleSecurityPolicyHttpRequest request = PatchRuleSecurityPolicyHttpRequest . newBuilder ( ) . setPriority ( priority ) . setSecurityPolicy ( securityPolicy ) . setSecurityPolicyRuleResource ( securityPolicyRuleResource ) . build ( ) ; return patchRuleSecurityPolicy ( request ) ; |
public class ALU { public static Object urshift ( final Object o1 , final Object o2 ) { } } | requireNonNull ( o1 , o2 ) ; int right = requireNumber ( o2 ) . intValue ( ) ; switch ( getTypeMark ( o1 ) ) { case CHAR : return ( ( Character ) o1 ) >>> right ; case BYTE : return ( ( Byte ) o1 ) >>> right ; case SHORT : return ( ( Short ) o1 ) >>> right ; case INTEGER : return ( ( Integer ) o1 ) >>> right ; case LON... |
public class ObjectEnvelopeOrdering { /** * Finds edges base on a specific collection descriptor ( 1 : n and m : n )
* and adds them to the edge map .
* @ param vertex the object envelope vertex holding the collection
* @ param cds the collection descriptor */
private void addCollectionEdges ( Vertex vertex , Col... | ObjectEnvelope envelope = vertex . getEnvelope ( ) ; Object col = cds . getPersistentField ( ) . get ( envelope . getRealObject ( ) ) ; Object [ ] refObjects ; if ( col == null || ( ProxyHelper . isCollectionProxy ( col ) && ! ProxyHelper . getCollectionProxy ( col ) . isLoaded ( ) ) ) { refObjects = EMPTY_OBJECT_ARRAY... |
public class Swaption { /** * This method returns the value of the product using a Black - Scholes model for the swap rate
* The model is determined by a discount factor curve and a swap rate volatility .
* @ param forwardCurve The forward curve on which to value the swap .
* @ param swaprateVolatility The Black ... | double swaprate = swaprates [ 0 ] ; for ( double swaprate1 : swaprates ) { if ( swaprate1 != swaprate ) { throw new RuntimeException ( "Uneven swaprates not allows for analytical pricing." ) ; } } double [ ] swapTenor = new double [ fixingDates . length + 1 ] ; System . arraycopy ( fixingDates , 0 , swapTenor , 0 , fix... |
public class AbstractBoottimeAddStepHandler { /** * If { @ link OperationContext # isBooting ( ) } returns { @ code true } , invokes
* { @ link # performBoottime ( OperationContext , org . jboss . dmr . ModelNode , org . jboss . as . controller . registry . Resource ) } ,
* else invokes { @ link OperationContext # ... | if ( context . isBooting ( ) ) { performBoottime ( context , operation , resource ) ; } else { context . reloadRequired ( ) ; } |
public class Transform { /** * Transforms the specified < code > ptSrc < / code > and stores the result
* in < code > ptDst < / code > .
* If < code > ptDst < / code > is < code > null < / code > , a new { @ link Point2D }
* object is allocated and then the result of the transformation is
* stored in this objec... | m_jso . transform ( ptSrc . getJSO ( ) , ptDst . getJSO ( ) ) ; |
public class Json { /** * Writes the value as a field on the current JSON object , without writing the actual class .
* @ param value May be null .
* @ see # writeValue ( String , Object , Class , Class ) */
public void writeValue ( String name , Object value ) { } } | try { writer . name ( name ) ; } catch ( IOException ex ) { throw new JsonException ( ex ) ; } if ( value == null ) writeValue ( value , null , null ) ; else writeValue ( value , value . getClass ( ) , null ) ; |
public class ContentMetadataKeyHierarchy { /** * Sets the hierarchyLevels value for this ContentMetadataKeyHierarchy .
* @ param hierarchyLevels * The levels of the { @ code ContentMetadataKeyHierarchy } . This
* attribute is readonly and
* the hierarchy levels must form a continuous set of
* 1 , 2 , . . . , N ... | this . hierarchyLevels = hierarchyLevels ; |
public class AutoConfigurationImportSelector { /** * Handle any invalid excludes that have been specified .
* @ param invalidExcludes the list of invalid excludes ( will always have at least one
* element ) */
protected void handleInvalidExcludes ( List < String > invalidExcludes ) { } } | StringBuilder message = new StringBuilder ( ) ; for ( String exclude : invalidExcludes ) { message . append ( "\t- " ) . append ( exclude ) . append ( String . format ( "%n" ) ) ; } throw new IllegalStateException ( String . format ( "The following classes could not be excluded because they are" + " not auto-configurat... |
public class BaseRpcServlet { /** * 获取http请求的request中的content - type , 如没有设置则设置为默认的
* { @ link com . baidu . beidou . navi . constant . NaviCommonConstant # DEFAULT _ PROTOCAL _ CONTENT _ TYPE }
* @ param httpServletRequest
* @ return */
protected String getProtocolByHttpContentType ( HttpServletRequest httpServl... | if ( StringUtil . isEmpty ( httpServletRequest . getContentType ( ) ) ) { throw new InvalidRequestException ( "Rpc protocol invalid" ) ; } String protocol = httpServletRequest . getContentType ( ) . split ( ";" ) [ 0 ] ; if ( protocol == null ) { protocol = NaviCommonConstant . DEFAULT_PROTOCAL_CONTENT_TYPE ; if ( LOG ... |
public class EJBMDOrchestrator { /** * Determine the Home ' s method level metadata
* @ param isEntity
* @ param methodInterface
* @ param homeMethods
* @ param sessionHomeNoTxAttrMethods
* @ param sessionHomeNoTxAttrMethodSignatures
* @ param entityHomeNoTxAttrMethods
* @ param entityHomeNoTxAttrMethodSi... | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "initializeHomeMethodMetadata" ) ; int metaMethodElementKind = methodInterface . getValue ( ) ; // d162441
EJBMethodInfoImpl [ ] homeMethodInfos = new EJBMethodInfoImpl [ homeMethods . leng... |
public class HashIntMap { /** * Remove an element with optional checking to see if we should shrink .
* When this is called from our iterator , checkShrink = = false to avoid booching the buckets . */
protected Record < V > removeImpl ( int key , boolean checkShrink ) { } } | int index = keyToIndex ( key ) ; // go through the chain looking for a match
for ( Record < V > prev = null , rec = _buckets [ index ] ; rec != null ; rec = rec . next ) { if ( rec . key == key ) { if ( prev == null ) { _buckets [ index ] = rec . next ; } else { prev . next = rec . next ; } _size -- ; if ( checkShrink ... |
public class StreamService { /** * { @ inheritDoc } */
public void publish ( Boolean dontStop ) { } } | // null is as good as false according to Boolean . valueOf ( ) so if null , interpret as false
if ( dontStop == null || ! dontStop ) { IConnection conn = Red5 . getConnectionLocal ( ) ; if ( conn instanceof IStreamCapableConnection ) { IStreamCapableConnection streamConn = ( IStreamCapableConnection ) conn ; Number str... |
public class HttpPublishingComponentImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . javaee . ddmodel . wsbnd . HttpPublishing # getWebserviceSecurity ( ) */
@ Override public WebserviceSecurity getWebserviceSecurity ( ) { } } | if ( delegate == null ) { return this . webServiceSecurity ; } else { return this . webServiceSecurity == null ? delegate . getWebserviceSecurity ( ) : this . webServiceSecurity ; } |
public class ClientAsynchEventThreadPool { /** * Dispatches a thread which will call the consumerSetChange method on the ConsumerSetChangeCallback passing in the supplied parameters .
* @ param consumerSetChangeCallback
* @ param isEmpty */
public void dispatchConsumerSetChangeCallbackEvent ( ConsumerSetChangeCallb... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "dispatchConsumerSetChangeCallbackEvent" , new Object [ ] { consumerSetChangeCallback , isEmpty } ) ; // Create a new ConsumerSetChangeCallbackThread and dispatch it .
final ConsumerSetChangeCallbackThread thread = ne... |
public class Graphs { /** * Returns true if { @ code graph } has at least one cycle . A cycle is defined as a non - empty subset
* of edges in a graph arranged to form a path ( a sequence of adjacent outgoing edges ) starting
* and ending with the same node .
* < p > This method will detect any non - empty cycle ... | int numEdges = graph . edges ( ) . size ( ) ; if ( numEdges == 0 ) { return false ; // An edge - free graph is acyclic by definition .
} if ( ! graph . isDirected ( ) && numEdges >= graph . nodes ( ) . size ( ) ) { return true ; // Optimization for the undirected case : at least one cycle must exist .
} Map < Object , ... |
public class AbstractCompiler { /** * Crack a command line .
* @ param toProcess
* the command line to process
* @ return the command line broken into strings . An empty or null toProcess
* parameter results in a zero sized array */
private String [ ] parseArgLine ( final String toProcess ) { } } | if ( toProcess == null || toProcess . length ( ) == 0 ) { // no command ? no string
return new String [ 0 ] ; } // parse with a simple finite state machine
final int normal = 0 ; final int inQuote = 1 ; final int inDoubleQuote = 2 ; int state = normal ; final StringTokenizer tok = new StringTokenizer ( toProcess , "\"\... |
public class ReflectionUtils { /** * Silently invoke the specified methodName using reflection .
* @ param object
* @ param methodName
* @ param parameters
* @ return true if the invoke was successful */
public static Object invoke ( Object object , String methodName , Object ... parameters ) { } } | Method method = getMethodThatMatchesParameters ( object . getClass ( ) , methodName , parameters ) ; if ( method != null ) { try { return method . invoke ( object , parameters ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( "Unable to invoke method" , e ) ; } catch ( IllegalArgumentException e )... |
import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; class DivisibleTuples { /** * Provides tuples from the input list where all elements are divisible by the given divisor .
* Examples :
* get _ divisible _ tuples ( [ ( 6 , 24 , 12 ) , ( 7 , 9 , 6 ) , ( 12 , 18 , 21 ) ] , 6 ) ... | List < List < Integer > > filtered_tuples = new ArrayList < > ( ) ; for ( List < Integer > tuple : input_list ) { boolean divisible = true ; for ( int element : tuple ) { if ( element % divisor != 0 ) { divisible = false ; break ; } } if ( divisible ) filtered_tuples . add ( tuple ) ; } return Arrays . toString ( filte... |
public class ColumnMajorSparseMatrix { /** * Parses { @ link ColumnMajorSparseMatrix } from the given Matrix Market .
* @ param is the input stream in Matrix Market format
* @ return a parsed matrix
* @ exception IOException if an I / O error occurs . */
public static ColumnMajorSparseMatrix fromMatrixMarket ( In... | return Matrix . fromMatrixMarket ( is ) . to ( Matrices . SPARSE_COLUMN_MAJOR ) ; |
public class Greeting { /** * Get the greeting message .
* @ return the greeting message . */
public String greeting ( ) { } } | int current = counter . getAndAdd ( 1 ) ; if ( current % 2 != 0 ) { return format ( "Hello Rollbar number %d" , current ) ; } throw new RuntimeException ( "Fatal error at greeting number: " + current ) ; |
public class OWLSEffect { /** * TODO
* Currently acts as an example of how to add an SWRL expression to the OWL - S result
* an instance of this class represents */
public void addExpression ( ) { } } | SWRL expression = getOWLModel ( ) . createSWRLExpression ( null ) ; if ( getOWLValueObject ( ) . owlValue ( ) . isIndividual ( ) ) { SWRLIndividual swrlIndividual = swrl ( ) . wrapIndividual ( getOWLValueObject ( ) . owlValue ( ) . castTo ( OWLIndividual . class ) ) ; Atom atom = swrl ( ) . createSameIndividualAtom ( s... |
public class DefaultGroovyMethods { /** * Selects the minimum value found from the Iterator
* using the closure to determine the correct ordering .
* The iterator will become
* exhausted of elements after this operation .
* If the closure has two parameters
* it is used like a traditional Comparator . I . e .... | "T" , "T,T" } ) Closure closure ) { return min ( ( Iterable < T > ) toList ( self ) , closure ) ; |
public class AffectedDeploymentOverlay { /** * It will look for all the deployments under the deploymentsRootAddress with a runtimeName in the specified list of
* runtime names and then transform the operation so that every server having those deployments will redeploy the
* affected deployments .
* @ see # trans... | Set < String > deploymentNames = listDeployments ( context . readResourceFromRoot ( deploymentsRootAddress ) , runtimeNames ) ; Operations . CompositeOperationBuilder opBuilder = Operations . CompositeOperationBuilder . create ( ) ; if ( deploymentNames . isEmpty ( ) ) { for ( String s : runtimeNames ) { ServerLogger .... |
public class ResourceFactory { /** * 将对象以指定资源名注入到资源池中
* @ param < A > 泛型
* @ param autoSync 是否同步已被注入的资源
* @ param name 资源名
* @ param rs 资源对象
* @ return 旧资源对象 */
public < A > A register ( final boolean autoSync , final String name , final A rs ) { } } | checkResourceName ( name ) ; final Class < ? > claz = rs . getClass ( ) ; ResourceType rtype = claz . getAnnotation ( ResourceType . class ) ; if ( rtype == null ) { return ( A ) register ( autoSync , name , claz , rs ) ; } else { A old = null ; A t = ( A ) register ( autoSync , name , rtype . value ( ) , rs ) ; if ( t... |
public class Assertions { /** * Check that object is presented among provided elements and replace the object by equal element from the list .
* @ param < T > type of object
* @ param obj object to be checked
* @ param list list of elements for checking
* @ return equal element provided in the list
* @ throws... | if ( obj == null ) { for ( final T i : assertNotNull ( list ) ) { if ( i == null ) { return i ; } } } else { final int objHash = obj . hashCode ( ) ; for ( final T i : assertNotNull ( list ) ) { if ( obj == i || ( i != null && objHash == i . hashCode ( ) && obj . equals ( i ) ) ) { return i ; } } } final AssertionError... |
public class MtasSolrCollectionCache { /** * Empty . */
public void empty ( ) { } } | for ( Entry < String , String > entry : idToVersion . entrySet ( ) ) { expirationVersion . remove ( entry . getValue ( ) ) ; versionToItem . remove ( entry . getValue ( ) ) ; if ( collectionCachePath != null && ! collectionCachePath . resolve ( entry . getValue ( ) ) . toFile ( ) . delete ( ) ) { log . debug ( "couldn'... |
public class CacheableWorkspaceDataManager { /** * Try to get the TransactionManager from the cache by calling by reflection
* getTransactionManager ( ) on the cache instance , by default it will return null */
private static TransactionManager getTransactionManagerFromCache ( WorkspaceStorageCache cache ) { } } | try { return ( TransactionManager ) cache . getClass ( ) . getMethod ( "getTransactionManager" , ( Class < ? > [ ] ) null ) . invoke ( cache , ( Object [ ] ) null ) ; } catch ( Exception e ) { LOG . debug ( "Could not get the transaction manager from the cache" , e ) ; } return null ; |
public class JdbcRow { /** * Returns the column as a long .
* @ param index 1 - based
* @ return column as a long */
public long getLong ( int index ) { } } | Object value = _values [ index - 1 ] ; if ( value instanceof Long ) { return ( Long ) value ; } else if ( value instanceof Integer ) { return ( Integer ) value ; } else { return Long . valueOf ( value . toString ( ) ) ; } |
public class ParticipationStatus { /** * Searches for a parameter value and creates one if it cannot be found . All
* objects are guaranteed to be unique , so they can be compared with
* { @ code = = } equality .
* @ param value the parameter value
* @ return the object */
public static ParticipationStatus get ... | if ( "NEEDS ACTION" . equalsIgnoreCase ( value ) ) { // vCal
return NEEDS_ACTION ; } return enums . get ( value ) ; |
public class OMVRBTree { /** * Intended to be called only from OTreeSet . readObject */
void readOTreeSet ( int iSize , ObjectInputStream s , V defaultVal ) throws java . io . IOException , ClassNotFoundException { } } | buildFromSorted ( iSize , null , s , defaultVal ) ; |
public class PreparedGetObject { /** * Creates { @ link Single } which will perform Get Operation lazily when somebody subscribes to it and send result to observer .
* < dl >
* < dt > < b > Scheduler : < / b > < / dt >
* < dd > Operates on { @ link StorIOContentResolver # defaultRxScheduler ( ) } if not { @ code ... | return RxJavaUtils . createSingleOptional ( storIOContentResolver , this ) ; |
public class AmazonCloudFrontClient { /** * Return public key configuration informaation
* @ param getPublicKeyConfigRequest
* @ return Result of the GetPublicKeyConfig operation returned by the service .
* @ throws AccessDeniedException
* Access denied .
* @ throws NoSuchPublicKeyException
* The specified ... | request = beforeClientExecution ( request ) ; return executeGetPublicKeyConfig ( request ) ; |
public class TokenFilter { /** * Replaces all current token values with the contents of the given map ,
* where each map key represents a token name , and each map value
* represents a token value .
* @ param tokens
* A map containing the token names and corresponding values to
* assign . */
public void setTo... | tokenValues . clear ( ) ; tokenValues . putAll ( tokens ) ; |
public class PlayerStatsService { /** * Retrieve the most played champions for the target player
* @ param accId The player ' s id
* @ param mode The mode to check
* @ return Champion stats */
public List < ChampionStatInfo > retrieveTopPlayedChampions ( long accId , GameMode mode ) { } } | return client . sendRpcAndWait ( SERVICE , "retrieveTopPlayedChampions" , accId , mode ) ; |
public class Canvas { /** * Draws { @ code image } at the specified location { @ code ( x , y ) } . */
public Canvas draw ( Drawable image , float x , float y ) { } } | return draw ( image , x , y , image . width ( ) , image . height ( ) ) ; |
public class OAuthProfileCreator { /** * Make a request to get the data of the authenticated user for the provider .
* @ param service the OAuth service
* @ param accessToken the access token
* @ param dataUrl url of the data
* @ param verb method used to request data
* @ return the user data response */
prot... | logger . debug ( "accessToken: {} / dataUrl: {}" , accessToken , dataUrl ) ; final long t0 = System . currentTimeMillis ( ) ; final OAuthRequest request = createOAuthRequest ( dataUrl , verb ) ; signRequest ( service , accessToken , request ) ; final String body ; final int code ; try { Response response = service . ex... |
public class CmsJspStatusBean { /** * Returns the initialized messages object to read localized messages from . < p >
* @ return the initialized messages object to read localized messages from */
protected CmsMessages getMessages ( ) { } } | if ( m_messages == null ) { // initialize the localized messages
m_messages = new CmsMessages ( Messages . get ( ) . getBundleName ( ) , getLocale ( ) . toString ( ) ) ; } return m_messages ; |
public class ValidatorTag { /** * < p > Create a new instance of the specified { @ link Validator }
* class , and register it with the { @ link UIComponent } instance associated
* with our most immediately surrounding { @ link UIComponentTag } instance , if
* the { @ link UIComponent } instance was created by thi... | // Locate our parent UIComponentTag
UIComponentClassicTagBase tag = UIComponentClassicTagBase . getParentUIComponentClassicTagBase ( pageContext ) ; if ( tag == null ) { // PENDING i18n
throw new JspException ( "Not nested in a UIComponentTag Error for tag with handler class:" + this . getClass ( ) . getName ( ) ) ; } ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.