signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TimeGuard { /** * Process all time points for the current stack level .
* @ since 1.0 */
@ Weight ( value = Weight . Unit . VARIABLE , comment = "Depends on the current call stack depth" ) public static void checkPoints ( ) { } } | final long time = System . currentTimeMillis ( ) ; final int stackDepth = ThreadUtils . stackDepth ( ) ; final List < TimeData > list = REGISTRY . get ( ) ; final Iterator < TimeData > iterator = list . iterator ( ) ; while ( iterator . hasNext ( ) ) { final TimeData timeWatchItem = iterator . next ( ) ; if ( timeWatchItem . isTimePoint ( ) && timeWatchItem . getDetectedStackDepth ( ) >= stackDepth ) { final long detectedDelay = time - timeWatchItem . getCreationTimeInMilliseconds ( ) ; try { timeWatchItem . getAlertListener ( ) . onTimeAlert ( detectedDelay , timeWatchItem ) ; } catch ( Exception ex ) { final UnexpectedProcessingError error = new UnexpectedProcessingError ( "Error during time point processing" , ex ) ; MetaErrorListeners . fireError ( error . getMessage ( ) , error ) ; } finally { iterator . remove ( ) ; } } } |
public class ColorHelper { /** * Get HSL Color from RGB
* https : / / www . programmingalgorithms . com / algorithm / rgb - to - hsl ? lang = C % 2B % 2B
* @ param r
* @ param g
* @ param b
* @ return */
public static float [ ] getHSLArray ( int r , int g , int b ) { } } | float [ ] hsl = new float [ 3 ] ; float h , s , l ; float rf = r / MAX ; float gf = g / MAX ; float bf = b / MAX ; float minRGB = Math . min ( rf , Math . min ( gf , bf ) ) ; float maxRGB = Math . max ( rf , Math . max ( gf , bf ) ) ; float delta = maxRGB - minRGB ; l = ( maxRGB + minRGB ) / 2 ; if ( delta == 0 ) { h = 0 ; s = 0.0f ; } else { s = ( l <= 0.5 ) ? ( delta / ( maxRGB + minRGB ) ) : ( delta / ( 2 - maxRGB - minRGB ) ) ; float hue ; if ( rf == maxRGB ) { hue = ( ( gf - bf ) / 6 ) / delta ; } else if ( gf == maxRGB ) { hue = ( 1.0f / 3 ) + ( ( bf - rf ) / 6 ) / delta ; } else { hue = ( 2.0f / 3 ) + ( ( rf - gf ) / 6 ) / delta ; } if ( hue < 0 ) { hue += 1 ; } else if ( hue > 1 ) { hue -= 1 ; } h = ( int ) ( hue * 360 ) ; } hsl [ 0 ] = h ; hsl [ 1 ] = s ; hsl [ 2 ] = l ; return hsl ; |
public class Name { /** * Invoke the method identified by this name .
* Performs caching of method resolution using SignatureKey .
* Name contains a wholely unqualfied messy name ; resolve it to
* ( object | static prefix ) + method name and invoke .
* The interpreter is necessary to support ' this . interpreter ' references
* in the called code . ( e . g . debug ( ) ) ;
* < pre >
* Some cases :
* dynamic
* local ( ) ;
* myVariable . foo ( ) ;
* myVariable . bar . blah . foo ( ) ;
* static
* java . lang . Integer . getInteger ( " foo " ) ;
* < / pre > */
public Object invokeMethod ( Interpreter interpreter , Object [ ] args , CallStack callstack , SimpleNode callerInfo ) throws UtilEvalError , EvalError , ReflectError , InvocationTargetException { } } | String methodName = Name . suffix ( value , 1 ) ; BshClassManager bcm = interpreter . getClassManager ( ) ; NameSpace namespace = callstack . top ( ) ; // Optimization - If classOfStaticMethod is set then we have already
// been here and determined that this is a static method invocation .
// Note : maybe factor this out with path below . . . clean up .
if ( classOfStaticMethod != null ) return Reflect . invokeStaticMethod ( bcm , classOfStaticMethod , methodName , args , callerInfo ) ; if ( ! Name . isCompound ( value ) ) return invokeLocalMethod ( interpreter , args , callstack , callerInfo ) ; // Note : if we want methods declared inside blocks to be accessible via
// this . methodname ( ) inside the block we could handle it here as a
// special case . See also resolveThisFieldReference ( ) special handling
// for BlockNameSpace case . They currently work via the direct name
// e . g . methodName ( ) .
String prefix = Name . prefix ( value ) ; // Superclass method invocation ? ( e . g . super . foo ( ) )
if ( prefix . equals ( "super" ) && Name . countParts ( value ) == 2 ) { // Allow getThis ( ) to work through block namespaces first
This ths = namespace . getThis ( interpreter ) ; NameSpace thisNameSpace = ths . getNameSpace ( ) ; thisNameSpace . setNode ( callerInfo ) ; NameSpace classNameSpace = getClassNameSpace ( thisNameSpace ) ; if ( classNameSpace != null ) { Object instance = classNameSpace . getClassInstance ( ) ; return ClassGenerator . getClassGenerator ( ) . invokeSuperclassMethod ( bcm , instance , methodName , args ) ; } } // Find target object or class identifier
Name targetName = namespace . getNameResolver ( prefix ) ; Object obj = targetName . toObject ( callstack , interpreter ) ; if ( obj == Primitive . VOID ) throw new UtilEvalError ( "Attempt to resolve method: " + methodName + "() on undefined variable or class name: " + targetName ) ; // if we ' ve got an object , resolve the method
if ( ! ( obj instanceof ClassIdentifier ) ) { if ( obj instanceof Primitive ) { if ( obj == Primitive . NULL ) throw new UtilTargetError ( new NullPointerException ( "Null Pointer in Method Invocation of " + methodName + "() on variable: " + targetName ) ) ; // some other primitive
// should avoid calling methods on primitive , as we do
// in Name ( can ' t treat primitive like an object message )
// but the hole is useful right now .
Interpreter . debug ( "Attempt to access method on primitive..." , " allowing bsh.Primitive to peek through for debugging" ) ; } // enum block members will be in namespace only
if ( obj . getClass ( ) . isEnum ( ) ) { NameSpace thisNamespace = Reflect . getThisNS ( obj ) ; if ( null != thisNamespace ) { BshMethod m = thisNamespace . getMethod ( methodName , Types . getTypes ( args ) , true ) ; if ( null != m ) return m . invoke ( args , interpreter , callstack , callerInfo ) ; } } // found an object and it ' s not an undefined variable
return Reflect . invokeObjectMethod ( obj , methodName , args , interpreter , callstack , callerInfo ) ; } // It ' s a class
// try static method
Interpreter . debug ( "invokeMethod: trying static - " , targetName ) ; Class clas = ( ( ClassIdentifier ) obj ) . getTargetClass ( ) ; // cache the fact that this is a static method invocation on this class
classOfStaticMethod = clas ; if ( clas != null ) return Reflect . invokeStaticMethod ( bcm , clas , methodName , args , callerInfo ) ; // return null ; ? ? ?
throw new UtilEvalError ( "invokeMethod: unknown target: " + targetName ) ; |
public class COSAPIClient { /** * Merge between two paths
* @ param hostName
* @ param p path
* @ param objectKey
* @ return merged path */
private String getMergedPath ( String hostName , Path p , String objectKey ) { } } | if ( ( p . getParent ( ) != null ) && ( p . getName ( ) != null ) && ( p . getParent ( ) . toString ( ) . equals ( hostName ) ) ) { if ( objectKey . equals ( p . getName ( ) ) ) { return p . toString ( ) ; } return hostName + objectKey ; } return hostName + objectKey ; |
public class JavaCodeInjector { /** * This method will add methods , fields and import statement to existing java file
* @ throws IOException
* @ throws ParseException */
public void insertCode ( ) throws IOException , ParseException { } } | CompilationUnit cuResult = JavaParser . parse ( baseFile ) ; if ( cuResult . getImports ( ) != null ) { List < ImportDeclaration > importsFromBaseFile = cuResult . getImports ( ) ; for ( ImportDeclaration eachImport : importsFromExtendedFile ) { if ( ! importAlreadyPresent ( importsFromBaseFile , eachImport ) ) { importsFromBaseFile . add ( eachImport ) ; } } cuResult . setImports ( importsFromBaseFile ) ; } String code = cuResult . toString ( ) ; BufferedWriter b = new BufferedWriter ( new FileWriter ( baseFile ) ) ; b . write ( code ) ; b . close ( ) ; |
public class CmsConvertXmlDialog { /** * Builds the file format select widget list . < p >
* @ return File format select widget list */
private List buildResourceTypeSelectWidgetList ( ) { } } | List fileFormats = new ArrayList ( ) ; // get all OpenCms resource types
List resourceTypes = OpenCms . getResourceManager ( ) . getResourceTypes ( ) ; // put for every resource type type id and name into list object for select widget
Iterator iter = resourceTypes . iterator ( ) ; while ( iter . hasNext ( ) ) { I_CmsResourceType type = ( I_CmsResourceType ) iter . next ( ) ; // only xml resource types
if ( type . isDirectEditable ( ) && ! type . getTypeName ( ) . toUpperCase ( ) . equals ( "JSP" ) ) { CmsSelectWidgetOption option = new CmsSelectWidgetOption ( new Integer ( type . getTypeId ( ) ) . toString ( ) , false , type . getTypeName ( ) ) ; fileFormats . add ( option ) ; } } return fileFormats ; |
public class ProbeWrapper { /** * Add a response URL to the probe .
* @ param label the string label for the respondTo address
* @ param url the actual URL string */
public void addRespondToURL ( String label , String url ) { } } | RespondToURL respondToURL = new RespondToURL ( ) ; respondToURL . label = label ; respondToURL . url = url ; respondToURLs . add ( respondToURL ) ; |
public class QueryRunner { /** * Executes the given INSERT , UPDATE , or DELETE SQL statement with
* a single replacement parameter . The < code > Connection < / code > is
* retrieved from the < code > DataSource < / code > set in the constructor .
* This < code > Connection < / code > must be in auto - commit mode or the
* update will not be saved .
* @ param sql The SQL statement to execute .
* @ param param The replacement parameter .
* @ throws java . sql . SQLException if a database access error occurs
* @ return The number of rows updated . */
public int update ( String sql , Object param ) throws SQLException { } } | return this . update ( sql , new Object [ ] { param } ) ; |
public class LoOP { /** * Compute the LOF values , using the pdist distances .
* @ param relation Data relation
* @ param knn kNN query
* @ param pdists Precomputed distances
* @ param plofs Storage for PLOFs .
* @ return Normalization factor . */
protected double computePLOFs ( Relation < O > relation , KNNQuery < O > knn , WritableDoubleDataStore pdists , WritableDoubleDataStore plofs ) { } } | FiniteProgress progressPLOFs = LOG . isVerbose ( ) ? new FiniteProgress ( "PLOFs for objects" , relation . size ( ) , LOG ) : null ; double nplof = 0. ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { final KNNList neighbors = knn . getKNNForDBID ( iditer , kcomp + 1 ) ; // + query
// point
// use first kref neighbors as comparison set .
int ks = 0 ; double sum = 0. ; for ( DBIDIter neighbor = neighbors . iter ( ) ; neighbor . valid ( ) && ks < kcomp ; neighbor . advance ( ) ) { if ( DBIDUtil . equal ( neighbor , iditer ) ) { continue ; } sum += pdists . doubleValue ( neighbor ) ; ks ++ ; } double plof = MathUtil . max ( pdists . doubleValue ( iditer ) * ks / sum , 1.0 ) ; if ( Double . isNaN ( plof ) || Double . isInfinite ( plof ) ) { plof = 1.0 ; } plofs . putDouble ( iditer , plof ) ; nplof += ( plof - 1.0 ) * ( plof - 1.0 ) ; LOG . incrementProcessed ( progressPLOFs ) ; } LOG . ensureCompleted ( progressPLOFs ) ; nplof = lambda * FastMath . sqrt ( nplof / relation . size ( ) ) ; if ( LOG . isDebuggingFine ( ) ) { LOG . debugFine ( "nplof normalization factor is " + nplof ) ; } return nplof > 0. ? nplof : 1. ; |
public class FLACEncoder { /** * Attempts to throw a stored exception that had been caught from a child
* thread . This method should be called regularly in any public method to
* let the calling thread know a problem occured .
* @ throws IOException */
private void checkForThreadErrors ( ) throws IOException { } } | if ( error == true && childException != null ) { error = false ; IOException temp = childException ; childException = null ; throw temp ; } |
public class BatcherBuilder { /** * Add a max size component for a batcher . If specified a batcher will call the { @ link BatchListener }
* as soon as the size bound is reached . */
public BatcherBuilder sizeBound ( int size ) { } } | checkState ( this . maxSize == UNSET_INT , "Max size already set to %s" , this . maxSize ) ; checkArgument ( size > 0 , "Required to have a size bound greater than 0" ) ; this . maxSize = size ; return this ; |
public class PutObjectEncryptedKms { /** * MinioClient . getObject ( ) example . */
public static void main ( String [ ] args ) throws NoSuchAlgorithmException , IOException , InvalidKeyException , XmlPullParserException { } } | try { /* play . min . io for test and development . */
MinioClient minioClient = new MinioClient ( "https://play.min.io:9000" , "Q3AM3UQ867SPQQA43P2F" , "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" ) ; /* Amazon S3: */
// MinioClient minioClient = new MinioClient ( " https : / / s3 . amazonaws . com " , " YOUR - ACCESSKEYID " ,
// Create some content for the object .
StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < 10 ; i ++ ) { builder . append ( "Sphinx of black quartz, judge my vow: Used by Adobe InDesign to display font samples. " ) ; builder . append ( "(29 letters)\n" ) ; builder . append ( "Jackdaws love my big sphinx of quartz: Similarly, used by Windows XP for some fonts. " ) ; builder . append ( "(31 letters)\n" ) ; builder . append ( "Pack my box with five dozen liquor jugs: According to Wikipedia, this one is used on " ) ; builder . append ( "NASAs Space Shuttle. (32 letters)\n" ) ; builder . append ( "The quick onyx goblin jumps over the lazy dwarf: Flavor text from an Unhinged Magic Card. " ) ; builder . append ( "(39 letters)\n" ) ; builder . append ( "How razorback-jumping frogs can level six piqued gymnasts!: Not going to win any brevity " ) ; builder . append ( "awards at 49 letters long, but old-time Mac users may recognize it.\n" ) ; builder . append ( "Cozy lummox gives smart squid who asks for job pen: A 41-letter tester sentence for Mac " ) ; builder . append ( "computers after System 7.\n" ) ; builder . append ( "A few others we like: Amazingly few discotheques provide jukeboxes; Now fax quiz Jack! my " ) ; builder . append ( "brave ghost pled; Watch Jeopardy!, Alex Trebeks fun TV quiz game.\n" ) ; builder . append ( "---\n" ) ; } // Create a InputStream for object upload .
ByteArrayInputStream bais = new ByteArrayInputStream ( builder . toString ( ) . getBytes ( "UTF-8" ) ) ; Map < String , String > myContext = new HashMap < > ( ) ; myContext . put ( "key1" , "value1" ) ; // To test SSE - KMS
ServerSideEncryption sse = ServerSideEncryption . withManagedKeys ( "Key-Id" , myContext ) ; minioClient . putObject ( "my-bucketname" , "my-objectname" , bais , bais . available ( ) , sse ) ; bais . close ( ) ; System . out . println ( "my-objectname is encrypted and uploaded successfully." ) ; } catch ( MinioException e ) { System . out . println ( "Error occurred: " + e ) ; } |
public class EJSHome { /** * LI2281.07 */
final TimedObjectWrapper getTimedObjectWrapper ( BeanId beanId ) { } } | TimedObjectWrapper timedWrapper = null ; // Get timedObject from container pool of timed objects .
timedWrapper = ( TimedObjectWrapper ) container . ivTimedObjectPool . get ( ) ; // If the pool was empty , create a new one . . . and set the
// invariant fields .
if ( timedWrapper == null ) { timedWrapper = new TimedObjectWrapper ( ) ; timedWrapper . container = container ; timedWrapper . wrapperManager = wrapperManager ; timedWrapper . ivCommon = null ; // Not cached d174057.2
timedWrapper . isManagedWrapper = false ; // Not managed d174057.2
timedWrapper . ivInterface = WrapperInterface . TIMED_OBJECT ; // d366807
} // Now , fill in the TimedObjectWrapper , based on this home .
timedWrapper . beanId = beanId ; timedWrapper . bmd = beanMetaData ; timedWrapper . methodInfos = beanMetaData . timedMethodInfos ; timedWrapper . methodNames = beanMetaData . timedMethodNames ; timedWrapper . isolationAttrs = null ; // not used for EJB 2 . x
timedWrapper . ivPmiBean = pmiBean ; // d174057.2
return timedWrapper ; |
public class ExportApi { /** * Export users .
* Export the specified users with the properties you list in the * * fields * * parameter .
* @ param exportFileData Export File Data ( required )
* @ return ExportFileResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ExportFileResponse exportFile ( ExportFileData exportFileData ) throws ApiException { } } | ApiResponse < ExportFileResponse > resp = exportFileWithHttpInfo ( exportFileData ) ; return resp . getData ( ) ; |
public class KeyVaultClientBaseImpl { /** * List certificate issuers for a specified key vault .
* The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault . This operation requires the certificates / manageissuers / getissuers permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param maxresults Maximum number of results to return in a page . If not specified the service will return up to 25 results .
* @ 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 < CertificateIssuerItem > > getCertificateIssuersAsync ( final String vaultBaseUrl , final Integer maxresults , final ListOperationCallback < CertificateIssuerItem > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( getCertificateIssuersSinglePageAsync ( vaultBaseUrl , maxresults ) , new Func1 < String , Observable < ServiceResponse < Page < CertificateIssuerItem > > > > ( ) { @ Override public Observable < ServiceResponse < Page < CertificateIssuerItem > > > call ( String nextPageLink ) { return getCertificateIssuersNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class ISUPMessageFactoryImpl { /** * ( non - Javadoc )
* @ see org . restcomm . protocols . ss7 . isup . ISUPMessageFactory # createRSC ( ) */
@ Override public ResetCircuitMessage createRSC ( ) { } } | ResetCircuitMessage msg = new ResetCircuitMessageImpl ( _RSC_HOLDER . mandatoryCodes , _RSC_HOLDER . mandatoryVariableCodes , _RSC_HOLDER . optionalCodes , _RSC_HOLDER . mandatoryCodeToIndex , _RSC_HOLDER . mandatoryVariableCodeToIndex , _RSC_HOLDER . optionalCodeToIndex ) ; return msg ; |
public class FileInstrumentationData { /** * Returns a byte - wise hex string representation of the BitField from
* MSB ( Most Significant Byte ) to LSB ( Least Significant Byte ) .
* Eg . Single byte : a setting of " 0001 1111 " , returns " 1f "
* Eg . Multiple bytes : a setting of " 0000 0010 0001 1111 " , returns " 1f02"
* @ return string representation of bits set */
private static String getHexString ( BitSet bitSet ) { } } | StringBuilder builder = new StringBuilder ( ) ; // Build the hex string .
for ( byte byteEntry : bitSet . toByteArray ( ) ) { // Java bytes are signed , but we want the value as if it were unsigned .
int value = UnsignedBytes . toInt ( byteEntry ) ; String hexString = Integer . toHexString ( value ) ; // Pad string to be two characters ( if it isn ' t already ) .
hexString = Strings . padStart ( hexString , 2 , '0' ) ; builder . append ( hexString ) ; } return builder . toString ( ) ; |
public class ImageCreative { /** * Sets the secondaryImageAssets value for this ImageCreative .
* @ param secondaryImageAssets * The list of secondary image assets associated with this creative .
* This attribute is optional .
* < p > Secondary image assets can be used to store
* different resolution versions of the
* primary asset for use on non - standard density
* screens . */
public void setSecondaryImageAssets ( com . google . api . ads . admanager . axis . v201811 . CreativeAsset [ ] secondaryImageAssets ) { } } | this . secondaryImageAssets = secondaryImageAssets ; |
public class AbstractMSBuildMojo { /** * Run MSBuild for each platform and configuration pair .
* @ param targets the build targets to pass to MSBuild
* @ param environment optional environment variable Map ( my be null )
* @ throws MojoExecutionException if there is a problem running MSBuild
* @ throws MojoFailureException if MSBuild returns a non - zero exit code */
protected void runMSBuild ( List < String > targets , Map < String , String > environment ) throws MojoExecutionException , MojoFailureException { } } | try { MSBuildExecutor msbuild = new MSBuildExecutor ( getLog ( ) , msbuildPath , msbuildMaxCpuCount , projectFile ) ; msbuild . setPlatforms ( platforms ) ; msbuild . setTargets ( targets ) ; msbuild . setEnvironment ( environment ) ; if ( msbuild . execute ( ) != 0 ) { throw new MojoFailureException ( "MSBuild execution failed, see log for details." ) ; } } catch ( IOException ioe ) { throw new MojoExecutionException ( "MSBUild execution failed" , ioe ) ; } catch ( InterruptedException ie ) { throw new MojoExecutionException ( "Interrupted waiting for " + "MSBUild execution to complete" , ie ) ; } |
public class DefaultAndroidApp { /** * ( non - Javadoc )
* @ see io . selendroid . android . impl . AndroidAppA # getMainActivity ( ) */
@ Override public String getMainActivity ( ) throws AndroidSdkException { } } | if ( mainActivity == null ) { try { mainActivity = extractApkDetails ( "launchable-activity: name='(.*?)'" ) ; } catch ( ShellCommandException e ) { throw new SelendroidException ( "The main activity of the apk " + apkFile . getName ( ) + " cannot be extracted." ) ; } } return mainActivity ; |
public class JsonRender { /** * 仅对无参 renderJson ( ) 起作用 */
public static void addExcludedAttrs ( String ... attrs ) { } } | if ( attrs != null ) { for ( String attr : attrs ) { excludedAttrs . add ( attr ) ; } } |
public class JKTableRecord { public int getColumnIndex ( final String name ) { } } | for ( int i = 0 ; i < this . columnsValues . size ( ) ; i ++ ) { final JKTableColumnValue value = this . columnsValues . get ( i ) ; if ( value . getTableColumn ( ) . getName ( ) . toLowerCase ( ) . equals ( name . toLowerCase ( ) ) ) { return i ; } } return - 1 ; |
public class ZipUtil { /** * Copies an existing ZIP file and appends it with one new entry .
* @ param zip
* an existing ZIP file ( only read ) .
* @ param entry
* new ZIP entry appended .
* @ param destZip
* new ZIP file created . */
public static void addEntry ( File zip , ZipEntrySource entry , File destZip ) { } } | addEntries ( zip , new ZipEntrySource [ ] { entry } , destZip ) ; |
public class ArrowSerde { /** * Convert the given { @ link INDArray }
* data type to the proper data type for the tensor .
* @ param bufferBuilder the buffer builder in use
* @ param arr the array to conver tthe data type for */
public static void addTypeTypeRelativeToNDArray ( FlatBufferBuilder bufferBuilder , INDArray arr ) { } } | switch ( arr . data ( ) . dataType ( ) ) { case LONG : case INT : Tensor . addTypeType ( bufferBuilder , Type . Int ) ; break ; case FLOAT : Tensor . addTypeType ( bufferBuilder , Type . FloatingPoint ) ; break ; case DOUBLE : Tensor . addTypeType ( bufferBuilder , Type . Decimal ) ; break ; } |
public class CsvEntityLoader { /** * Loads nodes from a CSV file with given labels to an online database , and fills the { @ code idMapping } ,
* which will be used by the { @ link # loadRelationships ( String , String , GraphDatabaseService , Map ) }
* method .
* @ param fileName URI of the CSV file representing the node
* @ param labels list of node labels to be applied to each node
* @ param db running database instance
* @ param idMapping to be filled with the mapping between the CSV ids and the DB ' s internal node ids
* @ throws IOException */
public void loadNodes ( final String fileName , final List < String > labels , final GraphDatabaseService db , final Map < String , Map < String , Long > > idMapping ) throws IOException { } } | final CountingReader reader = FileUtils . readerFor ( fileName ) ; final String header = readFirstLine ( reader ) ; reader . skip ( clc . getSkipLines ( ) - 1 ) ; final List < CsvHeaderField > fields = CsvHeaderFields . processHeader ( header , clc . getDelimiter ( ) , clc . getQuotationCharacter ( ) ) ; final Optional < CsvHeaderField > idField = fields . stream ( ) . filter ( f -> CsvLoaderConstants . ID_FIELD . equals ( f . getType ( ) ) ) . findFirst ( ) ; final Optional < String > idAttribute = idField . isPresent ( ) ? Optional . of ( idField . get ( ) . getName ( ) ) : Optional . empty ( ) ; final String idSpace = idField . isPresent ( ) ? idField . get ( ) . getIdSpace ( ) : CsvLoaderConstants . DEFAULT_IDSPACE ; idMapping . putIfAbsent ( idSpace , new HashMap < > ( ) ) ; final Map < String , Long > idspaceIdMapping = idMapping . get ( idSpace ) ; final Map < String , LoadCsv . Mapping > mapping = fields . stream ( ) . collect ( Collectors . toMap ( CsvHeaderField :: getName , f -> { final Map < String , Object > mappingMap = Collections . unmodifiableMap ( Stream . of ( new AbstractMap . SimpleEntry < > ( "type" , f . getType ( ) ) , new AbstractMap . SimpleEntry < > ( "array" , f . isArray ( ) ) ) . collect ( Collectors . toMap ( AbstractMap . SimpleEntry :: getKey , AbstractMap . SimpleEntry :: getValue ) ) ) ; return new LoadCsv . Mapping ( f . getName ( ) , mappingMap , clc . getArrayDelimiter ( ) , false ) ; } ) ) ; final CSVReader csv = new CSVReader ( reader , clc . getDelimiter ( ) , clc . getQuotationCharacter ( ) ) ; final String [ ] loadCsvCompatibleHeader = fields . stream ( ) . map ( f -> f . getName ( ) ) . toArray ( String [ ] :: new ) ; int lineNo = 0 ; try ( BatchTransaction tx = new BatchTransaction ( db , clc . getBatchSize ( ) , reporter ) ) { for ( String [ ] line : csv . readAll ( ) ) { lineNo ++ ; final EnumSet < LoadCsvConfig . Results > results = EnumSet . of ( LoadCsvConfig . Results . map ) ; final LoadCsv . CSVResult result = new LoadCsv . CSVResult ( loadCsvCompatibleHeader , line , lineNo , false , mapping , Collections . emptyList ( ) , results ) ; final String nodeCsvId = result . map . get ( idAttribute . get ( ) ) . toString ( ) ; // if ' ignore duplicate nodes ' is false , there is an id field and the mapping already has the current id ,
// we either fail the loading process or skip it depending on the ' ignore duplicate nodes ' setting
if ( idField . isPresent ( ) && idspaceIdMapping . containsKey ( nodeCsvId ) ) { if ( clc . getIgnoreDuplicateNodes ( ) ) { continue ; } else { throw new IllegalStateException ( "Duplicate node with id " + nodeCsvId + " found on line " + lineNo + "\n" + Arrays . toString ( line ) ) ; } } // create node and add its id to the mapping
final Node node = db . createNode ( ) ; if ( idField . isPresent ( ) ) { idspaceIdMapping . put ( nodeCsvId , node . getId ( ) ) ; } // add labels
for ( String label : labels ) { node . addLabel ( Label . label ( label ) ) ; } // add properties
int props = 0 ; for ( CsvHeaderField field : fields ) { final String name = field . getName ( ) ; Object value = result . map . get ( name ) ; if ( field . isMeta ( ) ) { final List < String > customLabels = ( List < String > ) value ; for ( String customLabel : customLabels ) { node . addLabel ( Label . label ( customLabel ) ) ; } } else if ( field . isId ( ) ) { final Object idValue ; if ( clc . getStringIds ( ) ) { idValue = value ; } else { idValue = Long . valueOf ( ( String ) value ) ; } node . setProperty ( field . getName ( ) , idValue ) ; props ++ ; } else { boolean propertyAdded = CsvPropertyConverter . addPropertyToGraphEntity ( node , field , value ) ; props += propertyAdded ? 1 : 0 ; } } reporter . update ( 1 , 0 , props ++ ) ; } } |
public class DateUtil { /** * 判断指定日期是否在当前时间之前 , 精确到指定单位
* @ param date 指定日期
* @ param format 指定日期的格式
* @ param dateUnit 精确单位 ( 例如传入年就是精确到年 )
* @ return 如果指定日期在当前时间之前返回 < code > true < / code > */
public static boolean beforeNow ( String date , String format , DateUnit dateUnit ) { } } | logger . debug ( "指定日期为:{}" , date ) ; return calc ( new Date ( ) , parse ( date , format ) , dateUnit ) > 0 ; |
public class MySqlDdlParser { /** * { @ inheritDoc }
* @ see org . modeshape . sequencer . ddl . StandardDdlParser # parseAlterTableStatement ( org . modeshape . sequencer . ddl . DdlTokenStream ,
* org . modeshape . sequencer . ddl . node . AstNode ) */
@ Override protected AstNode parseAlterTableStatement ( DdlTokenStream tokens , AstNode parentNode ) throws ParsingException { } } | assert tokens != null ; assert parentNode != null ; // TODO :
/* ALTER [ ONLINE | OFFLINE ] [ IGNORE ] TABLE tbl _ name
alter _ specification [ , alter _ specification ] . . .
alter _ specification :
table _ options
| ADD [ COLUMN ] col _ name column _ definition
[ FIRST | AFTER col _ name ]
| ADD [ COLUMN ] ( col _ name column _ definition , . . . )
| ADD { INDEX | KEY } [ index _ name ]
[ index _ type ] ( index _ col _ name , . . . ) [ index _ option ] . . .
| ADD [ CONSTRAINT [ symbol ] ] PRIMARY KEY
[ index _ type ] ( index _ col _ name , . . . ) [ index _ option ] . . .
| ADD [ CONSTRAINT [ symbol ] ]
UNIQUE [ INDEX | KEY ] [ index _ name ]
[ index _ type ] ( index _ col _ name , . . . ) [ index _ option ] . . .
| ADD FULLTEXT [ INDEX | KEY ] [ index _ name ]
( index _ col _ name , . . . ) [ index _ option ] . . .
| ADD SPATIAL [ INDEX | KEY ] [ index _ name ]
( index _ col _ name , . . . ) [ index _ option ] . . .
| ADD [ CONSTRAINT [ symbol ] ]
FOREIGN KEY [ index _ name ] ( index _ col _ name , . . . )
reference _ definition
| ALTER [ COLUMN ] col _ name { SET DEFAULT literal | DROP DEFAULT }
| CHANGE [ COLUMN ] old _ col _ name new _ col _ name column _ definition
[ FIRST | AFTER col _ name ]
| MODIFY [ COLUMN ] col _ name column _ definition
[ FIRST | AFTER col _ name ]
| DROP [ COLUMN ] col _ name
| DROP PRIMARY KEY
| DROP { INDEX | KEY } index _ name
| DROP FOREIGN KEY fk _ symbol
| DISABLE KEYS
| ENABLE KEYS
| RENAME [ TO ] new _ tbl _ name
| ORDER BY col _ name [ , col _ name ] . . .
| CONVERT TO CHARACTER SET charset _ name [ COLLATE collation _ name ]
| [ DEFAULT ] CHARACTER SET [ = ] charset _ name [ COLLATE [ = ] collation _ name ]
| DISCARD TABLESPACE
| IMPORT TABLESPACE
| partition _ options
| ADD PARTITION ( partition _ definition )
| DROP PARTITION partition _ names
| COALESCE PARTITION number
| REORGANIZE PARTITION [ partition _ names INTO ( partition _ definitions ) ]
| ANALYZE PARTITION partition _ names
| CHECK PARTITION partition _ names
| OPTIMIZE PARTITION partition _ names
| REBUILD PARTITION partition _ names
| REPAIR PARTITION partition _ names
| REMOVE PARTITIONING */
return super . parseAlterTableStatement ( tokens , parentNode ) ; |
public class ConverterSet { /** * Returns a copy of this set , with the given converter removed . If the
* converter was not in the set , the original set is returned .
* @ param converter converter to remove , must not be null
* @ param removed if not null , element 0 is set to the removed converter
* @ throws NullPointerException if converter is null */
ConverterSet remove ( Converter converter , Converter [ ] removed ) { } } | Converter [ ] converters = iConverters ; int length = converters . length ; for ( int i = 0 ; i < length ; i ++ ) { if ( converter . equals ( converters [ i ] ) ) { return remove ( i , removed ) ; } } // Not found .
if ( removed != null ) { removed [ 0 ] = null ; } return this ; |
public class ImportMatrixXML { public Matrix read ( Reader reader ) throws ParserConfigurationException , SAXException , IOException { } } | SAXParserFactory spf = SAXParserFactory . newInstance ( ) ; spf . setNamespaceAware ( true ) ; SAXParser saxParser = spf . newSAXParser ( ) ; XMLReader xmlReader = saxParser . getXMLReader ( ) ; UJMPContentHandler contentHandler = new UJMPContentHandler ( ) ; xmlReader . setContentHandler ( contentHandler ) ; xmlReader . parse ( new InputSource ( reader ) ) ; // System . out . println ( contentHandler . getResult ( ) ) ;
return contentHandler . getResult ( ) ; |
public class RocksDBIncrementalCheckpointUtils { /** * Choose the best state handle according to the { @ link # STATE _ HANDLE _ EVALUATOR }
* to init the initial db .
* @ param restoreStateHandles The candidate state handles .
* @ param targetKeyGroupRange The target key group range .
* @ return The best candidate or null if no candidate was a good fit . */
@ Nullable public static KeyedStateHandle chooseTheBestStateHandleForInitial ( @ Nonnull Collection < KeyedStateHandle > restoreStateHandles , @ Nonnull KeyGroupRange targetKeyGroupRange ) { } } | KeyedStateHandle bestStateHandle = null ; double bestScore = 0 ; for ( KeyedStateHandle rawStateHandle : restoreStateHandles ) { double handleScore = STATE_HANDLE_EVALUATOR . apply ( rawStateHandle , targetKeyGroupRange ) ; if ( handleScore > bestScore ) { bestStateHandle = rawStateHandle ; bestScore = handleScore ; } } return bestStateHandle ; |
public class WApplication { /** * { @ inheritDoc } */
@ Override public String getNamingContextId ( ) { } } | boolean append = isAppendID ( ) ; if ( ! append ) { // Check if this is the top level name context
NamingContextable top = WebUtilities . getParentNamingContext ( this ) ; if ( top != null ) { // Not top context , so always append
append = true ; } } if ( append ) { return getId ( ) ; } else { return "" ; } |
public class WAB { /** * and kicks off the collision resolution process */
Event createFailedEvent ( Throwable t ) { } } | synchronized ( terminated ) { if ( terminated . get ( ) ) { return null ; } if ( setState ( State . FAILED ) ) { installer . removeWabFromEligibleForCollisionResolution ( this ) ; installer . attemptRedeployOfPreviouslyCollidedContextPath ( this . wabContextPath ) ; return createEvent ( State . FAILED , t , null , null ) ; } } return null ; |
public class ConversationState { /** * setConnectionObjectId - sets and stores the connection object id
* @ param connectionObjectId */
public void setConnectionObjectId ( short connectionObjectId ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setConnectionObjectId" , Short . valueOf ( connectionObjectId ) ) ; this . connectionObjectId = connectionObjectId ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setConnectionObjectId" ) ; |
public class Pause { /** * Enter admin mode
* @ param ctx Internal parameter . Not user - accessible .
* @ return Standard STATUS table . */
public VoltTable [ ] run ( SystemProcedureExecutionContext ctx ) { } } | // Choose the lowest site ID on this host to actually flip the bit
if ( ctx . isLowestSiteId ( ) ) { VoltDBInterface voltdb = VoltDB . instance ( ) ; OperationMode opMode = voltdb . getMode ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "voltdb opmode is " + opMode ) ; } ZooKeeper zk = voltdb . getHostMessenger ( ) . getZK ( ) ; try { Stat stat ; OperationMode zkMode = null ; Code code ; do { stat = new Stat ( ) ; code = Code . BADVERSION ; try { byte [ ] data = zk . getData ( VoltZK . operationMode , false , stat ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "zkMode is " + ( zkMode == null ? "(null)" : OperationMode . valueOf ( data ) ) ) ; } zkMode = data == null ? opMode : OperationMode . valueOf ( data ) ; if ( zkMode == PAUSED ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "read node at version " + stat . getVersion ( ) + ", txn " + ll ( stat . getMzxid ( ) ) ) ; } break ; } stat = zk . setData ( VoltZK . operationMode , PAUSED . getBytes ( ) , stat . getVersion ( ) ) ; code = Code . OK ; zkMode = PAUSED ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "!WROTE! node at version " + stat . getVersion ( ) + ", txn " + ll ( stat . getMzxid ( ) ) ) ; } break ; } catch ( BadVersionException ex ) { code = ex . code ( ) ; } } while ( zkMode != PAUSED && code == Code . BADVERSION ) ; m_stat = stat ; voltdb . getHostMessenger ( ) . pause ( ) ; voltdb . setMode ( PAUSED ) ; // for snmp
SnmpTrapSender snmp = voltdb . getSnmpTrapSender ( ) ; if ( snmp != null ) { snmp . pause ( "Cluster paused." ) ; } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } // Force a tick so that stats will be updated .
// Primarily added to get latest table stats for DR pause and empty db check .
ctx . getSiteProcedureConnection ( ) . tick ( ) ; VoltTable t = new VoltTable ( VoltSystemProcedure . STATUS_SCHEMA ) ; t . addRow ( VoltSystemProcedure . STATUS_OK ) ; return ( new VoltTable [ ] { t } ) ; |
public class ByteUtil { /** * Calculate the number of bytes need to encode the number
* @ param val
* - number
* @ return number of min bytes used to encode the number */
public static int numBytes ( String val ) { } } | BigInteger bInt = new BigInteger ( val ) ; int bytes = 0 ; while ( ! bInt . equals ( BigInteger . ZERO ) ) { bInt = bInt . shiftRight ( 8 ) ; ++ bytes ; } if ( bytes == 0 ) ++ bytes ; return bytes ; |
public class ByteBufQueue { /** * Creates and returns a ByteBuf which contains all bytes from the
* queue ' s first ByteBuf if the latter contains { @ code exactSize } of bytes .
* Then { @ code first } index is increased by 1 or set to the value 0 if it
* has run a full circle of the queue .
* Otherwise creates and returns a ByteBuf of { @ code exactSize } which
* contains all bytes from queue ' s first ByteBuf .
* @ param exactSize the size of returned ByteBuf
* @ return ByteBuf with { @ code exactSize } bytes */
@ NotNull public ByteBuf takeExactSize ( int exactSize ) { } } | assert hasRemainingBytes ( exactSize ) ; if ( exactSize == 0 ) return ByteBuf . empty ( ) ; ByteBuf buf = bufs [ first ] ; if ( buf . readRemaining ( ) == exactSize ) { first = next ( first ) ; return buf ; } else if ( exactSize < buf . readRemaining ( ) ) { ByteBuf result = buf . slice ( exactSize ) ; buf . moveHead ( exactSize ) ; return result ; } ByteBuf result = ByteBufPool . allocate ( exactSize ) ; drainTo ( result . array ( ) , 0 , exactSize ) ; result . moveTail ( exactSize ) ; return result ; |
public class ExecutionChain { /** * Start the chain of execution running .
* @ throws IllegalStateException
* if the chain of execution has already been started . */
public void execute ( ) { } } | State currentState = state . getAndSet ( State . RUNNING ) ; if ( currentState == State . RUNNING ) { throw new IllegalStateException ( "ExecutionChain is already running!" ) ; } executeRunnable = new ExecuteRunnable ( ) ; |
public class EncryptionMaterials { /** * Fluent API to add material description . */
public EncryptionMaterials addDescription ( String name , String value ) { } } | desc . put ( name , value ) ; return this ; |
public class Formats { /** * Attempts to extract a name of a missing class loader dependency from an exception such as { @ link NoClassDefFoundError } or { @ link ClassNotFoundException } . */
public static String getNameOfMissingClassLoaderDependency ( Throwable e ) { } } | if ( e instanceof NoClassDefFoundError ) { // NoClassDefFoundError sometimes includes CNFE as the cause . Since CNFE has a better formatted class name
// and may also include classloader info , we prefer CNFE ' s over NCDFE ' s message .
if ( e . getCause ( ) instanceof ClassNotFoundException ) { return getNameOfMissingClassLoaderDependency ( e . getCause ( ) ) ; } if ( e . getMessage ( ) != null ) { return e . getMessage ( ) . replace ( '/' , '.' ) ; } } if ( e instanceof ClassNotFoundException ) { if ( e . getMessage ( ) != null ) { return e . getMessage ( ) ; } } if ( e . getCause ( ) != null ) { return getNameOfMissingClassLoaderDependency ( e . getCause ( ) ) ; } else { return "[unknown]" ; } |
public class DocumentTemplateRepository { /** * Returns all document templates , ordered by most specific to provided application tenancy first , and then by date ( desc ) . */
public List < DocumentTemplate > findByApplicableToAtPath ( final String atPath ) { } } | final List < DocumentTemplate > templates = repositoryService . allMatches ( new QueryDefault < > ( DocumentTemplate . class , "findByApplicableToAtPath" , "atPath" , atPath ) ) ; removeTemplatesWithSameDocumentType ( templates ) ; return templates ; |
public class CSLTool { /** * Sets the command to execute
* @ param command the command */
@ CommandDescList ( { } } | @ CommandDesc ( longName = "bibliography" , description = "generate a bibliography" , command = BibliographyCommand . class ) , @ CommandDesc ( longName = "citation" , description = "generate citations" , command = CitationCommand . class ) , @ CommandDesc ( longName = "list" , description = "display sorted list of available citation IDs" , command = ListCommand . class ) , @ CommandDesc ( longName = "lint" , description = "validate citation items" , command = LintCommand . class ) , @ CommandDesc ( longName = "json" , description = "convert input bibliography to JSON" , command = JsonCommand . class ) , @ CommandDesc ( longName = "mendeley" , description = "connect to Mendeley Web" , command = MendeleyCommand . class ) , @ CommandDesc ( longName = "zotero" , description = "connect to Zotero" , command = ZoteroCommand . class ) , @ CommandDesc ( longName = "shell" , description = "run citeproc-java in interactive mode" , command = ShellCommand . class ) , @ CommandDesc ( longName = "help" , description = "display help for a given command" , command = HelpCommand . class ) } ) public void setCommand ( AbstractCSLToolCommand command ) { if ( command instanceof ProviderCommand ) { this . command = new InputFileCommand ( ( ProviderCommand ) command ) ; } else { this . command = command ; } |
public class ShanksAgentMovementCapability { /** * Update the location of the agent in the simulation
* @ param simulation
* @ param agent
* @ param location */
private static void updateLocation ( ShanksSimulation simulation , MobileShanksAgent agent , Double2D location ) { } } | agent . getCurrentLocation ( ) . setLocation2D ( location ) ; ContinuousPortrayal2D devicesPortrayal ; try { devicesPortrayal = ( ContinuousPortrayal2D ) simulation . getScenarioPortrayal ( ) . getPortrayals ( ) . get ( Scenario3DPortrayal . MAIN_DISPLAY_ID ) . get ( ScenarioPortrayal . DEVICES_PORTRAYAL ) ; Continuous2D devicesField = ( Continuous2D ) devicesPortrayal . getField ( ) ; devicesField . setObjectLocation ( agent , location ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } |
public class TSProcessor { /** * Computes the median value of timeseries .
* @ param series The timeseries .
* @ return The median value . */
public double median ( double [ ] series ) { } } | double [ ] clonedSeries = series . clone ( ) ; Arrays . sort ( clonedSeries ) ; double median ; if ( clonedSeries . length % 2 == 0 ) { median = ( clonedSeries [ clonedSeries . length / 2 ] + ( double ) clonedSeries [ clonedSeries . length / 2 - 1 ] ) / 2 ; } else { median = clonedSeries [ clonedSeries . length / 2 ] ; } return median ; |
public class CPFriendlyURLEntryPersistenceImpl { /** * Returns an ordered range of all the cp friendly url entries where groupId = & # 63 ; and classNameId = & # 63 ; and classPK = & # 63 ; and main = & # 63 ; .
* 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 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CPFriendlyURLEntryModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param groupId the group ID
* @ param classNameId the class name ID
* @ param classPK the class pk
* @ param main the main
* @ param start the lower bound of the range of cp friendly url entries
* @ param end the upper bound of the range of cp friendly url entries ( not inclusive )
* @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > )
* @ return the ordered range of matching cp friendly url entries */
@ Override public List < CPFriendlyURLEntry > findByG_C_C_M ( long groupId , long classNameId , long classPK , boolean main , int start , int end , OrderByComparator < CPFriendlyURLEntry > orderByComparator ) { } } | return findByG_C_C_M ( groupId , classNameId , classPK , main , start , end , orderByComparator , true ) ; |
public class DescribeVolumesModificationsRequest { /** * The IDs of the volumes for which in - progress modifications will be described .
* @ param volumeIds
* The IDs of the volumes for which in - progress modifications will be described . */
public void setVolumeIds ( java . util . Collection < String > volumeIds ) { } } | if ( volumeIds == null ) { this . volumeIds = null ; return ; } this . volumeIds = new com . amazonaws . internal . SdkInternalList < String > ( volumeIds ) ; |
public class WarUtils { /** * Removes elements by a specified tag name from the xml Element passed in .
* @ param doc The xml Element to remove from .
* @ param tagname The tag name to remove . */
public static void removeNodesByTagName ( Element doc , String tagname ) { } } | NodeList nodes = doc . getElementsByTagName ( tagname ) ; for ( int i = 0 ; i < nodes . getLength ( ) ; i ++ ) { Node n = nodes . item ( i ) ; doc . removeChild ( n ) ; } |
public class GitlabAPI { /** * Get JIRA service settings for a project .
* https : / / docs . gitlab . com / ce / api / services . html # get - jira - service - settings
* @ param projectId The ID of the project containing the variable .
* @ return
* @ throws IOException on gitlab api call error */
public GitlabServiceJira getJiraService ( Integer projectId ) throws IOException { } } | String tailUrl = GitlabProject . URL + "/" + projectId + GitlabServiceJira . URL ; return retrieve ( ) . to ( tailUrl , GitlabServiceJira . class ) ; |
public class Pubsub { /** * Create a Pub / Sub topic .
* @ param canonicalTopic The canonical ( including project ) name of the topic to create .
* @ return A future that is completed when this request is completed . */
private PubsubFuture < Topic > createTopic ( final String canonicalTopic ) { } } | validateCanonicalTopic ( canonicalTopic ) ; return put ( "create topic" , canonicalTopic , NO_PAYLOAD , readJson ( Topic . class ) ) ; |
public class AsynchronousRequest { /** * For more info on continents API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / continents " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param continentID { @ link Continent # id }
* @ param ids list of floor id
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws GuildWars2Exception empty ID list
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see ContinentFloor continents floor info */
public void getContinentFloorInfo ( int continentID , int [ ] ids , Callback < List < ContinentFloor > > callback ) throws GuildWars2Exception , NullPointerException { } } | isParamValid ( new ParamChecker ( ids ) ) ; gw2API . getContinentFloorInfo ( Integer . toString ( continentID ) , processIds ( ids ) , GuildWars2 . lang . getValue ( ) ) . enqueue ( callback ) ; |
public class DockerCloud { /** * Counts the number of instances in Docker currently running that are using the specified template .
* @ param template If null , then all instances are counted . */
public int countCurrentDockerSlaves ( final DockerSlaveTemplate template ) throws Exception { } } | int count = 0 ; List < Container > containers = getClient ( ) . listContainersCmd ( ) . exec ( ) ; for ( Container container : containers ) { final Map < String , String > labels = container . getLabels ( ) ; if ( labels . containsKey ( DOCKER_CLOUD_LABEL ) && labels . get ( DOCKER_CLOUD_LABEL ) . equals ( getDisplayName ( ) ) ) { if ( template == null ) { // count only total cloud capacity
count ++ ; } else if ( labels . containsKey ( DOCKER_TEMPLATE_LABEL ) && labels . get ( DOCKER_TEMPLATE_LABEL ) . equals ( template . getId ( ) ) ) { count ++ ; } } } return count ; |
public class StencilOperands { /** * Test if left < = right .
* @ param left
* first value
* @ param right
* second value
* @ return test result . */
public boolean lessThanOrEqual ( Object left , Object right ) { } } | if ( left == right ) { return true ; } else if ( left == null || right == null ) { return false ; } else { return compare ( left , right , "<=" ) <= 0 ; } |
public class CHFWBundle { /** * DS method to set a factory provider .
* @ param provider */
@ Reference ( service = ChannelFactoryProvider . class , cardinality = ReferenceCardinality . MULTIPLE , policy = ReferencePolicy . DYNAMIC , policyOption = ReferencePolicyOption . GREEDY ) protected void setFactoryProvider ( ChannelFactoryProvider provider ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Add factory provider; " + provider ) ; } this . chfw . registerFactories ( provider ) ; |
public class MavenJDOMWriter { /** * Method updateBuildBase .
* @ param value
* @ param element
* @ param counter
* @ param xmlTag */
protected void updateBuildBase ( BuildBase value , String xmlTag , Counter counter , Element element ) { } } | boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "defaultGoal" , value . getDefaultGoal ( ) , null ) ; iterateResource ( innerCount , root , value . getResources ( ) , "resources" , "resource" ) ; iterateResource ( innerCount , root , value . getTestResources ( ) , "testResources" , "testResource" ) ; findAndReplaceSimpleElement ( innerCount , root , "directory" , value . getDirectory ( ) , null ) ; findAndReplaceSimpleElement ( innerCount , root , "finalName" , value . getFinalName ( ) , null ) ; findAndReplaceSimpleLists ( innerCount , root , value . getFilters ( ) , "filters" , "filter" ) ; updatePluginManagement ( value . getPluginManagement ( ) , "pluginManagement" , innerCount , root ) ; iteratePlugin ( innerCount , root , value . getPlugins ( ) , "plugins" , "plugin" ) ; } |
public class Article { /** * Gets the value of the paginationOrELocationID property .
* This accessor method returns a reference to the live list ,
* not a snapshot . Therefore any modification you make to the
* returned list will be present inside the JAXB object .
* This is why there is not a < CODE > set < / CODE > method for the paginationOrELocationID property .
* For example , to add a new item , do as follows :
* < pre >
* getPaginationOrELocationID ( ) . add ( newItem ) ;
* < / pre >
* Objects of the following type ( s ) are allowed in the list
* { @ link Pagination }
* { @ link ELocationID } */
public List < java . lang . Object > getPaginationOrELocationID ( ) { } } | if ( paginationOrELocationID == null ) { paginationOrELocationID = new ArrayList < java . lang . Object > ( ) ; } return this . paginationOrELocationID ; |
public class MCMPInfoUtil { /** * / * matches constants defined in mod _ cluster - 1.3.7 . Final / native / include / context . h */
static int formatStatus ( Context . Status status ) { } } | return status == Context . Status . ENABLED ? 1 : status == Context . Status . DISABLED ? 2 : status == Context . Status . STOPPED ? 3 : - 1 ; |
public class CreateFunctionRequest { /** * A list of < a href = " https : / / docs . aws . amazon . com / lambda / latest / dg / configuration - layers . html " > function layers < / a > to
* add to the function ' s execution environment . Specify each layer by its ARN , including the version .
* @ param layers
* A list of < a href = " https : / / docs . aws . amazon . com / lambda / latest / dg / configuration - layers . html " > function
* layers < / a > to add to the function ' s execution environment . Specify each layer by its ARN , including the
* version . */
public void setLayers ( java . util . Collection < String > layers ) { } } | if ( layers == null ) { this . layers = null ; return ; } this . layers = new com . amazonaws . internal . SdkInternalList < String > ( layers ) ; |
public class CommerceNotificationQueueEntryUtil { /** * Returns a range of all the commerce notification queue entries where sentDate & lt ; & # 63 ; .
* 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 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceNotificationQueueEntryModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param sentDate the sent date
* @ param start the lower bound of the range of commerce notification queue entries
* @ param end the upper bound of the range of commerce notification queue entries ( not inclusive )
* @ return the range of matching commerce notification queue entries */
public static List < CommerceNotificationQueueEntry > findByLtS ( Date sentDate , int start , int end ) { } } | return getPersistence ( ) . findByLtS ( sentDate , start , end ) ; |
public class CommercePriceListLocalServiceWrapper { /** * Returns the commerce price list matching the UUID and group .
* @ param uuid the commerce price list ' s UUID
* @ param groupId the primary key of the group
* @ return the matching commerce price list
* @ throws PortalException if a matching commerce price list could not be found */
@ Override public com . liferay . commerce . price . list . model . CommercePriceList getCommercePriceListByUuidAndGroupId ( String uuid , long groupId ) throws com . liferay . portal . kernel . exception . PortalException { } } | return _commercePriceListLocalService . getCommercePriceListByUuidAndGroupId ( uuid , groupId ) ; |
public class MultiUserChatLight { /** * Set the room configurations .
* @ param customConfigs
* @ throws NoResponseException
* @ throws XMPPErrorException
* @ throws NotConnectedException
* @ throws InterruptedException */
public void setRoomConfigs ( HashMap < String , String > customConfigs ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | setRoomConfigs ( null , customConfigs ) ; |
public class CmsDataViewPanel { /** * Gets the check box for the item with the given id . < p >
* @ param id the item id
* @ return the check box */
private CheckBox getCheckBox ( Object id ) { } } | if ( ! m_checkBoxes . containsKey ( id ) ) { m_checkBoxes . put ( id , new CheckBox ( ) ) ; } return m_checkBoxes . get ( id ) ; |
public class TransactionWriteRequest { /** * Adds delete operation ( to be executed on the object represented by key ) to the list of transaction write operations .
* transactionWriteExpression is used to conditionally delete the object represented by key .
* returnValuesOnConditionCheckFailure specifies which attributes values ( of existing item ) should be returned if condition check fails . */
public TransactionWriteRequest addDelete ( Object key , DynamoDBTransactionWriteExpression transactionWriteExpression , ReturnValuesOnConditionCheckFailure returnValuesOnConditionCheckFailure ) { } } | transactionWriteOperations . add ( new TransactionWriteOperation ( key , TransactionWriteOperationType . Delete , transactionWriteExpression , returnValuesOnConditionCheckFailure ) ) ; return this ; |
public class AnnotationVisitor { /** * Visits an annotation by breaking it down into its components and calling
* various other visit methods .
* @ param value Initial Annotation to visit
* @ param param custom parameter
* @ return custom result , null by default */
public final R visit ( Annotation value , P param ) { } } | return visit ( null , 0 , value , param ) ; |
public class CmsAliasManager { /** * Gets the list of aliases for a path in a given site . < p >
* This should only return either an empty list or a list with a single element .
* @ param cms the current CMS context
* @ param siteRoot the site root for which we want the aliases
* @ param aliasPath the alias path
* @ return the aliases for the given site root and path
* @ throws CmsException if something goes wrong */
public List < CmsAlias > getAliasesForPath ( CmsObject cms , String siteRoot , String aliasPath ) throws CmsException { } } | CmsAlias alias = m_securityManager . readAliasByPath ( cms . getRequestContext ( ) , siteRoot , aliasPath ) ; if ( alias == null ) { return Collections . emptyList ( ) ; } else { return Collections . singletonList ( alias ) ; } |
public class POIUtils { /** * 結合を考慮してセルの罫線 ( 上部 ) を取得する 。
* @ param cell セル
* @ return { @ literal BorderStyle }
* @ throws IllegalArgumentException { @ literal cell is null . } */
public static BorderStyle getBorderTop ( final Cell cell ) { } } | ArgUtils . notNull ( cell , "cell" ) ; final Sheet sheet = cell . getSheet ( ) ; CellRangeAddress mergedRegion = getMergedRegion ( sheet , cell . getRowIndex ( ) , cell . getColumnIndex ( ) ) ; final Cell target ; if ( mergedRegion == null ) { // 結合されていない場合
target = cell ; } else { if ( mergedRegion . getFirstRow ( ) == cell . getRowIndex ( ) ) { // 引数のCellが上部のセルの場合
target = cell ; } else { target = getCell ( sheet , cell . getColumnIndex ( ) , mergedRegion . getFirstRow ( ) ) ; } } final CellStyle style = target . getCellStyle ( ) ; if ( style == null ) { return BorderStyle . NONE ; } else { return style . getBorderTopEnum ( ) ; } |
public class OneSelect { /** * Method used to append to the from part of an SQL statement .
* @ param _ select SQL select wrapper
* @ throws EFapsException on error */
public void append2SQLFrom ( final SQLSelect _select ) throws EFapsException { } } | // for attributes it must be evaluated if the attribute is inside a child table
if ( this . valueSelect != null && "attribute" . equals ( this . valueSelect . getValueType ( ) ) ) { final Type type ; if ( this . selectParts . size ( ) > 0 ) { type = this . selectParts . get ( this . selectParts . size ( ) - 1 ) . getType ( ) ; } else { type = this . query . getMainType ( ) ; } Attribute attr = this . valueSelect . getAttribute ( ) ; if ( attr == null ) { attr = type . getAttribute ( ( ( AttributeValueSelect ) this . valueSelect ) . getAttrName ( ) ) ; } // if the attr is still null that means that the type does not have this attribute , so last
// chance to find the attribute is to search in the child types
if ( attr == null ) { for ( final Type childType : type . getChildTypes ( ) ) { attr = childType . getAttribute ( ( ( AttributeValueSelect ) this . valueSelect ) . getAttrName ( ) ) ; if ( attr != null ) { ( ( AttributeValueSelect ) this . valueSelect ) . setAttribute ( attr ) ; break ; } } } if ( attr != null && attr . getTable ( ) != null && ! attr . getTable ( ) . equals ( type . getMainTable ( ) ) ) { final ChildTableSelectPart childtable = new ChildTableSelectPart ( type , attr . getTable ( ) ) ; this . selectParts . add ( childtable ) ; } } for ( final ISelectPart sel : this . selectParts ) { this . tableIndex = sel . join ( this , _select , this . tableIndex ) ; } |
public class CmsDbPoolV11 { /** * If str starts with prefix + ' . ' , return the remaining part , otherwise return null . < p >
* @ param prefix the prefix
* @ param str the string to remove the prefix from
* @ return str with the prefix removed , or null if it didn ' t start with prefix + ' . ' */
public static String getPropertyRelativeSuffix ( String prefix , String str ) { } } | String realPrefix = prefix + "." ; if ( str . startsWith ( realPrefix ) ) { return str . substring ( realPrefix . length ( ) ) ; } return null ; |
public class Matcher { /** * Sets the current search position just after the end of last match . */
public void skip ( ) { } } | int we = wEnd ; if ( wOffset == we ) { // requires special handling
// if no variants at ' wOutside ' , advance pointer and clear
if ( top == null ) { wOffset ++ ; flush ( ) ; } // otherwise , if there exist a variant ,
// don ' t clear ( ) , i . e . allow it to match
return ; } else { if ( we < 0 ) wOffset = 0 ; else wOffset = we ; } // rflush ( ) ; / / rflush ( ) works faster on simple regexes ( with a small group / branch number )
flush ( ) ; |
public class NetUtil { /** * 测试端口是否空闲可用 , from Spring SocketUtils */
public static boolean isPortAvailable ( int port ) { } } | try { ServerSocket serverSocket = ServerSocketFactory . getDefault ( ) . createServerSocket ( port , 1 , InetAddress . getByName ( "localhost" ) ) ; serverSocket . close ( ) ; return true ; } catch ( Exception ex ) { // NOSONAR
return false ; } |
public class CmsModuleImportExportHandler { /** * Gets the module export handler containing all resources used in the module export . < p >
* @ param cms the { @ link CmsObject } used by to set up the handler . The object ' s site root might be adjusted to the import site of the module .
* @ param module The module to export
* @ param handlerDescription A description of the export handler , shown when the export thread using the handler runs .
* @ return CmsModuleImportExportHandler with all module resources */
public static CmsModuleImportExportHandler getExportHandler ( CmsObject cms , final CmsModule module , final String handlerDescription ) { } } | // check if all resources are valid
List < String > resListCopy = new ArrayList < String > ( ) ; String moduleName = module . getName ( ) ; try { cms = OpenCms . initCmsObject ( cms ) ; String importSite = module . getSite ( ) ; if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( importSite ) ) { cms . getRequestContext ( ) . setSiteRoot ( importSite ) ; } } catch ( CmsException e ) { // should never happen
LOG . error ( e . getLocalizedMessage ( ) , e ) ; } try { resListCopy = CmsModule . calculateModuleResourceNames ( cms , module ) ; } catch ( CmsException e ) { // some resource did not exist / could not be read
if ( LOG . isInfoEnabled ( ) ) { LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_READ_MODULE_RESOURCES_1 , module . getName ( ) ) , e ) ; } } resListCopy = CmsFileUtil . removeRedundancies ( resListCopy ) ; String [ ] resources = new String [ resListCopy . size ( ) ] ; for ( int i = 0 ; i < resListCopy . size ( ) ; i ++ ) { resources [ i ] = resListCopy . get ( i ) ; } String filename = OpenCms . getSystemInfo ( ) . getAbsoluteRfsPathRelativeToWebInf ( OpenCms . getSystemInfo ( ) . getPackagesRfsPath ( ) + CmsSystemInfo . FOLDER_MODULES + moduleName + "_" + "%(version)" ) ; CmsModuleImportExportHandler moduleExportHandler = new CmsModuleImportExportHandler ( ) ; moduleExportHandler . setFileName ( filename ) ; moduleExportHandler . setModuleName ( moduleName . replace ( '\\' , '/' ) ) ; moduleExportHandler . setAdditionalResources ( resources ) ; moduleExportHandler . setDescription ( handlerDescription ) ; return moduleExportHandler ; |
public class TypesafeConfigUtils { /** * Load , Parse & Resolve configurations from a file , specifying parse & resolve options .
* @ param parseOptions
* @ param resolveOptions
* @ param configFile
* @ return */
public static Config loadConfig ( ConfigParseOptions parseOptions , ConfigResolveOptions resolveOptions , String configFile ) { } } | return loadConfig ( parseOptions , resolveOptions , new File ( configFile ) ) ; |
public class FactoryMultiView { /** * Created an estimator for the P3P problem that selects a single solution by considering additional
* observations .
* < p > NOTE : Observations are in normalized image coordinates NOT pixels . < / p >
* NOTE : EPnP has several tuning parameters and the defaults here might not be the best for your situation .
* Use { @ link # computePnPwithEPnP } if you wish to have access to all parameters .
* @ param which The algorithm which is to be returned .
* @ param numIterations Number of iterations . Only used by some algorithms and recommended number varies
* significantly by algorithm .
* @ param numTest How many additional sample points are used to remove ambiguity in the solutions . Not used
* if only a single solution is found .
* @ return An estimator which returns a single estimate . */
public static Estimate1ofPnP pnp_1 ( EnumPNP which , int numIterations , int numTest ) { } } | if ( which == EnumPNP . EPNP ) { PnPLepetitEPnP alg = new PnPLepetitEPnP ( 0.1 ) ; alg . setNumIterations ( numIterations ) ; return new WrapPnPLepetitEPnP ( alg ) ; } else if ( which == EnumPNP . IPPE ) { Estimate1ofEpipolar H = FactoryMultiView . homographyTLS ( ) ; return new IPPE_to_EstimatePnP ( H ) ; } FastQueue < Se3_F64 > solutions = new FastQueue < > ( 4 , Se3_F64 . class , true ) ; return new EstimateNto1ofPnP ( pnp_N ( which , - 1 ) , solutions , numTest ) ; |
public class BitmapIterationBenchmark { /** * This main ( ) is for debugging from the IDE . */
public static void main ( String [ ] args ) { } } | BitmapIterationBenchmark state = new BitmapIterationBenchmark ( ) ; state . bitmapAlgo = "concise" ; state . prob = 0.001 ; state . size = 1000000 ; state . setup ( ) ; BitmapsForIntersection state2 = new BitmapsForIntersection ( ) ; state2 . setup ( state ) ; state . intersectionAndIter ( state2 ) ; |
public class OpenSSLFactory { /** * Sets the protocol : + SSLv3 */
public void setProtocol ( String protocol ) throws ConfigException { } } | _protocol = protocol ; String [ ] values = Pattern . compile ( "\\s+" ) . split ( protocol ) ; int protocolFlags = _defaultProtocolFlags ; for ( int i = 0 ; i < values . length ; i ++ ) { if ( values [ i ] . equalsIgnoreCase ( "+all" ) ) { protocolFlags = ~ 0 ; } else if ( values [ i ] . equalsIgnoreCase ( "-all" ) ) { protocolFlags = 0 ; } else if ( values [ i ] . equalsIgnoreCase ( "+sslv2" ) ) { protocolFlags |= PROTOCOL_SSL2 ; } else if ( values [ i ] . equalsIgnoreCase ( "-sslv2" ) ) { protocolFlags &= ~ PROTOCOL_SSL2 ; } else if ( values [ i ] . equalsIgnoreCase ( "+sslv3" ) ) { protocolFlags |= PROTOCOL_SSL3 ; } else if ( values [ i ] . equalsIgnoreCase ( "-sslv3" ) ) { protocolFlags &= ~ PROTOCOL_SSL3 ; } else if ( values [ i ] . equalsIgnoreCase ( "+tlsv1" ) ) { protocolFlags |= PROTOCOL_TLS1 ; } else if ( values [ i ] . equalsIgnoreCase ( "-tlsv1" ) ) { protocolFlags &= ~ PROTOCOL_TLS1 ; } else if ( values [ i ] . equalsIgnoreCase ( "+tlsv1.1" ) ) { protocolFlags |= PROTOCOL_TLS1_1 ; } else if ( values [ i ] . equalsIgnoreCase ( "-tlsv1.1" ) ) { protocolFlags &= ~ PROTOCOL_TLS1_1 ; } else if ( values [ i ] . equalsIgnoreCase ( "+tlsv1.2" ) ) { protocolFlags |= PROTOCOL_TLS1_2 ; } else if ( values [ i ] . equalsIgnoreCase ( "-tlsv1.2" ) ) { protocolFlags &= ~ PROTOCOL_TLS1_2 ; } else throw new ConfigException ( L . l ( "unknown protocol value '{0}'" , protocol ) ) ; } if ( values . length > 0 ) _protocolFlags = protocolFlags ; |
public class Chunks { /** * turn this chunked array into a regular int - array , mostly for compatibility
* cuts off unused space at the end */
public int [ ] mergeChunks ( ) { } } | int filledChunks = getFilledChunks ( ) ; int [ ] merged = new int [ size ( ) ] ; for ( int i = 0 ; i < filledChunks ; i ++ ) { if ( chunks [ i ] != null ) { System . arraycopy ( chunks [ i ] , 0 , merged , i * chunkSize , chunkSize ) ; } } int remainder = size ( ) % chunkSize ; if ( remainder != 0 && chunks [ filledChunks ] != null ) { System . arraycopy ( chunks [ filledChunks ] , 0 , merged , ( filledChunks ) * chunkSize , remainder ) ; } return merged ; |
public class DeferredSound { /** * Play this sound as a sound effect
* @ param pitch The pitch of the play back
* @ param gain The gain of the play back
* @ param loop True if we should loop
* @ param x The x position of the sound
* @ param y The y position of the sound
* @ param z The z position of the sound */
public int playAsSoundEffect ( float pitch , float gain , boolean loop , float x , float y , float z ) { } } | checkTarget ( ) ; return target . playAsSoundEffect ( pitch , gain , loop , x , y , z ) ; |
public class AbstractCacheService { /** * Sends an invalidation event for given < code > cacheName < / code > with specified < code > key < / code >
* from mentioned source with < code > sourceUuid < / code > .
* @ param cacheNameWithPrefix the name of the cache that invalidation event is sent for
* @ param key the { @ link com . hazelcast . nio . serialization . Data } represents the invalidation event
* @ param sourceUuid an ID that represents the source for invalidation event */
@ Override public void sendInvalidationEvent ( String cacheNameWithPrefix , Data key , String sourceUuid ) { } } | cacheEventHandler . sendInvalidationEvent ( cacheNameWithPrefix , key , sourceUuid ) ; |
public class RegisteredServiceAccessStrategyUtils { /** * Ensure service access is allowed .
* @ param service the service
* @ param registeredService the registered service
* @ param authentication the authentication
* @ param retrievePrincipalAttributesFromReleasePolicy retrieve attributes from release policy or simply rely on the principal attributes
* already collected . Setting this value to false bears the assumption that the policy
* has run already .
* @ throws UnauthorizedServiceException the unauthorized service exception
* @ throws PrincipalException the principal exception */
static void ensurePrincipalAccessIsAllowedForService ( final Service service , final RegisteredService registeredService , final Authentication authentication , final boolean retrievePrincipalAttributesFromReleasePolicy ) throws UnauthorizedServiceException , PrincipalException { } } | ensureServiceAccessIsAllowed ( service , registeredService ) ; val principal = authentication . getPrincipal ( ) ; val principalAttrs = retrievePrincipalAttributesFromReleasePolicy && registeredService != null && registeredService . getAttributeReleasePolicy ( ) != null ? registeredService . getAttributeReleasePolicy ( ) . getAttributes ( principal , service , registeredService ) : authentication . getPrincipal ( ) . getAttributes ( ) ; val attributes = new HashMap < String , Object > ( principalAttrs ) ; attributes . putAll ( authentication . getAttributes ( ) ) ; ensurePrincipalAccessIsAllowedForService ( service , registeredService , principal . getId ( ) , attributes ) ; |
public class HPackHuffman { /** * Decodes a huffman encoded string into the target StringBuilder . There must be enough space left in the buffer
* for this method to succeed .
* @ param data The byte buffer
* @ param length The data length
* @ param target The target for the decompressed data */
public static void decode ( ByteBuffer data , int length , StringBuilder target ) throws HpackException { } } | assert data . remaining ( ) >= length ; int treePos = 0 ; boolean eosBits = true ; int eosCount = 0 ; for ( int i = 0 ; i < length ; ++ i ) { byte b = data . get ( ) ; int bitPos = 7 ; while ( bitPos >= 0 ) { int val = DECODING_TABLE [ treePos ] ; if ( ( ( 1 << bitPos ) & b ) == 0 ) { // bit not set , we want the lower part of the tree
if ( ( val & LOW_TERMINAL_BIT ) == 0 ) { treePos = val & LOW_MASK ; eosBits = false ; eosCount = 0 ; } else { target . append ( ( char ) ( val & LOW_MASK ) ) ; treePos = 0 ; eosBits = true ; eosCount = 0 ; } } else { // bit not set , we want the lower part of the tree
if ( ( val & HIGH_TERMINAL_BIT ) == 0 ) { treePos = ( val >> 16 ) & LOW_MASK ; if ( eosBits ) { eosCount ++ ; } } else { target . append ( ( char ) ( ( val >> 16 ) & LOW_MASK ) ) ; treePos = 0 ; eosCount = 0 ; eosBits = true ; } } bitPos -- ; } } if ( ! eosBits || eosCount > 7 ) { throw UndertowMessages . MESSAGES . huffmanEncodedHpackValueDidNotEndWithEOS ( ) ; } |
public class VpnSitesConfigurationsInner { /** * Gives the sas - url to download the configurations for vpn - sites in a resource group .
* @ param resourceGroupName The resource group name .
* @ param virtualWANName The name of the VirtualWAN for which configuration of all vpn - sites is needed .
* @ param request Parameters supplied to download vpn - sites configuration .
* @ 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 < Void > beginDownloadAsync ( String resourceGroupName , String virtualWANName , GetVpnSitesConfigurationRequest request , final ServiceCallback < Void > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginDownloadWithServiceResponseAsync ( resourceGroupName , virtualWANName , request ) , serviceCallback ) ; |
public class AuditingInterceptor { /** * Return the access type for this request
* @ param theServletRequest
* the incoming request
* @ return the SecurityEventSourceTypeEnum representing the type of request being made */
protected List < CodingDt > getAccessType ( HttpServletRequest theServletRequest ) { } } | List < CodingDt > types = new ArrayList < CodingDt > ( ) ; if ( theServletRequest . getHeader ( Constants . HEADER_AUTHORIZATION ) != null && theServletRequest . getHeader ( Constants . HEADER_AUTHORIZATION ) . startsWith ( "OAuth" ) ) { types . add ( new CodingDt ( SecurityEventSourceTypeEnum . USER_DEVICE . getSystem ( ) , SecurityEventSourceTypeEnum . USER_DEVICE . getCode ( ) ) ) ; } else { String userId = theServletRequest . getHeader ( UserInfoInterceptor . HEADER_USER_ID ) ; String appId = theServletRequest . getHeader ( UserInfoInterceptor . HEADER_APPLICATION_NAME ) ; if ( userId == null && appId != null ) types . add ( new CodingDt ( SecurityEventSourceTypeEnum . APPLICATION_SERVER . getSystem ( ) , SecurityEventSourceTypeEnum . APPLICATION_SERVER . getCode ( ) ) ) ; else types . add ( new CodingDt ( SecurityEventSourceTypeEnum . USER_DEVICE . getSystem ( ) , SecurityEventSourceTypeEnum . USER_DEVICE . getCode ( ) ) ) ; } return types ; |
public class HttpSupport { /** * This method will send the text to a client verbatim . It will not use any layouts . Use it to build app . services
* and to support AJAX .
* @ param text text of response .
* @ return { @ link HttpSupport . HttpBuilder } , to accept additional information . */
protected HttpBuilder respond ( String text ) { } } | if ( text == null ) { text = "null" ; } DirectResponse resp = new DirectResponse ( text ) ; RequestContext . setControllerResponse ( resp ) ; return new HttpBuilder ( resp ) ; |
public class InterceptorChain { /** * Returns all the interceptors that have the fully qualified name of their class equal with the supplied class
* name . */
public List < CommandInterceptor > getInterceptorsWithClass ( Class clazz ) { } } | ArrayList < CommandInterceptor > list = new ArrayList < > ( asyncInterceptorChain . getInterceptors ( ) . size ( ) ) ; asyncInterceptorChain . getInterceptors ( ) . forEach ( ci -> { if ( clazz == ci . getClass ( ) ) { list . add ( ( CommandInterceptor ) ci ) ; } } ) ; return list ; |
public class QueueContainer { /** * Returns the item queue on the partition owner . This method
* will also move the items from the backup map if this
* member has been promoted from a backup replica to the
* partition owner and clear the backup map .
* @ return the item queue */
public Deque < QueueItem > getItemQueue ( ) { } } | if ( itemQueue == null ) { itemQueue = new LinkedList < QueueItem > ( ) ; if ( backupMap != null && ! backupMap . isEmpty ( ) ) { List < QueueItem > values = new ArrayList < QueueItem > ( backupMap . values ( ) ) ; Collections . sort ( values ) ; itemQueue . addAll ( values ) ; QueueItem lastItem = itemQueue . peekLast ( ) ; if ( lastItem != null ) { setId ( lastItem . itemId + ID_PROMOTION_OFFSET ) ; } backupMap . clear ( ) ; backupMap = null ; } if ( ! txMap . isEmpty ( ) ) { long maxItemId = Long . MIN_VALUE ; for ( TxQueueItem item : txMap . values ( ) ) { maxItemId = Math . max ( maxItemId , item . itemId ) ; } setId ( maxItemId + ID_PROMOTION_OFFSET ) ; } } return itemQueue ; |
public class BooleanUtils { /** * < p > Performs an or on a set of booleans . < / p >
* < pre >
* BooleanUtils . or ( true , true ) = true
* BooleanUtils . or ( false , false ) = false
* BooleanUtils . or ( true , false ) = true
* BooleanUtils . or ( true , true , false ) = true
* BooleanUtils . or ( true , true , true ) = true
* BooleanUtils . or ( false , false , false ) = false
* < / pre >
* @ param array an array of { @ code boolean } s
* @ return { @ code true } if the or is successful .
* @ throws IllegalArgumentException if { @ code array } is { @ code null }
* @ throws IllegalArgumentException if { @ code array } is empty .
* @ since 3.0.1 */
public static boolean or ( final boolean ... array ) { } } | // Validates input
if ( array == null ) { throw new IllegalArgumentException ( "The Array must not be null" ) ; } if ( array . length == 0 ) { throw new IllegalArgumentException ( "Array is empty" ) ; } for ( final boolean element : array ) { if ( element ) { return true ; } } return false ; |
public class ReduceInit { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > specify a primitive value like a String or a Number as the initial value of the accumulator variable of a REDUCE expression .
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > e . g . . . . REDUCE ( ) < br / > . fromAll ( n ) . IN _ nodes ( p ) < br / > . to ( totalAge ) < br / > . by ( totalAge . plus ( n . numberProperty ( " age " ) ) ) < br / > . < b > startWith ( 0 ) < / b > < / i > < / div >
* < br / > */
public CTerminal startWith ( Object value ) { } } | CollectExpression collXpr = ( CollectExpression ) this . astNode ; ReduceEvalExpression reduceEval = ( ReduceEvalExpression ) ( collXpr ) . getEvalExpression ( ) ; reduceEval . setInitialValue ( value ) ; return new CTerminal ( collXpr ) ; |
public class EnvLoader { /** * Returns the local environment . */
public static EnvironmentClassLoader getEnvironmentClassLoader ( ClassLoader loader ) { } } | for ( ; loader != null ; loader = loader . getParent ( ) ) { if ( loader instanceof EnvironmentClassLoader ) return ( EnvironmentClassLoader ) loader ; } return null ; |
public class KeenClient { /** * Synchronously sends all queued events for the given project . This method will immediately
* publish the events to the Keen server in the current thread .
* @ param project The project for which to send queued events . If a default project has been set
* on the client this parameter may be null , in which case the default project
* will be used .
* @ param callback An optional callback to receive notification of success or failure . */
public synchronized void sendQueuedEvents ( KeenProject project , KeenCallback callback ) { } } | if ( ! isActive ) { handleLibraryInactive ( callback ) ; return ; } if ( project == null && defaultProject == null ) { handleFailure ( null , new IllegalStateException ( "No project specified, but no default project found" ) ) ; return ; } if ( ! isNetworkConnected ( ) ) { KeenLogging . log ( "Not sending events because there is no network connection. " + "Events will be retried next time `sendQueuedEvents` is called." ) ; handleFailure ( callback , new Exception ( "Network not connected." ) ) ; return ; } KeenProject useProject = ( project == null ? defaultProject : project ) ; try { String projectId = useProject . getProjectId ( ) ; Map < String , List < Object > > eventHandles = eventStore . getHandles ( projectId ) ; Map < String , List < Map < String , Object > > > events = buildEventMap ( projectId , eventHandles ) ; String response = publishAll ( useProject , events ) ; if ( response != null ) { try { handleAddEventsResponse ( eventHandles , response ) ; } catch ( Exception e ) { // Errors handling the response are non - fatal ; just log them .
KeenLogging . log ( "Error handling response to batch publish: " + e . getMessage ( ) ) ; } } handleSuccess ( callback ) ; } catch ( Exception e ) { handleFailure ( callback , e ) ; } |
public class DefaultOutputConnection { /** * Handles a connection pause . */
private void doPause ( long id ) { } } | log . debug ( String . format ( "%s - Paused connection to %s" , this , context . target ( ) ) ) ; paused = true ; |
public class VTimeZone { /** * Convert the rule to its equivalent rule using WALL _ TIME mode */
private static DateTimeRule toWallTimeRule ( DateTimeRule rule , int rawOffset , int dstSavings ) { } } | if ( rule . getTimeRuleType ( ) == DateTimeRule . WALL_TIME ) { return rule ; } int wallt = rule . getRuleMillisInDay ( ) ; if ( rule . getTimeRuleType ( ) == DateTimeRule . UTC_TIME ) { wallt += ( rawOffset + dstSavings ) ; } else if ( rule . getTimeRuleType ( ) == DateTimeRule . STANDARD_TIME ) { wallt += dstSavings ; } int month = - 1 , dom = 0 , dow = 0 , dtype = - 1 ; int dshift = 0 ; if ( wallt < 0 ) { dshift = - 1 ; wallt += Grego . MILLIS_PER_DAY ; } else if ( wallt >= Grego . MILLIS_PER_DAY ) { dshift = 1 ; wallt -= Grego . MILLIS_PER_DAY ; } month = rule . getRuleMonth ( ) ; dom = rule . getRuleDayOfMonth ( ) ; dow = rule . getRuleDayOfWeek ( ) ; dtype = rule . getDateRuleType ( ) ; if ( dshift != 0 ) { if ( dtype == DateTimeRule . DOW ) { // Convert to DOW _ GEW _ DOM or DOW _ LEQ _ DOM rule first
int wim = rule . getRuleWeekInMonth ( ) ; if ( wim > 0 ) { dtype = DateTimeRule . DOW_GEQ_DOM ; dom = 7 * ( wim - 1 ) + 1 ; } else { dtype = DateTimeRule . DOW_LEQ_DOM ; dom = MONTHLENGTH [ month ] + 7 * ( wim + 1 ) ; } } // Shift one day before or after
dom += dshift ; if ( dom == 0 ) { month -- ; month = month < Calendar . JANUARY ? Calendar . DECEMBER : month ; dom = MONTHLENGTH [ month ] ; } else if ( dom > MONTHLENGTH [ month ] ) { month ++ ; month = month > Calendar . DECEMBER ? Calendar . JANUARY : month ; dom = 1 ; } if ( dtype != DateTimeRule . DOM ) { // Adjust day of week
dow += dshift ; if ( dow < Calendar . SUNDAY ) { dow = Calendar . SATURDAY ; } else if ( dow > Calendar . SATURDAY ) { dow = Calendar . SUNDAY ; } } } // Create a new rule
DateTimeRule modifiedRule ; if ( dtype == DateTimeRule . DOM ) { modifiedRule = new DateTimeRule ( month , dom , wallt , DateTimeRule . WALL_TIME ) ; } else { modifiedRule = new DateTimeRule ( month , dom , dow , ( dtype == DateTimeRule . DOW_GEQ_DOM ) , wallt , DateTimeRule . WALL_TIME ) ; } return modifiedRule ; |
public class AutomationExecution { /** * The combination of AWS Regions and / or AWS accounts where you want to run the Automation .
* @ return The combination of AWS Regions and / or AWS accounts where you want to run the Automation . */
public java . util . List < TargetLocation > getTargetLocations ( ) { } } | if ( targetLocations == null ) { targetLocations = new com . amazonaws . internal . SdkInternalList < TargetLocation > ( ) ; } return targetLocations ; |
public class OpenALMODPlayer { /** * Stream one section from the mod / xm into an OpenAL buffer
* @ param bufferId The ID of the buffer to fill
* @ return True if another section was available */
public boolean stream ( int bufferId ) { } } | int frames = sectionSize ; boolean reset = false ; boolean more = true ; if ( frames > songDuration ) { frames = songDuration ; reset = true ; } ibxm . get_audio ( data , frames ) ; bufferData . clear ( ) ; bufferData . put ( data ) ; bufferData . limit ( frames * 4 ) ; if ( reset ) { if ( loop ) { ibxm . seek ( 0 ) ; ibxm . set_module ( module ) ; songDuration = ibxm . calculate_song_duration ( ) ; } else { more = false ; songDuration -= frames ; } } else { songDuration -= frames ; } bufferData . flip ( ) ; AL10 . alBufferData ( bufferId , AL10 . AL_FORMAT_STEREO16 , bufferData , 48000 ) ; return more ; |
public class Transform { /** * Return the Transform dictionary object of an element , but reseting
* historical values and setting them to the initial value passed . */
public static Transform getInstance ( Element e , String initial ) { } } | Transform t = GQuery . data ( e , TRANSFORM ) ; if ( t == null || initial != null ) { if ( initial == null ) { initial = GQuery . getSelectorEngine ( ) . getDocumentStyleImpl ( ) . curCSS ( e , transform , false ) ; } t = new Transform ( initial ) ; GQuery . data ( e , TRANSFORM , t ) ; } return t ; |
public class Auth { /** * Returns a Cookie object by retrieving data from - Dcookie maven parameter .
* @ param domainUrl
* the domain on which the cookie is applied
* @ return a Cookie with a name , value , domain and path .
* @ throws TechnicalException
* with a message ( no screenshot , no exception ) */
public static Cookie getAuthenticationCookie ( String domainUrl ) throws TechnicalException { } } | if ( getInstance ( ) . authCookie == null ) { final String cookieStr = System . getProperty ( SESSION_COOKIE ) ; try { if ( cookieStr != null && ! "" . equals ( cookieStr ) ) { final int indexValue = cookieStr . indexOf ( '=' ) ; final int indexPath = cookieStr . indexOf ( ",path=" ) ; final String cookieName = cookieStr . substring ( 0 , indexValue ) ; final String cookieValue = cookieStr . substring ( indexValue + 1 , indexPath ) ; final String cookieDomain = new URI ( domainUrl ) . getHost ( ) . replaceAll ( "self." , "" ) ; final String cookiePath = cookieStr . substring ( indexPath + 6 ) ; getInstance ( ) . authCookie = new Cookie . Builder ( cookieName , cookieValue ) . domain ( cookieDomain ) . path ( cookiePath ) . build ( ) ; logger . debug ( "New cookie created: {}={} on domain {}{}" , cookieName , cookieValue , cookieDomain , cookiePath ) ; } } catch ( final URISyntaxException e ) { throw new TechnicalException ( Messages . getMessage ( WRONG_URI_SYNTAX ) , e ) ; } } return getInstance ( ) . authCookie ; |
public class ModalRenderer { /** * This methods generates the HTML code of the current b : modal .
* < code > encodeBegin < / code > generates the start of the component . After the ,
* the JSF framework calls < code > encodeChildren ( ) < / code > to generate the
* HTML code between the beginning and the end of the component . For
* instance , in the case of a panel component the content of the panel is
* generated by < code > encodeChildren ( ) < / code > . After that ,
* < code > encodeEnd ( ) < / code > is called to generate the rest of the HTML code .
* @ param context
* the FacesContext .
* @ param component
* the current b : modal .
* @ throws IOException
* thrown if something goes wrong when writing the HTML code . */
@ Override public void encodeBegin ( FacesContext context , UIComponent component ) throws IOException { } } | if ( ! component . isRendered ( ) ) { return ; } /* * < div id = " myModal " class = " modal fade " tabindex = " - 1 " role = " dialog "
* aria - labelledby = " myModalLabel " > < div
* class = " modal - dialog " > < div class = " modal - content " > < div
* class = " modal - header " > < button type = " button " class = " close "
* data - dismiss = " modal " a > × < / button > < h3
* id = " myModalLabel " > Modal header < / h3 > < / div > < div class = " modal - body " >
* < p > One fine body . . . < / p > < / div > < div class = " modal - footer " > < button
* class = " btn " data - dismiss = " modal " > Close < / button >
* < button class = " btn btn - primary " > Save changes < / button > < / div >
* < / div > < ! - - / . modal - content - - > < / div > < ! - - / . modal - dialog - - >
* < / div > < ! - - / . modal - - > */
ResponseWriter rw = context . getResponseWriter ( ) ; Modal modal = ( Modal ) component ; String title = modal . getTitle ( ) ; rw . startElement ( "div" , component ) ; // modal
String cid = component . getClientId ( context ) ; rw . writeAttribute ( "id" , cid , "id" ) ; String styleClasses = "modal" ; if ( modal . getStyleClass ( ) != null ) { styleClasses = modal . getStyleClass ( ) + " " + styleClasses ; } if ( ! modal . isBackdrop ( ) ) { rw . writeAttribute ( "data-backdrop" , "static" , null ) ; } if ( ! modal . isCloseOnEscape ( ) ) { rw . writeAttribute ( "data-keyboard" , "false" , null ) ; } rw . writeAttribute ( "class" , styleClasses , "class" ) ; if ( modal . getStyle ( ) != null ) { rw . writeAttribute ( "style" , modal . getStyle ( ) , "style" ) ; } rw . writeAttribute ( "role" , "dialog" , null ) ; rw . writeAttribute ( "tabindex" , "-1" , null ) ; rw . writeAttribute ( "aria-labelledby" , cid + "_Label" , null ) ; // rw . writeAttribute ( " aria - hidden " , " true " , null ) ;
rw . startElement ( "div" , component ) ; // modal - dialog
String modalStyleClass = "modal" + "-dialog" ; if ( modal . getSize ( ) != null ) { modalStyleClass = modalStyleClass + " " + modal . getSize ( ) ; } rw . writeAttribute ( "class" , modalStyleClass , "class" ) ; rw . writeAttribute ( "role" , "document" , "role" ) ; rw . startElement ( "div" , component ) ; // modal - content
rw . writeAttribute ( "class" , "modal-content" , "class" ) ; rw . startElement ( "div" , component ) ; // modal - header
rw . writeAttribute ( "id" , cid + "_header" , "id" ) ; String headerStyleClasses = "modal-header" ; if ( modal . getHeaderClass ( ) != null ) { headerStyleClasses += " " + modal . getHeaderClass ( ) ; } rw . writeAttribute ( "class" , headerStyleClasses , "class" ) ; if ( modal . getHeaderStyle ( ) != null ) { rw . writeAttribute ( "style" , modal . getHeaderStyle ( ) , "style" ) ; } if ( modal . isClosable ( ) ) { rw . startElement ( "button" , component ) ; rw . writeAttribute ( "type" , "button" , "type" ) ; rw . writeAttribute ( "class" , "close" , "class" ) ; rw . writeAttribute ( "aria-label" , "Close" , "aria-label" ) ; rw . writeAttribute ( "data-dismiss" , "modal" , "data-dismiss" ) ; rw . write ( "×" ) ; rw . endElement ( "button" ) ; } if ( title != null ) { rw . startElement ( "h4" , component ) ; rw . writeAttribute ( "id" , cid + "_Label" , "id" ) ; rw . writeText ( title , null ) ; rw . endElement ( "h4" ) ; } rw . endElement ( "div" ) ; // modal - header
rw . startElement ( "div" , component ) ; // modal - body
rw . writeAttribute ( "id" , cid + "_body" , "id" ) ; if ( modal . getContentClass ( ) != null ) { rw . writeAttribute ( "class" , "modal-body " + modal . getContentClass ( ) , "class" ) ; } else { rw . writeAttribute ( "class" , "modal-body" , "class" ) ; } if ( modal . getContentStyle ( ) != null ) { rw . writeAttribute ( "style" , modal . getContentStyle ( ) , "style" ) ; } |
public class ICUHumanize { /** * Same as { @ link # dateFormatInstance ( String ) dateFormatInstance } for the
* specified locale .
* @ param pattern
* Format pattern that follows the conventions of
* { @ link com . ibm . icu . text . DateFormat DateFormat }
* @ param locale
* Target locale
* @ return a DateFormat instance for the current thread */
public static DateFormat dateFormatInstance ( final String pattern , final Locale locale ) { } } | return withinLocale ( new Callable < DateFormat > ( ) { public DateFormat call ( ) throws Exception { return dateFormatInstance ( pattern ) ; } } , locale ) ; |
public class Light { /** * Sets light color
* < p > NOTE : you can also use colorless light with shadows , e . g . ( 0,0,0,1)
* @ param newColor
* RGB set the color and Alpha set intensity
* @ see # setColor ( float , float , float , float ) */
public void setColor ( Color newColor ) { } } | if ( newColor != null ) { color . set ( newColor ) ; } else { color . set ( DefaultColor ) ; } colorF = color . toFloatBits ( ) ; if ( staticLight ) dirty = true ; |
public class U { /** * Documented , # min */
public static < E extends Comparable < ? super E > > E min ( final Collection < E > collection ) { } } | return Collections . min ( collection ) ; |
public class MutationsUtil { /** * Performs a comprehensive translation of mutations present in a nucleotide sequence to effective mutations in
* corresponding amino acid sequence .
* < p > The resulting array contains : < / p >
* < ul > < li > the original nucleotide mutation < / li > < li > " individual " amino acid mutation , i . e . an expected amino acid
* mutation given no other mutations have occurred < / li > < li > " cumulative " amino acid mutation , i . e . the observed
* amino acid mutation combining effect from all other nucleotide mutations < / li > < / ul >
* @ param seq1 the reference nucleotide sequence
* @ param mutations nucleotide mutations in the reference nucleotide sequence
* @ param translationParameters translation parameters
* @ param maxShiftedTriplets max number of shifted triplets for computing the cumulative effect from indels
* @ return an array of nucleotide mutations with their amino acid translations */
public static MutationNt2AADescriptor [ ] nt2aaDetailed ( NucleotideSequence seq1 , Mutations < NucleotideSequence > mutations , TranslationParameters translationParameters , int maxShiftedTriplets ) { } } | MutationsWitMapping mutationsWitMapping = nt2aaWithMapping ( seq1 , mutations , translationParameters , maxShiftedTriplets ) ; int [ ] individualMutations = nt2IndividualAA ( seq1 , mutations , translationParameters ) ; MutationNt2AADescriptor [ ] result = new MutationNt2AADescriptor [ mutations . size ( ) ] ; for ( int i = 0 ; i < mutations . size ( ) ; i ++ ) { result [ i ] = new MutationNt2AADescriptor ( mutations . getMutation ( i ) , individualMutations [ i ] , mutationsWitMapping . mapping [ i ] == - 1 ? NON_MUTATION : mutationsWitMapping . mutations . getMutation ( mutationsWitMapping . mapping [ i ] ) ) ; } return result ; |
public class Element { /** * Determines if the element is a select .
* @ param action - what action is occurring
* @ param expected - what is the expected result
* @ return Boolean : is the element enabled ? */
private boolean isSelect ( String action , String expected ) { } } | // wait for element to be displayed
if ( ! is . select ( ) ) { reporter . fail ( action , expected , Element . CANT_SELECT + prettyOutput ( ) + NOT_A_SELECT ) ; // indicates element not an input
return false ; } return true ; |
public class SAXmyHtmlHandler { /** * This method gets called when an end tag is encountered .
* @ param uri
* the Uniform Resource Identifier
* @ param lname
* the local name ( without prefix ) , or the empty string if
* Namespace processing is not being performed .
* @ param name
* the name of the tag that ends */
public void endElement ( String uri , String lname , String name ) { } } | // System . err . println ( " End : " + name ) ;
name = name . toLowerCase ( ) ; if ( ElementTags . PARAGRAPH . equals ( name ) ) { try { document . add ( ( Element ) stack . pop ( ) ) ; return ; } catch ( DocumentException e ) { throw new ExceptionConverter ( e ) ; } } if ( HtmlTagMap . isHead ( name ) ) { // we do nothing
return ; } if ( HtmlTagMap . isTitle ( name ) ) { if ( currentChunk != null ) { bodyAttributes . put ( ElementTags . TITLE , currentChunk . getContent ( ) ) ; } return ; } if ( HtmlTagMap . isMeta ( name ) ) { // we do nothing
return ; } if ( HtmlTagMap . isLink ( name ) ) { // we do nothing
return ; } if ( HtmlTagMap . isBody ( name ) ) { // we do nothing
return ; } if ( myTags . containsKey ( name ) ) { XmlPeer peer = ( XmlPeer ) myTags . get ( name ) ; if ( ElementTags . TABLE . equals ( peer . getTag ( ) ) ) { tableBorder = false ; } super . handleEndingTags ( peer . getTag ( ) ) ; return ; } // super . handleEndingTags is replaced with handleEndingTags
// suggestion by Ken Auer
handleEndingTags ( name ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.