signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class StringUtilities { /** * Checks that a string buffer ends up with a given string . * @ param buffer The buffer to perform the check on * @ param suffix The suffix * @ return < code > true < / code > if the character sequence represented by the * argument is a suffix of the character sequence represented by * the StringBuffer object ; < code > false < / code > otherwise . Note that the * result will be < code > true < / code > if the argument is the empty string . */ public static boolean endsWith ( StringBuffer buffer , String suffix ) { } }
if ( suffix . length ( ) > buffer . length ( ) ) return false ; int endIndex = suffix . length ( ) - 1 ; int bufferIndex = buffer . length ( ) - 1 ; while ( endIndex >= 0 ) { if ( buffer . charAt ( bufferIndex ) != suffix . charAt ( endIndex ) ) return false ; bufferIndex -- ; endIndex -- ; } return true ;
public class FlexBase64 { /** * Encodes a fixed and complete byte array into a Base64url String . * < p > This method is only useful for applications which require a String and have all data to be encoded up - front . * Note that byte arrays or buffers are almost always a better storage choice . They consume half the memory and * can be reused ( modified ) . In other words , it is almost always better to use { @ link # encodeBytes } , * { @ link # createEncoder } , or { @ link # createEncoderOutputStream } instead . * instead . * @ param source the byte array to encode from * @ param wrap whether or not to wrap the output at 76 chars with CRLFs * @ return a new String representing the Base64url output */ public static String encodeStringURL ( byte [ ] source , boolean wrap ) { } }
return Encoder . encodeString ( source , 0 , source . length , wrap , true ) ;
public class Encoder { /** * Encodes the given binary content as an Aztec symbol * @ param data input data string * @ param minECCPercent minimal percentage of error check words ( According to ISO / IEC 24778:2008, * a minimum of 23 % + 3 words is recommended ) * @ param userSpecifiedLayers if non - zero , a user - specified value for the number of layers * @ return Aztec symbol matrix with metadata */ public static AztecCode encode ( byte [ ] data , int minECCPercent , int userSpecifiedLayers ) { } }
// High - level encode BitArray bits = new HighLevelEncoder ( data ) . encode ( ) ; // stuff bits and choose symbol size int eccBits = bits . getSize ( ) * minECCPercent / 100 + 11 ; int totalSizeBits = bits . getSize ( ) + eccBits ; boolean compact ; int layers ; int totalBitsInLayer ; int wordSize ; BitArray stuffedBits ; if ( userSpecifiedLayers != DEFAULT_AZTEC_LAYERS ) { compact = userSpecifiedLayers < 0 ; layers = Math . abs ( userSpecifiedLayers ) ; if ( layers > ( compact ? MAX_NB_BITS_COMPACT : MAX_NB_BITS ) ) { throw new IllegalArgumentException ( String . format ( "Illegal value %s for layers" , userSpecifiedLayers ) ) ; } totalBitsInLayer = totalBitsInLayer ( layers , compact ) ; wordSize = WORD_SIZE [ layers ] ; int usableBitsInLayers = totalBitsInLayer - ( totalBitsInLayer % wordSize ) ; stuffedBits = stuffBits ( bits , wordSize ) ; if ( stuffedBits . getSize ( ) + eccBits > usableBitsInLayers ) { throw new IllegalArgumentException ( "Data to large for user specified layer" ) ; } if ( compact && stuffedBits . getSize ( ) > wordSize * 64 ) { // Compact format only allows 64 data words , though C4 can hold more words than that throw new IllegalArgumentException ( "Data to large for user specified layer" ) ; } } else { wordSize = 0 ; stuffedBits = null ; // We look at the possible table sizes in the order Compact1 , Compact2 , Compact3, // Compact4 , Normal4 , . . . Normal ( i ) for i < 4 isn ' t typically used since Compact ( i + 1) // is the same size , but has more data . for ( int i = 0 ; ; i ++ ) { if ( i > MAX_NB_BITS ) { throw new IllegalArgumentException ( "Data too large for an Aztec code" ) ; } compact = i <= 3 ; layers = compact ? i + 1 : i ; totalBitsInLayer = totalBitsInLayer ( layers , compact ) ; if ( totalSizeBits > totalBitsInLayer ) { continue ; } // [ Re ] stuff the bits if this is the first opportunity , or if the // wordSize has changed if ( stuffedBits == null || wordSize != WORD_SIZE [ layers ] ) { wordSize = WORD_SIZE [ layers ] ; stuffedBits = stuffBits ( bits , wordSize ) ; } int usableBitsInLayers = totalBitsInLayer - ( totalBitsInLayer % wordSize ) ; if ( compact && stuffedBits . getSize ( ) > wordSize * 64 ) { // Compact format only allows 64 data words , though C4 can hold more words than that continue ; } if ( stuffedBits . getSize ( ) + eccBits <= usableBitsInLayers ) { break ; } } } BitArray messageBits = generateCheckWords ( stuffedBits , totalBitsInLayer , wordSize ) ; // generate mode message int messageSizeInWords = stuffedBits . getSize ( ) / wordSize ; BitArray modeMessage = generateModeMessage ( compact , layers , messageSizeInWords ) ; // allocate symbol int baseMatrixSize = ( compact ? 11 : 14 ) + layers * 4 ; // not including alignment lines int [ ] alignmentMap = new int [ baseMatrixSize ] ; int matrixSize ; if ( compact ) { // no alignment marks in compact mode , alignmentMap is a no - op matrixSize = baseMatrixSize ; for ( int i = 0 ; i < alignmentMap . length ; i ++ ) { alignmentMap [ i ] = i ; } } else { matrixSize = baseMatrixSize + 1 + 2 * ( ( baseMatrixSize / 2 - 1 ) / 15 ) ; int origCenter = baseMatrixSize / 2 ; int center = matrixSize / 2 ; for ( int i = 0 ; i < origCenter ; i ++ ) { int newOffset = i + i / 15 ; alignmentMap [ origCenter - i - 1 ] = center - newOffset - 1 ; alignmentMap [ origCenter + i ] = center + newOffset + 1 ; } } BitMatrix matrix = new BitMatrix ( matrixSize ) ; // draw data bits for ( int i = 0 , rowOffset = 0 ; i < layers ; i ++ ) { int rowSize = ( layers - i ) * 4 + ( compact ? 9 : 12 ) ; for ( int j = 0 ; j < rowSize ; j ++ ) { int columnOffset = j * 2 ; for ( int k = 0 ; k < 2 ; k ++ ) { if ( messageBits . get ( rowOffset + columnOffset + k ) ) { matrix . set ( alignmentMap [ i * 2 + k ] , alignmentMap [ i * 2 + j ] ) ; } if ( messageBits . get ( rowOffset + rowSize * 2 + columnOffset + k ) ) { matrix . set ( alignmentMap [ i * 2 + j ] , alignmentMap [ baseMatrixSize - 1 - i * 2 - k ] ) ; } if ( messageBits . get ( rowOffset + rowSize * 4 + columnOffset + k ) ) { matrix . set ( alignmentMap [ baseMatrixSize - 1 - i * 2 - k ] , alignmentMap [ baseMatrixSize - 1 - i * 2 - j ] ) ; } if ( messageBits . get ( rowOffset + rowSize * 6 + columnOffset + k ) ) { matrix . set ( alignmentMap [ baseMatrixSize - 1 - i * 2 - j ] , alignmentMap [ i * 2 + k ] ) ; } } } rowOffset += rowSize * 8 ; } // draw mode message drawModeMessage ( matrix , compact , matrixSize , modeMessage ) ; // draw alignment marks if ( compact ) { drawBullsEye ( matrix , matrixSize / 2 , 5 ) ; } else { drawBullsEye ( matrix , matrixSize / 2 , 7 ) ; for ( int i = 0 , j = 0 ; i < baseMatrixSize / 2 - 1 ; i += 15 , j += 16 ) { for ( int k = ( matrixSize / 2 ) & 1 ; k < matrixSize ; k += 2 ) { matrix . set ( matrixSize / 2 - j , k ) ; matrix . set ( matrixSize / 2 + j , k ) ; matrix . set ( k , matrixSize / 2 - j ) ; matrix . set ( k , matrixSize / 2 + j ) ; } } } AztecCode aztec = new AztecCode ( ) ; aztec . setCompact ( compact ) ; aztec . setSize ( matrixSize ) ; aztec . setLayers ( layers ) ; aztec . setCodeWords ( messageSizeInWords ) ; aztec . setMatrix ( matrix ) ; return aztec ;
public class GrpcServiceBuilder { /** * Adds gRPC { @ link BindableService } s to this { @ link GrpcServiceBuilder } . Most gRPC service * implementations are { @ link BindableService } s . */ public GrpcServiceBuilder addServices ( Iterable < BindableService > bindableServices ) { } }
requireNonNull ( bindableServices , "bindableServices" ) ; bindableServices . forEach ( this :: addService ) ; return this ;
public class ApiOvhMe { /** * Remove this RAID * REST : DELETE / me / installationTemplate / { templateName } / partitionScheme / { schemeName } / hardwareRaid / { name } * @ param templateName [ required ] This template name * @ param schemeName [ required ] name of this partitioning scheme * @ param name [ required ] Hardware RAID name */ public void installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_name_DELETE ( String templateName , String schemeName , String name ) throws IOException { } }
String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardwareRaid/{name}" ; StringBuilder sb = path ( qPath , templateName , schemeName , name ) ; exec ( qPath , "DELETE" , sb . toString ( ) , null ) ;
public class TableRef { /** * Applies a filter to the table . When fetched , it will return the items that contains the filter property value . * < pre > * StorageRef storage = new StorageRef ( " your _ app _ key " , " your _ token " ) ; * TableRef tableRef = storage . table ( " your _ table " ) ; * / / Retrieve all items with property " itemProperty " contains the value " xpto " * tableRef . contains ( " itemProperty " , new ItemAttribute ( " xpto " ) ) . getItems ( new OnItemSnapshot ( ) { * & # 064 ; Override * public void run ( ItemSnapshot itemSnapshot ) { * if ( itemSnapshot ! = null ) { * Log . d ( " TableRef " , " Item retrieved : " + itemSnapshot . val ( ) ) ; * } , new OnError ( ) { * & # 064 ; Override * public void run ( Integer code , String errorMessage ) { * Log . e ( " TableRef " , " Error retrieving items : " + errorMessage ) ; * < / pre > * @ param attributeName * The name of the property to filter . * @ param value * The value of the property to filter . * @ return Current table reference */ public TableRef contains ( String attributeName , ItemAttribute value ) { } }
filters . add ( new Filter ( StorageFilter . CONTAINS , attributeName , value , null ) ) ; return this ;
public class IonTextUtils { /** * Generates a surrogate pair as two four - digit hex escape sequences , * { @ code " \ } { @ code u } < i > { @ code HHHH } < / i > { @ code \ } { @ code u } < i > { @ code HHHH } < / i > { @ code " } , * using lower - case for alphabetics . * This for necessary for JSON when the code point is outside the BMP . */ private static void printCodePointAsSurrogatePairHexDigits ( Appendable out , int c ) throws IOException { } }
for ( final char unit : Character . toChars ( c ) ) { printCodePointAsFourHexDigits ( out , unit ) ; }
public class RsaSignature { /** * See https : / / tools . ietf . org / html / rfc3447 # section - 9.2 */ protected byte [ ] EMSA_PKCS1_V1_5_ENCODE_HASH ( byte [ ] h , int emLen , String algorithm ) throws NoSuchAlgorithmException { } }
// Check m if ( h == null || h . length == 0 ) { throw new IllegalArgumentException ( "m" ) ; } byte [ ] algorithmPrefix = null ; // Check algorithm if ( Strings . isNullOrWhiteSpace ( algorithm ) ) { throw new IllegalArgumentException ( "algorithm" ) ; } // Only supported algorithms if ( algorithm . equals ( "SHA-256" ) ) { // Initialize prefix and digest algorithmPrefix = SHA_256_PREFIX ; if ( h . length != 32 ) { throw new IllegalArgumentException ( "h is incorrect length for SHA-256" ) ; } } else { throw new IllegalArgumentException ( "algorithm" ) ; } // Construct t , the DER encoded DigestInfo structure byte [ ] t = new byte [ algorithmPrefix . length + h . length ] ; System . arraycopy ( algorithmPrefix , 0 , t , 0 , algorithmPrefix . length ) ; System . arraycopy ( h , 0 , t , algorithmPrefix . length , h . length ) ; if ( emLen < t . length + 11 ) { throw new IllegalArgumentException ( "intended encoded message length too short" ) ; } // Construct ps byte [ ] ps = new byte [ emLen - t . length - 3 ] ; for ( int i = 0 ; i < ps . length ; i ++ ) { ps [ i ] = ( byte ) 0xff ; } // Construct em byte [ ] em = new byte [ ps . length + t . length + 3 ] ; em [ 0 ] = 0x00 ; em [ 1 ] = 0x01 ; em [ ps . length + 2 ] = 0x00 ; System . arraycopy ( ps , 0 , em , 2 , ps . length ) ; System . arraycopy ( t , 0 , em , ps . length + 3 , t . length ) ; return em ;
public class PeasyViewHolder { /** * Will bind onClick and setOnLongClickListener here * @ param binder { @ link PeasyViewHolder } itself * @ param viewType viewType ID */ < T > void bindWith ( final PeasyRecyclerView < T > binder , final int viewType ) { } }
this . itemView . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { int position = getLayoutPosition ( ) ; position = ( position <= binder . getLastItemIndex ( ) ) ? position : getAdapterPosition ( ) ; position = ( position <= binder . getLastItemIndex ( ) ) ? position : RecyclerView . NO_POSITION ; if ( position != RecyclerView . NO_POSITION ) { binder . onItemClick ( v , viewType , position , binder . getItem ( position ) , getInstance ( ) ) ; } } } ) ; this . itemView . setOnLongClickListener ( new View . OnLongClickListener ( ) { @ Override public boolean onLongClick ( View v ) { int position = getLayoutPosition ( ) ; position = ( position <= binder . getLastItemIndex ( ) ) ? position : getAdapterPosition ( ) ; position = ( position <= binder . getLastItemIndex ( ) ) ? position : RecyclerView . NO_POSITION ; if ( getLayoutPosition ( ) != RecyclerView . NO_POSITION ) { return binder . onItemLongClick ( v , viewType , position , binder . getItem ( position ) , getInstance ( ) ) ; } return false ; } } ) ;
public class AbstractAttributeDefinitionBuilder { /** * Records that this attribute ' s value represents a reference to an instance of a * { @ link org . jboss . as . controller . capability . RuntimeCapability # isDynamicallyNamed ( ) dynamic capability } . * This method is a convenience method equivalent to calling * { @ link # setCapabilityReference ( CapabilityReferenceRecorder ) } * passing in a { @ link org . jboss . as . controller . CapabilityReferenceRecorder . DefaultCapabilityReferenceRecorder } * constructed using the parameters passed to this method . * @ param referencedCapability the name of the dynamic capability the dynamic portion of whose name is * represented by the attribute ' s value * @ param dependentCapability the capability that depends on { @ code referencedCapability } * @ return the builder * @ see AttributeDefinition # addCapabilityRequirements ( OperationContext , org . jboss . as . controller . registry . Resource , ModelNode ) * @ see AttributeDefinition # removeCapabilityRequirements ( OperationContext , org . jboss . as . controller . registry . Resource , ModelNode ) */ public BUILDER setCapabilityReference ( String referencedCapability , RuntimeCapability < ? > dependentCapability ) { } }
if ( dependentCapability . isDynamicallyNamed ( ) ) { return setCapabilityReference ( referencedCapability , dependentCapability . getName ( ) ) ; } else { // noinspection deprecation return setCapabilityReference ( referencedCapability , dependentCapability . getName ( ) , false ) ; }
public class GraphicUtils { /** * Draws a circle with the specified diameter using the given point as center * and fills it with the current color of the graphics context . * @ param g Graphics context * @ param center Circle center * @ param diameter Circle diameter */ public static void fillCircle ( Graphics g , Point center , int diameter ) { } }
fillCircle ( g , ( int ) center . getX ( ) , ( int ) center . getY ( ) , diameter ) ;
public class IssueFieldsSetter { /** * Used to set the author when it was null */ public boolean setNewAuthor ( DefaultIssue issue , @ Nullable String newAuthorLogin , IssueChangeContext context ) { } }
if ( isNullOrEmpty ( newAuthorLogin ) ) { return false ; } checkState ( issue . authorLogin ( ) == null , "It's not possible to update the author with this method, please use setAuthorLogin()" ) ; issue . setFieldChange ( context , AUTHOR , null , newAuthorLogin ) ; issue . setAuthorLogin ( newAuthorLogin ) ; issue . setUpdateDate ( context . date ( ) ) ; issue . setChanged ( true ) ; // do not send notifications to prevent spam when installing the developer cockpit plugin return true ;
public class DeleteFeatureAction { /** * Prepare a FeatureTransaction for deletion of the selected feature , and ask if the user wants to continue . If * he / she does , the feature will be deselected and then the FeatureTransaction will be committed . */ public void onClick ( MenuItemClickEvent event ) { } }
if ( feature != null && feature . isSelected ( ) ) { SC . confirm ( I18nProvider . getGlobal ( ) . confirmDeleteFeature ( feature . getLabel ( ) , feature . getLayer ( ) . getLabel ( ) ) , new BooleanCallback ( ) { public void execute ( Boolean value ) { if ( value ) { feature . getLayer ( ) . deselectFeature ( feature ) ; mapWidget . getMapModel ( ) . getFeatureEditor ( ) . startEditing ( new Feature [ ] { feature } , null ) ; SaveEditingAction action = new SaveEditingAction ( mapWidget , controller ) ; action . onClick ( null ) ; } } } ) ; }
public class AbstractTriangle3F { /** * Checks if the projection of a point on the triangle ' s plane is inside the triangle . * @ param x * @ param y * @ param z * @ return < code > true < / code > if the projection of the point is in the triangle , otherwise < code > false < / code > . */ @ Pure public boolean containsProjectionOf ( double x , double y , double z ) { } }
Point3f proj = ( Point3f ) getPlane ( ) . getProjection ( x , y , z ) ; if ( proj == null ) { return false ; } return contains ( proj ) ;
public class PercentileBuckets { /** * Compute a percentile based on the counts for the buckets . * @ param counts * Counts for each of the buckets . The size must be the same as { @ link # length ( ) } and the * positions must correspond to the positions of the bucket values . * @ param p * Percentile to compute , the value should be { @ code 0.0 < = p < = 100.0 } . * @ return * The calculated percentile value . */ public static double percentile ( long [ ] counts , double p ) { } }
double [ ] pcts = new double [ ] { p } ; double [ ] results = new double [ 1 ] ; percentiles ( counts , pcts , results ) ; return results [ 0 ] ;
public class InsertRingAction { /** * Insert a new point in the geometry at a given index . The index is taken from the context menu event . This * function will add a new empty interior ring in the polygon in question . * @ param event * The { @ link MenuItemClickEvent } from clicking the action . */ public void onClick ( MenuItemClickEvent event ) { } }
final FeatureTransaction ft = mapWidget . getMapModel ( ) . getFeatureEditor ( ) . getFeatureTransaction ( ) ; if ( ft != null && index != null ) { List < Feature > features = new ArrayList < Feature > ( ) ; features . add ( ft . getNewFeatures ( ) [ index . getFeatureIndex ( ) ] ) ; LazyLoader . lazyLoad ( features , GeomajasConstant . FEATURE_INCLUDE_GEOMETRY , new LazyLoadCallback ( ) { public void execute ( List < Feature > response ) { controller . setEditMode ( EditMode . INSERT_MODE ) ; Geometry geometry = response . get ( 0 ) . getGeometry ( ) ; if ( geometry instanceof Polygon ) { geometry = addRing ( ( Polygon ) geometry ) ; } else if ( geometry instanceof MultiPolygon ) { geometry = addRing ( ( MultiPolygon ) geometry ) ; } ft . getNewFeatures ( ) [ index . getFeatureIndex ( ) ] . setGeometry ( geometry ) ; controller . setGeometryIndex ( index ) ; controller . hideGeometricInfo ( ) ; } } ) ; }
public class Accessibles { /** * Sets the { @ code accessible } flag of the given { @ code AccessibleObject } to the given { @ code boolean } value , ignoring * any thrown exception . * @ param o the given { @ code AccessibleObject } . * @ param accessible the value to set the { @ code accessible } flag to . */ public static void setAccessibleIgnoringExceptions ( @ NotNull AccessibleObject o , boolean accessible ) { } }
try { setAccessible ( o , accessible ) ; } catch ( RuntimeException ignored ) { String format = "Failed to set 'accessible' flag of %s to %s" ; logger . log ( Level . SEVERE , String . format ( format , o . toString ( ) , String . valueOf ( accessible ) ) , ignored ) ; }
public class ThreadLocalContext { /** * 取出ThreadLocal的上下文信息 . */ @ SuppressWarnings ( "unchecked" ) public static < T > T get ( String key ) { } }
return ( T ) ( contextMap . get ( ) . get ( key ) ) ;
public class Vector { /** * Returns a view of the portion of this List between fromIndex , * inclusive , and toIndex , exclusive . ( If fromIndex and toIndex are * equal , the returned List is empty . ) The returned List is backed by this * List , so changes in the returned List are reflected in this List , and * vice - versa . The returned List supports all of the optional List * operations supported by this List . * < p > This method eliminates the need for explicit range operations ( of * the sort that commonly exist for arrays ) . Any operation that expects * a List can be used as a range operation by operating on a subList view * instead of a whole List . For example , the following idiom * removes a range of elements from a List : * < pre > * list . subList ( from , to ) . clear ( ) ; * < / pre > * Similar idioms may be constructed for indexOf and lastIndexOf , * and all of the algorithms in the Collections class can be applied to * a subList . * < p > The semantics of the List returned by this method become undefined if * the backing list ( i . e . , this List ) is < i > structurally modified < / i > in * any way other than via the returned List . ( Structural modifications are * those that change the size of the List , or otherwise perturb it in such * a fashion that iterations in progress may yield incorrect results . ) * @ param fromIndex low endpoint ( inclusive ) of the subList * @ param toIndex high endpoint ( exclusive ) of the subList * @ return a view of the specified range within this List * @ throws IndexOutOfBoundsException if an endpoint index value is out of range * { @ code ( fromIndex < 0 | | toIndex > size ) } * @ throws IllegalArgumentException if the endpoint indices are out of order * { @ code ( fromIndex > toIndex ) } */ public synchronized List < E > subList ( int fromIndex , int toIndex ) { } }
return Collections . synchronizedList ( super . subList ( fromIndex , toIndex ) , this ) ;
public class ApplicationCache { /** * Adds the application list to the applications for the account . * @ param applications The applications to add */ public void add ( Collection < Application > applications ) { } }
for ( Application application : applications ) this . applications . put ( application . getId ( ) , application ) ;
public class RStarTreeUtil { /** * Get an RTree range query , using an optimized double implementation when * possible . * @ param < O > Object type * @ param tree Tree to query * @ param distanceQuery distance query * @ param hints Optimizer hints * @ return Query object */ @ SuppressWarnings ( { } }
"cast" , "unchecked" } ) public static < O extends SpatialComparable > RangeQuery < O > getRangeQuery ( AbstractRStarTree < ? , ? , ? > tree , SpatialDistanceQuery < O > distanceQuery , Object ... hints ) { // Can we support this distance function - spatial distances only ! SpatialPrimitiveDistanceFunction < ? super O > df = distanceQuery . getDistanceFunction ( ) ; if ( EuclideanDistanceFunction . STATIC . equals ( df ) ) { return ( RangeQuery < O > ) new EuclideanRStarTreeRangeQuery < > ( tree , ( Relation < NumberVector > ) distanceQuery . getRelation ( ) ) ; } return new RStarTreeRangeQuery < > ( tree , distanceQuery . getRelation ( ) , df ) ;
public class EnterClickAdapter { /** * from interface KeyDownHandler */ public void onKeyDown ( KeyDownEvent event ) { } }
if ( event . getNativeKeyCode ( ) == KeyCodes . KEY_ENTER ) { _onEnter . onClick ( null ) ; }
public class UpdateConfigAction { /** * You may use this field to directly , programmatically add your own Map of * key , value pairs that you would like to send for this command . Setting * your own map will reset the command index to the number of keys in the * Map * @ see org . asteriskjava . manager . action . UpdateConfigAction # addCommand * @ param actions the actions to set */ public void setAttributes ( Map < String , String > actions ) { } }
this . actions = actions ; this . actionCounter = actions . keySet ( ) . size ( ) ;
public class ExcelBase { /** * 关闭工作簿 < br > * 如果用户设定了目标文件 , 先写出目标文件后给关闭工作簿 */ @ Override public void close ( ) { } }
IoUtil . close ( this . workbook ) ; this . sheet = null ; this . workbook = null ; this . isClosed = true ;
public class GoogleMapShape { /** * Expand the bounding box by the LatLngs * @ param boundingBox bounding box * @ param latLngs lat lngs */ private void expandBoundingBox ( BoundingBox boundingBox , List < LatLng > latLngs ) { } }
for ( LatLng latLng : latLngs ) { expandBoundingBox ( boundingBox , latLng ) ; }
public class HawkbitCommonUtil { /** * Get javascript to reflect new color selection for preview button . * @ param color * changed color * @ return javascript for the selected color . */ public static String getPreviewButtonColorScript ( final String color ) { } }
return new StringBuilder ( ) . append ( PREVIEW_BUTTON_COLOR_REMOVE_SCRIPT ) . append ( PREVIEW_BUTTON_COLOR_CREATE_SCRIPT ) . append ( "var tagColorPreviewStyle = \".v-app .tag-color-preview{ height: 15px !important; padding: 0 10px !important; border: 0px !important; margin-left:12px !important; margin-top: 4px !important; border-width: 0 !important; background: " ) . append ( color ) . append ( " } .v-app .tag-color-preview:after{ border-color: none !important; box-shadow:none !important;} \"; " ) . append ( PREVIEW_BUTTON_COLOR_SET_STYLE_SCRIPT ) . toString ( ) ;
public class RestApiClient { /** * Creates the group . * @ param group * the group * @ return the response */ public Response createGroup ( GroupEntity group ) { } }
return restClient . post ( "groups" , group , new HashMap < String , String > ( ) ) ;
public class VortexRequestor { /** * Sends a { @ link MasterToWorkerRequest } synchronously to a { @ link org . apache . reef . vortex . evaluator . VortexWorker } . */ void send ( final RunningTask reefTask , final MasterToWorkerRequest masterToWorkerRequest ) { } }
reefTask . send ( kryoUtils . serialize ( masterToWorkerRequest ) ) ;
public class BPGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . BPG__PAGE_NAME : setPageName ( PAGE_NAME_EDEFAULT ) ; return ; case AfplibPackage . BPG__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class AbstractJdbcCacheStore { /** * Persist a single object into the data store . * @ param key entry key of the object that should be persisted * @ param value object to persist */ public void store ( Object key , Object value ) { } }
getJdbcTemplate ( ) . update ( getMergeSql ( ) , new BeanPropertySqlParameterSource ( value ) ) ;
public class RegistryUtils { /** * Remove a specific value from a registry . * @ param registryName the name of the registry . * @ param key the unique key corresponding to the value to remove ( typically an appid ) . */ public static void removeValue ( String registryName , String key ) { } }
Sysprop registryObject = readRegistryObject ( registryName ) ; if ( registryObject == null || StringUtils . isBlank ( key ) ) { return ; } if ( registryObject . hasProperty ( key ) ) { registryObject . removeProperty ( key ) ; CoreUtils . getInstance ( ) . getDao ( ) . update ( REGISTRY_APP_ID , registryObject ) ; }
public class PowerShell { /** * Execute the provided PowerShell script in PowerShell console and gets * result . * @ param srcReader the script as BufferedReader ( when loading File from jar ) * @ param params the parameters of the script * @ return response with the output of the command */ public PowerShellResponse executeScript ( BufferedReader srcReader , String params ) { } }
PowerShellResponse response ; if ( srcReader != null ) { File tmpFile = createWriteTempFile ( srcReader ) ; if ( tmpFile != null ) { this . scriptMode = true ; response = executeCommand ( tmpFile . getAbsolutePath ( ) + " " + params ) ; tmpFile . delete ( ) ; } else { response = new PowerShellResponse ( true , "Cannot create temp script file!" , false ) ; } } else { logger . log ( Level . SEVERE , "Script buffered reader is null!" ) ; response = new PowerShellResponse ( true , "Script buffered reader is null!" , false ) ; } return response ;
public class InternalSimpleAntlrParser { /** * InternalSimpleAntlr . g : 281:1 : entryRuleIdOrInt returns [ String current = null ] : iv _ ruleIdOrInt = ruleIdOrInt EOF ; */ public final String entryRuleIdOrInt ( ) throws RecognitionException { } }
String current = null ; AntlrDatatypeRuleToken iv_ruleIdOrInt = null ; try { // InternalSimpleAntlr . g : 282:2 : ( iv _ ruleIdOrInt = ruleIdOrInt EOF ) // InternalSimpleAntlr . g : 283:2 : iv _ ruleIdOrInt = ruleIdOrInt EOF { if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getIdOrIntRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleIdOrInt = ruleIdOrInt ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleIdOrInt . getText ( ) ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ;
public class Validate { /** * < p > Validate that the argument condition is { @ code true } ; otherwise throwing an exception with the specified message . This method is useful when validating according to an arbitrary boolean * expression , such as validating a primitive number or using your own custom validation expression . < / p > * < pre > * Validate . isTrue ( i & gt ; = min & amp ; & amp ; i & lt ; = max , " The value must be between & # 37 ; d and & # 37 ; d " , min , max ) ; * Validate . isTrue ( myObject . isOk ( ) , " The object is not okay " ) ; * < / pre > * @ param expression * the boolean expression to check * @ param message * the { @ link String # format ( String , Object . . . ) } exception message if invalid , not null * @ param values * the optional values for the formatted exception message , null array not recommended * @ throws IllegalArgumentValidationException * if expression is { @ code false } * @ see # isTrue ( boolean ) * @ see # isTrue ( boolean , String , long ) * @ see # isTrue ( boolean , String , double ) */ public static void isTrue ( final boolean expression , final String message , final Object ... values ) { } }
INSTANCE . isTrue ( expression , message , values ) ;
public class ObjectGraphDump { /** * Reads the contents of a field . * @ param field the field definition . * @ param obj the object to read the value from . * @ return the value of the field in the given object . */ private Object readField ( final Field field , final Object obj ) { } }
try { return field . get ( obj ) ; } catch ( IllegalAccessException e ) { // Should not happen as we ' ve called Field . setAccessible ( true ) . LOG . error ( "Failed to read " + field . getName ( ) + " of " + obj . getClass ( ) . getName ( ) , e ) ; } return null ;
public class SessionApi { /** * Login ( HTTP session only ) * Starts the OAuth 2 flow for the Authorization Code grant type and returns a redirect to the Authentication service . For more information , see the [ Authentication API ] ( / reference / authentication / ) . * @ param redirectUri The URI the Authentication API uses to redirect the user after authentication . ( required ) * @ param includeState Flag denoting whether a state parameter should be generated and included in the redirect . ( optional ) * @ return ApiResponse & lt ; Void & gt ; * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiResponse < Void > getLoginWithHttpInfo ( String redirectUri , Boolean includeState ) throws ApiException { } }
com . squareup . okhttp . Call call = getLoginValidateBeforeCall ( redirectUri , includeState , null , null ) ; return apiClient . execute ( call ) ;
public class Serializer { /** * Converts the lowest five bytes of an unsigned long to a byte array . * The byte order is big - endian . * @ param value the long value , must not be negative . * @ return an array with five bytes . */ public static byte [ ] getFiveBytes ( long value ) { } }
if ( value < 0 ) { throw new IllegalArgumentException ( "negative value not allowed: " + value ) ; } else if ( value > 1099511627775L ) { throw new IllegalArgumentException ( "value out of range: " + value ) ; } return new byte [ ] { ( byte ) ( value >> 32 ) , ( byte ) ( value >> 24 ) , ( byte ) ( value >> 16 ) , ( byte ) ( value >> 8 ) , ( byte ) value } ;
public class ListManagementImageListsImpl { /** * Creates an image list . * @ param contentType The content type . * @ param bodyParameter Schema of the body . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ImageList object */ public Observable < ImageList > createAsync ( String contentType , BodyModel bodyParameter ) { } }
return createWithServiceResponseAsync ( contentType , bodyParameter ) . map ( new Func1 < ServiceResponse < ImageList > , ImageList > ( ) { @ Override public ImageList call ( ServiceResponse < ImageList > response ) { return response . body ( ) ; } } ) ;
public class Asserter { /** * Asserts that an expected { @ link Activity } is currently active one , with the possibility to * verify that the expected { @ code Activity } is a new instance of the { @ code Activity } . * @ param message the message that should be displayed if the assert fails * @ param name the name of the { @ code Activity } that is expected to be active e . g . { @ code " MyActivity " } * @ param isNewInstance { @ code true } if the expected { @ code Activity } is a new instance of the { @ code Activity } */ public void assertCurrentActivity ( String message , String name , boolean isNewInstance ) { } }
assertCurrentActivity ( message , name ) ; Activity activity = activityUtils . getCurrentActivity ( ) ; if ( activity != null ) { assertCurrentActivity ( message , activity . getClass ( ) , isNewInstance ) ; }
public class ConfigReadController { /** * 下载 * @ param configId * @ return */ @ RequestMapping ( value = "/download/{configId}" , method = RequestMethod . GET ) public HttpEntity < byte [ ] > downloadDspBill ( @ PathVariable long configId ) { } }
// 业务校验 configValidator . valideConfigExist ( configId ) ; ConfListVo config = configMgr . getConfVo ( configId ) ; HttpHeaders header = new HttpHeaders ( ) ; byte [ ] res = config . getValue ( ) . getBytes ( ) ; if ( res == null ) { throw new DocumentNotFoundException ( config . getKey ( ) ) ; } String name = null ; try { name = URLEncoder . encode ( config . getKey ( ) , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } header . set ( "Content-Disposition" , "attachment; filename=" + name ) ; header . setContentLength ( res . length ) ; return new HttpEntity < byte [ ] > ( res , header ) ;
public class BacklogEndPointSupport { /** * Returns the endpoint of shared file . * @ param projectIdOrKey the project identifier * @ param sharedFileId the shared file identifier * @ return the endpoint * @ throws BacklogException */ public String getSharedFileEndpoint ( Object projectIdOrKey , Object sharedFileId ) throws BacklogException { } }
return buildEndpoint ( "projects/" + projectIdOrKey + "/files/" + sharedFileId ) ;
public class EsaParser { /** * Adds the Require - Capability Strings from a bundle jar to the Map of * Require - Capabilities found * @ param zipSystem - the FileSystem mapping to the feature containing this bundle * @ param bundle - the bundle within a zipped up feature * @ param requiresMap - Map of Path to Require - Capability * @ throws IOException */ private static void addBundleManifestRequireCapability ( FileSystem zipSystem , Path bundle , Map < Path , String > requiresMap ) throws IOException { } }
Path extractedJar = null ; try { // Need to extract the bundles to read their manifest , can ' t find a way to do this in place . extractedJar = Files . createTempFile ( "unpackedBundle" , ".jar" ) ; extractedJar . toFile ( ) . deleteOnExit ( ) ; Files . copy ( bundle , extractedJar , StandardCopyOption . REPLACE_EXISTING ) ; Manifest bundleJarManifest = null ; JarFile bundleJar = null ; try { bundleJar = new JarFile ( extractedJar . toFile ( ) ) ; bundleJarManifest = bundleJar . getManifest ( ) ; } finally { if ( bundleJar != null ) { bundleJar . close ( ) ; } } Attributes bundleManifestAttrs = bundleJarManifest . getMainAttributes ( ) ; String requireCapabilityAttr = bundleManifestAttrs . getValue ( REQUIRE_CAPABILITY_HEADER_NAME ) ; if ( requireCapabilityAttr != null ) { requiresMap . put ( bundle , requireCapabilityAttr ) ; } } finally { if ( extractedJar != null ) { extractedJar . toFile ( ) . delete ( ) ; } }
public class SocketNode13 { /** * Notifies all registered listeners regarding the opening of a Socket . * @ param remoteInfo remote info */ private void fireSocketOpened ( final String remoteInfo ) { } }
synchronized ( listenerList ) { for ( Iterator iter = listenerList . iterator ( ) ; iter . hasNext ( ) ; ) { SocketNodeEventListener snel = ( SocketNodeEventListener ) iter . next ( ) ; if ( snel != null ) { snel . socketOpened ( remoteInfo ) ; } } }
public class XMLFormatterUtils { /** * This will encode the given string as a valid XML name . The format will be * an initial underscore followed by the hexadecimal representation of the * string . * The method will throw an exception if the argument is null . * @ param s * String to encode as an XML name * @ return valid XML name from String * @ throws NullPointerException if the argument is null */ public static String encodeAsXMLName ( String s ) { } }
StringBuilder sb = new StringBuilder ( "_" ) ; for ( byte b : s . getBytes ( Charset . forName ( "UTF-8" ) ) ) { sb . append ( Integer . toHexString ( ( b >>> 4 ) & 0xF ) ) ; sb . append ( Integer . toHexString ( b & 0xF ) ) ; } return sb . toString ( ) ;
public class HashUtils { /** * Hashes a string using the SHA - 384 algorithm . * @ since 1.1 * @ param data the string to hash * @ param charset the charset of the string * @ return the SHA - 384 hash of the string * @ throws NoSuchAlgorithmException the algorithm is not supported by existing providers */ public static byte [ ] sha384Hash ( String data , Charset charset ) throws NoSuchAlgorithmException { } }
return sha384Hash ( data . getBytes ( charset ) ) ;
public class ListDevelopmentSchemaArnsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListDevelopmentSchemaArnsRequest listDevelopmentSchemaArnsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listDevelopmentSchemaArnsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listDevelopmentSchemaArnsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listDevelopmentSchemaArnsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class UnilateralSortMerger { /** * Shuts down all the threads initiated by this sort / merger . Also releases all previously allocated * memory , if it has not yet been released by the threads , and closes and deletes all channels ( removing * the temporary files ) . * The threads are set to exit directly , but depending on their operation , it may take a while to actually happen . * The sorting thread will for example not finish before the current batch is sorted . This method attempts to wait * for the working thread to exit . If it is however interrupted , the method exits immediately and is not guaranteed * how long the threads continue to exist and occupy resources afterwards . * @ see java . io . Closeable # close ( ) */ @ Override public void close ( ) { } }
// check if the sorter has been closed before synchronized ( this ) { if ( this . closed ) { return ; } // mark as closed this . closed = true ; } // from here on , the code is in a try block , because even through errors might be thrown in this block , // we need to make sure that all the memory is released . try { // if the result iterator has not been obtained yet , set the exception synchronized ( this . iteratorLock ) { if ( this . iteratorException == null ) { this . iteratorException = new IOException ( "The sorter has been closed." ) ; this . iteratorLock . notifyAll ( ) ; } } // stop all the threads if ( this . readThread != null ) { try { this . readThread . shutdown ( ) ; } catch ( Throwable t ) { LOG . error ( "Error shutting down reader thread: " + t . getMessage ( ) , t ) ; } } if ( this . sortThread != null ) { try { this . sortThread . shutdown ( ) ; } catch ( Throwable t ) { LOG . error ( "Error shutting down sorter thread: " + t . getMessage ( ) , t ) ; } } if ( this . spillThread != null ) { try { this . spillThread . shutdown ( ) ; } catch ( Throwable t ) { LOG . error ( "Error shutting down spilling thread: " + t . getMessage ( ) , t ) ; } } try { if ( this . readThread != null ) { this . readThread . join ( ) ; } if ( this . sortThread != null ) { this . sortThread . join ( ) ; } if ( this . spillThread != null ) { this . spillThread . join ( ) ; } } catch ( InterruptedException iex ) { LOG . debug ( "Closing of sort/merger was interrupted. " + "The reading/sorting/spilling threads may still be working." , iex ) ; } } finally { // RELEASE ALL MEMORY . If the threads and channels are still running , this should cause // exceptions , because their memory segments are freed try { if ( ! this . writeMemory . isEmpty ( ) ) { this . memoryManager . release ( this . writeMemory ) ; } this . writeMemory . clear ( ) ; } catch ( Throwable t ) { } try { if ( ! this . sortReadMemory . isEmpty ( ) ) { this . memoryManager . release ( this . sortReadMemory ) ; } this . sortReadMemory . clear ( ) ; } catch ( Throwable t ) { } // we have to loop this , because it may fail with a concurrent modification exception while ( ! this . openChannels . isEmpty ( ) ) { try { for ( Iterator < BlockChannelAccess < ? , ? > > channels = this . openChannels . iterator ( ) ; channels . hasNext ( ) ; ) { final BlockChannelAccess < ? , ? > channel = channels . next ( ) ; channels . remove ( ) ; channel . closeAndDelete ( ) ; } } catch ( Throwable t ) { } } // we have to loop this , because it may fail with a concurrent modification exception while ( ! this . channelsToDeleteAtShutdown . isEmpty ( ) ) { try { for ( Iterator < Channel . ID > channels = this . channelsToDeleteAtShutdown . iterator ( ) ; channels . hasNext ( ) ; ) { final Channel . ID channel = channels . next ( ) ; channels . remove ( ) ; try { final File f = new File ( channel . getPath ( ) ) ; if ( f . exists ( ) ) { f . delete ( ) ; } } catch ( Throwable t ) { } } } catch ( Throwable t ) { } } }
public class AreaSizesL { /** * < p > Determine if an area includes another area . < / p > * < p > Inclusion is reflexive : { @ code ∀ a . includes ( a , a ) } < / p > * < p > Inclusion is transitive : { @ code ∀ a b c . includes ( a , b ) ∧ includes ( b , c ) * → includes ( a , c ) } < / p > * @ param a The containing area * @ param b The contained area * @ return { @ code true } if { @ code a } can contain { @ code b } */ public static boolean includes ( final AreaSizeL a , final AreaSizeL b ) { } }
Objects . requireNonNull ( a , "Area A" ) ; Objects . requireNonNull ( b , "Area B" ) ; return Long . compareUnsigned ( b . sizeX ( ) , a . sizeX ( ) ) <= 0 && Long . compareUnsigned ( b . sizeY ( ) , a . sizeY ( ) ) <= 0 ;
public class CmsVfsSitemapService { /** * Internal method for saving a sitemap . < p > * @ param entryPoint the URI of the sitemap to save * @ param change the change to save * @ return list of changed sitemap entries * @ throws CmsException if something goes wrong */ protected CmsSitemapChange saveInternal ( String entryPoint , CmsSitemapChange change ) throws CmsException { } }
ensureSession ( ) ; switch ( change . getChangeType ( ) ) { case clipboardOnly : // do nothing break ; case remove : change = removeEntryFromNavigation ( change ) ; break ; case undelete : change = undelete ( change ) ; break ; default : change = applyChange ( entryPoint , change ) ; } setClipboardData ( change . getClipBoardData ( ) ) ; return change ;
public class EnumMultiset { /** * Creates a new { @ code EnumMultiset } containing the specified elements . * < p > This implementation is highly efficient when { @ code elements } is itself a { @ link * Multiset } . * @ param elements the elements that the multiset should contain * @ throws IllegalArgumentException if { @ code elements } is empty */ public static < E extends Enum < E > > EnumMultiset < E > create ( Iterable < E > elements ) { } }
Iterator < E > iterator = elements . iterator ( ) ; checkArgument ( iterator . hasNext ( ) , "EnumMultiset constructor passed empty Iterable" ) ; EnumMultiset < E > multiset = new EnumMultiset < E > ( iterator . next ( ) . getDeclaringClass ( ) ) ; Iterables . addAll ( multiset , elements ) ; return multiset ;
public class AsynchronousRequest { /** * For more info on achievements groups API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / achievements / groups " > here < / a > < br / > * Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions * @ param ids list of achievement group id ( s ) * @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) } * @ throws GuildWars2Exception invalid API key * @ throws NullPointerException if given { @ link Callback } is empty * @ see AchievementGroup achievement group info */ public void getAchievementGroupInfo ( String [ ] ids , Callback < List < AchievementGroup > > callback ) throws GuildWars2Exception , NullPointerException { } }
isParamValid ( new ParamChecker ( ids ) ) ; gw2API . getAchievementGroupInfo ( processIds ( ids ) , GuildWars2 . lang . getValue ( ) ) . enqueue ( callback ) ;
public class JScreen { /** * Read from this record ' s default key . * In order to get this to work , you need to add some code like this : * < pre > * boolean bFirstChange = false ; * if ( this . getFieldList ( ) ! = null ) * if ( this . getFieldList ( ) . getEditMode ( ) = = Constants . EDIT _ ADD ) * if ( this . getFieldList ( ) . isModified ( ) = = false ) * bFirstChange = true ; * super . focusLost ( e ) ; * if ( bFirstChange ) * m _ componentNextFocus = null ; * Component component = ( Component ) e . getSource ( ) ; * String string = component . getName ( ) ; * FieldInfo field = m _ vFieldList . getFieldInfo ( string ) ; / / Get the fieldInfo for this component * if ( field ! = null ) * if ( " TestCode " . equals ( string ) ) * this . getFieldList ( ) . setKeyName ( " TestCode " ) ; * this . readKeyed ( field ) ; * < / pre > * @ return boolean success if successful ( if not , does an addnew ( ) ) */ public boolean readKeyed ( FieldInfo field ) { } }
boolean bSuccess = false ; String strValue = field . getString ( ) ; FieldList fieldList = this . getFieldList ( ) ; FieldTable fieldTable = null ; if ( fieldList != null ) fieldTable = fieldList . getTable ( ) ; if ( strValue != null ) if ( strValue . length ( ) > 0 ) if ( fieldTable != null ) { try { if ( ! ( bSuccess = fieldTable . seek ( null ) ) ) { fieldTable . addNew ( ) ; field . setString ( strValue ) ; } } catch ( Exception ex ) { this . getBaseApplet ( ) . setStatusText ( ex . getMessage ( ) , JOptionPane . ERROR_MESSAGE ) ; } } return bSuccess ;
public class PageCode { /** * Returns the VPD page name associated with the PAGE CODE { @ link # value } . * @ return the VPD page name associated with the PAGE CODE { @ link # value } */ public final VitalProductDataPageName getVitalProductDataPageName ( ) { } }
if ( value == 0x00 ) return VitalProductDataPageName . SUPPORTED_VPD_PAGES ; // mandatory if ( 0x01 <= value && value <= 0x7f ) return VitalProductDataPageName . ASCII_INFORMATION ; if ( value == 0x80 ) return VitalProductDataPageName . UNIT_SERIAL_NUMBER ; if ( value == 0x81 || value == 0x82 ) return VitalProductDataPageName . OBSOLETE ; if ( value == 0x83 ) return VitalProductDataPageName . DEVICE_IDENTIFICATION ; // mandatory if ( value == 0x84 ) return VitalProductDataPageName . SOFTWARE_INTERFACE_IDENTIFICATION ; if ( value == 0x85 ) return VitalProductDataPageName . MANAGEMENT_NETWORK_ADDRESSES ; if ( value == 0x86 ) return VitalProductDataPageName . EXTENDED_INQUIRY_DATA ; if ( value == 0x87 ) return VitalProductDataPageName . MODE_PAGE_POLICY ; if ( value == 0x88 ) return VitalProductDataPageName . SCSI_PORTS ; if ( 0x89 <= value && value <= 0xaf ) return VitalProductDataPageName . RESERVED ; if ( 0xb0 <= value && value <= 0xbf ) return VitalProductDataPageName . DEVICE_TYPE_SPECIFIC ; else return VitalProductDataPageName . VENDOR_SPECIFIC ;
public class WRepeater { /** * Remember the list of beans that hold the data object for each row . * @ param beanList the list of data objects for each row . */ public void setBeanList ( final List beanList ) { } }
RepeaterModel model = getOrCreateComponentModel ( ) ; model . setData ( beanList ) ; // Clean up any stale data . HashSet rowIds = new HashSet ( beanList . size ( ) ) ; for ( Object bean : beanList ) { rowIds . add ( getRowId ( bean ) ) ; } cleanupStaleContexts ( rowIds ) ; // Clean up cached component IDs UIContext uic = UIContextHolder . getCurrent ( ) ; if ( uic != null && getRepeatRoot ( ) != null ) { clearScratchMaps ( this ) ; }
public class ModeUtil { /** * translate a octal mode value ( 73 ) to a string representation ( " 111 " ) * @ param strMode * @ return */ public static String toStringMode ( int octalMode ) { } }
String str = Integer . toString ( octalMode , 8 ) ; while ( str . length ( ) < 3 ) str = "0" + str ; return str ;
public class Utils { /** * Read all data from the given reader into a buffer and return it as a single String . * If an I / O error occurs while reading the reader , it is passed through to the caller . * The reader is closed when before returning . * @ param reader Open character reader . * @ return All characters read from reader accumulated as a single String . * @ throws IOException If an error occurs reading from the reader . */ public static String readerToString ( Reader reader ) throws IOException { } }
assert reader != null ; StringWriter strWriter = new StringWriter ( ) ; char [ ] buffer = new char [ 65536 ] ; int charsRead = reader . read ( buffer ) ; while ( charsRead > 0 ) { strWriter . write ( buffer , 0 , charsRead ) ; charsRead = reader . read ( buffer ) ; } reader . close ( ) ; return strWriter . toString ( ) ;
public class ReplicationInternal { /** * Fire a trigger to the state machine */ protected void fireTrigger ( final ReplicationTrigger trigger ) { } }
Log . d ( Log . TAG_SYNC , "%s [fireTrigger()] => " + trigger , this ) ; // All state machine triggers need to happen on the replicator thread synchronized ( executor ) { if ( ! executor . isShutdown ( ) ) { executor . submit ( new Runnable ( ) { @ Override public void run ( ) { try { Log . d ( Log . TAG_SYNC , "firing trigger: %s" , trigger ) ; stateMachine . fire ( trigger ) ; } catch ( Exception e ) { Log . i ( Log . TAG_SYNC , "Error in StateMachine.fire(trigger): %s" , e . getMessage ( ) ) ; throw new RuntimeException ( e ) ; } } } ) ; } }
public class Server { public static void main ( String [ ] arg ) { } }
String [ ] dftConfig = { "etc/jetty.xml" } ; if ( arg . length == 0 ) { log . info ( "Using default configuration: etc/jetty.xml" ) ; arg = dftConfig ; } final Server [ ] servers = new Server [ arg . length ] ; // create and start the servers . for ( int i = 0 ; i < arg . length ; i ++ ) { try { servers [ i ] = new Server ( arg [ i ] ) ; servers [ i ] . setStopAtShutdown ( true ) ; servers [ i ] . start ( ) ; } catch ( Exception e ) { log . warn ( LogSupport . EXCEPTION , e ) ; } } // create and start the servers . for ( int i = 0 ; i < arg . length ; i ++ ) { try { servers [ i ] . join ( ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } }
public class MethodAnnotation { /** * Factory method to create a MethodAnnotation from the method the given * visitor is currently visiting . * @ param visitor * the BetterVisitor currently visiting the method */ public static MethodAnnotation fromVisitedMethod ( PreorderVisitor visitor ) { } }
String className = visitor . getDottedClassName ( ) ; MethodAnnotation result = new MethodAnnotation ( className , visitor . getMethodName ( ) , visitor . getMethodSig ( ) , visitor . getMethod ( ) . isStatic ( ) ) ; // Try to find the source lines for the method SourceLineAnnotation srcLines = SourceLineAnnotation . fromVisitedMethod ( visitor ) ; result . setSourceLines ( srcLines ) ; return result ;
public class TableMapLogEvent { /** * Decode field metadata by column types . * @ see mysql - 5.1.60 / sql / rpl _ utility . h */ private final void decodeFields ( LogBuffer buffer , final int len ) { } }
final int limit = buffer . limit ( ) ; buffer . limit ( len + buffer . position ( ) ) ; for ( int i = 0 ; i < columnCnt ; i ++ ) { ColumnInfo info = columnInfo [ i ] ; switch ( info . type ) { case MYSQL_TYPE_TINY_BLOB : case MYSQL_TYPE_BLOB : case MYSQL_TYPE_MEDIUM_BLOB : case MYSQL_TYPE_LONG_BLOB : case MYSQL_TYPE_DOUBLE : case MYSQL_TYPE_FLOAT : case MYSQL_TYPE_GEOMETRY : case MYSQL_TYPE_JSON : /* * These types store a single byte . */ info . meta = buffer . getUint8 ( ) ; break ; case MYSQL_TYPE_SET : case MYSQL_TYPE_ENUM : /* * log _ event . h : MYSQL _ TYPE _ SET & MYSQL _ TYPE _ ENUM : This * enumeration value is only used internally and cannot * exist in a binlog . */ logger . warn ( "This enumeration value is only used internally " + "and cannot exist in a binlog: type=" + info . type ) ; break ; case MYSQL_TYPE_STRING : { /* * log _ event . h : The first byte is always * MYSQL _ TYPE _ VAR _ STRING ( i . e . , 253 ) . The second byte is the * field size , i . e . , the number of bytes in the * representation of size of the string : 3 or 4. */ int x = ( buffer . getUint8 ( ) << 8 ) ; // real _ type x += buffer . getUint8 ( ) ; // pack or field length info . meta = x ; break ; } case MYSQL_TYPE_BIT : info . meta = buffer . getUint16 ( ) ; break ; case MYSQL_TYPE_VARCHAR : /* * These types store two bytes . */ info . meta = buffer . getUint16 ( ) ; break ; case MYSQL_TYPE_NEWDECIMAL : { int x = buffer . getUint8 ( ) << 8 ; // precision x += buffer . getUint8 ( ) ; // decimals info . meta = x ; break ; } case MYSQL_TYPE_TIME2 : case MYSQL_TYPE_DATETIME2 : case MYSQL_TYPE_TIMESTAMP2 : { info . meta = buffer . getUint8 ( ) ; break ; } default : info . meta = 0 ; break ; } } buffer . limit ( limit ) ;
public class AliasStrings { /** * Looks up the { @ link StringInfo } object for a JavaScript string . Creates * it if necessary . */ private StringInfo getOrCreateStringInfo ( String string ) { } }
StringInfo info = stringInfoMap . get ( string ) ; if ( info == null ) { info = new StringInfo ( stringInfoMap . size ( ) ) ; stringInfoMap . put ( string , info ) ; } return info ;
public class BundlesHandlerFactory { /** * Initialize the resource bundles from the mapping file */ private void initResourceBundlesFromFullMapping ( List < JoinableResourceBundle > resourceBundles ) { } }
if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Building bundles from the full bundle mapping. Only modified bundles will be processed." ) ; } Properties mappingProperties = resourceBundleHandler . getJawrBundleMapping ( ) ; FullMappingPropertiesBasedBundlesHandlerFactory factory = new FullMappingPropertiesBasedBundlesHandlerFactory ( resourceType , resourceReaderHandler , jawrConfig . getGeneratorRegistry ( ) , chainFactory ) ; resourceBundles . addAll ( factory . getResourceBundles ( mappingProperties ) ) ;
public class HasManyModel { /** * Adds the object to the child ids list . * @ param child The child to be added . * @ throws com . mauriciogiordano . easydb . exception . NoContextFoundException in case of null context . */ public void addChild ( C child ) { } }
SharedPreferences prefs = loadSharedPreferences ( "children" ) ; List < String > objects = getChildrenList ( ) ; Model toPut = ( Model ) child ; if ( objects . indexOf ( toPut . getId ( ) ) != ArrayUtils . INDEX_NOT_FOUND ) { return ; } objects . add ( toPut . getId ( ) ) ; toPut . save ( ) ; prefs . edit ( ) . putString ( String . valueOf ( getId ( ) ) , StringUtils . join ( objects , "," ) ) . commit ( ) ;
public class LinkUtil { /** * Builds a mapped link to the path ( resource path ) with optional selectors and extension . * @ param request the request context for path mapping ( the result is always mapped ) * @ param url the URL to use ( complete ) or the path to an addressed resource ( without any extension ) * @ param selectors an optional selector string with all necessary selectors ( can be ' null ' ) * @ param extension an optional extension ( can be ' null ' for extension determination ) * @ return the mapped url for the referenced resource */ public static String getUrl ( SlingHttpServletRequest request , String url , String selectors , String extension ) { } }
LinkMapper mapper = ( LinkMapper ) request . getAttribute ( LinkMapper . LINK_MAPPER_REQUEST_ATTRIBUTE ) ; return getUrl ( request , url , selectors , extension , mapper != null ? mapper : LinkMapper . RESOLVER ) ;
public class Code { /** * Assigns { @ code target } to a newly allocated array of length { @ code * length } . The array ' s type is the same as { @ code target } ' s type . */ public < T > void newArray ( Local < T > target , Local < Integer > length ) { } }
addInstruction ( new ThrowingCstInsn ( Rops . opNewArray ( target . type . ropType ) , sourcePosition , RegisterSpecList . make ( length . spec ( ) ) , catches , target . type . constant ) ) ; moveResult ( target , true ) ;
public class InstanceInformationFilterMarshaller { /** * Marshall the given parameter object . */ public void marshall ( InstanceInformationFilter instanceInformationFilter , ProtocolMarshaller protocolMarshaller ) { } }
if ( instanceInformationFilter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( instanceInformationFilter . getKey ( ) , KEY_BINDING ) ; protocolMarshaller . marshall ( instanceInformationFilter . getValueSet ( ) , VALUESET_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CsvReader { /** * parse cvs * @ param cellConsumer the consumer that the parser will callback * @ param < CC > the cell consumer type * @ throws java . io . IOException if an io error occurs * @ return the cell consumer */ public < CC extends CellConsumer > CC parseAll ( CC cellConsumer ) throws IOException { } }
_parseAll ( wrapConsumer ( cellConsumer ) , false ) ; return cellConsumer ;
public class ProxyReceiveListener { /** * This method will process a schema received from our peer ' s MFP compoennt . * At the moment this consists of contacting MFP here on the client and * giving it the schema . Schemas are received when the ME is about to send * us a message and realises that we don ' t have the necessary schema to decode * it . A High priority message is then sent ahead of the data ensuring that * by the time the message is received the schema will be understood . * @ param buffer * @ param conversation */ private void processSchema ( CommsByteBuffer buffer , Conversation conversation ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "processSchema" , new Object [ ] { buffer , conversation } ) ; ClientConversationState convState = ( ClientConversationState ) conversation . getAttachment ( ) ; byte [ ] mfpDataAsBytes = buffer . getRemaining ( ) ; // Get hold of the CommsConnection associated with this conversation CommsConnection cc = convState . getCommsConnection ( ) ; // Get hold of MFP Singleton and pass it the schema try { // Get hold of product version final HandshakeProperties handshakeGroup = conversation . getHandshakeProperties ( ) ; final int productVersion = handshakeGroup . getMajorVersion ( ) ; // Get hold of MFP and inform it of the schema CompHandshake ch = ( CompHandshake ) CompHandshakeFactory . getInstance ( ) ; ch . compData ( cc , productVersion , mfpDataAsBytes ) ; } catch ( Exception e1 ) { FFDCFilter . processException ( e1 , CLASS_NAME + ".processSchema" , CommsConstants . PROXYRECEIVELISTENER_PROCESSSCHEMA_01 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "MFP unable to create CompHandshake Singleton" , e1 ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "processSchema" ) ;
public class HalResource { /** * Adds links for the given relation * @ param relation Link relation * @ param links Links to add * @ return HAL resource */ public HalResource addLinks ( String relation , Iterable < Link > links ) { } }
return addLinks ( relation , Iterables . toArray ( links , Link . class ) ) ;
public class ObjectUtils { /** * < p > Null safe comparison of Comparables . < / p > * @ param < T > type of the values processed by this method * @ param values the set of comparable values , may be null * @ return * < ul > * < li > If any objects are non - null and unequal , the greater object . * < li > If all objects are non - null and equal , the first . * < li > If any of the comparables are null , the greater of the non - null objects . * < li > If all the comparables are null , null is returned . * < / ul > */ @ SafeVarargs public static < T extends Comparable < ? super T > > T max ( final T ... values ) { } }
T result = null ; if ( values != null ) { for ( final T value : values ) { if ( compare ( value , result , false ) > 0 ) { result = value ; } } } return result ;
public class FindClassCircularDependencies { /** * returns a set of dependent class names for a class , and if it doesn ' t exist create the set install it , and then return ; * @ param clsName * the class for which you are trying to get dependencies * @ return the active set of classes that are dependent on the specified class */ private Set < String > getDependenciesForClass ( String clsName ) { } }
Set < String > dependencies = dependencyGraph . get ( clsName ) ; if ( dependencies == null ) { dependencies = new HashSet < > ( ) ; dependencyGraph . put ( clsName , dependencies ) ; } return dependencies ;
public class AbstractRuntimeOnlyHandler { /** * Simply adds a { @ link org . jboss . as . controller . OperationContext . Stage # RUNTIME } step that calls * { @ link # executeRuntimeStep ( OperationContext , ModelNode ) } . * { @ inheritDoc } */ @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { } }
if ( requiresRuntime ( context ) && ! isProfile ( context ) ) { context . addStep ( new OperationStepHandler ( ) { @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { // make sure the resource exists before executing a runtime operation . // if that ' s not the case , the operation will report an error with a comprehensive failure // description instead of a subsequent exception ( such as a NPE ) . if ( resourceMustExist ( context , operation ) ) { context . readResource ( PathAddress . EMPTY_ADDRESS , false ) ; } executeRuntimeStep ( context , operation ) ; } } , OperationContext . Stage . RUNTIME ) ; }
public class EdgeLabel { /** * remove a vertex label from the in collection * @ param lbl the vertex label * @ param preserveData should we keep the sql data ? */ void removeInVertexLabel ( VertexLabel lbl , boolean preserveData ) { } }
this . uncommittedRemovedInVertexLabels . add ( lbl ) ; if ( ! preserveData ) { deleteColumn ( lbl . getFullName ( ) + Topology . IN_VERTEX_COLUMN_END ) ; }
public class ScriptfileUtils { /** * Set the executable flag on a file if supported by the OS * @ param scriptfile target file * @ throws IOException if an error occurs */ public static void setExecutePermissions ( final File scriptfile ) throws IOException { } }
if ( ! scriptfile . setExecutable ( true , true ) ) { System . err . println ( "Unable to set executable bit on temp script file, execution may fail: " + scriptfile . getAbsolutePath ( ) ) ; }
public class AnnotationPosition { /** * Tokenizes as little of the { @ code tree } as possible to ensure we grab all the annotations . */ private static ImmutableList < ErrorProneToken > annotationTokens ( Tree tree , VisitorState state , int annotationEnd ) { } }
int endPos ; if ( tree instanceof JCMethodDecl ) { JCMethodDecl methodTree = ( JCMethodDecl ) tree ; endPos = methodTree . getBody ( ) == null ? state . getEndPosition ( methodTree ) : methodTree . getBody ( ) . getStartPosition ( ) ; } else if ( tree instanceof JCVariableDecl ) { endPos = ( ( JCVariableDecl ) tree ) . getType ( ) . getStartPosition ( ) ; } else if ( tree instanceof JCClassDecl ) { JCClassDecl classTree = ( JCClassDecl ) tree ; endPos = classTree . getMembers ( ) . isEmpty ( ) ? state . getEndPosition ( classTree ) : classTree . getMembers ( ) . get ( 0 ) . getStartPosition ( ) ; } else { throw new AssertionError ( ) ; } return ErrorProneTokens . getTokens ( state . getSourceCode ( ) . subSequence ( annotationEnd , endPos ) . toString ( ) , state . context ) ;
public class StringUtilities { /** * Prints the character codes for the given string . * @ param s The string to be printed */ public static void printCharacters ( String s ) { } }
if ( s != null ) { logger . info ( "string length=" + s . length ( ) ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; logger . info ( "char[" + i + "]=" + c + " (" + ( int ) c + ")" ) ; } }
public class Stat { /** * See the class documentation . */ public static void main ( String [ ] args ) throws IOException { } }
if ( args . length == 0 || args [ 0 ] . equals ( "--help" ) ) { help ( ) ; return ; } if ( args [ 0 ] . equals ( "--list" ) ) { listFilesystems ( ) ; return ; } if ( args [ 0 ] . equals ( "--check" ) ) { checkGcs ( ) ; return ; } for ( String a : args ) { statFile ( a ) ; }
public class FluentValidator { /** * 如果验证器是一个 { @ link ValidatorHandler } 实例 , 那么可以通过 { @ link ValidatorHandler # compose ( FluentValidator , ValidatorContext , Object ) } * 方法增加一些验证逻辑 * @ param v 验证器 * @ param t 待验证对象 */ private < T > void composeIfPossible ( Validator < T > v , T t ) { } }
final FluentValidator self = this ; if ( v instanceof ValidatorHandler ) { ( ( ValidatorHandler ) v ) . compose ( self , context , t ) ; }
public class ListenerHelper { /** * You cannot invokeAsyncErrorHandling from more than one thread at a time * because we retrieve the error handling lock . Once that lock is retrieved * another thread cannot call complete or dispatch . Those calls will be ignored . * If complete or dispatch happens to get called right before we retrieve the lock , * but after the timeout or whatever occured , we will not do anything here because of * the check to isCompleted , etc . */ private static void _invokeAsyncErrorHandling ( AsyncContext asyncContext , WebContainerRequestState reqState , Throwable th , AsyncListenerEnum asyncEnum , ExecuteNextRunnable executeNextRunnable ) { } }
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) logger . entering ( CLASS_NAME , "_invokeAsyncErrorHandling" , new Object [ ] { asyncContext , reqState , th , asyncEnum } ) ; try { ServletRequest servletRequest = asyncContext . getRequest ( ) ; ServletResponse servletResponse = asyncContext . getResponse ( ) ; IExtendedRequest wasreq = ( IExtendedRequest ) ServletUtil . unwrapRequest ( servletRequest ) ; HttpServletResponse httpRes = ( HttpServletResponse ) ServletUtil . unwrapResponse ( servletResponse , HttpServletResponse . class ) ; IServletContext iServletContext = asyncContext . getWebApp ( ) ; ICollaboratorHelper collabHelper = ( ( IServletContextExtended ) iServletContext ) . getCollaboratorHelper ( ) ; WebComponentMetaData componentMetaData = iServletContext . getWebAppCmd ( ) ; WebAppDispatcherContext dispatchContext = ( WebAppDispatcherContext ) wasreq . getWebAppDispatcherContext ( ) ; CollaboratorMetaDataImpl collabMetaData = new CollaboratorMetaDataImpl ( componentMetaData , wasreq , httpRes , dispatchContext , null , iServletContext , null ) ; try { collabHelper . preInvokeCollaborators ( collabMetaData , CollaboratorHelper . allCollabEnum ) ; List < AsyncListenerEntry > list = asyncContext . getAsyncListenerEntryList ( ) ; if ( list != null ) { // If there are other listeners : // Give weld or other registered listeners the chance to add a listener to the end of the list . try { if ( ( ( AsyncContextImpl ) asyncContext ) . registerPostEventAsyncListeners ( ) ) { // then refresh the list to allow for the added ones . list = asyncContext . getAsyncListenerEntryList ( ) ; } } catch ( java . lang . ClassCastException exc ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) logger . fine ( "_invokeAsyncErrorHandling cannot cast AsyncContext to an impl class so post event Asynclistenrs will not be registered" ) ; } for ( AsyncListenerEntry entry : list ) { try { if ( asyncEnum == AsyncListenerEnum . ERROR ) entry . invokeOnError ( th ) ; else entry . invokeOnTimeout ( ) ; } catch ( Throwable throwable ) { LoggerHelper . logParamsAndException ( logger , Level . WARNING , CLASS_NAME , "_invokeAsyncErrorHandling" , "exception.invoking.async.listener" , new Object [ ] { entry . getAsyncListener ( ) } , throwable ) ; } } } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . logp ( Level . FINEST , CLASS_NAME , "_invokeAsyncErrorHandling" , "vals after listeners [asyncContext.isComplete(),asyncContext.isCompletePending(),asyncContext.isDispatchPending()]->[" + asyncContext . isComplete ( ) + "," + asyncContext . isCompletePending ( ) + "," + asyncContext . isDispatchPending ( ) + "]" ) ; } // only invoke sendError if we didn ' t complete or dispatch from the listeners if ( ! asyncContext . isComplete ( ) && ! asyncContext . isCompletePending ( ) && ! asyncContext . isDispatchPending ( ) ) { if ( th != null ) { ServletErrorReport ser ; if ( ! ( th instanceof ServletErrorReport ) ) { ser = new ServletErrorReport ( th ) ; } else { ser = ( ServletErrorReport ) th ; } ser . setErrorCode ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR ) ; asyncContext . getWebApp ( ) . sendError ( wasreq , httpRes , ser ) ; } else { // TODO : change this to webApp send error or something else that will prevent IllegalstateException from being thrown IExtendedRequest iExtendedRequest = ServletUtil . unwrapRequest ( servletRequest , IExtendedRequest . class ) ; iExtendedRequest . getWebAppDispatcherContext ( ) . sendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , nls . getFormattedMessage ( "error.occurred.during.async.servlet.handling" , new Object [ ] { asyncEnum } , asyncEnum + " occurred during async handling" ) , true ) ; } } } finally { collabHelper . postInvokeCollaborators ( collabMetaData , CollaboratorHelper . allCollabEnum ) ; } } catch ( Throwable throwable ) { logger . logp ( Level . WARNING , CLASS_NAME , "_invokeAsyncErrorHandling" , "exception.invoking.asnyc.error.mechanism" , throwable ) ; } finally { // if we still haven ' t completed or dispatched , complete now if ( ! asyncContext . isComplete ( ) && ! asyncContext . isCompletePending ( ) && ! asyncContext . isDispatchPending ( ) ) asyncContext . complete ( ) ; asyncContext . executeNextRunnable ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) logger . exiting ( CLASS_NAME , "_invokeAsyncErrorHandling" , asyncContext ) ; }
public class KnowledgeBuilderImpl { /** * Load a rule package from XML source . * @ param reader * @ throws DroolsParserException * @ throws IOException */ public void addPackageFromXml ( final Reader reader ) throws DroolsParserException , IOException { } }
this . resource = new ReaderResource ( reader , ResourceType . XDRL ) ; final XmlPackageReader xmlReader = new XmlPackageReader ( this . configuration . getSemanticModules ( ) ) ; xmlReader . getParser ( ) . setClassLoader ( this . rootClassLoader ) ; try { xmlReader . read ( reader ) ; } catch ( final SAXException e ) { throw new DroolsParserException ( e . toString ( ) , e . getCause ( ) ) ; } addPackage ( xmlReader . getPackageDescr ( ) ) ; this . resource = null ;
public class ScriptableObject { /** * Returns true if the named property is defined as a const on this object . * @ param name * @ return true if the named property is defined as a const , false * otherwise . */ @ Override public boolean isConst ( String name ) { } }
Slot slot = slotMap . query ( name , 0 ) ; if ( slot == null ) { return false ; } return ( slot . getAttributes ( ) & ( PERMANENT | READONLY ) ) == ( PERMANENT | READONLY ) ;
public class APMSpan { /** * This method initialises the span based on a ' child - of ' relationship . * @ param builder The span builder * @ param ref The ' child - of ' relationship */ protected void initChildOf ( APMSpanBuilder builder , Reference ref ) { } }
APMSpan parent = ( APMSpan ) ref . getReferredTo ( ) ; if ( parent . getNodeBuilder ( ) != null ) { nodeBuilder = new NodeBuilder ( parent . getNodeBuilder ( ) ) ; traceContext = parent . traceContext ; // As it is not possible to know if a tag has been set after span // creation , we use this situation to check if the parent span // has the ' transaction . name ' specified , to set on the trace // context . This is required in case a child span is used to invoke // another service ( and needs to propagate the transaction // name ) . if ( parent . getTags ( ) . containsKey ( Constants . PROP_TRANSACTION_NAME ) && traceContext . getTransaction ( ) == null ) { traceContext . setTransaction ( parent . getTags ( ) . get ( Constants . PROP_TRANSACTION_NAME ) . toString ( ) ) ; } } processRemainingReferences ( builder , ref ) ;
public class DescribeStaleSecurityGroupsResult { /** * Information about the stale security groups . * @ param staleSecurityGroupSet * Information about the stale security groups . */ public void setStaleSecurityGroupSet ( java . util . Collection < StaleSecurityGroup > staleSecurityGroupSet ) { } }
if ( staleSecurityGroupSet == null ) { this . staleSecurityGroupSet = null ; return ; } this . staleSecurityGroupSet = new com . amazonaws . internal . SdkInternalList < StaleSecurityGroup > ( staleSecurityGroupSet ) ;
public class JavaMailBuilder { /** * Set charset to use for email body . * You can specify a direct value . For example : * < pre > * . charset ( " UTF - 8 " ) ; * < / pre > * You can also specify one or several property keys . For example : * < pre > * . charset ( " $ { custom . property . high - priority } " , " $ { custom . property . low - priority } " ) ; * < / pre > * The properties are not immediately evaluated . The evaluation will be done * when the { @ link # build ( ) } method is called . * If you provide several property keys , evaluation will be done on the * first key and if the property exists ( see { @ link EnvironmentBuilder } ) , * its value is used . If the first property doesn ' t exist in properties , * then it tries with the second one and so on . * @ param charsets * one value , or one or several property keys * @ return this instance for fluent chaining */ public JavaMailBuilder charset ( String ... charsets ) { } }
for ( String c : charsets ) { if ( c != null ) { this . charsets . add ( c ) ; } } return this ;
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getBDAFlags ( ) { } }
if ( bdaFlagsEEnum == null ) { bdaFlagsEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 1 ) ; } return bdaFlagsEEnum ;
public class NotionalTokenizer { /** * 切分为句子形式 * @ param text * @ return */ public static List < List < Term > > seg2sentence ( String text ) { } }
List < List < Term > > sentenceList = SEGMENT . seg2sentence ( text ) ; for ( List < Term > sentence : sentenceList ) { ListIterator < Term > listIterator = sentence . listIterator ( ) ; while ( listIterator . hasNext ( ) ) { if ( ! CoreStopWordDictionary . shouldInclude ( listIterator . next ( ) ) ) { listIterator . remove ( ) ; } } } return sentenceList ;
public class FloatBuffer { /** * Returns a duplicated buffer that shares its content with this buffer . * < p > The duplicated buffer ' s position , limit , capacity and mark are the same as this buffer . * The duplicated buffer ' s read - only property and byte order are same as this buffer too . < / p > * < p > The new buffer shares its content with this buffer , which means either buffer ' s change * of content will be visible to the other . The two buffer ' s position , limit and mark are * independent . < / p > * @ return a duplicated buffer that shares its content with this buffer . */ public FloatBuffer duplicate ( ) { } }
FloatBuffer buf = new FloatBuffer ( byteBuffer . duplicate ( ) ) ; buf . limit = limit ; buf . position = position ; buf . mark = mark ; return buf ;
public class JsJmsStreamMessageImpl { /** * Write a float value into the payload Stream . * Javadoc description supplied by JsJmsMessage interface . */ public void writeFloat ( float value ) throws UnsupportedEncodingException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeFloat" , new Float ( value ) ) ; getBodyList ( ) . add ( new Float ( value ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "writeFloat" ) ;
public class ZonedDateTimeIteratorFactory { /** * given a block of RRULE , EXRULE , RDATE , and EXDATE content lines , parse * them into a single date time iterator . * @ param rdata RRULE , EXRULE , RDATE , and EXDATE lines . * @ param start the first occurrence of the series . * @ param tzid the local timezone - - used to interpret start and any dates in * RDATE and EXDATE lines that don ' t have TZID params . * @ param strict true if any failure to parse should result in a * ParseException . false causes bad content lines to be logged and ignored . */ public static ZonedDateTimeIterator createDateTimeIterator ( String rdata , ZonedDateTime start , ZoneId tzid , boolean strict ) throws ParseException { } }
return new RecurrenceIteratorWrapper ( RecurrenceIteratorFactory . createRecurrenceIterator ( rdata , zonedDateTimeToDateValue ( start . withZoneSameInstant ( tzid ) ) , TimeZoneConverter . toTimeZone ( tzid ) , strict ) ) ;
public class AttributeCollector { /** * Internal method used to see if we can expand the buffer that * the array decoder has . Bit messy , but simpler than having * separately typed instances ; and called rarely so that performance * downside of instanceof is irrelevant . */ private final static boolean checkExpand ( TypedArrayDecoder tad ) { } }
if ( tad instanceof ValueDecoderFactory . BaseArrayDecoder ) { ( ( ValueDecoderFactory . BaseArrayDecoder ) tad ) . expand ( ) ; return true ; } return false ;
public class AdGroupBidModifier { /** * Gets the bidModifierSource value for this AdGroupBidModifier . * @ return bidModifierSource * Bid modifier source . * < span class = " constraint ReadOnly " > This field is read * only and will be ignored when sent to the API . < / span > */ public com . google . api . ads . adwords . axis . v201809 . cm . BidModifierSource getBidModifierSource ( ) { } }
return bidModifierSource ;
public class TargetPoolClient { /** * Removes health check URL from a target pool . * < p > Sample code : * < pre > < code > * try ( TargetPoolClient targetPoolClient = TargetPoolClient . create ( ) ) { * ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ TARGET _ POOL ] " ) ; * TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = TargetPoolsRemoveHealthCheckRequest . newBuilder ( ) . build ( ) ; * Operation response = targetPoolClient . removeHealthCheckTargetPool ( targetPool . toString ( ) , targetPoolsRemoveHealthCheckRequestResource ) ; * < / code > < / pre > * @ param targetPool Name of the target pool to remove health checks from . * @ param targetPoolsRemoveHealthCheckRequestResource * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation removeHealthCheckTargetPool ( String targetPool , TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource ) { } }
RemoveHealthCheckTargetPoolHttpRequest request = RemoveHealthCheckTargetPoolHttpRequest . newBuilder ( ) . setTargetPool ( targetPool ) . setTargetPoolsRemoveHealthCheckRequestResource ( targetPoolsRemoveHealthCheckRequestResource ) . build ( ) ; return removeHealthCheckTargetPool ( request ) ;
public class PerformanceUtils { /** * Get cpu core number * @ return int cpu core number */ public static int getNumCores ( ) { } }
class CpuFilter implements FileFilter { @ Override public boolean accept ( File pathname ) { return Pattern . matches ( "cpu[0-9]" , pathname . getName ( ) ) ; } } if ( sCoreNum == 0 ) { try { // Get directory containing CPU info File dir = new File ( "/sys/devices/system/cpu/" ) ; // Filter to only list the devices we care about File [ ] files = dir . listFiles ( new CpuFilter ( ) ) ; // Return the number of cores ( virtual CPU devices ) sCoreNum = files . length ; } catch ( Exception e ) { Log . e ( TAG , "getNumCores exception" , e ) ; sCoreNum = 1 ; } } return sCoreNum ;
public class IndexImage { /** * Converts the input image ( must be { @ code TYPE _ INT _ RGB } or * { @ code TYPE _ INT _ ARGB } ) to an indexed image . Generating an adaptive * palette with the given number of colors . * Dithering , transparency and color selection is controlled with the * { @ code pHints } parameter . * The image returned is a new image , the input image is not modified . * @ param pImage the BufferedImage to index * @ param pNumberOfColors the number of colors for the image * @ param pHints hints that control output quality and speed . * @ return the indexed BufferedImage . The image will be of type * { @ code BufferedImage . TYPE _ BYTE _ INDEXED } or * { @ code BufferedImage . TYPE _ BYTE _ BINARY } , and use an * { @ code IndexColorModel } . * @ see # DITHER _ DIFFUSION * @ see # DITHER _ NONE * @ see # COLOR _ SELECTION _ FAST * @ see # COLOR _ SELECTION _ QUALITY * @ see # TRANSPARENCY _ OPAQUE * @ see # TRANSPARENCY _ BITMASK * @ see BufferedImage # TYPE _ BYTE _ INDEXED * @ see BufferedImage # TYPE _ BYTE _ BINARY * @ see IndexColorModel */ public static BufferedImage getIndexedImage ( BufferedImage pImage , int pNumberOfColors , int pHints ) { } }
return getIndexedImage ( pImage , pNumberOfColors , null , pHints ) ;
public class GraphHopper { /** * Sets the graphhopper folder . */ public GraphHopper setGraphHopperLocation ( String ghLocation ) { } }
ensureNotLoaded ( ) ; if ( ghLocation == null ) throw new IllegalArgumentException ( "graphhopper location cannot be null" ) ; this . ghLocation = ghLocation ; return this ;
public class ResourceSkusInner { /** * Gets the list of Microsoft . CognitiveServices SKUs available for your Subscription . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; ResourceSkuInner & gt ; object */ public Observable < Page < ResourceSkuInner > > listNextAsync ( final String nextPageLink ) { } }
return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < ResourceSkuInner > > , Page < ResourceSkuInner > > ( ) { @ Override public Page < ResourceSkuInner > call ( ServiceResponse < Page < ResourceSkuInner > > response ) { return response . body ( ) ; } } ) ;
public class ElementRule { /** * Validate the occurrence of this IMolecularFormula . * @ param formula Parameter is the IMolecularFormula * @ return An ArrayList containing 9 elements in the order described above */ @ Override public double validate ( IMolecularFormula formula ) throws CDKException { } }
logger . info ( "Start validation of " , formula ) ; ensureDefaultOccurElements ( formula . getBuilder ( ) ) ; double isValid = 1.0 ; Iterator < IElement > itElem = MolecularFormulaManipulator . elements ( formula ) . iterator ( ) ; while ( itElem . hasNext ( ) ) { IElement element = itElem . next ( ) ; int occur = MolecularFormulaManipulator . getElementCount ( formula , element ) ; IIsotope elemIsotope = formula . getBuilder ( ) . newInstance ( IIsotope . class , element . getSymbol ( ) ) ; if ( ( occur < mfRange . getIsotopeCountMin ( elemIsotope ) ) || ( occur > mfRange . getIsotopeCountMax ( elemIsotope ) ) ) { isValid = 0.0 ; break ; } } return isValid ;
public class ClassVisitor { /** * Determine the types label to be applied to a class node . * @ param flags * The access flags . * @ return The types label . */ private Class < ? extends ClassFileDescriptor > getJavaType ( int flags ) { } }
if ( hasFlag ( flags , Opcodes . ACC_ANNOTATION ) ) { return AnnotationTypeDescriptor . class ; } else if ( hasFlag ( flags , Opcodes . ACC_ENUM ) ) { return EnumTypeDescriptor . class ; } else if ( hasFlag ( flags , Opcodes . ACC_INTERFACE ) ) { return InterfaceTypeDescriptor . class ; } return ClassTypeDescriptor . class ;
public class DropboxClient { /** * Move file from specified source to specified target . * @ param from source * @ param to target * @ return metadata of target file * @ see Entry */ public Entry move ( String from , String to ) { } }
OAuthRequest request = new OAuthRequest ( Verb . GET , FILE_OPS_MOVE_URL ) ; request . addQuerystringParameter ( "root" , "dropbox" ) ; request . addQuerystringParameter ( "from_path" , encode ( from ) ) ; request . addQuerystringParameter ( "to_path" , encode ( to ) ) ; service . signRequest ( accessToken , request ) ; String content = checkMove ( request . send ( ) ) . getBody ( ) ; return Json . parse ( content , Entry . class ) ;
public class KeyVaultClientBaseImpl { /** * Imports a certificate into a specified key vault . * Imports an existing valid certificate , containing a private key , into Azure Key Vault . The certificate to be imported can be in either PFX or PEM format . If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates . This operation requires the certificates / import permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param certificateName The name of the certificate . * @ param base64EncodedCertificate Base64 encoded representation of the certificate object to import . This certificate needs to contain the private key . * @ param password If the private key in base64EncodedCertificate is encrypted , the password used for encryption . * @ param certificatePolicy The management policy for the certificate . * @ param certificateAttributes The attributes of the certificate ( optional ) . * @ param tags Application specific metadata in the form of key - value pairs . * @ 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 < CertificateBundle > importCertificateAsync ( String vaultBaseUrl , String certificateName , String base64EncodedCertificate , String password , CertificatePolicy certificatePolicy , CertificateAttributes certificateAttributes , Map < String , String > tags , final ServiceCallback < CertificateBundle > serviceCallback ) { } }
return ServiceFuture . fromResponse ( importCertificateWithServiceResponseAsync ( vaultBaseUrl , certificateName , base64EncodedCertificate , password , certificatePolicy , certificateAttributes , tags ) , serviceCallback ) ;