signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class HarrisFast { /** * Sobel边缘提取算子 * @ param x * @ param y * @ return */ private float [ ] sobel ( int x , int y ) { } }
int v00 = 0 , v01 = 0 , v02 = 0 , v10 = 0 , v12 = 0 , v20 = 0 , v21 = 0 , v22 = 0 ; int x0 = x - 1 , x1 = x , x2 = x + 1 ; int y0 = y - 1 , y1 = y , y2 = y + 1 ; if ( x0 < 0 ) x0 = 0 ; if ( y0 < 0 ) y0 = 0 ; if ( x2 >= width ) x2 = width - 1 ; if ( y2 >= height ) y2 = height - 1 ; v00 = image [ x0 ] [ y0 ] ; v10 = image [ x1 ] [ y0 ] ; v20 = image [ x2 ] [ y0 ] ; v01 = image [ x0 ] [ y1 ] ; v21 = image [ x2 ] [ y1 ] ; v02 = image [ x0 ] [ y2 ] ; v12 = image [ x1 ] [ y2 ] ; v22 = image [ x2 ] [ y2 ] ; float sx = ( ( v20 + 2 * v21 + v22 ) - ( v00 + 2 * v01 + v02 ) ) / ( 1200f ) ; float sy = ( ( v02 + 2 * v12 + v22 ) - ( v00 + 2 * v10 + v20 ) ) / ( 1200f ) ; return new float [ ] { sx , sy } ;
public class Intersectiond { /** * Test whether the one sphere with center < code > centerA < / code > and square radius < code > radiusSquaredA < / code > intersects the other * sphere with center < code > centerB < / code > and square radius < code > radiusSquaredB < / code > , and store the center of the circle of * intersection in the < code > ( x , y , z ) < / code > components of the supplied vector and the radius of that circle in the w component . * The normal vector of the circle of intersection can simply be obtained by subtracting the center of either sphere from the other . * Reference : < a href = " http : / / gamedev . stackexchange . com / questions / 75756 / sphere - sphere - intersection - and - circle - sphere - intersection " > http : / / gamedev . stackexchange . com < / a > * @ param centerA * the first sphere ' s center * @ param radiusSquaredA * the square of the first sphere ' s radius * @ param centerB * the second sphere ' s center * @ param radiusSquaredB * the square of the second sphere ' s radius * @ param centerAndRadiusOfIntersectionCircle * will hold the center of the circle of intersection in the < code > ( x , y , z ) < / code > components and the radius in the w component * @ return < code > true < / code > iff both spheres intersect ; < code > false < / code > otherwise */ public static boolean intersectSphereSphere ( Vector3dc centerA , double radiusSquaredA , Vector3dc centerB , double radiusSquaredB , Vector4d centerAndRadiusOfIntersectionCircle ) { } }
return intersectSphereSphere ( centerA . x ( ) , centerA . y ( ) , centerA . z ( ) , radiusSquaredA , centerB . x ( ) , centerB . y ( ) , centerB . z ( ) , radiusSquaredB , centerAndRadiusOfIntersectionCircle ) ;
public class AccessPolicy { /** * Creates an operation to create a new access policy * @ param name * name of the access policy * @ param durationInMinutes * how long the access policy will be in force * @ param permissions * permissions allowed by this access policy * @ return The operation */ public static EntityCreateOperation < AccessPolicyInfo > create ( String name , double durationInMinutes , EnumSet < AccessPolicyPermission > permissions ) { } }
return new Creator ( name , durationInMinutes , permissions ) ;
public class SourceDocumentRepositoryMongoImpl { /** * { @ inheritDoc } */ @ Override public String newId ( final RootDocument rootDocument ) { } }
return newId ( mongoTemplate , SourceDocumentMongo . class , rootDocument . getFilename ( ) , "S" ) ;
public class PortletAdministrationHelper { /** * Check if the link to the Fragment admin portlet should display in the status message . * < p > Checks that the portlet is new , that the portlet has been published and that the user has * necessary permissions to go to the fragment admin page . * @ param person the person publishing / editing the portlet * @ param form the portlet being editted * @ param portletId the id of the saved portlet * @ return true If all three conditions are met */ public boolean shouldDisplayLayoutLink ( IPerson person , PortletDefinitionForm form , String portletId ) { } }
if ( ! form . isNew ( ) ) { return false ; } // only include the " do layout " link for published portlets . if ( form . getLifecycleState ( ) != PortletLifecycleState . PUBLISHED ) { return false ; } // check that the user can edit at least 1 fragment . Map < String , String > layouts = fragmentAdminHelper . getAuthorizedDlmFragments ( person . getUserName ( ) ) ; if ( layouts == null || layouts . isEmpty ( ) ) { return false ; } // check that the user has subscribe priv . IAuthorizationPrincipal authPrincipal = authorizationService . newPrincipal ( person . getUserName ( ) , EntityEnum . PERSON . getClazz ( ) ) ; return authPrincipal . canSubscribe ( portletId ) ;
public class DebugLogPrinter { /** * { @ inheritDoc } */ @ Override public void notifyResult ( T result ) { } }
if ( logger . isDebugEnabled ( ) == true ) { logger . debug ( this . header + result . toString ( ) ) ; }
public class DbxClientV1 { /** * Similar to { @ link # uploadFile } , except always uses the / files _ put API call . * One difference is that { @ code numBytes } must not be negative . */ public Uploader startUploadFileSingle ( String targetPath , DbxWriteMode writeMode , long numBytes ) throws DbxException { } }
DbxPathV1 . checkArg ( "targetPath" , targetPath ) ; if ( numBytes < 0 ) throw new IllegalArgumentException ( "numBytes must be zero or greater" ) ; String host = this . host . getContent ( ) ; String apiPath = "1/files_put/auto" + targetPath ; ArrayList < HttpRequestor . Header > headers = new ArrayList < HttpRequestor . Header > ( ) ; headers . add ( new HttpRequestor . Header ( "Content-Type" , "application/octet-stream" ) ) ; headers . add ( new HttpRequestor . Header ( "Content-Length" , Long . toString ( numBytes ) ) ) ; HttpRequestor . Uploader uploader = DbxRequestUtil . startPut ( requestConfig , accessToken , USER_AGENT_ID , host , apiPath , writeMode . params , headers ) ; return new SingleUploader ( uploader , numBytes ) ;
public class MtasCQLParserBasicSentenceCondition { /** * Adds the basic sentence . * @ param s the s * @ throws ParseException the parse exception */ public void addBasicSentence ( MtasCQLParserBasicSentenceCondition s ) throws ParseException { } }
if ( ! simplified ) { List < MtasCQLParserBasicSentencePartCondition > newWordList = s . getPartList ( ) ; partList . addAll ( newWordList ) ; } else { throw new ParseException ( "already simplified" ) ; }
public class Files { /** * Replace extension on given file and return resulting file . * @ param file file to replace extension , * @ param newExtension newly extension . * @ return newly created file . * @ throws IllegalArgumentException if file parameter is null . */ public static File replaceExtension ( File file , String newExtension ) throws IllegalArgumentException { } }
Params . notNull ( file , "File" ) ; return new File ( replaceExtension ( file . getPath ( ) , newExtension ) ) ;
public class JTSLineStringExpression { /** * Returns the specified Point N in this LineString . * @ param idx one based index * @ return point at index */ public JTSPointExpression < Point > pointN ( int idx ) { } }
return JTSGeometryExpressions . pointOperation ( SpatialOps . POINTN , mixin , ConstantImpl . create ( idx ) ) ;
public class VirtualFileChannel { /** * Returns always a lock . Locking virtual file makes no sense . Dummy * implementation is provided so that existing applications don ' t throw * exception . * @ param position * @ param size * @ param shared * @ return * @ throws IOException */ @ Override public FileLock lock ( long position , long size , boolean shared ) throws IOException { } }
return new FileLockImpl ( this , position , size , shared ) ;
public class ElementsExceptionsFactory { /** * Constructs and initializes a new { @ link ObjectNotFoundException } with the given { @ link String message } * formatted with the given { @ link Object [ ] arguments } . * @ param message { @ link String } describing the { @ link ObjectNotFoundException exception } . * @ param args { @ link Object [ ] arguments } used to replace format placeholders in the { @ link String message } . * @ return a new { @ link ObjectNotFoundException } with the given { @ link String message } . * @ see # newObjectNotFoundException ( Throwable , String , Object . . . ) * @ see org . cp . elements . lang . ObjectNotFoundException */ public static ObjectNotFoundException newObjectNotFoundException ( String message , Object ... args ) { } }
return newObjectNotFoundException ( null , message , args ) ;
public class MenuRendererCallback { /** * Render the whole menu * @ param aLEC * The current layout execution context . Required for cookie - less * handling . May not be < code > null < / code > . * @ param aFactory * The factory to be used to create nodes of type T . May not be * < code > null < / code > . * @ param aRenderer * The renderer to use * @ return Never < code > null < / code > . * @ param < T > * HC list type to be instantiated */ @ Nonnull public static < T extends IHCList < T , HCLI > > T createRenderedMenu ( @ Nonnull final ILayoutExecutionContext aLEC , @ Nonnull final ISupplier < T > aFactory , @ Nonnull final IMenuItemRenderer < T > aRenderer ) { } }
final IMenuTree aMenuTree = aLEC . getMenuTree ( ) ; return createRenderedMenu ( aLEC , aFactory , aMenuTree . getRootItem ( ) , aRenderer , MenuItemDeterminatorCallback . getAllDisplayMenuItemIDs ( aMenuTree , aLEC . getSelectedMenuItemID ( ) ) ) ;
public class DTMDefaultBase { /** * Get the simple type ID for the given node identity . * @ param identity The node identity . * @ return The simple type ID , or DTM . NULL . */ protected short _type ( int identity ) { } }
int info = _exptype ( identity ) ; if ( NULL != info ) return m_expandedNameTable . getType ( info ) ; else return NULL ;
public class HalRepresentation { /** * Merges the Curies of an embedded resource with the Curies of this resource and updates * link - relation types in _ links and _ embedded items . * @ param curies the Curies of the embedding resource * @ return this */ HalRepresentation mergeWithEmbedding ( final Curies curies ) { } }
this . curies = this . curies . mergeWith ( curies ) ; if ( this . links != null ) { removeDuplicateCuriesFromEmbedding ( curies ) ; this . links = this . links . using ( this . curies ) ; if ( embedded != null ) { embedded = embedded . using ( this . curies ) ; } } else { if ( embedded != null ) { embedded = embedded . using ( curies ) ; } } return this ;
public class Transformation3D { /** * Transforms an envelope . The result is the bounding box of the transformed * envelope . */ public Envelope3D transform ( Envelope3D env ) { } }
if ( env . isEmpty ( ) ) return env ; Point3D [ ] buf = new Point3D [ 8 ] ; env . queryCorners ( buf ) ; transform ( buf , 8 , buf ) ; env . setFromPoints ( buf ) ; return env ;
public class Config { /** * Get attribute value or null if there is no attribute with requested name . An existing attribute value cannot ever * be empty or null so if this method returns null is for missing attribute . * @ param name attribute name . * @ return attribute value or null if named attribute not found . * @ throws IllegalArgumentException if < code > name < / code > argument is null or empty . */ public String getAttribute ( String name ) { } }
Params . notNullOrEmpty ( name , "Attribute name" ) ; return attributes . get ( name ) ;
public class StylesContainer { /** * Add a cell style to the content container and register the font face * @ param ffcStyle the cell style or the text style * @ return true if the style was created or updated */ public boolean addStylesFontFaceContainerStyle ( final FontFaceContainerStyle ffcStyle ) { } }
final FontFace fontFace = ffcStyle . getFontFace ( ) ; if ( fontFace != null ) { this . fontFaces . add ( fontFace ) ; } return this . addStylesStyle ( ffcStyle ) ;
public class KeyIgnoringVCFOutputFormat { /** * < code > setHeader < / code > or < code > readHeaderFrom < / code > must have been * called first . */ @ Override public RecordWriter < K , VariantContextWritable > getRecordWriter ( TaskAttemptContext ctx ) throws IOException { } }
Configuration conf = ctx . getConfiguration ( ) ; boolean isCompressed = getCompressOutput ( ctx ) ; CompressionCodec codec = null ; String extension = "" ; if ( isCompressed ) { Class < ? extends CompressionCodec > codecClass = getOutputCompressorClass ( ctx , BGZFCodec . class ) ; codec = ReflectionUtils . newInstance ( codecClass , conf ) ; extension = codec . getDefaultExtension ( ) ; } Path file = getDefaultWorkFile ( ctx , extension ) ; if ( ! isCompressed ) { return getRecordWriter ( ctx , file ) ; } else { FileSystem fs = file . getFileSystem ( conf ) ; return getRecordWriter ( ctx , codec . createOutputStream ( fs . create ( file ) ) ) ; }
public class RingBuffer { /** * Returns the current position and increments it . If discard = = true the * bytes before position are discarded . * < p > This method is a support for concrete subclasses get method . * @ param discard * @ return */ protected final int rawGet ( boolean discard ) { } }
int pos ; if ( hasRemaining ( ) ) { if ( discard ) { mark = position ; marked = 1 ; } else { marked ++ ; } pos = position ; position = ( position + 1 ) % capacity ; remaining -- ; updated ( ) ; return pos ; } else { throw new BufferUnderflowException ( ) ; }
public class CommerceOrderNotePersistenceImpl { /** * Removes all the commerce order notes where commerceOrderId = & # 63 ; from the database . * @ param commerceOrderId the commerce order ID */ @ Override public void removeByCommerceOrderId ( long commerceOrderId ) { } }
for ( CommerceOrderNote commerceOrderNote : findByCommerceOrderId ( commerceOrderId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceOrderNote ) ; }
public class RemoteAsyncResultImpl { /** * Export this object so that it is remotely accessible . * < p > This method must be called before the async work is scheduled . */ RemoteAsyncResult exportObject ( ) throws RemoteException { } }
ivObjectID = ivRemoteRuntime . activateAsyncResult ( ( Servant ) createTie ( ) ) ; return ivRemoteRuntime . getAsyncResultReference ( ivObjectID ) ;
public class StaplerResponseWrapper { /** * { @ inheritDoc } */ @ Override public void sendRedirect ( int statusCode , String url ) throws IOException { } }
getWrapped ( ) . sendRedirect ( statusCode , url ) ;
public class ExpressionUtil { /** * visit line number * @ param adapter * @ param line * @ param silent id silent this is ignored for log */ public static void visitLine ( BytecodeContext bc , Position pos ) { } }
if ( pos != null ) { visitLine ( bc , pos . line ) ; }
public class CPSubsystemConfig { /** * Sets the map of { @ link FencedLock } configurations , mapped by config * name . Names could optionally contain a { @ link CPGroup } name , such as * " myLock @ group1 " . * @ param lockConfigs the { @ link FencedLock } config map to set * @ return this config instance */ public CPSubsystemConfig setLockConfigs ( Map < String , FencedLockConfig > lockConfigs ) { } }
this . lockConfigs . clear ( ) ; this . lockConfigs . putAll ( lockConfigs ) ; for ( Entry < String , FencedLockConfig > entry : this . lockConfigs . entrySet ( ) ) { entry . getValue ( ) . setName ( entry . getKey ( ) ) ; } return this ;
public class TTFFile { /** * Read the " post " table * containing the PostScript names of the glyphs . * @ param in The reader to get the names from * @ throws IOException Indicates a failure to read the table */ private final void readPostScript ( FontFileReader in ) throws IOException { } }
seekTab ( in , "post" , 0 ) ; postFormat = in . readTTFLong ( ) ; italicAngle = in . readTTFULong ( ) ; underlinePosition = in . readTTFShort ( ) ; underlineThickness = in . readTTFShort ( ) ; isFixedPitch = in . readTTFULong ( ) ; // Skip memory usage values in . skip ( 4 * 4 ) ; log . debug ( "PostScript format: 0x" + Integer . toHexString ( postFormat ) ) ; switch ( postFormat ) { case 0x00010000 : log . debug ( "PostScript format 1" ) ; for ( int i = 0 ; i < Glyphs . MAC_GLYPH_NAMES . length ; i ++ ) { mtxTab [ i ] . setName ( Glyphs . MAC_GLYPH_NAMES [ i ] ) ; } break ; case 0x00020000 : log . debug ( "PostScript format 2" ) ; int numGlyphStrings = 0 ; // Read Number of Glyphs int l = in . readTTFUShort ( ) ; // Read indexes for ( int i = 0 ; i < l ; i ++ ) { mtxTab [ i ] . setIndex ( in . readTTFUShort ( ) ) ; if ( mtxTab [ i ] . getIndex ( ) > 257 ) { // Index is not in the Macintosh standard set numGlyphStrings ++ ; } if ( log . isTraceEnabled ( ) ) { log . trace ( "PostScript index: " + mtxTab [ i ] . getIndexAsString ( ) ) ; } } // firstChar = minIndex ; String [ ] psGlyphsBuffer = new String [ numGlyphStrings ] ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Reading " + numGlyphStrings + " glyphnames, that are not in the standard Macintosh" + " set. Total number of glyphs=" + l ) ; } for ( int i = 0 ; i < psGlyphsBuffer . length ; i ++ ) { psGlyphsBuffer [ i ] = in . readTTFString ( in . readTTFUByte ( ) ) ; } // Set glyph names for ( int i = 0 ; i < l ; i ++ ) { if ( mtxTab [ i ] . getIndex ( ) < NMACGLYPHS ) { mtxTab [ i ] . setName ( Glyphs . MAC_GLYPH_NAMES [ mtxTab [ i ] . getIndex ( ) ] ) ; } else { if ( ! mtxTab [ i ] . isIndexReserved ( ) ) { int k = mtxTab [ i ] . getIndex ( ) - NMACGLYPHS ; if ( log . isTraceEnabled ( ) ) { log . trace ( k + " i=" + i + " mtx=" + mtxTab . length + " ps=" + psGlyphsBuffer . length ) ; } mtxTab [ i ] . setName ( psGlyphsBuffer [ k ] ) ; } } } break ; case 0x00030000 : // PostScript format 3 contains no glyph names log . debug ( "PostScript format 3" ) ; break ; default : log . error ( "Unknown PostScript format: " + postFormat ) ; }
public class EvaluationMetricRunner { /** * Runs a single evaluation metric . * @ param properties The properties of the strategy . * @ throws IOException if recommendation file is not found or output cannot * be written ( see { @ link # generateOutput ( net . recommenders . rival . core . DataModelIF , int [ ] , * net . recommenders . rival . evaluation . metric . EvaluationMetric , java . lang . String , java . lang . Boolean , java . io . File , java . lang . Boolean , java . lang . Boolean ) } ) * @ throws ClassNotFoundException see { @ link # instantiateEvaluationMetric ( java . util . Properties , net . recommenders . rival . core . DataModelIF , net . recommenders . rival . core . DataModelIF ) } * @ throws IllegalAccessException see { @ link # instantiateEvaluationMetric ( java . util . Properties , net . recommenders . rival . core . DataModelIF , net . recommenders . rival . core . DataModelIF ) } * @ throws InstantiationException see { @ link # instantiateEvaluationMetric ( java . util . Properties , net . recommenders . rival . core . DataModelIF , net . recommenders . rival . core . DataModelIF ) } * @ throws InvocationTargetException see { @ link # instantiateEvaluationMetric ( java . util . Properties , net . recommenders . rival . core . DataModelIF , net . recommenders . rival . core . DataModelIF ) } * @ throws NoSuchMethodException see { @ link # instantiateEvaluationMetric ( java . util . Properties , net . recommenders . rival . core . DataModelIF , net . recommenders . rival . core . DataModelIF ) } */ @ SuppressWarnings ( "unchecked" ) public static void run ( final Properties properties ) throws IOException , ClassNotFoundException , IllegalAccessException , InstantiationException , InvocationTargetException , NoSuchMethodException { } }
System . out . println ( "Parsing started: recommendation file" ) ; File recommendationFile = new File ( properties . getProperty ( PREDICTION_FILE ) ) ; DataModelIF < Long , Long > predictions ; EvaluationStrategy . OUTPUT_FORMAT recFormat ; if ( properties . getProperty ( PREDICTION_FILE_FORMAT ) . equals ( EvaluationStrategy . OUTPUT_FORMAT . TRECEVAL . toString ( ) ) ) { recFormat = EvaluationStrategy . OUTPUT_FORMAT . TRECEVAL ; } else { recFormat = EvaluationStrategy . OUTPUT_FORMAT . SIMPLE ; } switch ( recFormat ) { case SIMPLE : predictions = new SimpleParser ( ) . parseData ( recommendationFile ) ; break ; case TRECEVAL : predictions = new TrecEvalParser ( ) . parseData ( recommendationFile ) ; break ; default : throw new AssertionError ( ) ; } System . out . println ( "Parsing finished: recommendation file" ) ; System . out . println ( "Parsing started: test file" ) ; File testFile = new File ( properties . getProperty ( TEST_FILE ) ) ; DataModelIF < Long , Long > testModel = new SimpleParser ( ) . parseData ( testFile ) ; System . out . println ( "Parsing finished: test file" ) ; // read other parameters Boolean overwrite = Boolean . parseBoolean ( properties . getProperty ( OUTPUT_OVERWRITE , "false" ) ) ; Boolean doAppend = Boolean . parseBoolean ( properties . getProperty ( OUTPUT_APPEND , "true" ) ) ; Boolean perUser = Boolean . parseBoolean ( properties . getProperty ( METRIC_PER_USER , "false" ) ) ; File resultsFile = new File ( properties . getProperty ( OUTPUT_FILE ) ) ; // get metric EvaluationMetric < Long > metric = instantiateEvaluationMetric ( properties , predictions , testModel ) ; // get ranking cutoffs int [ ] rankingCutoffs = getRankingCutoffs ( properties ) ; // generate output generateOutput ( testModel , rankingCutoffs , metric , metric . getClass ( ) . getSimpleName ( ) , perUser , resultsFile , overwrite , doAppend ) ;
public class ProofObligation { /** * Chain an OR expression onto a root , or just return the new expression if the root is null . Called in a loop , this * left - associates an OR tree . */ protected PExp makeOr ( PExp root , PExp e ) { } }
if ( root != null ) { AOrBooleanBinaryExp o = new AOrBooleanBinaryExp ( ) ; o . setLeft ( root . clone ( ) ) ; o . setOp ( new LexKeywordToken ( VDMToken . OR , null ) ) ; o . setType ( new ABooleanBasicType ( ) ) ; o . setRight ( e . clone ( ) ) ; return o ; } else { return e ; }
public class StructureTextsRepository { /** * This method will try to avoid creating new strings for each structure name ( element / attribute ) */ static String getStructureName ( final char [ ] buffer , final int offset , final int len ) { } }
final int index = TextUtil . binarySearch ( true , ALL_STANDARD_NAMES , buffer , offset , len ) ; if ( index < 0 ) { return new String ( buffer , offset , len ) ; } return ALL_STANDARD_NAMES [ index ] ;
public class PathAddress { /** * Navigate to , and remove , this address in the given model node . * @ param model the model node * @ return the submodel * @ throws NoSuchElementException if the model contains no such element * @ deprecated manipulating a deep DMR node tree via PathAddress is no longer how the management layer works * internally , so this method has become legacy cruft . Management operation handlers would * use { @ link org . jboss . as . controller . OperationContext # removeResource ( PathAddress ) } to * remove resources . */ @ Deprecated public ModelNode remove ( ModelNode model ) throws NoSuchElementException { } }
final Iterator < PathElement > i = pathAddressList . iterator ( ) ; while ( i . hasNext ( ) ) { final PathElement element = i . next ( ) ; if ( i . hasNext ( ) ) { model = model . require ( element . getKey ( ) ) . require ( element . getValue ( ) ) ; } else { final ModelNode parent = model . require ( element . getKey ( ) ) ; model = parent . remove ( element . getValue ( ) ) . clone ( ) ; } } return model ;
public class FileExecutor { /** * 批量复制文件 , 并重命名 * @ param files 文件路径数组 * @ param destinationFiles 目标文件路径数组 , 与文件路径数组一一对应 * @ throws IOException 异常 */ public static void copyFiles ( String [ ] files , String [ ] destinationFiles ) throws IOException { } }
copyFiles ( getFiles ( files ) , getFiles ( destinationFiles ) ) ;
public class DescribeConfigurationRecordersResult { /** * A list that contains the descriptions of the specified configuration recorders . * @ return A list that contains the descriptions of the specified configuration recorders . */ public java . util . List < ConfigurationRecorder > getConfigurationRecorders ( ) { } }
if ( configurationRecorders == null ) { configurationRecorders = new com . amazonaws . internal . SdkInternalList < ConfigurationRecorder > ( ) ; } return configurationRecorders ;
public class ClassNodeUtils { /** * Get methods from all interfaces . * Methods from interfaces visited early will be overwritten by later ones . * @ param cNode The ClassNode * @ return A map of methods */ public static Map < String , MethodNode > getDeclaredMethodsFromInterfaces ( ClassNode cNode ) { } }
Map < String , MethodNode > result = new HashMap < String , MethodNode > ( ) ; ClassNode [ ] interfaces = cNode . getInterfaces ( ) ; for ( ClassNode iface : interfaces ) { result . putAll ( iface . getDeclaredMethodsMap ( ) ) ; } return result ;
public class ParallelCountBytes { /** * Print the length and MD5 of the indicated file . * < p > This uses the normal Java NIO Api , so it can take advantage of any installed NIO Filesystem * provider without any extra effort . */ private static void countFile ( String fname ) throws Exception { } }
// large buffers pay off final int bufSize = 50 * 1024 * 1024 ; Queue < Future < WorkUnit > > work = new ArrayDeque < > ( ) ; Path path = Paths . get ( new URI ( fname ) ) ; long size = Files . size ( path ) ; System . out . println ( fname + ": " + size + " bytes." ) ; int nThreads = ( int ) Math . ceil ( size / ( double ) bufSize ) ; if ( nThreads > 4 ) nThreads = 4 ; System . out . println ( "Reading the whole file using " + nThreads + " threads..." ) ; Stopwatch sw = Stopwatch . createStarted ( ) ; long total = 0 ; MessageDigest md = MessageDigest . getInstance ( "MD5" ) ; ExecutorService exec = Executors . newFixedThreadPool ( nThreads ) ; int blockIndex ; for ( blockIndex = 0 ; blockIndex < nThreads ; blockIndex ++ ) { work . add ( exec . submit ( new WorkUnit ( Files . newByteChannel ( path ) , bufSize , blockIndex ) ) ) ; } while ( ! work . isEmpty ( ) ) { WorkUnit full = work . remove ( ) . get ( ) ; md . update ( full . buf . array ( ) , 0 , full . buf . position ( ) ) ; total += full . buf . position ( ) ; if ( full . buf . hasRemaining ( ) ) { full . close ( ) ; } else { work . add ( exec . submit ( full . resetForIndex ( blockIndex ++ ) ) ) ; } } exec . shutdown ( ) ; long elapsed = sw . elapsed ( TimeUnit . SECONDS ) ; System . out . println ( "Read all " + total + " bytes in " + elapsed + "s. " ) ; String hex = String . valueOf ( BaseEncoding . base16 ( ) . encode ( md . digest ( ) ) ) ; System . out . println ( "The MD5 is: 0x" + hex ) ; if ( total != size ) { System . out . println ( "Wait, this doesn't match! We saw " + total + " bytes, " + "yet the file size is listed at " + size + " bytes." ) ; }
public class InheritableState { /** * Return the default location of all images . It is used as the location * for the tree structure images . * @ return String */ public String getImageRoot ( ) { } }
if ( _imageRoot != null ) return _imageRoot ; if ( _parent != null ) return _parent . getImageRoot ( ) ; return null ;
public class Regex { /** * Creates an NFA from regular expression * @ param scope * @ param expression * @ return */ public static NFA < Integer > createNFA ( Scope < NFAState < Integer > > scope , String expression ) { } }
return createNFA ( scope , expression , 1 ) ;
public class MultiEnvAware { /** * Returns the key , if that specified key is mapped to something * @ param key - environment name * @ return String */ public String getKeyOrDefault ( String key ) { } }
if ( StringUtils . isBlank ( key ) ) { if ( this . hasDefaultEnvironment ( ) ) { return defaultEnvironment ; } else { throw new MultiEnvSupportException ( "[environment] property is mandatory and can't be empty" ) ; } } if ( map . containsKey ( key ) ) { return key ; } if ( this . hasTemplateEnvironment ( ) ) { return this . templateEnvironment ; } LOG . error ( "Failed to find environment [{}] in {}" , key , this . keySet ( ) ) ; throw new MultiEnvSupportException ( String . format ( "Failed to find configuration for environment %s" , key ) ) ;
public class PAbstractObject { /** * Get a property as a array or default . * @ param key the property name * @ param defaultValue default */ @ Override public final PObject optObject ( final String key , final PObject defaultValue ) { } }
PObject result = optObject ( key ) ; return result == null ? defaultValue : result ;
public class PatternLayoutEscaped { /** * Create a copy of event , but append a stack trace to the message ( if it exists ) . Then it escapes * the backslashes , tabs , newlines and quotes in its message as we are sending it as JSON and we * don ' t want any corruption of the JSON object . */ private LoggingEvent appendStackTraceToEvent ( final LoggingEvent event ) { } }
String message = event . getMessage ( ) . toString ( ) ; // If there is a stack trace available , print it out if ( event . getThrowableInformation ( ) != null ) { final String [ ] s = event . getThrowableStrRep ( ) ; for ( final String line : s ) { message += "\n" + line ; } } message = message . replace ( "\\" , "\\\\" ) . replace ( "\n" , "\\n" ) . replace ( "\"" , "\\\"" ) . replace ( "\t" , "\\t" ) ; final Throwable throwable = event . getThrowableInformation ( ) == null ? null : event . getThrowableInformation ( ) . getThrowable ( ) ; return new LoggingEvent ( event . getFQNOfLoggerClass ( ) , event . getLogger ( ) , event . getTimeStamp ( ) , event . getLevel ( ) , message , throwable ) ;
public class JobScheduleDisableHeaders { /** * Set the time at which the resource was last modified . * @ param lastModified the lastModified value to set * @ return the JobScheduleDisableHeaders object itself . */ public JobScheduleDisableHeaders withLastModified ( DateTime lastModified ) { } }
if ( lastModified == null ) { this . lastModified = null ; } else { this . lastModified = new DateTimeRfc1123 ( lastModified ) ; } return this ;
public class KTypeArrayList { /** * Applies < code > procedure < / code > to a slice of the list , * < code > fromIndex < / code > , inclusive , to < code > toIndex < / code > , exclusive . */ public < T extends KTypeProcedure < ? super KType > > T forEach ( T procedure , int fromIndex , final int toIndex ) { } }
assert ( fromIndex >= 0 && fromIndex <= size ( ) ) : "Index " + fromIndex + " out of bounds [" + 0 + ", " + size ( ) + ")." ; assert ( toIndex >= 0 && toIndex <= size ( ) ) : "Index " + toIndex + " out of bounds [" + 0 + ", " + size ( ) + "]." ; assert fromIndex <= toIndex : "fromIndex must be <= toIndex: " + fromIndex + ", " + toIndex ; final KType [ ] buffer = Intrinsics . < KType [ ] > cast ( this . buffer ) ; for ( int i = fromIndex ; i < toIndex ; i ++ ) { procedure . apply ( buffer [ i ] ) ; } return procedure ;
public class PeriodFormatterData { /** * Append a count to the string builder . * @ param unit the unit * @ param count the count * @ param cv the format to use for displaying the count * @ param useSep whether to use the count separator , if available * @ param name the term name * @ param last true if this is the last unit to be formatted * @ param sb the string builder to which to append the text * @ return index to use if might have required or optional suffix , or - 1 if none required */ public int appendCount ( TimeUnit unit , boolean omitCount , boolean useDigitPrefix , int count , int cv , boolean useSep , String name , boolean last , StringBuffer sb ) { } }
if ( cv == ECountVariant . HALF_FRACTION && dr . halves == null ) { cv = ECountVariant . INTEGER ; } if ( ! omitCount && useDigitPrefix && dr . digitPrefix != null ) { sb . append ( dr . digitPrefix ) ; } int index = unit . ordinal ( ) ; switch ( cv ) { case ECountVariant . INTEGER : { if ( ! omitCount ) { appendInteger ( count / 1000 , 1 , 10 , sb ) ; } } break ; case ECountVariant . INTEGER_CUSTOM : { int val = count / 1000 ; // only custom names we have for now if ( unit == TimeUnit . MINUTE && ( dr . fiveMinutes != null || dr . fifteenMinutes != null ) ) { if ( val != 0 && val % 5 == 0 ) { if ( dr . fifteenMinutes != null && ( val == 15 || val == 45 ) ) { val = val == 15 ? 1 : 3 ; if ( ! omitCount ) appendInteger ( val , 1 , 10 , sb ) ; name = dr . fifteenMinutes ; index = 8 ; // hack break ; } if ( dr . fiveMinutes != null ) { val = val / 5 ; if ( ! omitCount ) appendInteger ( val , 1 , 10 , sb ) ; name = dr . fiveMinutes ; index = 9 ; // hack break ; } } } if ( ! omitCount ) appendInteger ( val , 1 , 10 , sb ) ; } break ; case ECountVariant . HALF_FRACTION : { // 0 , 1/2 , 1 , 1-1/2 . . . int v = count / 500 ; if ( v != 1 ) { if ( ! omitCount ) appendCountValue ( count , 1 , 0 , sb ) ; } if ( ( v & 0x1 ) == 1 ) { // hack , using half name if ( v == 1 && dr . halfNames != null && dr . halfNames [ index ] != null ) { sb . append ( name ) ; return last ? index : - 1 ; } int solox = v == 1 ? 0 : 1 ; if ( dr . genders != null && dr . halves . length > 2 ) { if ( dr . genders [ index ] == EGender . F ) { solox += 2 ; } } int hp = dr . halfPlacements == null ? EHalfPlacement . PREFIX : dr . halfPlacements [ solox & 0x1 ] ; String half = dr . halves [ solox ] ; String measure = dr . measures == null ? null : dr . measures [ index ] ; switch ( hp ) { case EHalfPlacement . PREFIX : sb . append ( half ) ; break ; case EHalfPlacement . AFTER_FIRST : { if ( measure != null ) { sb . append ( measure ) ; sb . append ( half ) ; if ( useSep && ! omitCount ) { sb . append ( dr . countSep ) ; } sb . append ( name ) ; } else { // ignore sep completely sb . append ( name ) ; sb . append ( half ) ; return last ? index : - 1 ; // might use suffix } } return - 1 ; // exit early case EHalfPlacement . LAST : { if ( measure != null ) { sb . append ( measure ) ; } if ( useSep && ! omitCount ) { sb . append ( dr . countSep ) ; } sb . append ( name ) ; sb . append ( half ) ; } return last ? index : - 1 ; // might use suffix } } } break ; default : { int decimals = 1 ; switch ( cv ) { case ECountVariant . DECIMAL2 : decimals = 2 ; break ; case ECountVariant . DECIMAL3 : decimals = 3 ; break ; default : break ; } if ( ! omitCount ) appendCountValue ( count , 1 , decimals , sb ) ; } break ; } if ( ! omitCount && useSep ) { sb . append ( dr . countSep ) ; } if ( ! omitCount && dr . measures != null && index < dr . measures . length ) { String measure = dr . measures [ index ] ; if ( measure != null ) { sb . append ( measure ) ; } } sb . append ( name ) ; return last ? index : - 1 ;
public class JsonViewMessageConverter { /** * Registering custom serializer allows to the JSonView to deal with custom serializations for certains field types . < br > * This way you could register for instance a JODA serialization as a DateTimeSerializer . < br > * Thus , when JSonView find a field of that type ( DateTime ) , it will delegate the serialization to the serializer specified . < br > * Example : < br > * < code > * JsonViewSupportFactoryBean bean = new JsonViewSupportFactoryBean ( mapper ) ; * bean . registerCustomSerializer ( DateTime . class , new DateTimeSerializer ( ) ) ; * < / code > * @ param < T > Type class of the serializer * @ param class1 { @ link Class } the class type you want to add a custom serializer * @ param forType { @ link JsonSerializer } the serializer you want to apply for that type */ public < T > void registerCustomSerializer ( Class < T > class1 , JsonSerializer < T > forType ) { } }
this . serializer . registerCustomSerializer ( class1 , forType ) ;
public class Triple { /** * 根据等号左边的泛型 , 自动构造合适的Triple */ public static < L , M , R > Triple < L , M , R > of ( @ Nullable L left , @ Nullable M middle , @ Nullable R right ) { } }
return new Triple < L , M , R > ( left , middle , right ) ;
public class ExtensionFeatureOptions { /** * Adds a dependency */ public ExtensionFeatureOptions withDependency ( ExtensionFeature feature ) { } }
Set < String > existing = this . dependencies ; Set < String > newDependencies ; if ( existing == null ) { newDependencies = new HashSet < > ( ) ; } else { newDependencies = new HashSet < > ( existing ) ; } newDependencies . add ( feature . getId ( ) ) ; return withDependencies ( newDependencies ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcRelAssignsToGroupByFactor ( ) { } }
if ( ifcRelAssignsToGroupByFactorEClass == null ) { ifcRelAssignsToGroupByFactorEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 522 ) ; } return ifcRelAssignsToGroupByFactorEClass ;
public class EventSubscriptionsInner { /** * Get an event subscription . * Get properties of an event subscription . * @ param scope The scope of the event subscription . The scope can be a subscription , or a resource group , or a top level resource belonging to a resource provider namespace , or an EventGrid topic . For example , use ' / subscriptions / { subscriptionId } / ' for a subscription , ' / subscriptions / { subscriptionId } / resourceGroups / { resourceGroupName } ' for a resource group , and ' / subscriptions / { subscriptionId } / resourceGroups / { resourceGroupName } / providers / { resourceProviderNamespace } / { resourceType } / { resourceName } ' for a resource , and ' / subscriptions / { subscriptionId } / resourceGroups / { resourceGroupName } / providers / Microsoft . EventGrid / topics / { topicName } ' for an EventGrid topic . * @ param eventSubscriptionName Name of the event subscription * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the EventSubscriptionInner object if successful . */ public EventSubscriptionInner get ( String scope , String eventSubscriptionName ) { } }
return getWithServiceResponseAsync ( scope , eventSubscriptionName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class IRSwitchStatement { /** * The switch statement has a non - null terminal stmt iff : * 1 ) There are no case stmts or all the the case stmts have non - break terminator and * 2 ) The default stmt exists and has a non - break terminator */ @ Override public IRTerminalStatement getLeastSignificantTerminalStatement ( ) { } }
if ( _defaultStatements . isEmpty ( ) ) { return null ; } IRContinueStatement caseStmtContinue = null ; if ( _cases != null ) { outer : for ( int i = 0 ; i < _cases . size ( ) ; i ++ ) { List caseStatements = _cases . get ( i ) . getStatements ( ) ; if ( caseStatements != null && caseStatements . size ( ) > 0 ) { for ( int iStmt = 0 ; iStmt < caseStatements . size ( ) ; iStmt ++ ) { IRStatement statement = ( IRStatement ) caseStatements . get ( iStmt ) ; // Note that the statement can be null if it ' s just a semicolon IRTerminalStatement terminalStmt = ( statement == null ? null : statement . getLeastSignificantTerminalStatement ( ) ) ; if ( terminalStmt != null && ! ( terminalStmt instanceof IRBreakStatement ) ) { if ( terminalStmt instanceof IRContinueStatement ) { caseStmtContinue = ( IRContinueStatement ) terminalStmt ; } continue outer ; } } return null ; } } } for ( int i = 0 ; i < _defaultStatements . size ( ) ; i ++ ) { IRTerminalStatement terminalStmt = _defaultStatements . get ( i ) . getLeastSignificantTerminalStatement ( ) ; if ( terminalStmt != null && ! ( terminalStmt instanceof IRBreakStatement ) ) { return caseStmtContinue != null ? caseStmtContinue : terminalStmt ; } } return null ;
public class Bindings { /** * Removes a specific variable definition from * the list of bindings . The variable name must * match exactly to be removed ( it is case sensitive ) . * @ param varName variable name to remove the definition of . * @ return true if the variable was successfully removed . * False , otherwise . */ public boolean removeVariable ( String varName ) { } }
if ( values == null ) return false ; Iterator iter = values . iterator ( ) ; Binding binding ; int i = 0 ; int found = - 1 ; while ( iter . hasNext ( ) ) { binding = ( Binding ) iter . next ( ) ; if ( binding . getName ( ) . equals ( varName ) ) { found = i ; break ; } i ++ ; } if ( found != - 1 ) { values . remove ( found ) ; return true ; } else { return false ; }
public class DatabasesInner { /** * Returns database metrics . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param databaseName The name of the database . * @ param filter An OData filter expression that describes a subset of metrics to return . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < List < MetricInner > > listMetricsAsync ( String resourceGroupName , String serverName , String databaseName , String filter , final ServiceCallback < List < MetricInner > > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listMetricsWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , filter ) , serviceCallback ) ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getDataObjectFontDescriptor ( ) { } }
if ( dataObjectFontDescriptorEClass == null ) { dataObjectFontDescriptorEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 352 ) ; } return dataObjectFontDescriptorEClass ;
public class ByteArray { /** * 从指定的起始位置和长度查询value值出现的位置 , 没有返回 - 1 * @ param offset 起始位置 * @ param limit 长度限制 * @ param value 查询值 * @ return 所在位置 */ public int find ( int offset , int limit , byte value ) { } }
byte [ ] bytes = this . content ; int end = limit > 0 ? limit : count ; for ( int i = offset ; i < end ; i ++ ) { if ( bytes [ i ] == value ) return i ; } return - 1 ;
public class TargetLoginStage { /** * Sends a Login Response PDU informing the initiator that an error has occurred and that the connection must be * closed . * @ param errorStatus hints to the cause of the error * @ throws InterruptedException * @ throws IOException * @ throws InternetSCSIException */ protected final void sendRejectPdu ( final LoginStatus errorStatus ) throws InterruptedException , IOException , InternetSCSIException { } }
final ProtocolDataUnit rejectPDU = TargetPduFactory . createLoginResponsePdu ( false , // transit flag false , // continueFlag stageNumber , // currentStage stageNumber , // nextStage session . getInitiatorSessionID ( ) , // initiatorSessionID session . getTargetSessionIdentifyingHandle ( ) , // targetSessionIdentifyingHandle initiatorTaskTag , // initiatorTaskTag errorStatus , // status ByteBuffer . allocate ( 0 ) ) ; // dataSegment connection . sendPdu ( rejectPDU ) ;
public class A_CmsSearchIndex { /** * Returns a new index writer for this index . < p > * @ param report the report to write error messages on * @ param create if < code > true < / code > a whole new index is created , if < code > false < / code > an existing index is updated * @ return a new instance of IndexWriter * @ throws CmsIndexException if the index can not be opened */ public I_CmsIndexWriter getIndexWriter ( I_CmsReport report , boolean create ) throws CmsIndexException { } }
// note - create will be : // true if the index is to be fully rebuild , // false if the index is to be incrementally updated if ( m_indexWriter != null ) { if ( ! create ) { // re - use existing index writer return m_indexWriter ; } // need to close the index writer if create is " true " try { m_indexWriter . close ( ) ; m_indexWriter = null ; } catch ( IOException e ) { // if we can ' t close the index we are busted ! throw new CmsIndexException ( Messages . get ( ) . container ( Messages . LOG_IO_INDEX_WRITER_CLOSE_2 , getPath ( ) , getName ( ) ) , e ) ; } } // now create is true of false , but the index writer is definitely null / closed I_CmsIndexWriter indexWriter = createIndexWriter ( create , report ) ; if ( ! create ) { m_indexWriter = indexWriter ; } return indexWriter ;
public class CreateDeviceDefinitionVersionRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateDeviceDefinitionVersionRequest createDeviceDefinitionVersionRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createDeviceDefinitionVersionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createDeviceDefinitionVersionRequest . getAmznClientToken ( ) , AMZNCLIENTTOKEN_BINDING ) ; protocolMarshaller . marshall ( createDeviceDefinitionVersionRequest . getDeviceDefinitionId ( ) , DEVICEDEFINITIONID_BINDING ) ; protocolMarshaller . marshall ( createDeviceDefinitionVersionRequest . getDevices ( ) , DEVICES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SnowflakeDatabaseMetaData { /** * Returns the JDBC standard property string for the property string used * in our show constraint commands * @ param property _ name operation type * @ param property property value * @ return metdata property value */ private short getForeignKeyConstraintProperty ( String property_name , String property ) { } }
short result = 0 ; switch ( property_name ) { case "update" : case "delete" : switch ( property ) { case "NO ACTION" : result = importedKeyNoAction ; break ; case "CASCADE" : result = importedKeyCascade ; break ; case "SET NULL" : result = importedKeySetNull ; break ; case "SET DEFAULT" : result = importedKeySetDefault ; break ; case "RESTRICT" : result = importedKeyRestrict ; break ; } case "deferrability" : switch ( property ) { case "INITIALLY DEFERRED" : result = importedKeyInitiallyDeferred ; break ; case "INITIALLY IMMEDIATE" : result = importedKeyInitiallyImmediate ; break ; case "NOT DEFERRABLE" : result = importedKeyNotDeferrable ; break ; } } return result ;
public class PlayEngine { /** * Send playback stoppage status notification * @ param item * Playlist item */ private void sendStopStatus ( IPlayItem item ) { } }
Status stop = new Status ( StatusCodes . NS_PLAY_STOP ) ; stop . setClientid ( streamId ) ; stop . setDesciption ( String . format ( "Stopped playing %s." , item . getName ( ) ) ) ; stop . setDetails ( item . getName ( ) ) ; doPushMessage ( stop ) ;
public class InteractionManager { /** * Caller must hold lock on interactions */ private Interaction findContext ( String id ) { } }
for ( int i = _currentInteractions . size ( ) - 1 ; i >= 0 ; i -- ) { Interaction ia = ( Interaction ) _currentInteractions . get ( i ) ; if ( ia . id . equals ( id ) ) { return ia ; } } return null ;
public class DeleteLoadBalancerRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteLoadBalancerRequest deleteLoadBalancerRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteLoadBalancerRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteLoadBalancerRequest . getLoadBalancerName ( ) , LOADBALANCERNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class PathTools { /** * All - Pairs - Shortest - Path computation based on Floyd ' s * algorithm { @ cdk . cite FLO62 } . It takes an nxn * matrix C of edge costs and produces an nxn matrix A of lengths of shortest * paths . * @ param costMatrix edge cost matrix * @ return the topological distance matrix */ public static int [ ] [ ] computeFloydAPSP ( int costMatrix [ ] [ ] ) { } }
int nrow = costMatrix . length ; int [ ] [ ] distMatrix = new int [ nrow ] [ nrow ] ; // logger . debug ( " Matrix size : " + n ) ; for ( int i = 0 ; i < nrow ; i ++ ) { for ( int j = 0 ; j < nrow ; j ++ ) { if ( costMatrix [ i ] [ j ] == 0 ) { distMatrix [ i ] [ j ] = 999999999 ; } else { distMatrix [ i ] [ j ] = 1 ; } } } for ( int i = 0 ; i < nrow ; i ++ ) { distMatrix [ i ] [ i ] = 0 ; // no self cycle } for ( int k = 0 ; k < nrow ; k ++ ) { for ( int i = 0 ; i < nrow ; i ++ ) { for ( int j = 0 ; j < nrow ; j ++ ) { if ( distMatrix [ i ] [ k ] + distMatrix [ k ] [ j ] < distMatrix [ i ] [ j ] ) { distMatrix [ i ] [ j ] = distMatrix [ i ] [ k ] + distMatrix [ k ] [ j ] ; // P [ i ] [ j ] = k ; / / k is included in the shortest path } } } } return distMatrix ;
public class RemoteConsumerTransmit { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . runtime . SIMPRemoteConsumerTransmitControllable # getNumberOfRequestsReceived ( ) */ public long getNumberOfCurrentRequests ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getNumberOfCurrentRequests" ) ; // request , value , rejected and accepted messages are all counted long returnValue = _aoStream . getNumberOfRequestsInState ( TickRange . Requested ) ; returnValue += _aoStream . getNumberOfRequestsInState ( TickRange . Value ) ; returnValue += _aoStream . getNumberOfRequestsInState ( TickRange . Rejected ) ; returnValue += _aoStream . getNumberOfRequestsInState ( TickRange . Accepted ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getNumberOfCurrentRequests" , new Long ( returnValue ) ) ; return returnValue ;
public class ApiOvhOrder { /** * Get allowed durations for ' new ' option * REST : GET / order / router / new * @ param vrack [ required ] The name of your vrack */ public ArrayList < String > router_new_GET ( String vrack ) throws IOException { } }
String qPath = "/order/router/new" ; StringBuilder sb = path ( qPath ) ; query ( sb , "vrack" , vrack ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t1 ) ;
public class Vectors { /** * Returns true if vector ( x2 , y2 ) is clockwise of ( x1 , y1 ) in ( ox , oy ) centered * coordinate . * @ param ox * @ param oy * @ param x1 * @ param y1 * @ param x2 * @ param y2 * @ return */ public static final boolean isClockwise ( double ox , double oy , double x1 , double y1 , double x2 , double y2 ) { } }
return isClockwise ( x1 - ox , y1 - oy , x2 - ox , y2 - oy ) ;
public class XsdAsmVisitor { /** * Adds a specific method for a visitElement call . * Example : * void visitElementHtml ( Html < Z > html ) { * visitElement ( html ) ; * @ param classWriter The ElementVisitor class { @ link ClassWriter } . * @ param elementName The specific element . * @ param apiName The name of the generated fluent interface . */ @ SuppressWarnings ( "Duplicates" ) private static void addVisitorElementMethod ( ClassWriter classWriter , String elementName , String apiName ) { } }
elementName = getCleanName ( elementName ) ; String classType = getFullClassTypeName ( elementName , apiName ) ; String classTypeDesc = getFullClassTypeNameDesc ( elementName , apiName ) ; MethodVisitor mVisitor = classWriter . visitMethod ( ACC_PUBLIC , VISIT_ELEMENT_NAME + elementName , "(" + classTypeDesc + ")V" , "<Z::" + elementTypeDesc + ">(L" + classType + "<TZ;>;)V" , null ) ; mVisitor . visitCode ( ) ; mVisitor . visitVarInsn ( ALOAD , 0 ) ; mVisitor . visitVarInsn ( ALOAD , 1 ) ; mVisitor . visitMethodInsn ( INVOKEVIRTUAL , elementVisitorType , VISIT_ELEMENT_NAME , "(" + elementTypeDesc + ")V" , false ) ; mVisitor . visitInsn ( RETURN ) ; mVisitor . visitMaxs ( 2 , 2 ) ; mVisitor . visitEnd ( ) ;
public class MultipartHttpMessageConverter { /** * Set the message body converters to use . These converters are used to * convert objects to MIME parts . */ public void setPartConverters ( List < HttpMessageConverter > partConverters ) { } }
checkNotNull ( partConverters , "'partConverters' must not be null" ) ; checkArgument ( ! partConverters . isEmpty ( ) , "'partConverters' must not be empty" ) ; this . partConverters = partConverters ;
public class TreeGenerator { /** * / < param name = " manager " > TreeGP config < / param > */ public static TreeNode createWithDepth ( Program program , int allowableDepth , TreeGP manager , TGPInitializationStrategy method ) { } }
OperatorSet operatorSet = program . getOperatorSet ( ) ; RandEngine randEngine = manager . getRandEngine ( ) ; TreeNode root ; // Population Initialization method following the " RandomBranch " method described in " Kumar Chellapilla . Evolving computer programs without subtree crossover . IEEE Transactions on Evolutionary Computation , 1(3 ) : 209–216 , September 1997 . " if ( method == TGPInitializationStrategy . INITIALIZATION_METHOD_RANDOM_BRANCH ) { int s = allowableDepth ; // tree size Primitive non_terminal = program . anyOperatorWithArityLessThan ( s , randEngine ) ; if ( non_terminal == null ) { root = new TreeNode ( program . anyTerminal ( randEngine ) ) ; } else { root = new TreeNode ( non_terminal ) ; int b_n = non_terminal . arity ( ) ; s = ( int ) Math . floor ( ( double ) s / b_n ) ; randomBranch ( program , root , s , randEngine ) ; } } // Population Initialization method following the " PTC1 " method described in " Sean Luke . Two fast tree - creation algorithms for genetic programming . IEEE Transactions in Evolutionary Computation , 4(3 ) , 2000b . " else if ( method == TGPInitializationStrategy . INITIALIZATION_METHOD_PTC1 ) { // TODO : Change this one later back to use tag int expectedTreeSize = 20 ; // Convert . ToInt32 ( tag ) ; int b_n_sum = 0 ; for ( int i = 0 ; i < operatorSet . size ( ) ; ++ i ) { b_n_sum += operatorSet . get ( i ) . arity ( ) ; } double p = ( 1 - 1.0 / expectedTreeSize ) / ( ( double ) b_n_sum / operatorSet . size ( ) ) ; Primitive data = null ; if ( randEngine . uniform ( ) <= p ) { data = program . anyOperator ( randEngine ) ; } else { data = program . anyTerminal ( randEngine ) ; } root = new TreeNode ( data ) ; PTC1 ( program , root , p , allowableDepth - 1 , randEngine ) ; } else // handle full and grow method { root = new TreeNode ( anyPrimitive ( program , allowableDepth , method , randEngine ) ) ; createWithDepth ( program , root , allowableDepth - 1 , method , randEngine ) ; } return root ;
public class FormatTrackingHSSFListenerPlus { /** * Returns the format string , eg $ # # . # # , for the given number format index . * @ param formatIndex the format index * @ return the format string */ public String getFormatString ( int formatIndex ) { } }
String format = null ; if ( formatIndex >= HSSFDataFormat . getNumberOfBuiltinBuiltinFormats ( ) ) { FormatRecord tfr = _customFormatRecords . get ( Integer . valueOf ( formatIndex ) ) ; if ( tfr == null ) { logger . log ( POILogger . ERROR , "Requested format at index " + formatIndex + ", but it wasn't found" ) ; } else { format = tfr . getFormatString ( ) ; } } else { format = HSSFDataFormat . getBuiltinFormat ( ( short ) formatIndex ) ; } return format ;
public class Project { /** * Create a new Iteration in the Project where the schedule is defined . * @ param name The initial name of the Iteration . * @ param beginDate The begin date of the Iteration . * @ param endDate The end date of the Iteration . * @ param attributes additional attributes for Iteration . * @ return A new Iteration . */ public Iteration createIteration ( String name , DateTime beginDate , DateTime endDate , Map < String , Object > attributes ) { } }
return getInstance ( ) . create ( ) . iteration ( name , getSchedule ( ) , beginDate , endDate , attributes ) ;
public class CmsWorkplaceEditorConfiguration { /** * Sets the editor workplace URI . < p > * @ param uri the editor workplace URI */ private void setEditorUri ( String uri ) { } }
if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( uri ) ) { setValidConfiguration ( false ) ; LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_EDITOR_CONFIG_NO_URI_0 ) ) ; } m_editorUri = uri ;
public class AggregateCounterController { /** * Retrieve information about a specific aggregate counter . * @ param name counter name * @ return { @ link AggregateCounterResource } */ @ RequestMapping ( value = "/{name}" , method = RequestMethod . GET ) public AggregateCounterResource display ( @ PathVariable ( "name" ) String name ) { } }
AggregateCounter counter = repository . findOne ( name ) ; if ( counter == null ) { throw new NoSuchMetricException ( name ) ; } return deepAssembler . toResource ( counter ) ;
public class JawnServlet { /** * Actually sorts the paths , which is not appreciated and not even used anywhere * @ param servletContext2 * @ return */ private Set < String > findExclusionPaths ( ServletContext servletContext ) { } }
Set < String > exclusions = new TreeSet < String > ( ) ; // Let other handlers deal with folders that do not reside in the WEB - INF or META - INF Set < String > resourcePaths = servletContext . getResourcePaths ( "/" ) ; // This most certainly should not be null ! // It means that the server cannot read files at all if ( resourcePaths == null ) throw new InitException ( "ServletContext cannot read files. Reason is unknown" ) ; resourcePaths . removeIf ( path -> path . contains ( "-INF" ) || path . contains ( "-inf" ) ) ; // We still need to also remove the views folder from being processed by other handlers resourcePaths . removeIf ( path -> path . contains ( TemplateEngine . TEMPLATES_FOLDER ) ) ; // Add the remaining paths to exclusions for ( String path : resourcePaths ) { // add leading slash if ( path . charAt ( 0 ) != '/' ) path = '/' + path ; // remove the last slash if ( path . charAt ( path . length ( ) - 1 ) == '/' ) path = path . substring ( 0 , path . length ( ) - 1 ) ; exclusions . add ( path ) ; } return exclusions ;
public class SerializerIntrinsics { /** * Double Precision Shift Left . */ public final void shld ( Mem dst , Register src1 , Immediate src2 ) { } }
emitX86 ( INST_SHLD , dst , src1 , src2 ) ;
public class WikipediaTemplateInfoGenerator { /** * Extracts templates from pages only */ private void processPages ( ) { } }
PageIterator pageIter = new PageIterator ( getWiki ( ) , true , pageBuffer ) ; int pageCounter = 0 ; while ( pageIter . hasNext ( ) ) { pageCounter ++ ; if ( pageCounter % VERBOSITY == 0 ) { logger . info ( "{} pages processed ..." , pageCounter ) ; } Page curPage = pageIter . next ( ) ; int curPageId = curPage . getPageId ( ) ; fillMapWithTemplateData ( curPage . getText ( ) , pageFilter , curPageId , TPLNAME_TO_PAGEIDS ) ; }
public class NodeStack { /** * Push a node and associated state onto the stack , remembering * a height imbalance if there is one . */ void balancedPush ( int state , GBSNode node ) { } }
push ( state , node ) ; if ( node . balance ( ) != 0 ) _bpidx = _cidx ;
public class PasswordAuthFilter { /** * Handles an authentication request . * @ param request HTTP request * @ param response HTTP response * @ return an authentication object that contains the principal object if successful . * @ throws IOException ex * @ throws ServletException ex */ @ Override public Authentication attemptAuthentication ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } }
String requestURI = request . getRequestURI ( ) ; UserAuthentication userAuth = null ; User user = null ; if ( requestURI . endsWith ( PASSWORD_ACTION ) ) { user = new User ( ) ; user . setIdentifier ( request . getParameter ( EMAIL ) ) ; user . setPassword ( request . getParameter ( PASSWORD ) ) ; String appid = request . getParameter ( Config . _APPID ) ; if ( ! App . isRoot ( appid ) ) { App app = Para . getDAO ( ) . read ( App . id ( appid ) ) ; if ( app != null ) { user . setAppid ( app . getAppIdentifier ( ) ) ; } } if ( User . passwordMatches ( user ) && StringUtils . contains ( user . getIdentifier ( ) , "@" ) ) { // success ! user = User . readUserForIdentifier ( user ) ; userAuth = new UserAuthentication ( new AuthenticatedUserDetails ( user ) ) ; } } return SecurityUtils . checkIfActive ( userAuth , user , true ) ;
public class AmazonCloudFormationClient { /** * Returns summary information about stack sets that are associated with the user . * @ param listStackSetsRequest * @ return Result of the ListStackSets operation returned by the service . * @ sample AmazonCloudFormation . ListStackSets * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cloudformation - 2010-05-15 / ListStackSets " target = " _ top " > AWS * API Documentation < / a > */ @ Override public ListStackSetsResult listStackSets ( ListStackSetsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListStackSets ( request ) ;
public class JDBDT { /** * Create a new database handle for given { @ link javax . sql . DataSource } * instance . * < p > Calling this method is shorthand for : < br > * & nbsp ; & nbsp ; & nbsp ; & nbsp ; * < code > database ( xds . getConnection ( ) ) < / code > . * @ param xds { @ link javax . sql . DataSource } instance . * @ return A new database handle for the connection . * @ throws SQLException If the connection cannot be created . * @ see # database ( Connection ) * @ see javax . sql . DataSource # getConnection ( ) * @ since 1.2 */ public static DB database ( javax . sql . DataSource xds ) throws SQLException { } }
return database ( xds . getConnection ( ) ) ;
public class CmsToolManager { /** * Returns the admin tool corresponding to the given abstract path . < p > * @ param rootKey the tool root * @ param toolPath the path * @ return the corresponding tool , or < code > null < / code > if not found */ public CmsTool resolveAdminTool ( String rootKey , String toolPath ) { } }
return m_tools . getObject ( rootKey + ROOT_SEPARATOR + toolPath ) ;
public class LogLog { /** * This method is used to output log4j internal debug * statements . Output goes to < code > System . out < / code > . */ public static void debug ( String msg , Throwable t ) { } }
if ( debugEnabled && ! quietMode ) { System . out . println ( PREFIX + msg ) ; if ( t != null ) t . printStackTrace ( System . out ) ; }
public class CommerceOrderPersistenceImpl { /** * Returns the first commerce order in the ordered set where groupId = & # 63 ; and commerceAccountId = & # 63 ; . * @ param groupId the group ID * @ param commerceAccountId the commerce account ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce order , or < code > null < / code > if a matching commerce order could not be found */ @ Override public CommerceOrder fetchByG_C_First ( long groupId , long commerceAccountId , OrderByComparator < CommerceOrder > orderByComparator ) { } }
List < CommerceOrder > list = findByG_C ( groupId , commerceAccountId , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ;
public class Providers { /** * Provide a Provider from the resource found in the current class loader with the provided encoding . < br / > As * resource is accessed through a class loader , a leading " / " is not allowed in pathToResource */ public static Provider resourceProvider ( String pathToResource , Charset encoding ) throws IOException { } }
ClassLoader classLoader = Provider . class . getClassLoader ( ) ; return resourceProvider ( classLoader , pathToResource , encoding ) ;
public class InternalXtextParser { /** * InternalXtext . g : 178:1 : entryRuleReferencedMetamodel : ruleReferencedMetamodel EOF ; */ public final void entryRuleReferencedMetamodel ( ) throws RecognitionException { } }
try { // InternalXtext . g : 179:1 : ( ruleReferencedMetamodel EOF ) // InternalXtext . g : 180:1 : ruleReferencedMetamodel EOF { before ( grammarAccess . getReferencedMetamodelRule ( ) ) ; pushFollow ( FollowSets000 . FOLLOW_1 ) ; ruleReferencedMetamodel ( ) ; state . _fsp -- ; after ( grammarAccess . getReferencedMetamodelRule ( ) ) ; match ( input , EOF , FollowSets000 . FOLLOW_2 ) ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { } return ;
public class NumberUtil { /** * 提供 ( 相对 ) 精确的除法运算 , 当发生除不尽的情况时 , 由scale指定精确度 , 后面的四舍五入 * @ param v1 被除数 * @ param v2 除数 * @ param scale 精确度 , 如果为负值 , 取绝对值 * @ return 两个参数的商 * @ since 3.1.0 */ public static BigDecimal div ( Number v1 , Number v2 , int scale ) { } }
return div ( v1 , v2 , scale , RoundingMode . HALF_UP ) ;
public class RSA { /** * 从KeyStore获取公钥 * @ param location * @ param alias * @ param storeType * @ param storePass * @ param keyPass * @ return */ public static PublicKey loadPublicKeyFromKeyStore ( String location , String alias , String storeType , String storePass , String keyPass ) { } }
try { storeType = null == storeType ? KeyStore . getDefaultType ( ) : storeType ; keyPass = keyPass == null ? storePass : keyPass ; KeyStore keyStore = KeyStore . getInstance ( storeType ) ; InputStream is = new FileInputStream ( location ) ; keyStore . load ( is , storePass . toCharArray ( ) ) ; RSAPrivateCrtKey key = ( RSAPrivateCrtKey ) keyStore . getKey ( alias , keyPass . toCharArray ( ) ) ; RSAPublicKeySpec spec = new RSAPublicKeySpec ( key . getModulus ( ) , key . getPublicExponent ( ) ) ; PublicKey publicKey = KeyFactory . getInstance ( KEY_ALGORITHM ) . generatePublic ( spec ) ; return publicKey ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class RecoveryPointsInner { /** * Provides the backup data for the RecoveryPointID . This is an asynchronous operation . To learn the status of the operation , call the GetProtectedItemOperationResult API . * @ param vaultName The name of the Recovery Services vault . * @ param resourceGroupName The name of the resource group associated with the Recovery Services vault . * @ param fabricName The fabric name associated with backup item . * @ param containerName The container name associated with backup item . * @ param protectedItemName The name of the backup item used in this GET operation . * @ param recoveryPointId The RecoveryPointID associated with this GET operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the RecoveryPointResourceInner object */ public Observable < RecoveryPointResourceInner > getAsync ( String vaultName , String resourceGroupName , String fabricName , String containerName , String protectedItemName , String recoveryPointId ) { } }
return getWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName , protectedItemName , recoveryPointId ) . map ( new Func1 < ServiceResponse < RecoveryPointResourceInner > , RecoveryPointResourceInner > ( ) { @ Override public RecoveryPointResourceInner call ( ServiceResponse < RecoveryPointResourceInner > response ) { return response . body ( ) ; } } ) ;
public class CacheLoader { /** * Dump the XML representation of the expirer . * @ param writer The formatted writer to which the dump should be directed . * @ throws IOException */ public void xmlWriteOn ( FormattedWriter writer ) throws IOException { } }
DateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd @ HH:mm:ss.SSS" ) ; String timeNow = dateFormat . format ( new Date ( ) ) ; writer . newLine ( ) ; writer . startTag ( XML_CACHE_LOADER ) ; writer . indent ( ) ; writer . newLine ( ) ; writer . taggedValue ( "timeNow" , timeNow ) ; writer . newLine ( ) ; writer . taggedValue ( "interval" , interval ) ; writer . newLine ( ) ; writer . taggedValue ( "enabled" , Boolean . valueOf ( enabled ) ) ; writer . newLine ( ) ; writer . taggedValue ( "maxStreamsPerCycle" , maxStreamsPerCycle ) ; writer . newLine ( ) ; writer . taggedValue ( "loaderStartTime" , dateFormat . format ( new Date ( loaderStartTime ) ) ) ; writer . newLine ( ) ; writer . taggedValue ( "loaderStopTime" , dateFormat . format ( new Date ( loaderStopTime ) ) ) ; writer . newLine ( ) ; writer . taggedValue ( "totalStreams" , totalStreams ) ; writer . newLine ( ) ; for ( int i = 0 ; i < MAX_DIAG_LOG ; i ++ ) { String str = "Cycle=" + i + ( diagIndex == i ? ":*" : ": " ) + dateFormat . format ( new Date ( cycleTime [ i ] ) ) + " streamsLoaded=" + logStreamsLoaded [ i ] + " duration=" + logDuration [ i ] ; writer . taggedValue ( "info" , str ) ; writer . newLine ( ) ; } writer . startTag ( XML_STORED_EXCEPTION ) ; if ( lastException == null ) { writer . write ( "No exceptions recorded" ) ; } else { writer . indent ( ) ; writer . newLine ( ) ; writer . taggedValue ( "time" , new Date ( lastExceptionTime ) ) ; writer . outdent ( ) ; writer . write ( lastException ) ; writer . newLine ( ) ; } writer . endTag ( XML_STORED_EXCEPTION ) ; writer . outdent ( ) ; writer . newLine ( ) ; writer . endTag ( XML_CACHE_LOADER ) ;
public class DoubleTuples { /** * Returns the standard deviation of the given tuple . * The method will compute { @ link # variance ( DoubleTuple ) } , return * the square root of this value . * @ param t The input tuple * @ param mean The mean , which may have been computed before with * { @ link # arithmeticMean ( DoubleTuple ) } * @ return The standard deviation */ public static double standardDeviationFromMean ( DoubleTuple t , double mean ) { } }
double variance = variance ( t , mean ) ; return Math . sqrt ( variance ) ;
public class DynamoDBTableMapper { /** * Loads an object with the hash key given . * @ param hashKey The hash key value . * @ return The object . * @ see com . amazonaws . services . dynamodbv2 . datamodeling . DynamoDBMapper # load */ public T load ( H hashKey ) { } }
return mapper . < T > load ( model . targetType ( ) , hashKey ) ;
public class APRIORI { /** * Build the 2 - itemsets . * @ param oneitems Frequent 1 - itemsets * @ param relation Data relation * @ param dim Maximum dimensionality * @ param needed Minimum support needed * @ param ids Objects to process * @ param survivors Output : objects that had at least two 1 - frequent items . * @ return Frequent 2 - itemsets */ protected List < SparseItemset > buildFrequentTwoItemsets ( List < OneItemset > oneitems , final Relation < BitVector > relation , final int dim , final int needed , DBIDs ids , ArrayModifiableDBIDs survivors ) { } }
int f1 = 0 ; long [ ] mask = BitsUtil . zero ( dim ) ; for ( OneItemset supported : oneitems ) { BitsUtil . setI ( mask , supported . item ) ; f1 ++ ; } if ( LOG . isStatistics ( ) ) { LOG . statistics ( new LongStatistic ( STAT + "2-items.candidates" , f1 * ( long ) ( f1 - 1 ) ) ) ; } // We quite aggressively size the map , assuming that almost each combination // is present somewhere . If this won ' t fit into memory , we ' re likely running // OOM somewhere later anyway ! Long2IntOpenHashMap map = new Long2IntOpenHashMap ( ( f1 * ( f1 - 1 ) ) >>> 1 ) ; final long [ ] scratch = BitsUtil . zero ( dim ) ; for ( DBIDIter iditer = ids . iter ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { BitsUtil . setI ( scratch , mask ) ; relation . get ( iditer ) . andOnto ( scratch ) ; int lives = 0 ; for ( int i = BitsUtil . nextSetBit ( scratch , 0 ) ; i >= 0 ; i = BitsUtil . nextSetBit ( scratch , i + 1 ) ) { for ( int j = BitsUtil . nextSetBit ( scratch , i + 1 ) ; j >= 0 ; j = BitsUtil . nextSetBit ( scratch , j + 1 ) ) { long key = ( ( ( long ) i ) << 32 ) | j ; map . put ( key , 1 + map . get ( key ) ) ; ++ lives ; } } if ( lives > 2 ) { survivors . add ( iditer ) ; } } // Generate candidates of length 2. List < SparseItemset > frequent = new ArrayList < > ( f1 * ( int ) FastMath . sqrt ( f1 ) ) ; for ( ObjectIterator < Long2IntMap . Entry > iter = map . long2IntEntrySet ( ) . fastIterator ( ) ; iter . hasNext ( ) ; ) { Long2IntMap . Entry entry = iter . next ( ) ; if ( entry . getIntValue ( ) >= needed ) { int ii = ( int ) ( entry . getLongKey ( ) >>> 32 ) ; int ij = ( int ) ( entry . getLongKey ( ) & - 1L ) ; frequent . add ( new SparseItemset ( new int [ ] { ii , ij } , entry . getIntValue ( ) ) ) ; } } // The hashmap may produce them out of order . Collections . sort ( frequent ) ; if ( LOG . isStatistics ( ) ) { LOG . statistics ( new LongStatistic ( STAT + "2-items.frequent" , frequent . size ( ) ) ) ; } return frequent ;
public class SftpClient { /** * Upload a file to the remote computer . * @ param local * the path / name of the local file * @ param progress * @ throws SftpStatusException * @ throws SshException * @ throws TransferCancelledException * @ throws FileNotFoundException */ public void put ( String local , FileTransferProgress progress ) throws FileNotFoundException , SftpStatusException , SshException , TransferCancelledException { } }
put ( local , progress , false ) ;
public class ActionConstants { /** * Creates a permission * @ param name * @ param serviceName * @ param actions * @ return the created Permission * @ throws java . lang . IllegalArgumentException if there is no service found with the given serviceName . */ public static Permission getPermission ( String name , String serviceName , String ... actions ) { } }
PermissionFactory permissionFactory = PERMISSION_FACTORY_MAP . get ( serviceName ) ; if ( permissionFactory == null ) { throw new IllegalArgumentException ( "No permissions found for service: " + serviceName ) ; } return permissionFactory . create ( name , actions ) ;
public class JDefaultIdentity { /** * Creates a Driver ' s license in the format of 2 Letter State Code , Dash , 8 Digit Random Number * ie CO - 12345678 * @ return driver ' s license string */ public static String driversLicense ( ) { } }
StringBuffer dl = new StringBuffer ( JDefaultAddress . stateAbbr ( ) ) ; dl . append ( "-" ) ; dl . append ( JDefaultNumber . randomNumberString ( 8 ) ) ; return dl . toString ( ) ;
public class GenericInputSplit { @ Override public void write ( DataOutput out ) throws IOException { } }
out . writeInt ( this . partitionNumber ) ; out . writeInt ( this . totalNumberOfPartitions ) ;
public class SegmentIndexBufferFileIO { /** * Reads from the specified segment index buffer file . * @ param sib - the segment index buffer * @ param sibFile - the segment index buffer file to read from * @ throws IOException */ @ Override public int read ( SegmentIndexBuffer sib , File sibFile ) throws IOException { } }
check ( sibFile ) ; RandomAccessFile raf = new RandomAccessFile ( sibFile , "r" ) ; FileChannel channel = raf . getChannel ( ) ; readVersion ( channel ) ; int length = sib . read ( channel ) ; length += STORAGE_VERSION_LENGTH ; channel . close ( ) ; raf . close ( ) ; if ( _logger . isTraceEnabled ( ) ) { _logger . trace ( "read " + sibFile . getAbsolutePath ( ) ) ; } return length ;
public class RoaringIntPacking { /** * Duplicated from jdk8 Integer . compareUnsigned */ public static int compareUnsigned ( int x , int y ) { } }
return Integer . compare ( x + Integer . MIN_VALUE , y + Integer . MIN_VALUE ) ;
public class SqlMapper { /** * 查询返回List < Map < String , Object > > * @ param sql 执行的sql * @ param value 参数 * @ return result */ public List < Map < String , Object > > selectList ( String sql , Object value ) { } }
Class < ? > parameterType = value != null ? value . getClass ( ) : null ; String msId = msUtils . selectDynamic ( sql , parameterType ) ; return sqlSession . selectList ( msId , value ) ;
public class QueueEntryRow { /** * Returns a byte array representing prefix of a queue . The prefix is formed by first two bytes of * MD5 of the queue name followed by the queue name . */ public static byte [ ] getQueueRowPrefix ( QueueName queueName ) { } }
if ( queueName . isStream ( ) ) { // NOTE : stream is uniquely identified by table name return Bytes . EMPTY_BYTE_ARRAY ; } String flowlet = queueName . getThirdComponent ( ) ; String output = queueName . getSimpleName ( ) ; byte [ ] idWithinFlow = ( flowlet + "/" + output ) . getBytes ( Charsets . US_ASCII ) ; return getQueueRowPrefix ( idWithinFlow ) ;
public class SourceCredentialsInfoMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SourceCredentialsInfo sourceCredentialsInfo , ProtocolMarshaller protocolMarshaller ) { } }
if ( sourceCredentialsInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( sourceCredentialsInfo . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( sourceCredentialsInfo . getServerType ( ) , SERVERTYPE_BINDING ) ; protocolMarshaller . marshall ( sourceCredentialsInfo . getAuthType ( ) , AUTHTYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ClassByImplementationBenchmark { /** * Performs a benchmark of an interface implementation using cglib . * @ return The created instance , in order to avoid JIT removal . */ @ Benchmark public ExampleInterface benchmarkCglib ( ) { } }
Enhancer enhancer = new Enhancer ( ) ; enhancer . setUseCache ( false ) ; enhancer . setClassLoader ( newClassLoader ( ) ) ; enhancer . setSuperclass ( baseClass ) ; CallbackHelper callbackHelper = new CallbackHelper ( Object . class , new Class [ ] { baseClass } ) { protected Object getCallback ( Method method ) { if ( method . getDeclaringClass ( ) == baseClass ) { return new FixedValue ( ) { public Object loadObject ( ) { return null ; } } ; } else { return NoOp . INSTANCE ; } } } ; enhancer . setCallbackFilter ( callbackHelper ) ; enhancer . setCallbacks ( callbackHelper . getCallbacks ( ) ) ; return ( ExampleInterface ) enhancer . create ( ) ;
public class CertificateChainUtil { /** * Extracts the DNs of the issuers from a certificate chain . The last certificate in the chain will be ignored ( since it is * the subject ) * @ param chain * a normalised chain * @ return */ public static X500Principal [ ] getIssuerDNsFromChain ( List < X509Certificate > chain ) { } }
if ( chain == null || chain . isEmpty ( ) ) throw new IllegalArgumentException ( "Must provide a chain that is non-null and non-empty" ) ; // Given a chain of n , there are n - 1 values for " issuers " and 1 " subject " final X500Principal [ ] issuers = new X500Principal [ chain . size ( ) - 1 ] ; // Allocate array of n - 1 for issuers for ( int i = 0 ; i < issuers . length ; i ++ ) { final X509Certificate certificate = chain . get ( i ) ; final X500Principal subject = certificate . getSubjectX500Principal ( ) ; issuers [ i ] = subject ; } return issuers ;