signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ExtensionHookView { /** * Adds the given { @ link AbstractPanel } to the view hook , to be later added to the
* { @ link org . parosproxy . paros . view . WorkbenchPanel WorkbenchPanel } as a
* { @ link org . parosproxy . paros . view . WorkbenchPanel . PanelType # STATUS status } panel .
* @ param panel the panel that will be added to the { @ code WorkbenchPanel } .
* @ see org . parosproxy . paros . view . View # getWorkbench ( ) */
public void addStatusPanel ( AbstractPanel panel ) { } } | if ( statusPanelList == null ) { statusPanelList = createList ( ) ; } statusPanelList . add ( panel ) ; |
public class PrcEntitySave { /** * < p > Process entity request . < / p >
* @ param pAddParam additional param , e . g . return this line ' s
* document in " nextEntity " for farther process
* @ param pRequestData Request Data
* @ param pEntity Entity to process
* @ return Entity processed for farther process or null
* @ throws Exception - an exception */
@ Override public final T process ( final Map < String , Object > pAddParam , final T pEntity , final IRequestData pRequestData ) throws Exception { } } | if ( pEntity . getIsNew ( ) ) { this . srvOrm . insertEntity ( pAddParam , pEntity ) ; pEntity . setIsNew ( false ) ; } else { this . srvOrm . updateEntity ( pAddParam , pEntity ) ; } return pEntity ; |
public class TagsInner { /** * Creates a tag value . The name of the tag must already exist .
* @ param tagName The name of the tag .
* @ param tagValue The value of the tag to create .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TagValueInner object */
public Observable < TagValueInner > createOrUpdateValueAsync ( String tagName , String tagValue ) { } } | return createOrUpdateValueWithServiceResponseAsync ( tagName , tagValue ) . map ( new Func1 < ServiceResponse < TagValueInner > , TagValueInner > ( ) { @ Override public TagValueInner call ( ServiceResponse < TagValueInner > response ) { return response . body ( ) ; } } ) ; |
public class JdbcDatabase { /** * Commit the transactions since the last commit .
* Override this for SQL implementations .
* @ exception DBException An exception . */
public void commit ( ) throws DBException { } } | super . commit ( ) ; // Will throw an error if something is not set up right .
try { if ( m_JDBCConnection != null ) m_JDBCConnection . commit ( ) ; } catch ( SQLException ex ) { throw this . convertError ( ex ) ; } |
public class AbstractSorter { /** * Swaps elements at 2 different positions ( indexes ) in the List of elements .
* @ param < E > the Class type of the elements in the List .
* @ param elements the List of elements to perform an element swap on .
* @ param index1 the index of the first element to swap .
* @ param index2 the index of the second element to swap .
* @ see java . util . List */
protected < E > void swap ( final List < E > elements , final int index1 , final int index2 ) { } } | E elementFromIndex1 = elements . get ( index1 ) ; elements . set ( index1 , elements . get ( index2 ) ) ; elements . set ( index2 , elementFromIndex1 ) ; |
public class Unmarshaller { /** * Unmarshals the given native Entity into an object of given type , entityClass .
* @ param < T >
* target object type
* @ param nativeEntity
* the native Entity
* @ param entityClass
* the target type
* @ return Object that is equivalent to the given native entity . If the given
* < code > datastoreEntity < / code > is < code > null < / code > , returns < code > null < / code > . */
public static < T > T unmarshal ( Entity nativeEntity , Class < T > entityClass ) { } } | return unmarshalBaseEntity ( nativeEntity , entityClass ) ; |
public class HistoryHandler { /** * Move the date field ( or the current time ) to the target date field . */
public void moveDateToTarget ( ) { } } | DateTimeField fldHistoryDateTarget = ( DateTimeField ) this . getHistoryRecord ( ) . getField ( m_iHistoryDateSeq ) ; if ( ( this . getHistorySourceDate ( ) != null ) && ( ! this . getHistorySourceDate ( ) . isNull ( ) ) ) fldHistoryDateTarget . moveFieldToThis ( this . getHistorySourceDate ( ) ) ; else fldHistoryDateTarget . setDateTime ( new Date ( ) , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; // Need seconds |
public class MisoUtil { /** * Convert the given fine coordinates to pixel coordinates within
* the containing tile . Converted coordinates are placed in the
* given point object .
* @ param x the x - position fine coordinate .
* @ param y the y - position fine coordinate .
* @ param ppos the point object to place coordinates in . */
public static void fineToPixel ( MisoSceneMetrics metrics , int x , int y , Point ppos ) { } } | ppos . x = metrics . tilehwid + ( ( x - y ) * metrics . finehwid ) ; ppos . y = ( x + y ) * metrics . finehhei ; |
public class DataSegmentFactory { /** * Creates a data segment of the given format and with the given chunk size ( in bytes ) .
* @ param format A format from the < code > DataSegmentFormat < / code > enumeration .
* @ param maxChunkSize The size ( in bytes ) of one chunk , which represents the < code > MaxRecvDataSegmentLength < / code >
* @ return The instance of an < codE > DataSegment < / code > object . */
public static final IDataSegment create ( final DataSegmentFormat format , final int maxChunkSize ) { } } | final IDataSegment dataSegment ; switch ( format ) { case TEXT : dataSegment = new TextParameterDataSegment ( maxChunkSize ) ; break ; case BINARY : dataSegment = new BinaryDataSegment ( maxChunkSize ) ; break ; case NONE : dataSegment = new NullDataSegment ( maxChunkSize ) ; break ; default : throw new IllegalArgumentException ( "Unknown data segment format." ) ; } return dataSegment ; |
public class AdSenseSettings { /** * Gets the borderStyle value for this AdSenseSettings .
* @ return borderStyle * Specifies the border - style of the { @ link AdUnit } . This attribute
* is
* optional and defaults to the ad unit ' s parent or ancestor ' s
* setting if one
* has been set . If no ancestor of the ad unit has set
* { @ code borderStyle } ,
* the attribute is defaulted to { @ link BorderStyle # DEFAULT } . */
public com . google . api . ads . admanager . axis . v201808 . AdSenseSettingsBorderStyle getBorderStyle ( ) { } } | return borderStyle ; |
public class RoaringBitmap { /** * Return the jth value stored in this bitmap . The provided value
* needs to be smaller than the cardinality otherwise an
* IllegalArgumentException
* exception is thrown .
* @ param j index of the value
* @ return the value
* @ see < a href = " https : / / en . wikipedia . org / wiki / Selection _ algorithm " > Selection algorithm < / a > */
@ Override public int select ( int j ) { } } | long leftover = Util . toUnsignedLong ( j ) ; for ( int i = 0 ; i < this . highLowContainer . size ( ) ; i ++ ) { Container c = this . highLowContainer . getContainerAtIndex ( i ) ; int thiscard = c . getCardinality ( ) ; if ( thiscard > leftover ) { int keycontrib = this . highLowContainer . getKeyAtIndex ( i ) << 16 ; int lowcontrib = Util . toIntUnsigned ( c . select ( ( int ) leftover ) ) ; return lowcontrib + keycontrib ; } leftover -= thiscard ; } throw new IllegalArgumentException ( "You are trying to select the " + j + "th value when the cardinality is " + this . getCardinality ( ) + "." ) ; |
public class UserCoreDao { /** * Query for typed values
* @ param < T >
* result value type
* @ param sql
* sql statement
* @ param args
* arguments
* @ param limit
* result row limit
* @ return results
* @ since 3.1.0 */
public < T > List < List < T > > queryTypedResults ( String sql , String [ ] args , Integer limit ) { } } | return db . queryTypedResults ( sql , args , limit ) ; |
public class SheetColumnResourcesImpl { /** * Add column to a sheet .
* It mirrors to the following Smartsheet REST API method : POST / sheets / { sheetId } / columns
* Exceptions :
* IllegalArgumentException : if any argument is null
* InvalidRequestException : if there is any problem with the REST API request
* AuthorizationException : if there is any problem with the REST API authorization ( access token )
* ResourceNotFoundException : if the resource can not be found
* ServiceUnavailableException : if the REST API service is not available ( possibly due to rate limiting )
* SmartsheetRestException : if there is any other REST API related error occurred during the operation
* SmartsheetException : if there is any other error occurred during the operation
* @ param sheetId the sheet id
* @ param columns the list of columns object limited to the following attributes : *
* title * type * symbol ( optional ) * options ( optional ) - array of options * index ( zero - based ) * systemColumnType
* ( optional ) * autoNumberFormat ( optional )
* @ return the list of created columns
* @ throws SmartsheetException the smartsheet exception */
public List < Column > addColumns ( long sheetId , List < Column > columns ) throws SmartsheetException { } } | return this . postAndReceiveList ( "sheets/" + sheetId + "/columns" , columns , Column . class ) ; |
public class CPFriendlyURLEntryLocalServiceUtil { /** * Returns a range of all the cp friendly url entries .
* 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 com . liferay . portal . kernel . dao . orm . 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 com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . product . model . impl . 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 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 )
* @ return the range of cp friendly url entries */
public static java . util . List < com . liferay . commerce . product . model . CPFriendlyURLEntry > getCPFriendlyURLEntries ( int start , int end ) { } } | return getService ( ) . getCPFriendlyURLEntries ( start , end ) ; |
public class XmlExporter { /** * http : / / www . javaworld . com / javatips / jw - javatip117 . html */
public String getBinaryDataForXml ( byte [ ] buffer ) { } } | StringBuffer hexData = new StringBuffer ( ) ; Base64Encoder encoder = new Base64Encoder ( ) ; return encoder . encode ( buffer ) ; |
public class BusItinerary { /** * Replies the nearest bus halt to the given point .
* @ param x x coordinate .
* @ param y y coordinate .
* @ return the nearest bus halt or < code > null < / code > if none was found . */
@ Pure public BusItineraryHalt getNearestBusHalt ( double x , double y ) { } } | double distance = Double . POSITIVE_INFINITY ; BusItineraryHalt besthalt = null ; double dist ; for ( final BusItineraryHalt halt : this . validHalts ) { dist = halt . distance ( x , y ) ; if ( dist < distance ) { distance = dist ; besthalt = halt ; } } return besthalt ; |
public class AbstractMultiDataSetNormalizer { /** * Undo ( revert ) the normalization applied by this normalizer to a specific labels array .
* If labels normalization is disabled ( i . e . , { @ link # isFitLabel ( ) } = = false ) then this is a no - op .
* Can also be used to undo normalization for network output arrays , in the case of regression .
* @ param labels Labels arrays to revert the normalization on
* @ param output the index of the array to revert */
public void revertLabels ( @ NonNull INDArray labels , INDArray mask , int output ) { } } | if ( isFitLabel ( ) ) { strategy . revert ( labels , mask , getLabelStats ( output ) ) ; } |
public class SimpleValueCreator { /** * { @ inheritDoc } */
@ Override public void create ( String string , Value value ) throws DataFormatException { } } | String [ ] strings = splitter . split ( string ) ; for ( int i = 0 ; i < strings . length ; i ++ ) { value . addPrimitiveValue ( String . valueOf ( i ) , strings [ i ] ) ; } |
public class StorageProviderUtil { /** * Determines if the checksum for a particular piece of content
* stored in a StorageProvider matches the expected checksum value .
* @ param provider The StorageProvider where the content was stored
* @ param spaceId The Space in which the content was stored
* @ param contentId The Id of the content
* @ param checksum The content checksum , either provided or computed
* @ throws StorageException if the included checksum does not match
* the storage provider generated checksum
* @ returns the validated checksum value from the provider */
public static String compareChecksum ( StorageProvider provider , String spaceId , String contentId , String checksum ) throws StorageException { } } | String providerChecksum = provider . getContentProperties ( spaceId , contentId ) . get ( StorageProvider . PROPERTIES_CONTENT_CHECKSUM ) ; return compareChecksum ( providerChecksum , spaceId , contentId , checksum ) ; |
public class State { /** * { @ inheritDoc } */
@ Override public < B > State < S , B > fmap ( Function < ? super A , ? extends B > fn ) { } } | return Monad . super . < B > fmap ( fn ) . coerce ( ) ; |
public class CPDefinitionLinkLocalServiceUtil { /** * Returns a range of all the cp definition links .
* 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 com . liferay . portal . kernel . dao . orm . 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 com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . product . model . impl . CPDefinitionLinkModelImpl } . 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 start the lower bound of the range of cp definition links
* @ param end the upper bound of the range of cp definition links ( not inclusive )
* @ return the range of cp definition links */
public static java . util . List < com . liferay . commerce . product . model . CPDefinitionLink > getCPDefinitionLinks ( int start , int end ) { } } | return getService ( ) . getCPDefinitionLinks ( start , end ) ; |
public class Item { /** * Sets the value of the specified attribute in the current item to the
* given value . */
public Item withNumber ( String attrName , BigDecimal val ) { } } | checkInvalidAttribute ( attrName , val ) ; attributes . put ( attrName , val ) ; return this ; |
public class DestinationDefinitionImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . admin . DestinationDefinition # setAuditAllowed ( boolean
* value ) */
void setAuditAllowed ( boolean auditAllowed ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "setAuditAllowed" , Boolean . valueOf ( auditAllowed ) ) ; } _isAuditAllowed = auditAllowed ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "setAuditAllowed" ) ; } |
public class Image { /** * Creates an Image with CCITT G3 or G4 compression . It assumes that the
* data bytes are already compressed .
* @ param width
* the exact width of the image
* @ param height
* the exact height of the image
* @ param reverseBits
* reverses the bits in < code > data < / code > . Bit 0 is swapped
* with bit 7 and so on
* @ param typeCCITT
* the type of compression in < code > data < / code > . It can be
* CCITTG4 , CCITTG31D , CCITTG32D
* @ param parameters
* parameters associated with this stream . Possible values are
* CCITT _ BLACKIS1 , CCITT _ ENCODEDBYTEALIGN , CCITT _ ENDOFLINE and
* CCITT _ ENDOFBLOCK or a combination of them
* @ param data
* the image data
* @ return an Image object
* @ throws BadElementException
* on error */
public static Image getInstance ( int width , int height , boolean reverseBits , int typeCCITT , int parameters , byte [ ] data ) throws BadElementException { } } | return Image . getInstance ( width , height , reverseBits , typeCCITT , parameters , data , null ) ; |
public class Model { /** * Export a context into the given configuration
* @ param ctx the context to export .
* @ param config the { @ code Configuration } where to export the context data .
* @ throws IllegalArgumentException ( since TODO add version ) if the given context is { @ code null } .
* @ since 2.4.0 */
public void exportContext ( Context ctx , Configuration config ) { } } | validateContextNotNull ( ctx ) ; validateConfigNotNull ( config ) ; for ( ContextDataFactory cdf : this . contextDataFactories ) { cdf . exportContextData ( ctx , config ) ; } |
public class AbstractFileBasedContentStoreAdapter { /** * Creates and configures an XML SAX reader . */
protected SAXReader createXmlReader ( ) { } } | SAXReader xmlReader = new SAXReader ( ) ; xmlReader . setMergeAdjacentText ( true ) ; xmlReader . setStripWhitespaceText ( true ) ; xmlReader . setIgnoreComments ( true ) ; try { xmlReader . setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; xmlReader . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; xmlReader . setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ; } catch ( SAXException ex ) { LOGGER . error ( "Unable to turn off external entity loading, This could be a security risk." , ex ) ; } return xmlReader ; |
public class DBUtils { /** * 用于查询记录中大数据类型值 , 若有多条记录符合要求则返回第一条记录的大数据
* @ param sql 查询SQL语句 , 查询字段的类型必须为Blob类型
* @ param arg 传入的占位符的参数
* @ return 返回查询的大数据 , 封装在Map中 , 若没有符合条件的记录则返回空Map */
public static Map < String , byte [ ] > getBigData ( String sql , Object ... arg ) { } } | Map < String , byte [ ] > bigDataMap = new HashMap < String , byte [ ] > ( ) ; Connection connection = JDBCUtils . getConnection ( ) ; PreparedStatement ps = null ; ResultSet result = null ; // 填充占位符
try { ps = connection . prepareStatement ( sql ) ; for ( int i = 0 ; i < arg . length ; i ++ ) { ps . setObject ( i + 1 , arg [ i ] ) ; } // 执行SQL语句
result = ps . executeQuery ( ) ; // 获取字段名
List < String > columnList = DBUtils . getColumnLabels ( result ) ; // 遍历结果集
while ( result . next ( ) ) { // 遍历字段名获取相应大数据值
for ( String column : columnList ) { Blob data = result . getBlob ( column ) ; byte [ ] datas = data . getBytes ( 1 , ( int ) data . length ( ) ) ; bigDataMap . put ( column , datas ) ; } break ; } } catch ( SQLException e ) { e . printStackTrace ( ) ; } finally { JDBCUtils . release ( result , ps , connection ) ; } return bigDataMap ; |
public class InvocationRegistry { /** * Deregisters an invocation . If the associated operation is inactive , takes no action and returns { @ code false } .
* This ensures the idempotency of deregistration .
* @ param invocation The Invocation to deregister .
* @ return { @ code true } if this call deregistered the invocation ; { @ code false } if the invocation wasn ' t registered */
public boolean deregister ( Invocation invocation ) { } } | if ( ! deactivate ( invocation . op ) ) { return false ; } invocations . remove ( invocation . op . getCallId ( ) ) ; callIdSequence . complete ( ) ; return true ; |
public class AdminPathmapAction { private static OptionalEntity < PathMapping > getEntity ( final CreateForm form , final String username , final long currentTime ) { } } | switch ( form . crudMode ) { case CrudMode . CREATE : return OptionalEntity . of ( new PathMapping ( ) ) . map ( entity -> { entity . setCreatedBy ( username ) ; entity . setCreatedTime ( currentTime ) ; return entity ; } ) ; case CrudMode . EDIT : if ( form instanceof EditForm ) { return ComponentUtil . getComponent ( PathMappingService . class ) . getPathMapping ( ( ( EditForm ) form ) . id ) ; } break ; default : break ; } return OptionalEntity . empty ( ) ; |
public class ImageUtil { /** * public static Type getImageType ( ) { return Type . getType ( " Lorg / lucee / extension / image / Image ; " ) ; } */
public static boolean isCastableToImage ( PageContext pc , Object obj ) { } } | try { Class clazz = ImageUtil . getImageClass ( ) ; if ( clazz != null ) { Method m = clazz . getMethod ( "isCastableToImage" , new Class [ ] { PageContext . class , Object . class } ) ; return ( boolean ) m . invoke ( null , new Object [ ] { pc , obj } ) ; } } catch ( Exception e ) { } return false ; |
public class EventContextDataTypeMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EventContextDataType eventContextDataType , ProtocolMarshaller protocolMarshaller ) { } } | if ( eventContextDataType == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( eventContextDataType . getIpAddress ( ) , IPADDRESS_BINDING ) ; protocolMarshaller . marshall ( eventContextDataType . getDeviceName ( ) , DEVICENAME_BINDING ) ; protocolMarshaller . marshall ( eventContextDataType . getTimezone ( ) , TIMEZONE_BINDING ) ; protocolMarshaller . marshall ( eventContextDataType . getCity ( ) , CITY_BINDING ) ; protocolMarshaller . marshall ( eventContextDataType . getCountry ( ) , COUNTRY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class GetDeviceMethodsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetDeviceMethodsRequest getDeviceMethodsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getDeviceMethodsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getDeviceMethodsRequest . getDeviceId ( ) , DEVICEID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TypeRefImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case XtextPackage . TYPE_REF__METAMODEL : return metamodel != null ; case XtextPackage . TYPE_REF__CLASSIFIER : return classifier != null ; } return super . eIsSet ( featureID ) ; |
public class MongoDBClient { /** * Gets the GFSDB files .
* @ param mongoQuery
* the mongo query
* @ param sort
* the sort
* @ param collectionName
* the collection name
* @ param maxResult
* the max result
* @ param firstResult
* the first result
* @ return the GFSDB files */
private List < GridFSDBFile > getGFSDBFiles ( BasicDBObject mongoQuery , BasicDBObject sort , String collectionName , int maxResult , int firstResult ) { } } | KunderaGridFS gfs = new KunderaGridFS ( mongoDb , collectionName ) ; return gfs . find ( mongoQuery , sort , firstResult , maxResult ) ; |
public class HLL { /** * / * package , for testing */
double sparseProbabilisticAlgorithmCardinality ( ) { } } | final int m = this . m /* for performance */
; // compute the " indicator function " - - sum ( 2 ^ ( - M [ j ] ) ) where M [ j ] is the
// ' j ' th register value
double sum = 0 ; int numberOfZeroes = 0 /* " V " in the paper */
; for ( int j = 0 ; j < m ; j ++ ) { final long register = sparseProbabilisticStorage . get ( j ) ; sum += 1.0 / ( 1L << register ) ; if ( register == 0L ) numberOfZeroes ++ ; } // apply the estimate and correction to the indicator function
final double estimator = alphaMSquared / sum ; if ( ( numberOfZeroes != 0 ) && ( estimator < smallEstimatorCutoff ) ) { return HLLUtil . smallEstimator ( m , numberOfZeroes ) ; } else if ( estimator <= largeEstimatorCutoff ) { return estimator ; } else { return HLLUtil . largeEstimator ( log2m , regwidth , estimator ) ; } |
public class SeekableStringReader { /** * Read everything until one of the sentinel ( s ) , which must exist in the string .
* Sentinel char is read but not returned in the result . */
public String readUntil ( String sentinels ) { } } | int index = Integer . MAX_VALUE ; for ( char s : sentinels . toCharArray ( ) ) { int i = str . indexOf ( s , cursor ) ; if ( i >= 0 ) index = Math . min ( i , index ) ; } if ( index >= 0 && index < Integer . MAX_VALUE ) { String result = str . substring ( cursor , index ) ; cursor = index + 1 ; return result ; } throw new ParseException ( "terminator not found" ) ; |
public class RetryerBuilder { /** * Sets the stop strategy used to decide when to stop retrying . The default strategy is to not stop at all .
* @ param stopStrategy the strategy used to decide when to stop retrying
* @ return < code > this < / code >
* @ throws IllegalStateException if a stop strategy has already been set . */
public RetryerBuilder < V > withStopStrategy ( @ Nonnull StopStrategy stopStrategy ) throws IllegalStateException { } } | Preconditions . checkNotNull ( stopStrategy , "stopStrategy may not be null" ) ; Preconditions . checkState ( this . stopStrategy == null , "a stop strategy has already been set %s" , this . stopStrategy ) ; this . stopStrategy = stopStrategy ; return this ; |
public class GeneralNames { /** * Write the extension to the DerOutputStream .
* @ param out the DerOutputStream to write the extension to .
* @ exception IOException on error . */
public void encode ( DerOutputStream out ) throws IOException { } } | if ( isEmpty ( ) ) { return ; } DerOutputStream temp = new DerOutputStream ( ) ; for ( GeneralName gn : names ) { gn . encode ( temp ) ; } out . write ( DerValue . tag_Sequence , temp ) ; |
public class DeviceProxyDAODefaultImpl { @ Deprecated public AttributeInfo get_attribute_config ( final DeviceProxy deviceProxy , final String attname ) throws DevFailed { } } | return get_attribute_info ( deviceProxy , attname ) ; |
public class CommandLineParser { /** * Add an argument for this command line parser . Options should not be
* prepended by dashes .
* @ param shortForm
* Single character command line option
* @ param longForm
* String command line option
* @ param helpText
* Help text to show after the short and long form in
* getHelpText ( )
* @ param isParameter
* True if this argument is a parameter and will not be preceded
* by an option
* @ param valueRequired
* True if the user MUST enter a value for this argument .
* @ param takesValue
* Should be true if this option may followed by a value when
* called from the command line .
* @ throws DuplicateOptionException
* Thrown if this parser already has an option with the same
* short or long form . */
@ Deprecated public void addArgument ( char shortForm , String longForm , String helpText , boolean isParameter , boolean takesValue , boolean valueRequired ) throws DuplicateOptionException { } } | Argument f = new Argument ( ) ; f . option = "" + shortForm ; f . longOption = longForm ; f . takesValue = takesValue ; f . valueRequired = valueRequired ; f . helpText = helpText ; f . isParam = isParameter ; if ( isParameter ) params . add ( f ) ; addArgument ( f ) ; |
public class Profiler { /** * Run performance test for the specified < code > method < / code > with the specified < code > threadNum < / code > and < code > loopNum < / code > for each thread .
* The performance test will be repeatedly execute times specified by < code > roundNum < / code > .
* @ param instance
* @ param method
* @ param args the size of < code > args < / code > can be 0 , 1 , or same size with < code > threadNum . It ' s the input argument for every loop in each thread .
* @ param setUpForMethod
* @ param tearDownForMethod
* @ param setUpForLoop
* @ param tearDownForLoop
* @ param threadNum
* @ param threadDelay
* @ param loopNum
* @ param loopDelay
* @ param roundNum
* @ return */
static MultiLoopsStatistics run ( final Object instance , final Method method , final List < ? > args , final Method setUpForMethod , final Method tearDownForMethod , final Method setUpForLoop , final Method tearDownForLoop , final int threadNum , final long threadDelay , final int loopNum , final long loopDelay , final int roundNum ) { } } | return run ( instance , method . getName ( ) , method , args , setUpForMethod , tearDownForMethod , setUpForLoop , tearDownForLoop , threadNum , threadDelay , loopNum , loopDelay , roundNum ) ; |
public class CNFactory { /** * 词性标注
* @ param input 词数组
* @ return 词性数组 */
public String [ ] tag ( String [ ] input ) { } } | if ( pos == null ) return null ; return pos . tagSeged ( input ) ; |
public class ModelResource { /** * Insert a model .
* success status 201
* @ param model the model to insert
* @ return a { @ link javax . ws . rs . core . Response } object .
* @ throws java . lang . Exception if any . */
@ POST public final Response insert ( @ NotNull @ Valid final MODEL model ) throws Exception { } } | return super . insert ( model ) ; |
public class ClassInstanceProvider { /** * If the instance is provided by the user , { @ link Closeable # close ( ) }
* will not be invoked . */
protected void releaseInstance ( T instance ) throws IOException { } } | AtomicInteger currentCount = providedVsCount . get ( instance ) ; if ( currentCount != null ) { if ( currentCount . decrementAndGet ( ) < 0 ) { currentCount . incrementAndGet ( ) ; throw new IllegalArgumentException ( "Given instance of " + instance . getClass ( ) . getName ( ) + " is not managed by this provider" ) ; } } else { throw new IllegalArgumentException ( "Given instance of " + instance . getClass ( ) . getName ( ) + " is not managed by this provider" ) ; } if ( instantiated . remove ( instance ) && instance instanceof Closeable ) { ( ( Closeable ) instance ) . close ( ) ; } |
public class PanController { /** * Private methods : */
private void stopPanning ( HumanInputEvent < ? > event ) { } } | mapWidget . getMapModel ( ) . getMapView ( ) . setPanDragging ( false ) ; panning = false ; moving = false ; mapWidget . setCursorString ( mapWidget . getDefaultCursorString ( ) ) ; if ( null != event ) { updateView ( event ) ; } |
public class StreamSet { /** * Get the persistence of this StreamSet
* @ return true if this StreamSet is persistent */
public boolean isPersistent ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "isPersistent" ) ; SibTr . exit ( tc , "isPersistent" , Boolean . valueOf ( persistent ) ) ; } return persistent ; |
public class ExcelUtils { /** * 基于Excel模板与注解 { @ link com . github . crab2died . annotation . ExcelField } 导出多sheet的Excel
* @ param sheetWrappers sheet包装类
* @ param templatePath Excel模板路径
* @ param targetPath 导出Excel文件路径
* @ throws Excel4JException 异常 */
public void normalSheet2Excel ( List < NormalSheetWrapper > sheetWrappers , String templatePath , String targetPath ) throws Excel4JException { } } | try ( SheetTemplate sheetTemplate = exportExcelByModuleHandler ( templatePath , sheetWrappers ) ) { sheetTemplate . write2File ( targetPath ) ; } catch ( IOException e ) { throw new Excel4JException ( e ) ; } |
public class S4DoTask { /** * ( non - Javadoc )
* @ see org . apache . s4 . core . App # onStart ( ) */
@ Override protected void onStart ( ) { } } | logger . info ( "Starting DoTaskApp... App Partition [{}]" , this . getPartitionId ( ) ) ; // < < < < < HEAD Task doesn ' t have start in latest storm - impl
// TODO change the way the app starts
// if ( this . getPartitionId ( ) = = 0)
S4Topology s4topology = ( S4Topology ) getTask ( ) . getTopology ( ) ; S4EntranceProcessingItem epi = ( S4EntranceProcessingItem ) s4topology . getEntranceProcessingItem ( ) ; while ( epi . injectNextEvent ( ) ) // inject events from the EntrancePI
; |
public class CreateProjectRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateProjectRequest createProjectRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createProjectRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createProjectRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createProjectRequest . getDefaultJobTimeoutMinutes ( ) , DEFAULTJOBTIMEOUTMINUTES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Subspace { /** * Returns true if this subspace is a subspace of the specified subspace , i . e .
* if the set of dimensions building this subspace are contained in the set of
* dimensions building the specified subspace .
* @ param subspace the subspace to test
* @ return true if this subspace is a subspace of the specified subspace ,
* false otherwise */
public boolean isSubspace ( Subspace subspace ) { } } | return this . dimensionality <= subspace . dimensionality && BitsUtil . intersectionSize ( dimensions , subspace . dimensions ) == dimensionality ; |
public class EC2TagFilterMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EC2TagFilter eC2TagFilter , ProtocolMarshaller protocolMarshaller ) { } } | if ( eC2TagFilter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( eC2TagFilter . getKey ( ) , KEY_BINDING ) ; protocolMarshaller . marshall ( eC2TagFilter . getValue ( ) , VALUE_BINDING ) ; protocolMarshaller . marshall ( eC2TagFilter . getType ( ) , TYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Datatype_Builder { /** * If the value to be returned by { @ link Datatype # getRebuildableType ( ) } is present , replaces it by
* applying { @ code mapper } to it and using the result .
* < p > If the result is null , clears the value .
* @ return this { @ code Builder } object
* @ throws NullPointerException if { @ code mapper } is null */
public Datatype . Builder mapRebuildableType ( UnaryOperator < TypeClass > mapper ) { } } | return setRebuildableType ( getRebuildableType ( ) . map ( mapper ) ) ; |
public class CPDefinitionOptionRelPersistenceImpl { /** * Returns the cp definition option rel where uuid = & # 63 ; and groupId = & # 63 ; or throws a { @ link NoSuchCPDefinitionOptionRelException } if it could not be found .
* @ param uuid the uuid
* @ param groupId the group ID
* @ return the matching cp definition option rel
* @ throws NoSuchCPDefinitionOptionRelException if a matching cp definition option rel could not be found */
@ Override public CPDefinitionOptionRel findByUUID_G ( String uuid , long groupId ) throws NoSuchCPDefinitionOptionRelException { } } | CPDefinitionOptionRel cpDefinitionOptionRel = fetchByUUID_G ( uuid , groupId ) ; if ( cpDefinitionOptionRel == null ) { StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "uuid=" ) ; msg . append ( uuid ) ; msg . append ( ", groupId=" ) ; msg . append ( groupId ) ; msg . append ( "}" ) ; if ( _log . isDebugEnabled ( ) ) { _log . debug ( msg . toString ( ) ) ; } throw new NoSuchCPDefinitionOptionRelException ( msg . toString ( ) ) ; } return cpDefinitionOptionRel ; |
public class PdfContentStreamProcessor { /** * Gets the width of a String .
* @ param stringthe string that needs measuring
* @ param tjtext adjustment
* @ returnthe width of a String */
public float getStringWidth ( String string , float tj ) { } } | DocumentFont font = gs ( ) . font ; char [ ] chars = string . toCharArray ( ) ; float totalWidth = 0 ; for ( int i = 0 ; i < chars . length ; i ++ ) { float w = font . getWidth ( chars [ i ] ) / 1000.0f ; float wordSpacing = chars [ i ] == 32 ? gs ( ) . wordSpacing : 0f ; totalWidth += ( ( w - tj / 1000f ) * gs ( ) . fontSize + gs ( ) . characterSpacing + wordSpacing ) * gs ( ) . horizontalScaling ; } return totalWidth ; |
public class SingleItemSketch { /** * Create this sketch with the given byte array .
* If the byte array is null or empty no create attempt is made and the method returns null .
* @ param data The given byte array .
* @ return a SingleItemSketch or null */
public static SingleItemSketch create ( final byte [ ] data ) { } } | if ( ( data == null ) || ( data . length == 0 ) ) { return null ; } return new SingleItemSketch ( hash ( data , DEFAULT_UPDATE_SEED ) [ 0 ] >>> 1 ) ; |
public class DTSTrackImpl { /** * EXTSS _ MD */
private boolean parseExtssmd ( int size , ByteBuffer bb ) { } } | int a = bb . get ( ) ; int b = bb . getShort ( ) ; extAvgBitrate = ( a << 16 ) | ( b & 0xffff ) ; int i = 3 ; if ( isVBR ) { a = bb . get ( ) ; b = bb . getShort ( ) ; extPeakBitrate = ( a << 16 ) | ( b & 0xffff ) ; extSmoothBuffSize = bb . getShort ( ) ; i += 5 ; } else { extFramePayloadInBytes = bb . getInt ( ) ; i += 4 ; } while ( i < size ) { bb . get ( ) ; i ++ ; } return true ; |
public class BackupsInner { /** * Triggers backup for specified backed up item . This is an asynchronous operation . To know the status of the operation , call GetProtectedItemOperationResult API .
* @ param vaultName The name of the recovery services vault .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param fabricName Fabric name associated with the backup item .
* @ param containerName Container name associated with the backup item .
* @ param protectedItemName Backup item for which backup needs to be triggered .
* @ param parameters resource backup request
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > triggerAsync ( String vaultName , String resourceGroupName , String fabricName , String containerName , String protectedItemName , BackupRequestResource parameters ) { } } | return triggerWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName , protectedItemName , parameters ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class SessionWindowAssigner { /** * Merge curWindow and other , return a new window which covers curWindow and other
* if they are overlapped . Otherwise , returns the curWindow itself . */
private TimeWindow mergeWindow ( TimeWindow curWindow , TimeWindow other , Collection < TimeWindow > mergedWindow ) { } } | if ( curWindow . intersects ( other ) ) { mergedWindow . add ( other ) ; return curWindow . cover ( other ) ; } else { return curWindow ; } |
public class PaytrailService { /** * Get url for payment
* @ param payment payment
* @ return Result result
* @ throws PaytrailException */
public Result processPayment ( Payment payment ) throws PaytrailException { } } | try { String data = marshaller . objectToString ( payment ) ; String url = serviceUrl + "/api-payment/create" ; IOHandlerResult requestResult = postJsonRequest ( url , data ) ; if ( requestResult . getCode ( ) != 201 ) { JsonError jsonError = marshaller . stringToObject ( JsonError . class , requestResult . getResponse ( ) ) ; throw new PaytrailException ( jsonError . getErrorMessage ( ) ) ; } return marshaller . stringToObject ( Result . class , requestResult . getResponse ( ) ) ; } catch ( IOException e ) { throw new PaytrailException ( e ) ; } |
public class SimpleConfiguration { /** * Loads configuration from InputStream . Later loads have lower priority .
* @ param in InputStream to load from
* @ since 1.2.0 */
public void load ( InputStream in ) { } } | try { PropertiesConfiguration config = new PropertiesConfiguration ( ) ; // disabled to prevent accumulo classpath value from being shortened
config . setDelimiterParsingDisabled ( true ) ; config . load ( in ) ; ( ( CompositeConfiguration ) internalConfig ) . addConfiguration ( config ) ; } catch ( ConfigurationException e ) { throw new IllegalArgumentException ( e ) ; } |
public class BELScriptWalker { /** * BELScriptWalker . g : 364:1 : statement : st = outer _ term ( rel = relationship ( ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN ) | ot = outer _ term ) ) ? ( comment = STATEMENT _ COMMENT ) ? ; */
public final BELScriptWalker . statement_return statement ( ) throws RecognitionException { } } | BELScriptWalker . statement_return retval = new BELScriptWalker . statement_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; CommonTree _first_0 = null ; CommonTree _last = null ; CommonTree comment = null ; CommonTree OPEN_PAREN30 = null ; CommonTree CLOSE_PAREN31 = null ; BELScriptWalker . outer_term_return st = null ; BELScriptWalker . relationship_return rel = null ; BELScriptWalker . outer_term_return nst = null ; BELScriptWalker . relationship_return nrel = null ; BELScriptWalker . outer_term_return not = null ; BELScriptWalker . outer_term_return ot = null ; CommonTree comment_tree = null ; CommonTree OPEN_PAREN30_tree = null ; CommonTree CLOSE_PAREN31_tree = null ; try { // BELScriptWalker . g : 364:10 : ( st = outer _ term ( rel = relationship ( ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN ) | ot = outer _ term ) ) ? ( comment = STATEMENT _ COMMENT ) ? )
// BELScriptWalker . g : 365:5 : st = outer _ term ( rel = relationship ( ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN ) | ot = outer _ term ) ) ? ( comment = STATEMENT _ COMMENT ) ?
{ root_0 = ( CommonTree ) adaptor . nil ( ) ; _last = ( CommonTree ) input . LT ( 1 ) ; pushFollow ( FOLLOW_outer_term_in_statement545 ) ; st = outer_term ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , st . getTree ( ) ) ; // BELScriptWalker . g : 365:19 : ( rel = relationship ( ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN ) | ot = outer _ term ) ) ?
int alt12 = 2 ; int LA12_0 = input . LA ( 1 ) ; if ( ( ( LA12_0 >= 103 && LA12_0 <= 130 ) ) ) { alt12 = 1 ; } switch ( alt12 ) { case 1 : // BELScriptWalker . g : 365:20 : rel = relationship ( ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN ) | ot = outer _ term )
{ _last = ( CommonTree ) input . LT ( 1 ) ; pushFollow ( FOLLOW_relationship_in_statement550 ) ; rel = relationship ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , rel . getTree ( ) ) ; // BELScriptWalker . g : 365:37 : ( ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN ) | ot = outer _ term )
int alt11 = 2 ; int LA11_0 = input . LA ( 1 ) ; if ( ( LA11_0 == OPEN_PAREN ) ) { alt11 = 1 ; } else if ( ( ( LA11_0 >= 44 && LA11_0 <= 102 ) ) ) { alt11 = 2 ; } else { NoViableAltException nvae = new NoViableAltException ( "" , 11 , 0 , input ) ; throw nvae ; } switch ( alt11 ) { case 1 : // BELScriptWalker . g : 365:38 : ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN )
{ // BELScriptWalker . g : 365:38 : ( OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN )
// BELScriptWalker . g : 365:39 : OPEN _ PAREN nst = outer _ term nrel = relationship not = outer _ term CLOSE _ PAREN
{ _last = ( CommonTree ) input . LT ( 1 ) ; OPEN_PAREN30 = ( CommonTree ) match ( input , OPEN_PAREN , FOLLOW_OPEN_PAREN_in_statement554 ) ; OPEN_PAREN30_tree = ( CommonTree ) adaptor . dupNode ( OPEN_PAREN30 ) ; adaptor . addChild ( root_0 , OPEN_PAREN30_tree ) ; _last = ( CommonTree ) input . LT ( 1 ) ; pushFollow ( FOLLOW_outer_term_in_statement558 ) ; nst = outer_term ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , nst . getTree ( ) ) ; _last = ( CommonTree ) input . LT ( 1 ) ; pushFollow ( FOLLOW_relationship_in_statement562 ) ; nrel = relationship ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , nrel . getTree ( ) ) ; _last = ( CommonTree ) input . LT ( 1 ) ; pushFollow ( FOLLOW_outer_term_in_statement566 ) ; not = outer_term ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , not . getTree ( ) ) ; _last = ( CommonTree ) input . LT ( 1 ) ; CLOSE_PAREN31 = ( CommonTree ) match ( input , CLOSE_PAREN , FOLLOW_CLOSE_PAREN_in_statement568 ) ; CLOSE_PAREN31_tree = ( CommonTree ) adaptor . dupNode ( CLOSE_PAREN31 ) ; adaptor . addChild ( root_0 , CLOSE_PAREN31_tree ) ; } } break ; case 2 : // BELScriptWalker . g : 365:113 : ot = outer _ term
{ _last = ( CommonTree ) input . LT ( 1 ) ; pushFollow ( FOLLOW_outer_term_in_statement575 ) ; ot = outer_term ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , ot . getTree ( ) ) ; } break ; } } break ; } // BELScriptWalker . g : 365:137 : ( comment = STATEMENT _ COMMENT ) ?
int alt13 = 2 ; int LA13_0 = input . LA ( 1 ) ; if ( ( LA13_0 == STATEMENT_COMMENT ) ) { alt13 = 1 ; } switch ( alt13 ) { case 1 : // BELScriptWalker . g : 365:137 : comment = STATEMENT _ COMMENT
{ _last = ( CommonTree ) input . LT ( 1 ) ; comment = ( CommonTree ) match ( input , STATEMENT_COMMENT , FOLLOW_STATEMENT_COMMENT_in_statement582 ) ; comment_tree = ( CommonTree ) adaptor . dupNode ( comment ) ; adaptor . addChild ( root_0 , comment_tree ) ; } break ; } final StringBuilder stmtBuilder = new StringBuilder ( ) ; stmtBuilder . append ( st . r ) ; if ( rel != null ) { stmtBuilder . append ( " " ) . append ( rel . r ) ; if ( ot != null ) { stmtBuilder . append ( " " ) . append ( ot . r ) ; } else { stmtBuilder . append ( "(" ) ; if ( nst != null && nrel != null && not != null ) { stmtBuilder . append ( nst . r ) . append ( " " ) . append ( nrel . r ) . append ( " " ) . append ( not . r ) ; } stmtBuilder . append ( ")" ) ; } } String commentText = null ; if ( comment != null ) { commentText = comment . getText ( ) ; } // build effective annotations from main statement group context and then local statement group context , if any
final Map < String , BELAnnotation > effectiveAnnotations = new LinkedHashMap < String , BELAnnotation > ( annotationContext ) ; if ( activeStatementGroup != null ) { effectiveAnnotations . putAll ( sgAnnotationContext ) ; } final List < BELAnnotation > annotations = new ArrayList < BELAnnotation > ( effectiveAnnotations . values ( ) ) ; // build statement and keep track of it for validation purposes
final BELStatement stmt = new BELStatement ( stmtBuilder . toString ( ) , annotations , citationContext , evidenceContext , commentText ) ; stmtlist . add ( stmt ) ; // add statement to scoped statement group
if ( activeStatementGroup != null ) { activeStatementGroup . getStatements ( ) . add ( stmt ) ; } else { documentStatementGroup . getStatements ( ) . add ( stmt ) ; } } retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { } return retval ; |
public class ResourceObjectIncludeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . RESOURCE_OBJECT_INCLUDE__OBJ_TYPE : return getObjType ( ) ; case AfplibPackage . RESOURCE_OBJECT_INCLUDE__OBJ_NAME : return getObjName ( ) ; case AfplibPackage . RESOURCE_OBJECT_INCLUDE__XOBJ_OSET : return getXobjOset ( ) ; case AfplibPackage . RESOURCE_OBJECT_INCLUDE__YOBJ_OSET : return getYobjOset ( ) ; case AfplibPackage . RESOURCE_OBJECT_INCLUDE__OB_ORENT : return getObOrent ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class Utils { /** * Returns the size of an iterable . This method should only be used with fixed size
* collections . It will attempt to find an efficient method to get the size before falling
* back to a traversal of the iterable . */
@ SuppressWarnings ( "PMD.UnusedLocalVariable" ) public static < T > int size ( Iterable < T > iter ) { } } | if ( iter instanceof ArrayTagSet ) { return ( ( ArrayTagSet ) iter ) . size ( ) ; } else if ( iter instanceof Collection < ? > ) { return ( ( Collection < ? > ) iter ) . size ( ) ; } else { int size = 0 ; for ( T v : iter ) { ++ size ; } return size ; } |
public class BigDecimalUtil { /** * returns a new BigDecimal with correct scale after being round to n dec places .
* @ param bd value
* @ param numberOfDecPlaces number of dec place to round to
* @ param finalScale final scale of result ( typically numberOfDecPlaces & lt ; finalScale ) ;
* @ return new bd or null */
public static BigDecimal roundTo ( final BigDecimal bd , final int numberOfDecPlaces , final int finalScale ) { } } | return setScale ( setScale ( bd , numberOfDecPlaces , BigDecimal . ROUND_HALF_UP ) , finalScale ) ; |
public class ServerPluginRepository { /** * Removes the plugins that are not compatible with current environment . */
private void unloadIncompatiblePlugins ( ) { } } | // loop as long as the previous loop ignored some plugins . That allows to support dependencies
// on many levels , for example D extends C , which extends B , which requires A . If A is not installed ,
// then B , C and D must be ignored . That ' s not possible to achieve this algorithm with a single
// iteration over plugins .
Set < String > removedKeys = new HashSet < > ( ) ; do { removedKeys . clear ( ) ; for ( PluginInfo plugin : pluginInfosByKeys . values ( ) ) { if ( ! isCompatible ( plugin , runtime , pluginInfosByKeys ) ) { removedKeys . add ( plugin . getKey ( ) ) ; } } for ( String removedKey : removedKeys ) { pluginInfosByKeys . remove ( removedKey ) ; } } while ( ! removedKeys . isEmpty ( ) ) ; |
public class DigitLookupMap { /** * Prints out certain number of spaces . */
private void printSpaces ( int count , java . io . PrintStream out ) { } } | for ( int i = 0 ; i < count ; i ++ ) { out . print ( " " ) ; } |
public class TaskTracker { /** * Close down the TaskTracker and all its components . We must also shutdown
* any running tasks or threads , and cleanup disk space . A new TaskTracker
* within the same process space might be restarted , so everything must be
* clean . */
public synchronized void close ( ) throws IOException { } } | // Kill running tasks . Do this in a 2nd vector , called ' tasksToClose ' ,
// because calling jobHasFinished ( ) may result in an edit to ' tasks ' .
TreeMap < TaskAttemptID , TaskInProgress > tasksToClose = new TreeMap < TaskAttemptID , TaskInProgress > ( ) ; tasksToClose . putAll ( tasks ) ; for ( TaskInProgress tip : tasksToClose . values ( ) ) { tip . jobHasFinished ( false ) ; } this . running = false ; if ( pulseChecker != null ) { pulseChecker . shutdown ( ) ; } if ( versionBeanName != null ) { MBeanUtil . unregisterMBean ( versionBeanName ) ; } // Clear local storage
if ( asyncDiskService != null ) { // Clear local storage
asyncDiskService . cleanupAllVolumes ( ) ; // Shutdown all async deletion threads with up to 10 seconds of delay
asyncDiskService . shutdown ( ) ; try { if ( ! asyncDiskService . awaitTermination ( 10000 ) ) { asyncDiskService . shutdownNow ( ) ; asyncDiskService = null ; } } catch ( InterruptedException e ) { asyncDiskService . shutdownNow ( ) ; asyncDiskService = null ; } } // Shutdown the fetcher thread
if ( this . mapEventsFetcher != null ) { this . mapEventsFetcher . interrupt ( ) ; } // Stop the launchers
this . mapLauncher . interrupt ( ) ; this . reduceLauncher . interrupt ( ) ; if ( this . heartbeatMonitor != null ) { this . heartbeatMonitor . interrupt ( ) ; } // Stop memory manager thread
if ( this . taskMemoryManager != null ) { this . taskMemoryManager . shutdown ( ) ; } // Stop cgroup memory watcher
this . cgroupMemoryWatcher . shutdown ( ) ; // All tasks are killed . So , they are removed from TaskLog monitoring also .
// Interrupt the monitor .
getTaskLogsMonitor ( ) . interrupt ( ) ; jvmManager . stop ( ) ; // shutdown RPC connections
RPC . stopProxy ( jobClient ) ; // wait for the fetcher thread to exit
for ( boolean done = false ; ! done ; ) { try { if ( this . mapEventsFetcher != null ) { this . mapEventsFetcher . join ( ) ; } done = true ; } catch ( InterruptedException e ) { } } if ( taskReportServer != null ) { taskReportServer . stop ( ) ; taskReportServer = null ; } if ( healthChecker != null ) { // stop node health checker service
healthChecker . stop ( ) ; healthChecker = null ; } if ( this . server != null ) { try { LOG . info ( "Shutting down StatusHttpServer" ) ; this . server . stop ( ) ; LOG . info ( "Shutting down Netty MapOutput Server" ) ; if ( this . nettyMapOutputServer != null ) { this . nettyMapOutputServer . stop ( ) ; } } catch ( Exception e ) { LOG . warn ( "Exception shutting down TaskTracker" , e ) ; } } |
public class ShortColumn { /** * Returns a new DoubleColumn containing a value for each value in this column , truncating if necessary .
* A widening primitive conversion from an int to a double does not lose information about the overall magnitude
* of a numeric value . It may , however , result in loss of precision - that is , the result may lose some of the
* least significant bits of the value . In this case , the resulting floating - point value will be a correctly
* rounded version of the integer value , using IEEE 754 round - to - nearest mode .
* Despite the fact that a loss of precision may occur , a widening primitive conversion never results in a
* run - time exception .
* A missing value in the receiver is converted to a missing value in the result */
@ Override public DoubleColumn asDoubleColumn ( ) { } } | DoubleArrayList values = new DoubleArrayList ( ) ; for ( int d : data ) { values . add ( d ) ; } values . trim ( ) ; return DoubleColumn . create ( this . name ( ) , values . elements ( ) ) ; |
public class EsMarshalling { /** * Unmarshals the given map source into a bean .
* @ param map the search hit map
* @ return the plugin summary */
public static PluginSummaryBean unmarshallPluginSummary ( Map < String , Object > map ) { } } | PluginSummaryBean bean = new PluginSummaryBean ( ) ; bean . setId ( asLong ( map . get ( "id" ) ) ) ; bean . setName ( asString ( map . get ( "name" ) ) ) ; if ( map . containsKey ( "description" ) ) { bean . setDescription ( asString ( map . get ( "description" ) ) ) ; } bean . setGroupId ( asString ( map . get ( "groupId" ) ) ) ; bean . setArtifactId ( asString ( map . get ( "artifactId" ) ) ) ; bean . setVersion ( asString ( map . get ( "version" ) ) ) ; if ( map . containsKey ( "type" ) ) { bean . setType ( asString ( map . get ( "type" ) ) ) ; } if ( map . containsKey ( "classifier" ) ) { bean . setClassifier ( asString ( map . get ( "classifier" ) ) ) ; } bean . setCreatedBy ( asString ( map . get ( "createdBy" ) ) ) ; bean . setCreatedOn ( asDate ( map . get ( "createdOn" ) ) ) ; postMarshall ( bean ) ; return bean ; |
public class Graph { /** * This method allows access to the graph ' s edge values along with its source and target vertex values .
* @ return a triplet DataSet consisting of ( srcVertexId , trgVertexId , srcVertexValue , trgVertexValue , edgeValue ) */
public DataSet < Triplet < K , VV , EV > > getTriplets ( ) { } } | return this . getVertices ( ) . join ( this . getEdges ( ) ) . where ( 0 ) . equalTo ( 0 ) . with ( new ProjectEdgeWithSrcValue < > ( ) ) . name ( "Project edge with source value" ) . join ( this . getVertices ( ) ) . where ( 1 ) . equalTo ( 0 ) . with ( new ProjectEdgeWithVertexValues < > ( ) ) . name ( "Project edge with vertex values" ) ; |
public class Area { /** * Intersects the supplied area with this area . */
public void intersect ( Area area ) { } } | if ( area == null ) { return ; } else if ( isEmpty ( ) || area . isEmpty ( ) ) { reset ( ) ; return ; } if ( isPolygonal ( ) && area . isPolygonal ( ) ) { intersectPolygon ( area ) ; } else { intersectCurvePolygon ( area ) ; } if ( areaBoundsSquare ( ) < GeometryUtil . EPSILON ) { reset ( ) ; } |
public class V1Span { /** * Returns the distinct { @ link Endpoint # serviceName ( ) service names } that logged to this span . */
public Set < String > serviceNames ( ) { } } | Set < String > result = new LinkedHashSet < > ( ) ; for ( V1Annotation a : annotations ) { if ( a . endpoint == null ) continue ; if ( a . endpoint . serviceName ( ) == null ) continue ; result . add ( a . endpoint . serviceName ( ) ) ; } for ( V1BinaryAnnotation a : binaryAnnotations ) { if ( a . endpoint == null ) continue ; if ( a . endpoint . serviceName ( ) == null ) continue ; result . add ( a . endpoint . serviceName ( ) ) ; } return result ; |
public class Locale { /** * Checks whether a given string is an ASCII alphanumeric string . */
private static boolean isAsciiAlphaNum ( String string ) { } } | for ( int i = 0 ; i < string . length ( ) ; i ++ ) { final char character = string . charAt ( i ) ; if ( ! ( character >= 'a' && character <= 'z' || character >= 'A' && character <= 'Z' || character >= '0' && character <= '9' ) ) { return false ; } } return true ; |
public class AppServiceEnvironmentsInner { /** * Get a diagnostics item for an App Service Environment .
* Get a diagnostics item for an App Service Environment .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param diagnosticsName Name of the diagnostics item .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the HostingEnvironmentDiagnosticsInner object */
public Observable < HostingEnvironmentDiagnosticsInner > getDiagnosticsItemAsync ( String resourceGroupName , String name , String diagnosticsName ) { } } | return getDiagnosticsItemWithServiceResponseAsync ( resourceGroupName , name , diagnosticsName ) . map ( new Func1 < ServiceResponse < HostingEnvironmentDiagnosticsInner > , HostingEnvironmentDiagnosticsInner > ( ) { @ Override public HostingEnvironmentDiagnosticsInner call ( ServiceResponse < HostingEnvironmentDiagnosticsInner > response ) { return response . body ( ) ; } } ) ; |
public class ImagePyramidBase { /** * Initializes internal data structures based on the input image ' s size . Should be called each time a new image
* is processed .
* @ param width Image width
* @ param height Image height */
@ Override public void initialize ( int width , int height ) { } } | // see if it has already been initialized
if ( bottomWidth == width && bottomHeight == height ) return ; this . bottomWidth = width ; this . bottomHeight = height ; layers = imageType . createArray ( getNumLayers ( ) ) ; double scaleFactor = getScale ( 0 ) ; if ( scaleFactor == 1 ) { if ( ! saveOriginalReference ) { layers [ 0 ] = imageType . createImage ( bottomWidth , bottomHeight ) ; } } else { layers [ 0 ] = imageType . createImage ( ( int ) Math . ceil ( bottomWidth / scaleFactor ) , ( int ) Math . ceil ( bottomHeight / scaleFactor ) ) ; } for ( int i = 1 ; i < layers . length ; i ++ ) { scaleFactor = getScale ( i ) ; layers [ i ] = imageType . createImage ( ( int ) Math . ceil ( bottomWidth / scaleFactor ) , ( int ) Math . ceil ( bottomHeight / scaleFactor ) ) ; } |
public class SidesIconProvider { /** * Gets the { @ link Icon } for the side for the block in world . < br >
* Takes in account the facing of the block . < br >
* If no icon was set for the side , { @ link # defaultIcon } is used .
* @ param world the world
* @ param pos the pos
* @ param state the state
* @ param side the side
* @ return the icon */
@ Override public Icon getIcon ( IBlockAccess world , BlockPos pos , IBlockState state , EnumFacing side ) { } } | return getIcon ( side ) ; |
public class CreateLayerRequest { /** * An array containing the layer custom security group IDs .
* @ return An array containing the layer custom security group IDs . */
public java . util . List < String > getCustomSecurityGroupIds ( ) { } } | if ( customSecurityGroupIds == null ) { customSecurityGroupIds = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return customSecurityGroupIds ; |
public class MultiPoint { /** * Return the bounding box spanning the full list of points . */
public Bbox getBounds ( ) { } } | if ( isEmpty ( ) ) { return null ; } double minX = Double . MAX_VALUE ; double minY = Double . MAX_VALUE ; double maxX = - Double . MAX_VALUE ; double maxY = - Double . MAX_VALUE ; for ( Point point : points ) { if ( point . getX ( ) < minX ) { minX = point . getX ( ) ; } if ( point . getY ( ) < minY ) { minY = point . getY ( ) ; } if ( point . getX ( ) > maxX ) { maxX = point . getX ( ) ; } if ( point . getY ( ) > maxY ) { maxY = point . getY ( ) ; } } return new Bbox ( minX , minY , maxX - minX , maxY - minY ) ; |
public class OneShotSQLGeneratorEngine { /** * Generates the SQL string that forms or retrieves the given term . The
* function takes as input either : a constant ( value or URI ) , a variable , or
* a Function ( i . e . , uri ( ) , eq ( . . ) , ISNULL ( . . ) , etc ) ) .
* If the input is a constant , it will return the SQL that generates the
* string representing that constant .
* If its a variable , it returns the column references to the position where
* the variable first appears .
* If its a function uri ( . . ) it returns the SQL string concatenation that
* builds the result of uri ( . . . )
* If its a boolean comparison , it returns the corresponding SQL comparison . */
private String getSQLString ( Term term , AliasIndex index , boolean useBrackets ) { } } | if ( term == null ) { return "" ; } if ( term instanceof ValueConstant ) { ValueConstant ct = ( ValueConstant ) term ; if ( hasIRIDictionary ( ) ) { if ( ct . getType ( ) . isA ( XSD . STRING ) ) { int id = getUriid ( ct . getValue ( ) ) ; if ( id >= 0 ) // return jdbcutil . getSQLLexicalForm ( String . valueOf ( id ) ) ;
return String . valueOf ( id ) ; } } return getSQLLexicalForm ( ct ) ; } else if ( term instanceof IRIConstant ) { IRIConstant uc = ( IRIConstant ) term ; if ( hasIRIDictionary ( ) ) { int id = getUriid ( uc . getValue ( ) ) ; return sqladapter . getSQLLexicalFormString ( String . valueOf ( id ) ) ; } return sqladapter . getSQLLexicalFormString ( uc . toString ( ) ) ; } else if ( term instanceof Variable ) { Set < QualifiedAttributeID > columns = index . getColumns ( ( Variable ) term ) ; return columns . iterator ( ) . next ( ) . getSQLRendering ( ) ; } // If it ' s not constant , or variable it ' s a function
Function function = ( Function ) term ; Predicate functionSymbol = function . getFunctionSymbol ( ) ; int size = function . getTerms ( ) . size ( ) ; if ( function . isDataTypeFunction ( ) ) { if ( functionSymbol . getExpectedBaseType ( 0 ) . isA ( typeFactory . getUnsupportedDatatype ( ) ) ) { throw new RuntimeException ( "Unsupported type in the query: " + function ) ; } // Note : datatype functions are unary .
// The only exception is rdf : langString ( represented internally as a binary predicate , with string and
// language tag as arguments ) , but in this case the first argument only is used for SQL generation .
// atoms of the form integer ( x )
return getSQLString ( function . getTerm ( 0 ) , index , false ) ; } if ( functionSymbol instanceof URITemplatePredicate || functionSymbol instanceof BNodePredicate ) { // The atom must be of the form uri ( " . . . " , x , y )
return getSQLStringForTemplateFunction ( function . getTerms ( ) , index ) ; } if ( operations . containsKey ( functionSymbol ) ) { String expressionFormat = operations . get ( functionSymbol ) ; switch ( function . getArity ( ) ) { case 0 : return expressionFormat ; case 1 : // for unary functions , e . g . , NOT , IS NULL , IS NOT NULL
String arg = getSQLString ( function . getTerm ( 0 ) , index , true ) ; return String . format ( expressionFormat , arg ) ; case 2 : // for binary functions , e . g . , AND , OR , EQ , NEQ , GT etc .
String left = getSQLString ( function . getTerm ( 0 ) , index , true ) ; String right = getSQLString ( function . getTerm ( 1 ) , index , true ) ; String result = String . format ( expressionFormat , left , right ) ; return useBrackets ? inBrackets ( result ) : result ; default : throw new RuntimeException ( "Cannot translate boolean function: " + functionSymbol ) ; } } if ( functionSymbol == ExpressionOperation . IS_TRUE ) { return effectiveBooleanValue ( function . getTerm ( 0 ) , index ) ; } if ( functionSymbol == ExpressionOperation . REGEX ) { boolean caseinSensitive = false , multiLine = false , dotAllMode = false ; if ( function . getArity ( ) == 3 ) { String options = function . getTerm ( 2 ) . toString ( ) ; caseinSensitive = options . contains ( "i" ) ; multiLine = options . contains ( "m" ) ; dotAllMode = options . contains ( "s" ) ; } String column = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String pattern = getSQLString ( function . getTerm ( 1 ) , index , false ) ; return sqladapter . sqlRegex ( column , pattern , caseinSensitive , multiLine , dotAllMode ) ; } /* * TODO : make sure that SPARQL _ LANG are eliminated earlier on */
if ( functionSymbol == ExpressionOperation . SPARQL_LANG ) { Term subTerm = function . getTerm ( 0 ) ; if ( subTerm instanceof Variable ) { Variable var = ( Variable ) subTerm ; Optional < QualifiedAttributeID > lang = index . getLangColumn ( var ) ; if ( ! lang . isPresent ( ) ) throw new RuntimeException ( "Cannot find LANG column for " + var ) ; return lang . get ( ) . getSQLRendering ( ) ; } else { // Temporary fix
String langString = Optional . of ( subTerm ) . filter ( t -> t instanceof Function ) . map ( t -> ( ( Function ) t ) . getFunctionSymbol ( ) ) . filter ( f -> f instanceof DatatypePredicate ) . map ( f -> ( ( DatatypePredicate ) f ) . getReturnedType ( ) ) . flatMap ( RDFDatatype :: getLanguageTag ) . map ( LanguageTag :: getFullString ) . orElse ( "" ) ; return sqladapter . getSQLLexicalFormString ( langString ) ; } } /* TODO : replace by a switch */
if ( functionSymbol . equals ( ExpressionOperation . IF_ELSE_NULL ) ) { String condition = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String value = getSQLString ( function . getTerm ( 1 ) , index , false ) ; return sqladapter . ifElseNull ( condition , value ) ; } if ( functionSymbol == ExpressionOperation . QUEST_CAST ) { String columnName = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String datatype = ( ( Constant ) function . getTerm ( 1 ) ) . getValue ( ) ; int sqlDatatype = datatype . equals ( XMLSchema . STRING . stringValue ( ) ) ? Types . VARCHAR : Types . LONGVARCHAR ; return isStringColType ( function , index ) ? columnName : sqladapter . sqlCast ( columnName , sqlDatatype ) ; } if ( functionSymbol == ExpressionOperation . SPARQL_STR ) { String columnName = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return isStringColType ( function , index ) ? columnName : sqladapter . sqlCast ( columnName , Types . VARCHAR ) ; } if ( functionSymbol == ExpressionOperation . REPLACE ) { String orig = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String out_str = getSQLString ( function . getTerm ( 1 ) , index , false ) ; String in_str = getSQLString ( function . getTerm ( 2 ) , index , false ) ; // TODO : handle flags
return sqladapter . strReplace ( orig , out_str , in_str ) ; } if ( functionSymbol == ExpressionOperation . CONCAT ) { String left = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String right = getSQLString ( function . getTerm ( 1 ) , index , false ) ; return sqladapter . strConcat ( new String [ ] { left , right } ) ; } if ( functionSymbol == ExpressionOperation . STRLEN ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . strLength ( literal ) ; } if ( functionSymbol == ExpressionOperation . YEAR ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . dateYear ( literal ) ; } if ( functionSymbol == ExpressionOperation . MINUTES ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . dateMinutes ( literal ) ; } if ( functionSymbol == ExpressionOperation . DAY ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . dateDay ( literal ) ; } if ( functionSymbol == ExpressionOperation . MONTH ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . dateMonth ( literal ) ; } if ( functionSymbol == ExpressionOperation . SECONDS ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . dateSeconds ( literal ) ; } if ( functionSymbol == ExpressionOperation . HOURS ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . dateHours ( literal ) ; } if ( functionSymbol == ExpressionOperation . TZ ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . dateTZ ( literal ) ; } if ( functionSymbol == ExpressionOperation . ENCODE_FOR_URI ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . iriSafeEncode ( literal ) ; } if ( functionSymbol == ExpressionOperation . UCASE ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . strUcase ( literal ) ; } if ( functionSymbol == ExpressionOperation . MD5 ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . MD5 ( literal ) ; } if ( functionSymbol == ExpressionOperation . SHA1 ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . SHA1 ( literal ) ; } if ( functionSymbol == ExpressionOperation . SHA256 ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . SHA256 ( literal ) ; } if ( functionSymbol == ExpressionOperation . SHA512 ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . SHA512 ( literal ) ; // TODO FIX
} if ( functionSymbol == ExpressionOperation . LCASE ) { String literal = getSQLString ( function . getTerm ( 0 ) , index , false ) ; return sqladapter . strLcase ( literal ) ; } if ( functionSymbol == ExpressionOperation . SUBSTR2 ) { String string = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String start = getSQLString ( function . getTerm ( 1 ) , index , false ) ; return sqladapter . strSubstr ( string , start ) ; } if ( functionSymbol == ExpressionOperation . SUBSTR3 ) { String string = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String start = getSQLString ( function . getTerm ( 1 ) , index , false ) ; String end = getSQLString ( function . getTerm ( 2 ) , index , false ) ; return sqladapter . strSubstr ( string , start , end ) ; } if ( functionSymbol == ExpressionOperation . STRBEFORE ) { String string = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String before = getSQLString ( function . getTerm ( 1 ) , index , false ) ; return sqladapter . strBefore ( string , before ) ; } if ( functionSymbol == ExpressionOperation . STRAFTER ) { String string = getSQLString ( function . getTerm ( 0 ) , index , false ) ; String after = getSQLString ( function . getTerm ( 1 ) , index , false ) ; return sqladapter . strAfter ( string , after ) ; } if ( functionSymbol == ExpressionOperation . COUNT ) { if ( function . getTerm ( 0 ) . toString ( ) . equals ( "*" ) ) { return "COUNT(*)" ; } String columnName = getSQLString ( function . getTerm ( 0 ) , index , false ) ; // havingCond = true ;
return "COUNT(" + columnName + ")" ; } if ( functionSymbol == ExpressionOperation . AVG ) { String columnName = getSQLString ( function . getTerm ( 0 ) , index , false ) ; // havingCond = true ;
return "AVG(" + columnName + ")" ; } if ( functionSymbol == ExpressionOperation . SUM ) { String columnName = getSQLString ( function . getTerm ( 0 ) , index , false ) ; // havingCond = true ;
return "SUM(" + columnName + ")" ; } throw new RuntimeException ( "Unexpected function in the query: " + functionSymbol ) ; |
public class TupleCombinerBuilder { /** * Excludes the given variables from this combiner . */
public TupleCombinerBuilder exclude ( Stream < String > varNamePatterns ) { } } | varNamePatterns . forEach ( varNamePattern -> tupleCombiner_ . addExcludedVar ( varNamePattern ) ) ; return this ; |
public class CollectionUtils { /** * Create a list out of the items in the Iterable .
* @ param < T >
* The type of items in the Iterable .
* @ param items
* The items to be made into a list .
* @ return A list consisting of the items of the Iterable , in the same order . */
public static < T > List < T > toList ( Iterable < T > items ) { } } | List < T > list = new ArrayList < T > ( ) ; addAll ( list , items ) ; return list ; |
public class DtoConverterServiceImpl { /** * Convert a geometry class to a layer type .
* @ param geometryClass
* JTS geometry class
* @ return Geomajas layer type */
public LayerType toDto ( Class < ? extends com . vividsolutions . jts . geom . Geometry > geometryClass ) { } } | if ( geometryClass == LineString . class ) { return LayerType . LINESTRING ; } else if ( geometryClass == MultiLineString . class ) { return LayerType . MULTILINESTRING ; } else if ( geometryClass == Point . class ) { return LayerType . POINT ; } else if ( geometryClass == MultiPoint . class ) { return LayerType . MULTIPOINT ; } else if ( geometryClass == Polygon . class ) { return LayerType . POLYGON ; } else if ( geometryClass == MultiPolygon . class ) { return LayerType . MULTIPOLYGON ; } else { return LayerType . GEOMETRY ; } |
public class _Private_IonBinaryWriterBuilder { /** * Fills all properties and returns an immutable builder . */
private _Private_IonBinaryWriterBuilder fillDefaults ( ) { } } | // Ensure that we don ' t modify the user ' s builder .
_Private_IonBinaryWriterBuilder b = copy ( ) ; if ( b . getSymtabValueFactory ( ) == null ) { IonSystem system = IonSystemBuilder . standard ( ) . build ( ) ; b . setSymtabValueFactory ( system ) ; } return b . immutable ( ) ; |
public class JamaLU { /** * Return upper triangular factor
* @ return U */
public Matrix getU ( ) { } } | Matrix X = MatrixFactory . createMatrix ( n , n ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i <= j ) { X . set ( i , j , LU [ i ] [ j ] ) ; } } } return X ; |
public class HSQLInterface { /** * Modify the current schema with a SQL DDL command .
* @ param ddl The SQL DDL statement to be run .
* @ throws HSQLParseException Throws exception if SQL parse error is
* encountered . */
public void runDDLCommand ( String ddl ) throws HSQLParseException { } } | sessionProxy . clearLocalTables ( ) ; Result result = sessionProxy . executeDirectStatement ( ddl ) ; if ( result . hasError ( ) ) { throw new HSQLParseException ( result . getMainString ( ) ) ; } |
public class TogglingCommandLink { /** * Changes the state without executing the command . */
public void setState ( State state ) { } } | this . state = state ; setText ( state . isPrimary ( ) ? text1 : text2 ) ; |
public class BootstrapContextImpl { /** * Stop the resource adapter context descriptor task if one was started .
* @ param raThreadContextDescriptor
* @ param threadContext */
private void stopTask ( ThreadContextDescriptor raThreadContextDescriptor , ArrayList < ThreadContext > threadContext ) { } } | if ( raThreadContextDescriptor != null ) raThreadContextDescriptor . taskStopping ( threadContext ) ; |
public class ClassRef { /** * Reads a class Object .
* @ param in source to read from
* @ return the Class read */
public static Class < ? > read ( ObjectInput in ) throws java . io . IOException { } } | byte dim ; Class < ? > cl ; String name ; dim = in . readByte ( ) ; if ( dim == - 1 ) { return null ; } else { name = in . readUTF ( ) ; cl = classFind ( name ) ; if ( cl == null ) { throw new RuntimeException ( "can't load class " + name ) ; } while ( dim -- > 0 ) { cl = net . oneandone . sushi . util . Arrays . getArrayClass ( cl ) ; } return cl ; } |
public class RegistriesInner { /** * Gets the quota usages for the specified container registry .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the RegistryUsageListResultInner object if successful . */
public RegistryUsageListResultInner listUsages ( String resourceGroupName , String registryName ) { } } | return listUsagesWithServiceResponseAsync ( resourceGroupName , registryName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class StorableProperties { /** * Before it saves this value it creates a string out of it . */
public synchronized StorableProperties put ( String key , Object val ) { } } | if ( ! key . equals ( toLowerCase ( key ) ) ) throw new IllegalArgumentException ( "Do not use upper case keys (" + key + ") for StorableProperties since 0.7" ) ; map . put ( key , val . toString ( ) ) ; return this ; |
public class JKIOUtil { /** * Convert to string .
* @ param input the input
* @ return the string
* @ throws IOException Signals that an I / O exception has occurred . */
public static String convertToString ( InputStream input ) throws IOException { } } | try { if ( input == null ) { throw new IOException ( "Input Stream Cannot be NULL" ) ; } StringBuilder sb1 = new StringBuilder ( ) ; String line ; try { BufferedReader r1 = new BufferedReader ( new InputStreamReader ( input , "UTF-8" ) ) ; while ( ( line = r1 . readLine ( ) ) != null ) { sb1 . append ( line ) ; } } finally { input . close ( ) ; } return sb1 . toString ( ) ; } catch ( IOException e ) { throw new JKException ( e ) ; } |
public class CmsOrgUnitBean { /** * Sets the parentOu . < p >
* @ param parentOu the parentOu to set */
public void setParentOu ( String parentOu ) { } } | if ( parentOu . startsWith ( CmsOrganizationalUnit . SEPARATOR ) ) { parentOu = parentOu . substring ( 1 ) ; } m_parentOu = parentOu ; |
public class CommonUtils { /** * Append the given { @ code annotation } to list of annotations for the given { @ code field } . */
public static void addAnnotation ( JVar field , JAnnotationUse annotation ) { } } | List < JAnnotationUse > annotations = getPrivateField ( field , "annotations" ) ; annotations . add ( annotation ) ; |
public class UtlInvBase { /** * < p > Makes invoice line final results . < / p >
* @ param < T > invoice type
* @ param < L > invoice line type
* @ param pLine invoice line
* @ param pTotTxs total line taxes
* @ param pTotTxsFc total line taxes FC
* @ param pIsTxByUser if tax set by user */
public final < T extends IInvoice , L extends IInvoiceLine < T > > void mkLnFinal ( final L pLine , final BigDecimal pTotTxs , final BigDecimal pTotTxsFc , final Boolean pIsTxByUser ) { } } | if ( pIsTxByUser ) { if ( pLine . getItsOwner ( ) . getForeignCurrency ( ) == null ) { if ( pLine . getTotalTaxes ( ) . compareTo ( pTotTxs ) != 0 ) { if ( pLine . getDescription ( ) == null ) { pLine . setDescription ( pLine . getTotalTaxes ( ) . toString ( ) + "!=" + pTotTxs + "!" ) ; } else { pLine . setDescription ( pLine . getDescription ( ) + " " + pLine . getTotalTaxes ( ) . toString ( ) + "!=" + pTotTxs + "!" ) ; } } } else { pLine . setTotalTaxes ( pTotTxs ) ; if ( pLine . getForeignTotalTaxes ( ) . compareTo ( pTotTxsFc ) != 0 ) { if ( pLine . getDescription ( ) == null ) { pLine . setDescription ( pLine . getForeignTotalTaxes ( ) . toString ( ) + "!=" + pTotTxsFc + "!" ) ; } else { pLine . setDescription ( pLine . getDescription ( ) + " " + pLine . getForeignTotalTaxes ( ) . toString ( ) + "!=" + pTotTxsFc + "!" ) ; } } } } else { pLine . setTotalTaxes ( pTotTxs ) ; pLine . setForeignTotalTaxes ( pTotTxsFc ) ; } |
public class BeanValidationImpl { /** * Start
* @ exception Throwable If an error occurs */
public void start ( ) throws Throwable { } } | Context context = null ; try { Properties properties = new Properties ( ) ; properties . setProperty ( Context . PROVIDER_URL , jndiProtocol + "://" + jndiHost + ":" + jndiPort ) ; context = new InitialContext ( properties ) ; context . rebind ( VALIDATOR_FACTORY , new SerializableValidatorFactory ( validatorFactory ) ) ; } finally { try { if ( context != null ) context . close ( ) ; } catch ( NamingException ne ) { // Ignore
} } |
public class SimulatorImpl { /** * Shuts down properly .
* This method is typically called from a shutdown hook to terminate the simulator properly .
* Cancels the timer thread used for task scheduling .
* Overloading implementations should call this method AFTER doing its own work . */
protected void shutdown ( ) { } } | LOGGER . info ( "Shutting down SimulatorImpl" ) ; LOGGER . info ( "Cancelling timer thread" ) ; mTimer . cancel ( ) ; mTimer = null ; mSimulator = mPySimulator = null ; mInterpreter = null ; |
public class CoreNLPConstituencyParse { /** * finds the open / closes using a stack */
private static ImmutableList < Range < Integer > > findAllOpenCloseParens ( final String parse ) { } } | final ImmutableList . Builder < Range < Integer > > ret = ImmutableList . builder ( ) ; final Stack < Integer > openPositions = new Stack < > ( ) ; for ( int pos = 0 ; pos < parse . length ( ) ; pos ++ ) { // push
if ( parse . charAt ( pos ) == '(' ) { openPositions . push ( pos ) ; } // pop
if ( parse . charAt ( pos ) == ')' ) { Integer open = openPositions . pop ( ) ; ret . add ( Range . closed ( open , pos ) ) ; } } return ret . build ( ) ; |
public class VarCheck { /** * Returns true if n is the name of a variable that declares a namespace in an externs file . */
static boolean isExternNamespace ( Node n ) { } } | return n . getParent ( ) . isVar ( ) && n . isFromExterns ( ) && NodeUtil . isNamespaceDecl ( n ) ; |
public class AuditAnnotationAttributes { /** * Gets the action .
* @ param annotations
* the annotations
* @ param method
* the method
* @ return the action */
private String getAction ( final Annotation [ ] annotations , final Method method ) { } } | for ( final Annotation annotation : annotations ) { if ( annotation instanceof Audit ) { final Audit audit = ( Audit ) annotation ; String action = audit . action ( ) ; if ( ACTION . equals ( action ) ) { return method . getName ( ) ; } else { return action ; } } } return null ; |
public class UnicodeUtilImpl { /** * @ see # normalize2Ascii ( char )
* @ param character is the character to convert .
* @ param nonNormalizableCharaterReplacement is the character used to replace unicode characters that have
* no { @ link # normalize2Ascii ( char ) corresponding ASCII representation } . Use { @ link # NULL } to remove
* these characters . A typical character to use is { @ code ? } .
* @ return a sequence of ASCII - characters that represent the given character or { @ code null } if the
* character is already ASCII or there is no ASCII - representation available . */
public String normalize2Ascii ( char character , char nonNormalizableCharaterReplacement ) { } } | String transliteration = transliterate ( character ) ; if ( transliteration == null ) { return CHARACTER_TO_ASCII_MAP . get ( Character . valueOf ( character ) ) ; } else { int length = transliteration . length ( ) ; if ( length == 1 ) { return CHARACTER_TO_ASCII_MAP . get ( Character . valueOf ( transliteration . charAt ( 0 ) ) ) ; } StringBuilder buffer = new StringBuilder ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = transliteration . charAt ( i ) ; if ( c <= 127 ) { buffer . append ( c ) ; } else { String ascii = CHARACTER_TO_ASCII_MAP . get ( c ) ; if ( ascii != null ) { buffer . append ( ascii ) ; } else if ( nonNormalizableCharaterReplacement != NULL ) { buffer . append ( nonNormalizableCharaterReplacement ) ; } } } return buffer . toString ( ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.