signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class LU { /** * Returns the pivot sign . */
private static int pivsign ( int [ ] piv , int n ) { } } | int pivsign = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( piv [ i ] != ( i + 1 ) ) pivsign = - pivsign ; } return pivsign ; |
public class Path { /** * move to the next key in the tree */
void successor ( ) { } } | Object [ ] node = currentNode ( ) ; int i = currentIndex ( ) ; if ( ! isLeaf ( node ) ) { // if we ' re on a key in a branch , we MUST have a descendant either side of us ,
// so we always go down the left - most child until we hit a leaf
node = ( Object [ ] ) node [ getBranchKeyEnd ( node ) + i + 1 ] ; while ( ! isLea... |
public class HBaseDataHandler { /** * ( non - Javadoc )
* @ see
* com . impetus . client . hbase . admin . DataHandler # writeJoinTableData ( java . lang
* . String , java . lang . String , java . util . Map ) */
@ Override public void writeJoinTableData ( String tableName , Object rowId , Map < String , Object >... | HTableInterface hTable = gethTable ( tableName ) ; hbaseWriter . writeColumns ( hTable , rowId , columns , columnFamilyName ) ; puthTable ( hTable ) ; |
public class AmqpClient { /** * Sends a StartOkConnection to server .
* @ param clientProperties
* @ param mechanism
* @ param response
* @ param locale
* @ return AmqpClient */
AmqpClient startOkConnection ( AmqpArguments clientProperties , String mechanism , String response , String locale ) { } } | this . startOkConnection ( clientProperties , mechanism , response , locale , null , null ) ; return this ; |
public class ClientEventHandler { /** * Invoke the execute method
* @ param method the execute method
* @ param listener the listener
* @ param userAgent the user agent object */
protected void invokeExecuteMethod ( Method method , Object listener , Object userAgent ) { } } | ReflectMethodUtil . invokeExecuteMethod ( method , listener , context , userAgent ) ; |
public class Vector3f { /** * Set the x , y and z components to match the supplied vector .
* Note that due to the given vector < code > v < / code > storing the components in double - precision ,
* there is the possibility to lose precision .
* @ param v
* contains the values of x , y and z to set
* @ return... | return set ( ( float ) v . x ( ) , ( float ) v . y ( ) , ( float ) v . z ( ) ) ; |
public class MtasSolrComponentVersion { /** * ( non - Javadoc )
* @ see
* mtas . solr . handler . component . util . MtasSolrComponent # create ( mtas . codec . util .
* CodecComponent . BasicComponent , java . lang . Boolean ) */
@ Override public SimpleOrderedMap < Object > create ( ComponentVersion version , B... | return getVersion ( ) ; |
public class CmsReplaceDialog { /** * Starts the upload progress bar . < p > */
private void showProgress ( ) { } } | CmsFileInfo fileInfo = m_fileInput . getFiles ( ) [ 0 ] ; m_progressInfo = new CmsUploadProgressInfo ( Collections . singletonList ( fileInfo . getFileName ( ) ) ) ; m_progressInfo . setContentLength ( fileInfo . getFileSize ( ) ) ; m_mainPanel . setContainerWidget ( m_progressInfo ) ; m_updateProgressTimer = new Timer... |
public class LinuxTaskController { /** * a file and execute it . */
private void writeCommand ( String cmdLine , String directory ) throws IOException { } } | PrintWriter pw = null ; String commandFile = directory + File . separator + COMMAND_FILE ; LOG . info ( "Writing commands to " + commandFile ) ; try { FileWriter fw = new FileWriter ( commandFile ) ; BufferedWriter bw = new BufferedWriter ( fw ) ; pw = new PrintWriter ( bw ) ; pw . write ( cmdLine ) ; } catch ( IOExcep... |
public class DefaultTransformer { /** * { @ inheritDoc } */
@ Override protected Iterable < Target > output ( ) { } } | if ( currentInput == null && currentOutput == null ) return null ; // In case a transformation is already in progress , return the existing output iterable
if ( currentOutput != null ) return currentOutput ; // No transformation is in progress - > create new output and forget the input
currentOutput = new DefaultTransf... |
public class ReflectionUtil { /** * For a field of type List < Enumeration < Foo > > , returns Foo */
public static Class < ? > getGenericCollectionTypeOfFieldWithSecondOrderForList ( Field next ) { } } | if ( ! List . class . isAssignableFrom ( next . getType ( ) ) ) { return getGenericCollectionTypeOfField ( next ) ; } Class < ? > type ; ParameterizedType collectionType = ( ParameterizedType ) next . getGenericType ( ) ; Type firstArg = collectionType . getActualTypeArguments ( ) [ 0 ] ; if ( ParameterizedType . class... |
public class CompositeResultHandler { /** * Processes the specified result using all delegate result handlers .
* @ param result Validation result to be handled .
* @ see ResultHandler # handleResult ( Object ) */
@ Override public void handleResult ( RHI result ) { } } | for ( ResultHandler < RHI > resultHandler : resultHandlers ) { resultHandler . handleResult ( result ) ; } |
public class IteratorHelper { /** * Retrieve the size of the passed { @ link Enumeration } .
* @ param aEnumeration
* Enumeration to check . May be < code > null < / code > .
* @ return The number objects or 0 if the passed parameter is
* < code > null < / code > . */
@ Nonnegative public static int getSize ( @... | int ret = 0 ; if ( aEnumeration != null ) while ( aEnumeration . hasMoreElements ( ) ) { aEnumeration . nextElement ( ) ; ++ ret ; } return ret ; |
public class ServletHttpResponse { public void setDateHeader ( String name , long value ) { } } | try { _httpResponse . setDateField ( name , value ) ; } catch ( IllegalStateException e ) { LogSupport . ignore ( log , e ) ; } |
public class Symbol { /** * This method looks in the supertypes graph that has the current class as the
* initial node , till it finds the current symbol or another symbol that hides it .
* If the current class has more than one supertype ( extends one class and
* implements one or more interfaces ) then null can... | if ( currentClass == owner ) { return this ; } Scope . Entry e = currentClass . members ( ) . lookup ( name ) ; while ( e . scope != null ) { if ( e . sym . kind == kind && ( kind != MTH || ( e . sym . flags ( ) & STATIC ) != 0 && types . isSubSignature ( e . sym . type , type ) ) ) { return e . sym ; } e = e . next ( ... |
public class PluginMessageDescription { /** * Create a description for an EventCondition object .
* @ param condition the condition
* @ return a description to be used on email templates */
public String events ( EventCondition condition ) { } } | String description = "event on: " + condition . getDataId ( ) ; if ( condition . getExpression ( ) != null ) { description += " [" + condition . getExpression ( ) + "]" ; } return description ; |
public class MarkSet { /** * Marks { @ code type } , throwing if it is explicitly excluded , or if any of its members are also
* specifically included . */
void root ( ProtoType type ) { } } | if ( type == null ) throw new NullPointerException ( "type == null" ) ; checkArgument ( ! identifierSet . excludes ( type ) ) ; checkArgument ( ! members . containsKey ( type ) ) ; types . add ( type ) ; |
public class DynaFormRow { /** * Adds nested model with given colspan and rowspan .
* @ param model
* @ param colspan
* @ param rowspan
* @ return DynaFormModelElement added model */
public DynaFormModelElement addModel ( final DynaFormModel model , final int colspan , final int rowspan ) { } } | final DynaFormModelElement nestedModel = new DynaFormModelElement ( model , colspan , rowspan , row , elements . size ( ) + 1 , dynaFormModel . getControls ( ) . size ( ) + 1 , extended ) ; elements . add ( nestedModel ) ; dynaFormModel . getControls ( ) . addAll ( model . getControls ( ) ) ; totalColspan = totalColspa... |
public class PageWrapper { /** * Creates a new instance of the PageWrapper class for a new Page .
* @ param page Page to wrap .
* @ param parent Page ' s Parent .
* @ param pointer Page Pointer . */
static PageWrapper wrapNew ( BTreePage page , PageWrapper parent , PagePointer pointer ) { } } | return new PageWrapper ( page , parent , pointer , true ) ; |
public class HdfsFileVec { /** * This name is used by the DVecs to load data on - demand . */
public static Key make ( FileStatus f ) { } } | Futures fs = new Futures ( ) ; Key key = make ( f , fs ) ; fs . blockForPending ( ) ; return key ; |
public class MOEADD { /** * update the parent population by using the ENLU method , instead of fast non - dominated sorting */
public void updateArchive ( S indiv ) { } } | // find the location of ' indiv '
setLocation ( indiv , idealPoint . getValues ( ) , nadirPoint . getValues ( ) ) ; int location = ( int ) indiv . getAttribute ( "region" ) ; numRanks = nondominated_sorting_add ( indiv ) ; if ( numRanks == 1 ) { deleteRankOne ( indiv , location ) ; } else { ArrayList < S > lastFront = ... |
public class CsvReader { /** * Specifies the types for the CSV fields . This method parses the CSV data to a 2 - tuple
* which has fields of the specified types .
* This method is overloaded for each possible length of the tuples to support type safe
* creation of data sets through CSV parsing .
* @ param type0... | TupleTypeInfo < Tuple2 < T0 , T1 > > types = TupleTypeInfo . getBasicTupleTypeInfo ( type0 , type1 ) ; CsvInputFormat < Tuple2 < T0 , T1 > > inputFormat = new CsvInputFormat < Tuple2 < T0 , T1 > > ( path ) ; configureInputFormat ( inputFormat , type0 , type1 ) ; return new DataSource < Tuple2 < T0 , T1 > > ( executionC... |
public class ElementWithOptions { /** * Indicates if the element has an enabled value in any of its groups , that must also be enabled .
* @ param value Value
* @ return True if the value exists and is enabled , false otherwise */
public boolean hasValueEnabled ( String value ) { } } | for ( OptionGroup group : optionGroups . values ( ) ) { if ( group . hasValueEnabled ( value ) ) { return true ; } } return false ; |
public class BosClient { /** * Gets the object content stored in Bos under the specified bucket and key .
* @ param request The request object containing all the options on how to download the Bos object content .
* @ return The object content stored in Bos in the specified bucket and key . */
public byte [ ] getOb... | BosObjectInputStream content = this . getObject ( request ) . getObjectContent ( ) ; try { return IOUtils . toByteArray ( content ) ; } catch ( IOException e ) { try { content . close ( ) ; } catch ( IOException e1 ) { // ignore , throw e not e1.
} throw new BceClientException ( "Fail read object content" , e ) ; } fin... |
public class YearWeek { /** * from IsoFields in ThreeTen - Backport */
private static int weekRange ( int weekBasedYear ) { } } | LocalDate date = LocalDate . of ( weekBasedYear , 1 , 1 ) ; // 53 weeks if year starts on Thursday , or Wed in a leap year
if ( date . getDayOfWeek ( ) == THURSDAY || ( date . getDayOfWeek ( ) == WEDNESDAY && date . isLeapYear ( ) ) ) { return 53 ; } return 52 ; |
public class RxPresenter { /** * Returns a method that can be used for manual restartable chain build . It returns an Action1 that splits
* a received { @ link Delivery } into two { @ link Action2 } onNext and onError calls .
* @ param onNext a method that will be called if the delivery contains an emitted onNext v... | return new Action1 < Delivery < View , T > > ( ) { @ Override public void call ( Delivery < View , T > delivery ) { delivery . split ( onNext , onError ) ; } } ; |
public class CoverageUtil { /** * TODO : Comment */
public LexNameList getSpanNames ( File filename ) { } } | LexNameList list = new LexNameList ( ) ; for ( LexNameToken name : nameSpans . keySet ( ) ) { ILexLocation span = nameSpans . get ( name ) ; if ( span . getFile ( ) . equals ( filename ) ) { list . add ( name ) ; } } return list ; |
public class ClassDef { /** * Write this class file to the specified output stream . */
public void write ( Output dest ) throws IOException { } } | int i , max ; dest . writeU2 ( Access . toFlags ( accessFlags ) ) ; dest . writeClassRef ( thisClass ) ; if ( superClass != null ) { dest . writeClassRef ( superClass ) ; } else { dest . writeU2 ( 0 ) ; } max = interfaces . size ( ) ; dest . writeU2 ( max ) ; for ( i = 0 ; i < max ; i ++ ) { dest . writeClassRef ( inte... |
public class ColumnListEditor { /** * Set the column that cannot be removed from the list , as it ' s used by the filter .
* @ param value The column id . */
@ Override public void onValueRestricted ( final String value ) { } } | this . restrictedColumns . add ( value ) ; setEditorEnabled ( value , false , DataSetEditorConstants . INSTANCE . columnIsUsedInFilter ( ) ) ; |
public class AbstractProgramTwillRunnable { /** * TODO ( terence ) make this works for different mode */
protected Module createModule ( final TwillContext context ) { } } | return Modules . combine ( new ConfigModule ( cConf , hConf ) , new IOModule ( ) , new ZKClientModule ( ) , new MetricsClientRuntimeModule ( ) . getDistributedModules ( ) , new LocationRuntimeModule ( ) . getDistributedModules ( ) , new DiscoveryRuntimeModule ( ) . getDistributedModules ( ) , new DataFabricModules ( ) ... |
public class ServiceLoaderProcessor { /** * { @ inheritDoc } */
public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } } | final Map < String , List < String > > foundServices = new HashMap < String , List < String > > ( ) ; final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ResourceRoot deploymentRoot = deploymentUnit . getAttachment ( Attachments . DEPLOYMENT_ROOT ) ; if ( deploymentRoot != null ) { proces... |
public class IndexInfos { /** * Removes the name from the index infos .
* @ param name the name to remove . */
public void removeName ( String name ) { } } | indexes . remove ( name ) ; names . remove ( name ) ; dirty = true ; |
public class SVGPath { /** * Cubic Bezier line to the given relative coordinates .
* @ param c1xy first control point
* @ param c2xy second control point
* @ param xy new coordinates
* @ return path object , for compact syntax . */
public SVGPath relativeCubicTo ( double [ ] c1xy , double [ ] c2xy , double [ ] ... | return append ( PATH_CUBIC_TO_RELATIVE ) . append ( c1xy [ 0 ] ) . append ( c1xy [ 1 ] ) . append ( c2xy [ 0 ] ) . append ( c2xy [ 1 ] ) . append ( xy [ 0 ] ) . append ( xy [ 1 ] ) ; |
public class CPOptionPersistenceImpl { /** * Returns a range of all the cp options .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 <... | return findAll ( start , end , null ) ; |
public class GeoJSONParser { /** * Parses a GeoJSON document into an array of { @ link JTSFeature }
* @ param geoJSON
* The GeoJSON content
* @ return An array of { @ link JTSFeature }
* @ throws JSONException */
public ArrayList < JTSFeature > parse ( String geoJSON ) throws JSONException { } } | ArrayList < JTSFeature > features = new ArrayList < JTSFeature > ( ) ; JSONObject json = new JSONObject ( geoJSON ) ; JSONArray feats = json . getJSONArray ( "features" ) ; JSONObject feature ; JTSFeature feat ; final int size = feats . length ( ) ; for ( int i = 0 ; i < size ; i ++ ) { feature = feats . getJSONObject ... |
public class SubPathTree { /** * Expose a resource with a path that maps to external path
* @ param resource
* @ return */
private Resource < T > translateResourceExternal ( Resource < T > resource ) { } } | if ( fullPath ) { return resource ; } return new translatedResource < T > ( resource , translatePathExternal ( resource . getPath ( ) ) ) ; |
public class DeleteResponseUnmarshaller { /** * { @ inheritDoc } */
@ Override public Object unMarshall ( Response < DeleteResponse > response , Object entity ) { } } | return unMarshall ( response , entity . getClass ( ) ) ; |
public class AddOn { /** * Tells whether or not the given { @ code extension } has a ( direct ) dependency on the given { @ code addOn } ( including
* version ) .
* @ param extension the extension that will be checked
* @ param addOn the add - on that will be checked in the dependencies on the extension
* @ ret... | String classname = extension . getClass ( ) . getCanonicalName ( ) ; for ( ExtensionWithDeps extensionWithDeps : extensionsWithDeps ) { if ( extensionWithDeps . getClassname ( ) . equals ( classname ) ) { return dependsOn ( extensionWithDeps . getDependencies ( ) , addOn ) ; } } return false ; |
public class Snapshot { /** * / * ( non - Javadoc )
* @ see java . util . Comparator # compare ( java . lang . Object , java . lang . Object ) */
@ Override public int compare ( Snapshot o1 , Snapshot o2 ) { } } | return o1 . name . compareTo ( o2 . name ) ; |
public class ClientService { /** * Get and refresh the details of an existing PAYMILL { @ link Client } .
* @ param client
* A { @ link Client } with Id .
* @ return Refreshed instance of the given { @ link Client } . */
public Client get ( Client client ) { } } | return RestfulUtils . show ( ClientService . PATH , client , Client . class , super . httpClient ) ; |
public class AbstractTreeWriter { /** * Add each level of the class tree . For each sub - class or
* sub - interface indents the next level information .
* Recurses itself to add subclasses info .
* @ param parent the superclass or superinterface of the list
* @ param list list of the sub - classes at this leve... | int size = list . size ( ) ; if ( size > 0 ) { Content ul = new HtmlTree ( HtmlTag . UL ) ; for ( int i = 0 ; i < size ; i ++ ) { ClassDoc local = list . get ( i ) ; HtmlTree li = new HtmlTree ( HtmlTag . LI ) ; li . addAttr ( HtmlAttr . TYPE , LI_CIRCLE ) ; addPartialInfo ( local , li ) ; addExtendsImplements ( parent... |
public class DictionaryMaker { /** * 插入条目 , 但是不合并 , 如果已有则忽略
* @ param item */
public void addNotCombine ( Item item ) { } } | Item innerItem = trie . get ( item . key ) ; if ( innerItem == null ) { innerItem = item ; trie . put ( innerItem . key , innerItem ) ; } |
public class AbstractRule { /** * Create and return a new Violation for this rule and the specified import className and alias
* @ param sourceCode - the SourceCode
* @ param className - the class name ( as specified within the import statement )
* @ param alias - the alias for the import statement
* @ param vi... | Map importInfo = ImportUtil . sourceLineAndNumberForImport ( sourceCode , className , alias ) ; Violation violation = new Violation ( ) ; violation . setRule ( this ) ; violation . setSourceLine ( ( String ) importInfo . get ( "sourceLine" ) ) ; violation . setLineNumber ( ( Integer ) importInfo . get ( "lineNumber" ) ... |
public class Element { /** * Captures an image of the element , and returns the html friendly link of
* it for use in the logging file . If there is a problem capturing the
* image , an error message is returned instead .
* @ return String the location of the screenshot */
private String getScreenshot ( ) { } } | WebElement webElement = getWebElement ( ) ; String imageLink = "<b><font class='fail'>No Image Preview</font></b>" ; // capture an image of it
try { imageLink = reporter . captureEntirePageScreenshot ( ) ; File image = new File ( reporter . getDirectory ( ) , imageLink . split ( "\"" ) [ 1 ] ) ; BufferedImage fullImg =... |
public class JoinedStreams { /** * Specifies a { @ link KeySelector } for elements from the first input with explicit type information for the key type .
* @ param keySelector The KeySelector to be used for extracting the first input ' s key for partitioning .
* @ param keyType The type information describing the k... | requireNonNull ( keySelector ) ; requireNonNull ( keyType ) ; return new Where < > ( input1 . clean ( keySelector ) , keyType ) ; |
public class MtasFieldsConsumer { /** * Gets the prefix stats intersection prefix attribute .
* @ param field
* the field
* @ return the prefix stats intersection prefix attribute */
public String getPrefixStatsIntersectionPrefixAttribute ( String field ) { } } | if ( intersectingPrefixes . containsKey ( field ) ) { return String . join ( MtasToken . DELIMITER , intersectingPrefixes . get ( field ) ) ; } else { return "" ; } |
public class AttachmentDeserializer { /** * ( non - Javadoc )
* @ see
* com . google . gson . JsonDeserializer # deserialize ( com . google . gson . JsonElement ,
* java . lang . reflect . Type , com . google . gson . JsonDeserializationContext ) */
public Attachment deserialize ( JsonElement json , Type typeOfT ... | Attachment attachment = delegateGson . fromJson ( json , Attachment . class ) ; AttachmentType type = attachment . getType ( ) ; Class < ? extends Payload > payloadClass = null ; JsonElement payloadJson = json . getAsJsonObject ( ) . get ( "payload" ) ; switch ( type ) { case AUDIO : case FILE : case IMAGE : case VIDEO... |
public class IRBuilderMethods { /** * - - - - - Array Store Statement - - - - - */
public static IRArrayStoreStatementBuilder arrayStore ( IRExpressionBuilder target , IRExpressionBuilder index , IRExpressionBuilder value ) { } } | IRArrayStoreStatementBuilder statement = new IRArrayStoreStatementBuilder ( target , index , value ) ; return statement ; |
public class JdbcConnectionDescriptor { /** * Sets the jdbcLevel . parse the string setting and check that it is indeed an integer .
* @ param jdbcLevel The jdbcLevel to set */
public void setJdbcLevel ( String jdbcLevel ) { } } | if ( jdbcLevel != null ) { try { double intLevel = Double . parseDouble ( jdbcLevel ) ; setJdbcLevel ( intLevel ) ; } catch ( NumberFormatException nfe ) { setJdbcLevel ( 2.0 ) ; logger . info ( "Specified JDBC level was not numeric (Value=" + jdbcLevel + "), used default jdbc level of 2.0 " ) ; } } else { setJdbcLevel... |
public class HBaseClientTemplate { /** * Execute an increment on an entity field . This field must be a type that
* supports increments . Returns the new increment value of type long .
* @ param key
* The key to map to an Increment
* @ param fieldName
* The name of the field we are incrementing
* @ param am... | Increment increment = entityMapper . mapToIncrement ( key , fieldName , amount ) ; HTableInterface table = pool . getTable ( tableName ) ; Result result ; try { result = table . increment ( increment ) ; } catch ( IOException e ) { throw new DatasetIOException ( "Error incrementing field." , e ) ; } return entityMapper... |
public class CachedCounters { /** * Calculates min / average / max statistics based on the current and previous
* values .
* @ param name a counter name of Statistics type
* @ param value a value to update statistics */
public void stats ( String name , float value ) { } } | Counter counter = get ( name , CounterType . Statistics ) ; calculateStats ( counter , value ) ; update ( ) ; |
public class DocumentBuilderImpl { /** * Helper method to load XML document from input source .
* @ param source input source ,
* @ param useNamespace flag to control name space awareness .
* @ return newly created XML document . */
private static Document loadXML ( InputSource source , boolean useNamespace ) { }... | try { org . w3c . dom . Document doc = getDocumentBuilder ( null , useNamespace ) . parse ( source ) ; return new DocumentImpl ( doc ) ; } catch ( Exception e ) { throw new DomException ( e ) ; } finally { close ( source ) ; } |
public class CrystalBuilder { /** * Calculate interfaces between original asymmetric unit and neighboring
* whole unit cells , including the original full unit cell i . e . i = 0 , j = 0 , k = 0
* @ param set
* @ param cutoff */
private void calcInterfacesCrystal ( StructureInterfaceList set , double cutoff ) { }... | // initialising debugging vars
long start = - 1 ; long end = - 1 ; int trialCount = 0 ; int skippedRedundant = 0 ; int skippedAUsNoOverlap = 0 ; int skippedChainsNoOverlap = 0 ; int skippedSelfEquivalent = 0 ; // The bounding boxes of all AUs of the unit cell
UnitCellBoundingBox bbGrid = new UnitCellBoundingBox ( numOp... |
public class ArrayUtils { /** * Determines the intersection of the given arrays . < br >
* Note : Only use this method when the given arrays are sorted and contain
* only distinct values .
* @ param arrs
* @ return */
public static short [ ] intersectionSorted ( short [ ] ... arrs ) { } } | if ( arrs . length == 0 ) return new short [ 0 ] ; if ( arrs . length == 1 ) return arrs [ 0 ] ; short [ ] [ ] arrList = new short [ arrs . length - 1 ] [ ] ; short [ ] minLengthArray = arrs [ 0 ] ; for ( int i = 1 ; i < arrs . length ; i ++ ) { short [ ] arr = arrs [ i ] ; if ( arr . length < minLengthArray . length )... |
public class PropertyExtractor { /** * { @ inheritDoc } */
public T extract ( Object target ) { } } | if ( target == null ) { return null ; } Class targetClass = target . getClass ( ) ; try { if ( propertyAccessor == null || propertyAccessor . getDeclaringClass ( ) != targetClass ) { propertyAccessor = findReadMethod ( propertyName , target . getClass ( ) ) ; } if ( propertyAccessor != null ) { return ( T ) propertyAcc... |
public class RasterableModel { /** * Rasterable */
@ Override public void prepare ( FeatureProvider provider ) { } } | super . prepare ( provider ) ; transformable = provider . getFeature ( Transformable . class ) ; mirrorable = provider . getFeature ( Mirrorable . class ) ; animator = provider . getFeature ( Animatable . class ) ; |
public class PMContext { /** * Creates a new instance wrapper with the instance and the instanceId . */
public EntityInstanceWrapper buildInstanceWrapper ( final Object instance ) throws PMException { } } | final EntityInstanceWrapper wrapper = new EntityInstanceWrapper ( instance ) ; if ( hasEntity ( ) && ! getEntityContainer ( ) . isSelectedNew ( ) ) { wrapper . setInstanceId ( getDataAccess ( ) . getInstanceId ( this , wrapper ) ) ; } return wrapper ; |
public class IntArrayList { /** * Removes a single instance of the specified element from this
* list , if it is present ( optional operation ) . More formally ,
* removes an element < tt > e < / tt > such that < tt > ( o = = null ? e = = null :
* o . equals ( e ) ) < / tt > , if the list contains one or more suc... | for ( int index = 0 ; index < size ; index ++ ) if ( value == elementData [ index ] ) { fastRemove ( index ) ; return true ; } return false ; |
public class DatabaseHashMapMR { /** * Initialize SQL Strings */
protected void initializeSQL_Strings ( ) { } } | super . initializeSQL_Strings ( ) ; findProps = "select propid, small, medium, large from " + tableName + " where id = ? and propid <> ? and appname = ?" ; findAllKeys = "select propid from " + tableName + " where id = ? and propid <> id and appname = ?" ; // upSmProp = " update " + tableName + " set small = ? , med... |
public class OfflineChangePointDetectionAlgorithm { /** * Compute the incremental sum of an array , i . e . the sum of all points up to
* the given index .
* @ param data Input data
* @ param out Output array ( must be large enough ) . */
public static void cusum ( double [ ] data , double [ ] out , int begin , i... | assert ( out . length >= data . length ) ; // Use Kahan summation for better precision !
// FIXME : this should be unit tested .
double m = 0. , carry = 0. ; for ( int i = begin ; i < end ; i ++ ) { double v = data [ i ] - carry ; // Compensation
double n = out [ i ] = ( m + v ) ; // May lose small digits of v .
carry ... |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcBuildingElementComponent ( ) { } } | if ( ifcBuildingElementComponentEClass == null ) { ifcBuildingElementComponentEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 56 ) ; } return ifcBuildingElementComponentEClass ; |
public class HashObjectStore { /** * / * ( non - Javadoc )
* @ see org . jboss . arquillian . core . impl . ObjectStore # get ( java . lang . Class ) */
@ Override public < T > T get ( Class < T > type ) { } } | Validate . notNull ( type , "Type must be specified" ) ; return type . cast ( store . get ( type ) ) ; |
public class MDRRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . MDRRG__RG_LENGTH : setRGLength ( ( Integer ) newValue ) ; return ; case AfplibPackage . MDRRG__TRIPLETS : getTriplets ( ) . clear ( ) ; getTriplets ( ) . addAll ( ( Collection < ? extends Triplet > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class ZipUtil { /** * Compresses the given directory and all its sub - directories into a ZIP file .
* The ZIP file must not be a directory and its parent directory must exist .
* Will not include the root directory name in the archive .
* @ param rootDir
* root directory .
* @ param zip
* ZIP file t... | pack ( rootDir , zip , IdentityNameMapper . INSTANCE , compressionLevel ) ; |
public class AccountsInner { /** * Get usages for the requested Cognitive Services account .
* @ param resourceGroupName The name of the resource group within the user ' s subscription .
* @ param accountName The name of Cognitive Services account .
* @ param filter An OData filter expression that describes a sub... | return getUsagesWithServiceResponseAsync ( resourceGroupName , accountName , filter ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Identity { /** * Compare two DSN
* @ param dsn1 Distinguished name ( X . 500 DSN ) string
* @ param dsn2 Distinguished name ( X . 500 DSN ) string
* @ return boolean true if both DSN are equal
* @ since 0.1.5 */
private boolean distinguishedNameEquals ( String dsn1 , String dsn2 ) { } } | return new X500Principal ( dsn1 ) . equals ( new X500Principal ( dsn2 ) ) ; |
public class DRealHistogram { /** * Big allocation of arrays */
@ Override void init0 ( ) { } } | _sums = MemoryManager . malloc8d ( _nbin ) ; _ssqs = MemoryManager . malloc8d ( _nbin ) ; |
public class RunningWorkers { /** * Concurrency : Called by multiple threads .
* Parameter : Same taskletId can come in multiple times . */
void cancelTasklet ( final boolean mayInterruptIfRunning , final int taskletId ) { } } | lock . lock ( ) ; try { // This is not ideal since we are using a linear time search on all the workers .
final String workerId = getWhereTaskletWasScheduledTo ( taskletId ) ; if ( workerId == null ) { // launchTasklet called but not yet running .
taskletsToCancel . add ( taskletId ) ; return ; } if ( mayInterruptIfRun... |
public class XmlTransformer { /** * Transforms the XML node into the string
* @ param node
* the node to transform
* @ param builder
* the string builder */
public void transform ( XmlNode node , StringBuilder builder ) { } } | switch ( node . getType ( ) ) { case XmlNode . ELEMENT_NODE : { builder . append ( "<" ) ; builder . append ( node . getName ( ) ) ; for ( XmlNode attribute : node . getAttributes ( ) . values ( ) ) { transform ( attribute , builder ) ; } builder . append ( ">" ) ; for ( XmlNode child : node . getChildren ( ) ) { trans... |
public class ClassScanner { /** * Find all classes that match the class name pattern .
* @ param classNamePattern the class name pattern
* @ return a Map for scanned classes
* @ throws IOException if an I / O error has occurred */
public Map < String , Class < ? > > scan ( String classNamePattern ) throws IOExcep... | final Map < String , Class < ? > > scannedClasses = new LinkedHashMap < > ( ) ; scan ( classNamePattern , scannedClasses ) ; return scannedClasses ; |
public class JobClient { /** * Wait for the job driver to complete . */
public void waitForCompletion ( final int waitTime ) { } } | LOG . info ( "Waiting for the Job Driver to complete: " + waitTime ) ; if ( waitTime == 0 ) { close ( 0 ) ; return ; } else if ( waitTime < 0 ) { waitTillDone ( ) ; } final long endTime = System . currentTimeMillis ( ) + waitTime * 1000 ; close ( endTime ) ; |
public class CallbackWrapper { /** * Warning : this will not be called on error or timeout
* @ param resultHandler
* @ return */
@ Override public IPromise < T > onResult ( Consumer < T > resultHandler ) { } } | if ( realCallback instanceof IPromise == false ) throw new RuntimeException ( "this is an error." ) ; else return ( ( IPromise ) realCallback ) . onResult ( resultHandler ) ; |
public class CommandLine { /** * Copy ctor . */
public CommandLine makeCopy ( ) { } } | CommandLine cl = new CommandLine ( m_startAction ) ; // first copy the base class fields
cl . m_ipcPort = m_ipcPort ; cl . m_backend = m_backend ; cl . m_leader = m_leader ; cl . m_pathToCatalog = m_pathToCatalog ; cl . m_pathToDeployment = m_pathToDeployment ; cl . m_pathToLicense = m_pathToLicense ; cl . m_noLoadLibV... |
public class Conversion { /** * Converts binary ( represented as boolean array ) into a short using the default ( little
* endian , Lsb0 ) byte and bit ordering .
* @ param src the binary to convert
* @ param srcPos the position in { @ code src } , in boolean unit , from where to start the
* conversion
* @ pa... | if ( src . length == 0 && srcPos == 0 || 0 == nBools ) { return dstInit ; } if ( nBools - 1 + dstPos >= 16 ) { throw new IllegalArgumentException ( "nBools-1+dstPos is greater or equal to than 16" ) ; } short out = dstInit ; for ( int i = 0 ; i < nBools ; i ++ ) { final int shift = i + dstPos ; final int bits = ( src [... |
public class TangramEngine { /** * { @ inheritDoc } */
@ Override public void destroy ( ) { } } | RecyclerView contentView = getContentView ( ) ; if ( contentView != null ) { contentView . removeCallbacks ( updateRunnable ) ; } super . destroy ( ) ; |
public class CsvBeanWriter { /** * { @ inheritDoc } */
public void write ( final Object source , final String [ ] nameMapping , final CellProcessor [ ] processors ) throws IOException { } } | // update the current row / line numbers
super . incrementRowAndLineNo ( ) ; // extract the bean values
extractBeanValues ( source , nameMapping ) ; // execute the processors for each column
Util . executeCellProcessors ( processedColumns , beanValues , processors , getLineNumber ( ) , getRowNumber ( ) ) ; // write the... |
public class AttributePayload { /** * A JSON string containing up to three key - value pair in JSON format . For example :
* < code > { \ " attributes \ " : { \ " string1 \ " : \ " string2 \ " } } < / code >
* @ param attributes
* A JSON string containing up to three key - value pair in JSON format . For example ... | setAttributes ( attributes ) ; return this ; |
public class SuspendedAccessContext { /** * Set prepared access - context on thread .
* @ param accessContext The context of DB access . ( NotNull ) */
public static void setAccessContextOnThread ( AccessContext accessContext ) { } } | if ( accessContext == null ) { String msg = "The argument[accessContext] must not be null." ; throw new IllegalArgumentException ( msg ) ; } Stack < AccessContext > stack = threadLocal . get ( ) ; if ( stack == null ) { stack = new Stack < AccessContext > ( ) ; threadLocal . set ( stack ) ; } stack . add ( accessContex... |
public class Project { /** * Get stories in this Project filtered as specified in the passed in
* filter .
* @ param filter Criteria to filter on . Project will be set automatically .
* If null , all stories in the project are returned .
* @ param includeSubprojects Specifies whether to include items from sub
... | filter = ( filter != null ) ? filter : new StoryFilter ( ) ; return getInstance ( ) . get ( ) . story ( getFilter ( filter , includeSubprojects ) ) ; |
public class ExcelUtils { /** * 无模板 、 基于注解的数据导出
* @ param data 待导出数据
* @ param clazz { @ link com . github . crab2died . annotation . ExcelField } 映射对象Class
* @ param isWriteHeader 是否写入表头
* @ param os 生成的Excel待输出数据流
* @ throws Excel4JException 异常
* @ throws IOException 异常
* @ author Crab2Died */
public vo... | try ( Workbook workbook = exportExcelNoTemplateHandler ( data , clazz , isWriteHeader , null , true ) ) { workbook . write ( os ) ; } |
public class QueryCacheEventPublisher { /** * TODO known issue : Locked keys will also be cleared from the query - cache after calling a map - wide event like clear / evictAll */
public void hintMapEvent ( Address caller , String mapName , EntryEventType eventType , int numberOfEntriesAffected , int partitionId ) { } } | // this collection contains all defined query - caches on this map .
Collection < PartitionAccumulatorRegistry > partitionAccumulatorRegistries = getPartitionAccumulatorRegistries ( mapName ) ; for ( PartitionAccumulatorRegistry accumulatorRegistry : partitionAccumulatorRegistries ) { Accumulator accumulator = accumula... |
public class ShuttleList { /** * Move the selected items in the source list to the chosen list . I . e . , add
* the items to our selection model . */
protected void moveLeftToRight ( ) { } } | // Loop over the selected items and locate them in the data model , Add
// these to the selection .
Object [ ] sourceSelected = sourceList . getSelectedValues ( ) ; int nSourceSelected = sourceSelected . length ; int [ ] currentSelection = helperList . getSelectedIndices ( ) ; int [ ] newSelection = new int [ currentSe... |
public class Converters { /** * Creates an entity and populates its state based on the dbObject given . This method is primarily an internal method . Reliance on
* this method may break your application in future releases .
* @ param dbObj the object state to use
* @ param mf the MappedField containing the metada... | final Object object = mf . getDbObjectValue ( dbObj ) ; if ( object != null ) { final TypeConverter enc = getEncoder ( mf ) ; final Object decodedValue = enc . decode ( mf . getType ( ) , object , mf ) ; try { mf . setFieldValue ( targetEntity , decodedValue ) ; } catch ( IllegalArgumentException e ) { throw new Mappin... |
public class BundleEntryScanner { /** * Returns the recurse by first looking for an entry in the manifest of the bundle specified by recurse manifest
* header . It will return the default recurse if :
* - file pattern manifest header is null
* - header is not set
* - header is not a string
* - header is not t... | if ( m_recurseManifestHeader != null ) { final Object value = bundle . getHeaders ( ) . get ( m_recurseManifestHeader ) ; if ( value instanceof String && ( ( String ) value ) . trim ( ) . length ( ) > 0 && ( ( ( ( String ) value ) . trim ( ) . equalsIgnoreCase ( "true" ) ) || ( ( String ) value ) . trim ( ) . equalsIgn... |
public class BeansDescriptorImpl { /** * If not already created , a new < code > decorators < / code > element will be created and returned . Otherwise , the first
* existing < code > decorators < / code > element will be returned .
* @ return the instance defined for the element < code > decorators < / code > */
p... | List < Node > nodeList = model . get ( "decorators" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new DecoratorsImpl < BeansDescriptor > ( this , "decorators" , model , nodeList . get ( 0 ) ) ; } return createDecorators ( ) ; |
public class OtpInputStream { /** * Read a two byte little endian integer from the stream .
* @ return the bytes read , converted from little endian to an integer .
* @ exception OtpErlangDecodeException
* if the next byte cannot be read . */
public int read2LE ( ) throws OtpErlangDecodeException { } } | final byte [ ] b = new byte [ 2 ] ; try { super . read ( b ) ; } catch ( final IOException e ) { throw new OtpErlangDecodeException ( "Cannot read from input stream" ) ; } return ( b [ 1 ] << 8 & 0xff00 ) + ( b [ 0 ] & 0xff ) ; |
public class ErrorLogger { /** * Write a debug message to the logs
* @ param message The debug message */
public void debug ( final String message , final int level ) { } } | messages . add ( new LogMessage ( message , LogMessage . Type . DEBUG , level ) ) ; log . debug ( message ) ; |
public class CollectionLiteralsTypeComputer { /** * Creates a collection type reference that comes as close as possible / necessary to its expected type . */
protected LightweightTypeReference createCollectionTypeReference ( JvmGenericType collectionType , LightweightTypeReference elementType , LightweightTypeReference... | ParameterizedTypeReference result = new ParameterizedTypeReference ( owner , collectionType ) ; result . addTypeArgument ( elementType ) ; if ( isIterableExpectation ( expectedType ) && ! expectedType . isAssignableFrom ( result ) ) { // avoid to assign a set literal to a list and viceversa :
// at least the raw types ... |
public class DecompilerUtil { /** * Returns an appropriate output directory for the decompiled data based upon the provided { @ link JavaClassFileModel } .
* This should be the top - level directory for the package ( eg , / tmp / project / foo for the file / tmp / project / foo / com / example / Foo . class ) .
* T... | final File result ; WindupConfigurationModel configuration = WindupConfigurationService . getConfigurationModel ( context ) ; File inputPath = fileModel . getProjectModel ( ) . getRootProjectModel ( ) . getRootFileModel ( ) . asFile ( ) ; if ( PathUtil . isInSubDirectory ( inputPath , fileModel . asFile ( ) ) ) { Strin... |
public class Ftp { /** * Opens a FTP Connection
* @ return FTPCLinet
* @ throws IOException
* @ throws PageException */
private AFTPClient actionOpen ( ) throws IOException , PageException { } } | required ( "server" , server ) ; required ( "username" , username ) ; // required ( " password " , password ) ;
AFTPClient client = getClient ( ) ; writeCfftp ( client ) ; return client ; |
public class NTLMResponses { /** * Creates the NTLMv2 blob from the given target information block and
* client nonce .
* @ param targetInformation The target information block from the Type 2
* message .
* @ param clientNonce The random 8 - byte client nonce .
* @ param time the time stamp .
* @ return The... | byte [ ] blobSignature = new byte [ ] { ( byte ) 0x01 , ( byte ) 0x01 , ( byte ) 0x00 , ( byte ) 0x00 } ; byte [ ] reserved = new byte [ ] { ( byte ) 0x00 , ( byte ) 0x00 , ( byte ) 0x00 , ( byte ) 0x00 } ; byte [ ] unknown1 = new byte [ ] { ( byte ) 0x00 , ( byte ) 0x00 , ( byte ) 0x00 , ( byte ) 0x00 } ; byte [ ] unk... |
public class GenericUrl { /** * Appends the given raw encoded path to the current { @ link # pathParts } , setting field only if it
* is { @ code null } or empty .
* < p > The last part of the { @ link # pathParts } is merged with the first part of the path parts
* computed from the given encoded path . Thus , if... | if ( encodedPath != null && encodedPath . length ( ) != 0 ) { List < String > appendedPathParts = toPathParts ( encodedPath ) ; if ( pathParts == null || pathParts . isEmpty ( ) ) { this . pathParts = appendedPathParts ; } else { int size = pathParts . size ( ) ; pathParts . set ( size - 1 , pathParts . get ( size - 1 ... |
public class DescribeVirtualInterfacesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeVirtualInterfacesRequest describeVirtualInterfacesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeVirtualInterfacesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeVirtualInterfacesRequest . getConnectionId ( ) , CONNECTIONID_BINDING ) ; protocolMarshaller . marshall ( describeVirtualInterfacesRequest . get... |
public class NodeIndexer { /** * Adds the reference value to the document as the named field . The value ' s
* string representation is added as the reference data . Additionally the
* reference data is stored in the index .
* @ param doc The document to which to add the field
* @ param fieldName The name of th... | String uuid = internalValue . toString ( ) ; doc . add ( createFieldWithoutNorms ( fieldName , uuid , PropertyType . REFERENCE ) ) ; doc . add ( new Field ( FieldNames . PROPERTIES , FieldNames . createNamedValue ( fieldName , uuid ) , Field . Store . YES , Field . Index . NO , Field . TermVector . NO ) ) ; |
public class IOUtils { /** * < p > readInputStreamBufferedAsString . < / p >
* @ param in a { @ link java . io . InputStream } object .
* @ param charset a { @ link java . lang . String } object .
* @ return a { @ link java . lang . String } object .
* @ throws java . io . IOException if any . */
public static ... | BufferedReader reader = null ; try { reader = new BufferedReader ( new UnicodeReader ( in , charset ) ) ; StringBuilder result = new StringBuilder ( ) ; char [ ] cbuf = new char [ 2048 ] ; int read ; while ( ( read = reader . read ( cbuf ) ) > 0 ) result . append ( cbuf , 0 , read ) ; return result . toString ( ) ; } f... |
public class SSLReadServiceContext { /** * Get the buffers that will be used for output from the SSL engine . If read
* buffers were supplied by the calling application channel , then they will
* be used . Not , if a buffer array was supplied , the first buffer of the array
* will be used ( since the SSL engine o... | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getDecryptedNetworkBuffers" ) ; } // Check if we already have a known decNetworkBuffer array .
if ( decryptedNetBuffers == null ) { // Check if the buffer was set by the calling app channel .
decryptedNetBuffers = getBuffers... |
public class ThreadServiceWorker { /** * Gets the next worker available to process a task .
* @ return The next available worker .
* @ throws InterruptedException If the thread is interrupted while waiting
* for an available worker . */
private Worker getWorker ( ) throws InterruptedException { } } | while ( ! courtesyMonitor . allowTasksToRun ( ) ) { courtesyMonitor . waitFor ( ) ; } while ( numWorkers > maxWorkers ) { workerQueue . take ( ) ; numWorkers -- ; } return workerQueue . take ( ) ; |
public class CapabilitiesRegistrarImpl { /** * ( non - Javadoc )
* @ see io . joynr . capabilities . CapabilitiesRegistrar # registerProvider ( java . lang . String ,
* io . joynr . provider . JoynrProvider , java . lang . Class , boolean ) */
@ Override public Future < Void > registerProvider ( final String domain... | if ( providerQos == null ) { throw new JoynrRuntimeException ( "providerQos == null. It must not be null" ) ; } ProviderContainer providerContainer = providerContainerFactory . create ( provider ) ; String participantId = participantIdStorage . getProviderParticipantId ( domain , providerContainer . getInterfaceName ( ... |
public class SqlConnRunner { /** * 分页全字段查询 < br >
* 此方法不会关闭Connection
* @ param conn 数据库连接对象
* @ param where 条件实体类 ( 包含表名 )
* @ param page 分页对象
* @ return 结果对象
* @ throws SQLException SQL执行异常 */
public PageResult < Entity > page ( Connection conn , Entity where , Page page ) throws SQLException { } } | return this . page ( conn , null , where , page ) ; |
public class ClassHelper { /** * Determines the field via reflection look - up .
* @ param clazz The java class to search in
* @ param fieldName The field ' s name
* @ return The field object or < code > null < / code > if no matching field was found */
public static Field getField ( Class clazz , String fieldNam... | try { return clazz . getField ( fieldName ) ; } catch ( Exception ignored ) { } return null ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.