signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class RepeatedFieldBuilder { /** * Increments the mod counts so that an ConcurrentModificationException can be thrown if calling
* code tries to modify the builder while its iterating the list . */
private void incrementModCounts ( ) { } } | if ( externalMessageList != null ) { externalMessageList . incrementModCount ( ) ; } if ( externalBuilderList != null ) { externalBuilderList . incrementModCount ( ) ; } if ( externalMessageOrBuilderList != null ) { externalMessageOrBuilderList . incrementModCount ( ) ; } |
public class BooleanUtils { /** * < p > Converts an int to a boolean specifying the conversion values . < / p >
* < pre >
* BooleanUtils . toBoolean ( 0 , 1 , 0 ) = false
* BooleanUtils . toBoolean ( 1 , 1 , 0 ) = true
* BooleanUtils . toBoolean ( 2 , 1 , 2 ) = false
* BooleanUtils . toBoolean ( 2 , 2 , 0 ) = true
* < / pre >
* @ param value the Integer to convert
* @ param trueValue the value to match for { @ code true }
* @ param falseValue the value to match for { @ code false }
* @ return { @ code true } or { @ code false }
* @ throws IllegalArgumentException if no match */
public static boolean toBoolean ( final int value , final int trueValue , final int falseValue ) { } } | if ( value == trueValue ) { return true ; } if ( value == falseValue ) { return false ; } // no match
throw new IllegalArgumentException ( "The Integer did not match either specified value" ) ; |
public class GeoServiceGeometry { /** * Convert a Point and LocationType into a Feature .
* @ param point the Point
* @ param locationType the LocationType
* @ return the Feature */
private static Feature createLocation ( final Point point , final LocationType locationType ) { } } | final Feature location = new Feature ( ) ; location . setGeometry ( point ) ; location . setProperty ( "locationType" , locationType ) ; location . setId ( "location" ) ; return location ; |
public class CQLService { /** * Return true if the given table exists in the given keyspace . */
private boolean storeExists ( String tableName ) { } } | KeyspaceMetadata ksMetadata = m_cluster . getMetadata ( ) . getKeyspace ( m_keyspace ) ; return ( ksMetadata != null ) && ( ksMetadata . getTable ( tableName ) != null ) ; |
public class Signature { /** * Prepend arguments ( names + types ) to the signature .
* @ param names the names of the arguments
* @ param types the types of the arguments
* @ return a new signature with the added arguments */
public Signature prependArgs ( String [ ] names , Class < ? > ... types ) { } } | String [ ] newArgNames = new String [ argNames . length + names . length ] ; System . arraycopy ( argNames , 0 , newArgNames , names . length , argNames . length ) ; System . arraycopy ( names , 0 , newArgNames , 0 , names . length ) ; MethodType newMethodType = methodType . insertParameterTypes ( 0 , types ) ; return new Signature ( newMethodType , newArgNames ) ; |
public class AffineGapAlignmentScoring { /** * Returns AminoAcid BLAST scoring
* @ param matrix BLAST substitution matrix to be used
* @ param gapOpenPenalty penalty for opening gap to be used in system
* @ param gapExtensionPenalty penalty for extending gap to be used in system
* @ return AminoAcid BLAST scoring */
public static AffineGapAlignmentScoring < AminoAcidSequence > getAminoAcidBLASTScoring ( BLASTMatrix matrix , int gapOpenPenalty , int gapExtensionPenalty ) { } } | return new AffineGapAlignmentScoring < > ( AminoAcidSequence . ALPHABET , matrix . getMatrix ( ) , gapOpenPenalty , gapExtensionPenalty ) ; |
public class ImageLoading { /** * Saving image in bmp to file
* @ param src source image
* @ param fileName destination file name
* @ throws ImageSaveException if it is unable to save image */
public static void saveBmp ( Bitmap src , String fileName ) throws ImageSaveException { } } | try { BitmapUtil . save ( src , fileName ) ; } catch ( IOException e ) { throw new ImageSaveException ( e ) ; } |
public class StatementUtil { /** * 创建批量操作的 { @ link PreparedStatement }
* @ param conn 数据库连接
* @ param sql SQL语句 , 使用 " ? " 做为占位符
* @ param paramsBatch " ? " 对应参数批次列表
* @ return { @ link PreparedStatement }
* @ throws SQLException SQL异常
* @ since 4.1.13 */
public static PreparedStatement prepareStatementForBatch ( Connection conn , String sql , Object [ ] ... paramsBatch ) throws SQLException { } } | return prepareStatementForBatch ( conn , sql , new ArrayIter < Object [ ] > ( paramsBatch ) ) ; |
public class ModuleApiKeys { /** * Fetch all delivery api keys from the given space .
* This method will override the configuration specified through
* { @ link CMAClient . Builder # setSpaceId ( String ) } and will ignore
* { @ link CMAClient . Builder # setEnvironmentId ( String ) } .
* @ param spaceId the id of the space to host the api keys .
* @ return a list of delivery api keys .
* @ throws IllegalArgumentException if spaceId is null . */
public CMAArray < CMAApiKey > fetchAll ( String spaceId ) { } } | assertNotNull ( spaceId , "spaceId" ) ; return service . fetchAll ( spaceId ) . blockingFirst ( ) ; |
public class DeleteResults { /** * Creates new instance of immutable container for results of Delete Operation
* @ param results map with results of Delete Operation
* @ param < T > type of objects
* @ return new instance of { @ link DeleteResults } */
@ NonNull public static < T > DeleteResults < T > newInstance ( @ NonNull Map < T , DeleteResult > results ) { } } | return new DeleteResults < T > ( results ) ; |
public class TenantService { /** * Get the { @ link Tenant } object for the tenant with the given name . This is a
* convenience method that calls { @ link # getTenantDefinition ( String ) } and either
* returns null or calls < code > new Teanant ( tenantDef ) < / code > using the tenant
* definition found .
* @ param tenantName Name of a tenant .
* @ return { @ link Tenant } object for tenant , which also contains the
* tenant ' s { @ link TenantDefinition } . */
public Tenant getTenant ( String tenantName ) { } } | if ( tenantName . equals ( m_defaultTenantName ) ) { return getDefaultTenant ( ) ; } checkServiceState ( ) ; TenantDefinition tenantDef = getTenantDefinition ( tenantName ) ; if ( tenantDef == null ) { return null ; } return new Tenant ( tenantDef ) ; |
public class XlsMapper { /** * Excelファイルの複数シートを読み込み 、 任意のクラスにマップする 。
* < p > 複数のシートの形式を一度に読み込む際に使用します 。 < / p >
* @ param xlsIn 読み込み元のExcelファイルのストリーム 。
* @ param classes マッピング先のクラスタイプの配列 。
* @ return マッピングした複数のシート 。
* { @ link Configuration # isIgnoreSheetNotFound ( ) } の値がtrueで 、 シートが見つからない場合 、 マッピング結果には含まれません 。
* @ throws IllegalArgumentException { @ literal xlsIn = = null or classes = = null }
* @ throws IllegalArgumentException { @ literal calsses . length = = 0}
* @ throws XlsMapperException マッピングに失敗した場合
* @ throws IOException ファイルの読み込みに失敗した場合 */
public Object [ ] loadMultiple ( final InputStream xlsIn , final Class < ? > [ ] classes ) throws XlsMapperException , IOException { } } | return loader . loadMultiple ( xlsIn , classes ) ; |
public class ZooKeeperClient { /** * { @ inheritDoc } */
@ Override public void destroy ( ) { } } | try { _destroyNodeWatcher ( ) ; } catch ( Exception e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } try { _close ( ) ; } catch ( Exception e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } super . destroy ( ) ; |
public class ManualHttpRequestEditorDialog { /** * Return the footer status bar object
* @ return */
protected JToolBar getFooterStatusBar ( ) { } } | if ( footerToolbar == null ) { footerToolbar = new JToolBar ( ) ; footerToolbar . setEnabled ( true ) ; footerToolbar . setFloatable ( false ) ; footerToolbar . setRollover ( true ) ; footerToolbar . setName ( "Footer Toolbar Left" ) ; footerToolbar . setBorder ( BorderFactory . createEtchedBorder ( ) ) ; } return footerToolbar ; |
public class CDKRMapHandler { /** * This makes atom map of matching atoms out of atom map of matching bonds as produced by the get ( Subgraph | Ismorphism ) Map methods .
* Added by Asad since CDK one doesn ' t pick up the correct changes
* @ param list The list produced by the getMap method .
* @ param sourceGraph first molecule . Must not be an IQueryAtomContainer .
* @ param targetGraph second molecule . May be an IQueryAtomContainer .
* @ return The mapping found projected on sourceGraph . This is atom List of CDKRMap objects containing Ids of matching atoms . */
private static List < List < CDKRMap > > makeAtomsMapOfBondsMapSingleBond ( List < CDKRMap > list , IAtomContainer sourceGraph , IAtomContainer targetGraph ) { } } | if ( list == null ) { return null ; } Map < IBond , IBond > bondMap = new HashMap < IBond , IBond > ( list . size ( ) ) ; for ( CDKRMap solBondMap : list ) { int id1 = solBondMap . getId1 ( ) ; int id2 = solBondMap . getId2 ( ) ; IBond qBond = sourceGraph . getBond ( id1 ) ; IBond tBond = targetGraph . getBond ( id2 ) ; bondMap . put ( qBond , tBond ) ; } List < CDKRMap > result1 = new ArrayList < CDKRMap > ( ) ; List < CDKRMap > result2 = new ArrayList < CDKRMap > ( ) ; for ( IBond qbond : sourceGraph . bonds ( ) ) { if ( bondMap . containsKey ( qbond ) ) { IBond tbond = bondMap . get ( qbond ) ; CDKRMap map00 = null ; CDKRMap map01 = null ; CDKRMap map10 = null ; CDKRMap map11 = null ; if ( ( qbond . getBegin ( ) . getSymbol ( ) . equals ( tbond . getBegin ( ) . getSymbol ( ) ) ) && ( qbond . getEnd ( ) . getSymbol ( ) . equals ( tbond . getEnd ( ) . getSymbol ( ) ) ) ) { map00 = new CDKRMap ( sourceGraph . indexOf ( qbond . getBegin ( ) ) , targetGraph . indexOf ( tbond . getBegin ( ) ) ) ; map11 = new CDKRMap ( sourceGraph . indexOf ( qbond . getEnd ( ) ) , targetGraph . indexOf ( tbond . getEnd ( ) ) ) ; if ( ! result1 . contains ( map00 ) ) { result1 . add ( map00 ) ; } if ( ! result1 . contains ( map11 ) ) { result1 . add ( map11 ) ; } } if ( ( qbond . getBegin ( ) . getSymbol ( ) . equals ( tbond . getEnd ( ) . getSymbol ( ) ) ) && ( qbond . getEnd ( ) . getSymbol ( ) . equals ( tbond . getBegin ( ) . getSymbol ( ) ) ) ) { map01 = new CDKRMap ( sourceGraph . indexOf ( qbond . getBegin ( ) ) , targetGraph . indexOf ( tbond . getEnd ( ) ) ) ; map10 = new CDKRMap ( sourceGraph . indexOf ( qbond . getEnd ( ) ) , targetGraph . indexOf ( tbond . getBegin ( ) ) ) ; if ( ! result2 . contains ( map01 ) ) { result2 . add ( map01 ) ; } if ( ! result2 . contains ( map10 ) ) { result2 . add ( map10 ) ; } } } } List < List < CDKRMap > > result = new ArrayList < List < CDKRMap > > ( ) ; if ( result1 . size ( ) == result2 . size ( ) ) { result . add ( result1 ) ; result . add ( result2 ) ; } else if ( result1 . size ( ) > result2 . size ( ) ) { result . add ( result1 ) ; } else { result . add ( result2 ) ; } return result ; |
public class StageServiceImpl { /** * Gets the stage .
* @ param swb the waveBean holding default values
* @ param scene the scene
* @ return the stage */
private Stage getStage ( final StageWaveBean swb , final Scene scene ) { } } | Stage stage = swb . stage ( ) ; if ( stage == null ) { stage = new Stage ( ) ; } stage . setScene ( scene ) ; return stage ; |
public class MyAboutMePage { /** * public SamplePage assertSocialButtons ( SocialButtonsAssert socialButtonsAssert ) { */
protected WebElement getSocialIcon ( String social ) { } } | logger . debug ( "getSocialIcon " + social ) ; By linkLocator = By . cssSelector ( "a." + social ) ; WebElement foundSocialIcon = null ; for ( WebElement socialIcon : socialIcons ) { try { socialIcon . findElement ( linkLocator ) ; foundSocialIcon = socialIcon ; } catch ( NoSuchElementException e ) { continue ; } } assertNotNull ( "social button for " + social + " not found." , foundSocialIcon ) ; return foundSocialIcon ; |
public class MoneyUtils { /** * Adds two { @ code Money } objects , handling null .
* This returns { @ code money1 + money2 } where null is ignored .
* If both input values are null , then null is returned .
* @ param money1 the first money instance , null returns money2
* @ param money2 the first money instance , null returns money1
* @ return the total , where null is ignored , null if both inputs are null
* @ throws CurrencyMismatchException if the currencies differ */
public static Money add ( Money money1 , Money money2 ) { } } | if ( money1 == null ) { return money2 ; } if ( money2 == null ) { return money1 ; } return money1 . plus ( money2 ) ; |
public class IntStreamEx { /** * Produces an array containing cumulative results of applying the
* accumulation function going left to right .
* This is a terminal operation .
* For parallel stream it ' s not guaranteed that accumulator will always be
* executed in the same thread .
* This method cannot take all the advantages of parallel streams as it must
* process elements strictly left to right .
* @ param accumulator a
* < a href = " package - summary . html # NonInterference " > non - interfering
* < / a > , < a href = " package - summary . html # Statelessness " > stateless < / a >
* function for incorporating an additional element into a result
* @ return the array where the first element is the first element of this
* stream and every successor element is the result of applying
* accumulator function to the previous array element and the
* corresponding stream element . The resulting array has the same
* length as this stream .
* @ see # foldLeft ( IntBinaryOperator )
* @ since 0.5.1 */
public int [ ] scanLeft ( IntBinaryOperator accumulator ) { } } | Spliterator . OfInt spliterator = spliterator ( ) ; long size = spliterator . getExactSizeIfKnown ( ) ; IntBuffer buf = new IntBuffer ( size >= 0 && size <= Integer . MAX_VALUE ? ( int ) size : INITIAL_SIZE ) ; delegate ( spliterator ) . forEachOrdered ( i -> buf . add ( buf . size == 0 ? i : accumulator . applyAsInt ( buf . data [ buf . size - 1 ] , i ) ) ) ; return buf . toArray ( ) ; |
public class VictimsSQL { /** * Given a an sql query containing the string " IN ( ? ) " and a set of strings ,
* this method constructs a query by safely replacing the first occurence of
* " IN ( ? ) " with " IN ( ' v1 ' , ' v2 ' . . . ) " , where v1 , v2 , . . are in values .
* @ param query
* @ param values
* @ return */
protected String constructInStringsQuery ( String query , Set < String > values ) { } } | String replace = "IN (?)" ; assert query . lastIndexOf ( replace ) == query . indexOf ( replace ) ; String sql = query . replace ( "IN (?)" , "IN (%s)" ) ; StringBuffer list = new StringBuffer ( ) ; for ( String value : values ) { if ( list . length ( ) > 0 ) { list . append ( "," ) ; } value = String . format ( "'%s'" , StringEscapeUtils . escapeSql ( value ) ) ; list . append ( value ) ; } return String . format ( sql , list . toString ( ) ) ; |
public class NondominatedPopulation { /** * only add solution if solution is not worse than any solution in the non - dominated population */
@ Override public boolean add ( Solution solution_to_add ) { } } | List < Solution > solutions_to_remove = new ArrayList < > ( ) ; boolean should_add = true ; for ( Solution solution : solutions ) { int flag = invertedCompare ( solution_to_add , solution ) ; if ( flag < 0 ) // solution _ to _ add is better
{ solutions_to_remove . add ( solution ) ; } else if ( flag > 0 ) // solution is better than solution _ to _ add
{ should_add = false ; break ; } else if ( getDistance ( solution_to_add , solution ) < Epsilon ) { should_add = false ; break ; } } solutions . removeAll ( solutions_to_remove ) ; if ( should_add ) { return solutions . add ( solution_to_add ) ; } return should_add ; |
public class Utils { /** * アノテーションの指定した属性値を取得する 。
* < p > アノテーションの修飾子はpublicである必要があります 。 < / p >
* @ param anno アノテーションのインスタンス
* @ param attrName 属性名
* @ param attrType 属性のタイプ 。
* @ return 属性を持たない場合 、 空を返す 。 */
@ SuppressWarnings ( "unchecked" ) public static < T > Optional < T > getAnnotationAttribute ( final Annotation anno , final String attrName , final Class < T > attrType ) { } } | try { final Method method = anno . annotationType ( ) . getMethod ( attrName ) ; method . setAccessible ( true ) ; if ( ! attrType . equals ( method . getReturnType ( ) ) ) { return Optional . empty ( ) ; } final Object value = method . invoke ( anno ) ; return Optional . of ( ( T ) value ) ; } catch ( Exception e ) { return Optional . empty ( ) ; } |
public class BusinessUtils { /** * Returns an arrays of all identifier class corresponding the the given array of aggregate root
* classes . */
public static Class < ? > [ ] getAggregateIdClasses ( Class < ? extends AggregateRoot < ? > > [ ] aggregateRootClasses ) { } } | checkNotNull ( aggregateRootClasses , "aggregateRootClasses should not be null" ) ; Class < ? > [ ] result = new Class < ? > [ aggregateRootClasses . length ] ; for ( int i = 0 ; i < aggregateRootClasses . length ; i ++ ) { result [ i ] = resolveGenerics ( AggregateRoot . class , aggregateRootClasses [ i ] ) [ 0 ] ; } return result ; |
public class Utils4J { /** * CHECKSTYLE : OFF */
public static String createWindowsDesktopUrlLinkContent ( final String baseUrl , final String url , final File workingDir , final Integer showCommand , final Integer iconIndex , final File iconFile , final Integer hotKey , final Date modified ) { } } | // CHECKSTYLE : ON
checkNotNull ( "baseUrl" , baseUrl ) ; checkNotEmpty ( "baseUrl" , baseUrl ) ; checkNotNull ( "url" , url ) ; checkNotEmpty ( "url" , url ) ; final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "[DEFAULT]\r\n" ) ; sb . append ( "BASEURL=" + baseUrl + "\r\n" ) ; sb . append ( "\r\n" ) ; sb . append ( "[InternetShortcut]\r\n" ) ; sb . append ( "URL=" + url + "\r\n" ) ; if ( workingDir != null ) { sb . append ( "WorkingDirectory=" + workingDir + "\r\n" ) ; } if ( showCommand != null ) { sb . append ( "ShowCommand=" + showCommand ) ; } if ( ( iconFile != null ) && ( iconFile . exists ( ) ) ) { if ( iconIndex == null ) { sb . append ( "IconIndex=0\r\n" ) ; } else { sb . append ( "IconIndex=" + iconIndex ) ; } sb . append ( "IconFile=" + iconFile + "\r\n" ) ; } sb . append ( "Modified=" + dateToFileTime ( new Date ( ) ) + "\r\n" ) ; if ( hotKey != null ) { sb . append ( "HotKey=" + hotKey + "\r\n" ) ; } return sb . toString ( ) ; |
public class NBTIO { /** * Reads an NBT tag .
* @ param in Data input to read from .
* @ return The read tag , or null if the tag is an end tag .
* @ throws java . io . IOException If an I / O error occurs . */
public static Tag readTag ( DataInput in ) throws IOException { } } | int id = in . readUnsignedByte ( ) ; if ( id == 0 ) { return null ; } String name = in . readUTF ( ) ; Tag tag ; try { tag = TagRegistry . createInstance ( id , name ) ; } catch ( TagCreateException e ) { throw new IOException ( "Failed to create tag." , e ) ; } tag . read ( in ) ; return tag ; |
public class BeanGen { private void generateMetaGetPropertyValue ( ) { } } | if ( properties . size ( ) == 0 ) { return ; } data . ensureImport ( Bean . class ) ; addLine ( 2 , "@Override" ) ; addLine ( 2 , "protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {" ) ; addLine ( 3 , "switch (propertyName.hashCode()) {" ) ; for ( PropertyGen prop : properties ) { addLines ( prop . generatePropertyGetCase ( ) ) ; } addLine ( 3 , "}" ) ; addLine ( 3 , "return super.propertyGet(bean, propertyName, quiet);" ) ; addLine ( 2 , "}" ) ; addBlankLine ( ) ; |
public class MapEntryLite { /** * Parses an entry off of the input as a { @ link Map . Entry } . This helper requires an allocation so using
* { @ link # parseInto } is preferred if possible .
* @ param bytes the bytes
* @ param extensionRegistry the extension registry
* @ return the map . entry
* @ throws IOException Signals that an I / O exception has occurred . */
public Map . Entry < K , V > parseEntry ( ByteString bytes , ExtensionRegistryLite extensionRegistry ) throws IOException { } } | return parseEntry ( bytes . newCodedInput ( ) , metadata , extensionRegistry ) ; |
public class TranslateTextRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TranslateTextRequest translateTextRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( translateTextRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( translateTextRequest . getText ( ) , TEXT_BINDING ) ; protocolMarshaller . marshall ( translateTextRequest . getTerminologyNames ( ) , TERMINOLOGYNAMES_BINDING ) ; protocolMarshaller . marshall ( translateTextRequest . getSourceLanguageCode ( ) , SOURCELANGUAGECODE_BINDING ) ; protocolMarshaller . marshall ( translateTextRequest . getTargetLanguageCode ( ) , TARGETLANGUAGECODE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CPOptionValueUtil { /** * Returns a range of all the cp option values where CPOptionId = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CPOptionValueModelImpl } . 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 CPOptionId the cp option ID
* @ param start the lower bound of the range of cp option values
* @ param end the upper bound of the range of cp option values ( not inclusive )
* @ return the range of matching cp option values */
public static List < CPOptionValue > findByCPOptionId ( long CPOptionId , int start , int end ) { } } | return getPersistence ( ) . findByCPOptionId ( CPOptionId , start , end ) ; |
public class HttpStopwatchSource { /** * Indicates whether the HTTP Request should be monitored - method is intended for override .
* Default behavior ignores URIs ending with . css , . png , . gif , . jpg and . js ( ignores casing ) .
* @ param httpServletRequest HTTP Request
* @ return true to enable request monitoring , false either */
@ Override public boolean isMonitored ( HttpServletRequest httpServletRequest ) { } } | String uri = httpServletRequest . getRequestURI ( ) . toLowerCase ( ) ; return ! ( uri . endsWith ( ".css" ) || uri . endsWith ( ".png" ) || uri . endsWith ( ".gif" ) || uri . endsWith ( ".jpg" ) || uri . endsWith ( ".js" ) ) ; |
public class FlipTileSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | super . initGraphics ( ) ; timeline = new Timeline ( ) ; characters = tile . getCharacterList ( ) ; currentSelectionIndex = 0 ; nextSelectionIndex = 1 ; centerX = PREFERRED_WIDTH * 0.5 ; centerY = PREFERRED_HEIGHT * 0.5 ; pane . setBackground ( null ) ; pane . setBorder ( null ) ; rotateFlap = new Rotate ( ) ; rotateFlap . setAxis ( Rotate . X_AXIS ) ; rotateFlap . setAngle ( 0 ) ; flapHeight = PREFERRED_HEIGHT * 0.495 ; upperBackground = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT * 0.495 ) ; upperBackgroundCtx = upperBackground . getGraphicsContext2D ( ) ; upperBackgroundText = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT * 0.495 ) ; upperBackgroundTextCtx = upperBackgroundText . getGraphicsContext2D ( ) ; upperBackgroundTextCtx . setTextBaseline ( VPos . CENTER ) ; upperBackgroundTextCtx . setTextAlign ( TextAlignment . CENTER ) ; lowerBackground = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT * 0.495 ) ; lowerBackgroundCtx = lowerBackground . getGraphicsContext2D ( ) ; lowerBackgroundText = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT * 0.495 ) ; lowerBackgroundTextCtx = lowerBackgroundText . getGraphicsContext2D ( ) ; lowerBackgroundTextCtx . setTextBaseline ( VPos . CENTER ) ; lowerBackgroundTextCtx . setTextAlign ( TextAlignment . CENTER ) ; flap = new Canvas ( PREFERRED_WIDTH , PREFERRED_HEIGHT * 0.495 ) ; flap . getTransforms ( ) . add ( rotateFlap ) ; flapCtx = flap . getGraphicsContext2D ( ) ; flapTextFront = new Canvas ( ) ; flapTextFront . getTransforms ( ) . add ( rotateFlap ) ; flapTextFrontCtx = flapTextFront . getGraphicsContext2D ( ) ; flapTextFrontCtx . setTextBaseline ( VPos . CENTER ) ; flapTextFrontCtx . setTextAlign ( TextAlignment . CENTER ) ; flapTextBack = new Canvas ( ) ; flapTextBack . getTransforms ( ) . add ( rotateFlap ) ; flapTextBack . setOpacity ( 0 ) ; flapTextBackCtx = flapTextBack . getGraphicsContext2D ( ) ; flapTextBackCtx . setTextBaseline ( VPos . CENTER ) ; flapTextBackCtx . setTextAlign ( TextAlignment . CENTER ) ; pane . getChildren ( ) . addAll ( upperBackground , lowerBackground , upperBackgroundText , lowerBackgroundText , flap , flapTextFront , flapTextBack ) ; |
public class ScopedServletUtils { /** * Get a URI relative to a given webapp root .
* @ param contextPath the webapp context path , e . g . , " / myWebapp "
* @ param uri the URI which should be made relative . */
public static final String getRelativeURI ( String contextPath , String uri ) { } } | String requestUrl = uri ; int overlap = requestUrl . indexOf ( contextPath + '/' ) ; assert overlap != - 1 : "contextPath: " + contextPath + ", uri: " + uri ; return requestUrl . substring ( overlap + contextPath . length ( ) ) ; |
public class AnnotationMappingInfo { /** * 指定したクラス情報を削除します 。
* @ since 1.4.1
* @ param className FQCN ( 完全限定クラス名 ) を指定します 。
* @ return true : 指定したクラス名を含み 、 それが削除できた場合 。 */
public boolean removeClassInfo ( final String className ) { } } | final ClassInfo existInfo = getClassInfo ( className ) ; if ( existInfo != null ) { this . classInfos . remove ( existInfo ) ; return true ; } return false ; |
public class LByteToCharFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static LByteToCharFunction byteToCharFunctionFrom ( Consumer < LByteToCharFunctionBuilder > buildingFunction ) { } } | LByteToCharFunctionBuilder builder = new LByteToCharFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class FileSystemServlet { /** * { @ inheritDoc } */
protected void doDelete ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { } } | String path = req . getPathInfo ( ) ; String context ; if ( path == null ) { path = req . getServletPath ( ) ; context = req . getContextPath ( ) ; } else { context = req . getContextPath ( ) + req . getServletPath ( ) ; } Entry entry = fileSystem . get ( path ) ; if ( entry == null ) { resp . setStatus ( HttpURLConnection . HTTP_OK ) ; return ; } try { fileSystem . remove ( entry ) ; resp . setStatus ( HttpURLConnection . HTTP_OK ) ; } catch ( UnsupportedOperationException e ) { resp . sendError ( HttpURLConnection . HTTP_BAD_METHOD ) ; } |
public class BeanMap { /** * Convenience method for getting an iterator over the values .
* @ return an iterator over the values */
public Iterator < Object > valueIterator ( ) { } } | final Iterator < String > iter = keyIterator ( ) ; return new Iterator < Object > ( ) { public boolean hasNext ( ) { return iter . hasNext ( ) ; } public Object next ( ) { String key = iter . next ( ) ; return get ( key ) ; } public void remove ( ) { throw new UnsupportedOperationException ( "remove() not supported for BeanMap" ) ; } } ; |
public class BlockBrowser { /** * This is called when the browser canvas is clicked */
private void canvasClick ( int x , int y ) { } } | // always called listeners
for ( CanvasClickListener listener : canvasClickAlwaysListeners ) listener . canvasClicked ( x , y ) ; // selected listener by toggle buttons
for ( JToggleButton button : canvasClickToggleListeners . keySet ( ) ) { if ( button . isSelected ( ) ) canvasClickToggleListeners . get ( button ) . canvasClicked ( x , y ) ; } /* if ( lookupButton . isSelected ( ) )
if ( proc . getAreaTree ( ) ! = null )
Area node = proc . getAreaTree ( ) . getAreaAt ( x , y ) ;
if ( node ! = null )
showAreaInTree ( node ) ;
showAreaInLogicalTree ( node ) ;
/ / lookupButton . setSelected ( false ) ;
if ( boxLookupButton . isSelected ( ) )
Box node = proc . getPage ( ) . getBoxAt ( x , y ) ;
if ( node ! = null )
showBoxInTree ( node ) ;
/ / boxLookupButton . setSelected ( false ) ;
if ( sepLookupButton . isSelected ( ) )
showSeparatorAt ( x , y ) ;
if ( extractButton . isSelected ( ) )
AreaNode node = proc . getAreaTree ( ) . getAreaAt ( x , y ) ;
if ( node ! = null )
proc . getExtractor ( ) . findArticleBounds ( node ) ;
try {
PrintStream exs = new PrintStream ( new FileOutputStream ( " test / extract . html " ) ) ;
proc . getExtractor ( ) . dumpTo ( exs ) ;
exs . close ( ) ;
} catch ( java . io . IOException e ) {
System . err . println ( " Output failed : " + e . getMessage ( ) ) ;
/ / String s = ex . getDescriptionX ( node , 2 ) ;
/ / System . out . println ( " Extracted : " + s ) ;
extractButton . setSelected ( false ) ; */ |
public class EnvelopePayloadConverter { /** * Convert to the output value of a field */
protected Object convertFieldValue ( Schema outputSchema , Field field , GenericRecord inputRecord , WorkUnitState workUnit ) throws DataConversionException { } } | if ( field . name ( ) . equals ( payloadField ) ) { return upConvertPayload ( inputRecord ) ; } return inputRecord . get ( field . name ( ) ) ; |
public class TargetSpecifications { /** * { @ link Specification } for retrieving { @ link Target } s including
* { @ link TargetTag } s .
* @ param controllerIDs
* to search for
* @ return the { @ link Target } { @ link Specification } */
public static Specification < JpaTarget > byControllerIdWithTagsInJoin ( final Collection < String > controllerIDs ) { } } | return ( targetRoot , query , cb ) -> { final Predicate predicate = targetRoot . get ( JpaTarget_ . controllerId ) . in ( controllerIDs ) ; targetRoot . fetch ( JpaTarget_ . tags , JoinType . LEFT ) ; query . distinct ( true ) ; return predicate ; } ; |
public class AbstractArakhneMojo { /** * Copy a file .
* @ param in input file .
* @ param out output file .
* @ throws IOException on error . */
public final void fileCopy ( URL in , File out ) throws IOException { } } | assert in != null ; try ( InputStream inStream = in . openStream ( ) ) { try ( OutputStream outStream = new FileOutputStream ( out ) ) { final byte [ ] buf = new byte [ FILE_BUFFER ] ; int len ; while ( ( len = inStream . read ( buf ) ) > 0 ) { outStream . write ( buf , 0 , len ) ; } } } finally { getBuildContext ( ) . refresh ( out ) ; } |
public class ScopedMessageHandler { /** * Save message as ( global ) user messages . ( overriding existing messages ) < br >
* This message will be deleted immediately after display if you use e . g . la : errors .
* @ param property The property name corresponding to the message . ( NotNull )
* @ param messageKey The message key to be saved . ( NotNull )
* @ param args The varying array of arguments for the message . ( NullAllowed , EmptyAllowed ) */
public void save ( String property , String messageKey , Object ... args ) { } } | assertObjectNotNull ( "messageKey" , messageKey ) ; doSaveInfo ( prepareUserMessages ( property , messageKey , args ) ) ; |
public class AbstractObjectQuery { /** * Get the index for a SQLTable if the table is not existing the table is
* added and a new index given .
* @ param _ sqlTable SQLTable the index is wanted for
* @ return index of the SQLTable */
public Integer getIndex4SqlTable ( final SQLTable _sqlTable ) { } } | final Integer ret ; if ( this . sqlTable2Index . containsKey ( _sqlTable ) ) { ret = this . sqlTable2Index . get ( _sqlTable ) ; } else { Integer max = 0 ; for ( final Integer index : this . sqlTable2Index . values ( ) ) { if ( index > max ) { max = index ; } } ret = max + 1 ; this . sqlTable2Index . put ( _sqlTable , ret ) ; } return ret ; |
public class CloseableIterators { /** * Creates a { @ link com . merakianalytics . datapipelines . iterators . CloseableIterator } wrapper around the provided { @ link java . util . Iterator }
* @ param < T >
* the type of the { @ link java . util . Iterator }
* @ param iterator
* the { @ link java . util . Iterator } to wrap in a { @ link com . merakianalytics . datapipelines . iterators . CloseableIterator }
* @ return a { @ link com . merakianalytics . datapipelines . iterators . CloseableIterator } view of the { @ link java . util . Iterator } */
public static < T > CloseableIterator < T > from ( final Iterator < T > iterator ) { } } | if ( iterator instanceof CloseableIterator ) { return ( CloseableIterator < T > ) iterator ; } return new CloseableIterator < T > ( ) { @ Override public void close ( ) { // Do nothing
} @ Override public boolean hasNext ( ) { return iterator . hasNext ( ) ; } @ Override public T next ( ) { return iterator . next ( ) ; } @ Override public void remove ( ) { iterator . remove ( ) ; } } ; |
public class EntryStream { /** * Returns a sequential { @ link EntryStream } created from given
* { @ link Spliterator } .
* @ param < K > the type of stream keys
* @ param < V > the type of stream values
* @ param spliterator a spliterator to create the stream from .
* @ return the new stream
* @ since 0.3.4 */
public static < K , V > EntryStream < K , V > of ( Spliterator < ? extends Entry < K , V > > spliterator ) { } } | return of ( StreamSupport . stream ( spliterator , false ) ) ; |
public class ComponentBindingsProviderCache { /** * Registers the ComponentBindingsProvider specified by the
* ServiceReference .
* @ param reference
* the reference to the ComponentBindingsProvider service */
public void registerComponentBindingsProvider ( ServiceReference reference ) { } } | log . info ( "registerComponentBindingsProvider" ) ; log . info ( "Registering Component Bindings Provider {} - {}" , new Object [ ] { reference . getProperty ( Constants . SERVICE_ID ) , reference . getProperty ( Constants . SERVICE_PID ) } ) ; String [ ] resourceTypes = OsgiUtil . toStringArray ( reference . getProperty ( ComponentBindingsProvider . RESOURCE_TYPE_PROP ) , new String [ 0 ] ) ; for ( String resourceType : resourceTypes ) { if ( ! this . containsKey ( resourceType ) ) { put ( resourceType , new HashSet < ServiceReference > ( ) ) ; } log . debug ( "Adding to resource type {}" , resourceType ) ; get ( resourceType ) . add ( reference ) ; } |
public class SimpleDateFormat { /** * / * Initialize compiledPattern and numberFormat fields */
private void initialize ( Locale loc ) { } } | // Verify and compile the given pattern .
compiledPattern = compile ( pattern ) ; /* try the cache first */
numberFormat = cachedNumberFormatData . get ( loc ) ; if ( numberFormat == null ) { /* cache miss */
numberFormat = NumberFormat . getIntegerInstance ( loc ) ; numberFormat . setGroupingUsed ( false ) ; /* update cache */
cachedNumberFormatData . putIfAbsent ( loc , numberFormat ) ; } numberFormat = ( NumberFormat ) numberFormat . clone ( ) ; initializeDefaultCentury ( ) ; |
public class AsynchronousRequest { /** * For more info on guild treasury API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / guild / : id / treasury " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions < br / >
* @ param id guild id
* @ param api Guild leader ' s Guild Wars 2 API key
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see GuildTreasury guild treasury info */
public void getGuildTreasuryInfo ( String id , String api , Callback < List < GuildTreasury > > callback ) throws GuildWars2Exception , NullPointerException { } } | isParamValid ( new ParamChecker ( ParamType . GUILD , id ) , new ParamChecker ( ParamType . API , api ) ) ; gw2API . getGuildTreasuryInfo ( id , api ) . enqueue ( callback ) ; |
public class MappedDataCache { /** * Retrieve the value associated with the given key , blocking as long as necessary up to the specified maximum .
* @ param k The key .
* @ param timeout The length of the timeout .
* @ param unit The time unit of the timeout .
* @ return The value associated with the key .
* @ throws InterruptedException
* @ throws TimeoutException */
public V get ( K k , long timeout , TimeUnit unit ) throws InterruptedException , TimeoutException { } } | await ( k , timeout , unit ) ; return cache . get ( k ) ; |
public class Sentence { /** * Returns the substring of the sentence from start ( inclusive )
* to end ( exclusive ) .
* @ param start Leftmost index of the substring
* @ param end Rightmost index of the ngram
* @ return The ngram as a String */
public static < T > String extractNgram ( List < T > list , int start , int end ) { } } | if ( start < 0 || end > list . size ( ) || start >= end ) return null ; final StringBuilder sb = new StringBuilder ( ) ; // TODO : iterator
for ( int i = start ; i < end ; i ++ ) { T o = list . get ( i ) ; if ( sb . length ( ) != 0 ) sb . append ( " " ) ; sb . append ( ( o instanceof HasWord ) ? ( ( HasWord ) o ) . word ( ) : o . toString ( ) ) ; } return sb . toString ( ) ; |
public class SendTemplatedEmailRequest { /** * The reply - to email address ( es ) for the message . If the recipient replies to the message , each reply - to address
* will receive the reply .
* @ param replyToAddresses
* The reply - to email address ( es ) for the message . If the recipient replies to the message , each reply - to
* address will receive the reply . */
public void setReplyToAddresses ( java . util . Collection < String > replyToAddresses ) { } } | if ( replyToAddresses == null ) { this . replyToAddresses = null ; return ; } this . replyToAddresses = new com . amazonaws . internal . SdkInternalList < String > ( replyToAddresses ) ; |
public class BoundedLinkedList { /** * ( non - Javadoc )
* @ see java . util . LinkedList # addAll ( java . util . Collection ) */
@ Override public boolean addAll ( @ NonNull Collection < ? extends E > collection ) { } } | final int size = collection . size ( ) ; if ( size > maxSize ) { collection = new ArrayList < > ( collection ) . subList ( size - maxSize , size ) ; } final int overhead = size ( ) + collection . size ( ) - maxSize ; if ( overhead > 0 ) { removeRange ( 0 , overhead ) ; } return super . addAll ( collection ) ; |
public class ParserDDL { /** * Process a bracketed column list as used in the declaration of SQL
* CONSTRAINTS and return an array containing the indexes of the columns
* within the table .
* @ param table table that contains the columns
* @ param ascOrDesc boolean
* @ return array of column indexes */
private int [ ] readColumnList ( Table table , boolean ascOrDesc ) { } } | OrderedHashSet set = readColumnNames ( ascOrDesc ) ; return table . getColumnIndexes ( set ) ; |
public class AbstractHttpHandler { public void start ( ) throws Exception { } } | if ( _context == null ) throw new IllegalStateException ( "No context for " + this ) ; _started = true ; if ( log . isDebugEnabled ( ) ) log . debug ( "Started " + this ) ; |
public class TridiagonalHelper_DDRB { /** * Computes W from the householder reflectors stored in the columns of the row block
* submatrix Y .
* Y = v < sup > ( 1 ) < / sup > < br >
* W = - & beta ; < sub > 1 < / sub > v < sup > ( 1 ) < / sup > < br >
* for j = 2 : r < br >
* & nbsp ; & nbsp ; z = - & beta ; ( I + WY < sup > T < / sup > ) v < sup > ( j ) < / sup > < br >
* & nbsp ; & nbsp ; W = [ W z ] < br >
* & nbsp ; & nbsp ; Y = [ Y v < sup > ( j ) < / sup > ] < br >
* end < br >
* < br >
* where v < sup > ( . ) < / sup > are the house holder vectors , and r is the block length . Note that
* Y already contains the householder vectors so it does not need to be modified .
* Y and W are assumed to have the same number of rows and columns . */
public static void computeW_row ( final int blockLength , final DSubmatrixD1 Y , final DSubmatrixD1 W , final double beta [ ] , int betaIndex ) { } } | final int heightY = Y . row1 - Y . row0 ; CommonOps_DDRM . fill ( W . original , 0 ) ; // W = - beta * v ( 1)
BlockHouseHolder_DDRB . scale_row ( blockLength , Y , W , 0 , 1 , - beta [ betaIndex ++ ] ) ; final int min = Math . min ( heightY , W . col1 - W . col0 ) ; // set up rest of the rows
for ( int i = 1 ; i < min ; i ++ ) { // w = - beta * ( I + W * Y ^ T ) * u
double b = - beta [ betaIndex ++ ] ; // w = w - beta * W * ( Y ^ T * u )
for ( int j = 0 ; j < i ; j ++ ) { double yv = BlockHouseHolder_DDRB . innerProdRow ( blockLength , Y , i , Y , j , 1 ) ; VectorOps_DDRB . add_row ( blockLength , W , i , 1 , W , j , b * yv , W , i , 1 , Y . col1 - Y . col0 ) ; } // w = w - beta * u + stuff above
BlockHouseHolder_DDRB . add_row ( blockLength , Y , i , b , W , i , 1 , W , i , 1 , Y . col1 - Y . col0 ) ; } |
public class ConfiguratorPanel { /** * Add parameter to this panel .
* @ param param Parameter to add
* @ param track Parameter tracking object */
public void addParameter ( Object owner , Parameter < ? > param , TrackParameters track ) { } } | this . setBorder ( new SoftBevelBorder ( SoftBevelBorder . LOWERED ) ) ; ParameterConfigurator cfg = null ; { // Find
Object cur = owner ; while ( cur != null ) { cfg = childconfig . get ( cur ) ; if ( cfg != null ) { break ; } cur = track . getParent ( cur ) ; } } if ( cfg != null ) { cfg . addParameter ( owner , param , track ) ; return ; } else { cfg = makeConfigurator ( param ) ; cfg . addChangeListener ( this ) ; children . add ( cfg ) ; } |
public class StagePathUtils { /** * 返回对应的process path */
public static String getProcess ( Long pipelineId , String processNode ) { } } | // 根据channelId , pipelineId构造path
return MessageFormat . format ( ArbitrateConstants . NODE_PROCESS_FORMAT , getChannelId ( pipelineId ) , String . valueOf ( pipelineId ) , processNode ) ; |
public class AbstractPojoPathNavigator { /** * This method { @ link CollectionReflectionUtil # set ( Object , int , Object , GenericBean ) sets } the single
* { @ link CachingPojoPath # getSegment ( ) segment } of the given { @ code currentPath } from the array or
* { @ link java . util . List } given by { @ code parentPojo } . If the result is { @ code null } and { @ code mode } is
* { @ link PojoPathMode # CREATE _ IF _ NULL } it creates and attaches ( sets ) the missing object .
* @ param currentPath is the current { @ link CachingPojoPath } to set .
* @ param context is the { @ link PojoPathContext context } for this operation .
* @ param state is the { @ link # createState ( Object , String , PojoPathMode , PojoPathContext ) state } to use .
* @ param parentPojo is the parent { @ link net . sf . mmm . util . pojo . api . Pojo } to work on .
* @ param value is the value to set in { @ code parentPojo } .
* @ param index is the position of the { @ code value } to set in the array or { @ link java . util . List } given by
* { @ code parentPojo } .
* @ return the replaced value . It may be { @ code null } . */
protected Object setInList ( CachingPojoPath currentPath , PojoPathContext context , PojoPathState state , Object parentPojo , Object value , int index ) { } } | Object arrayOrList = convertList ( currentPath , context , state , parentPojo ) ; GenericBean < Object > arrayReceiver = new GenericBean < > ( ) ; Object convertedValue = value ; if ( currentPath . parent != null ) { GenericType < ? > collectionType = currentPath . parent . pojoType ; if ( collectionType != null ) { GenericType < ? > valueType = collectionType . getComponentType ( ) ; convertedValue = convert ( currentPath , context , value , valueType . getAssignmentClass ( ) , valueType ) ; } } Object result = getCollectionReflectionUtil ( ) . set ( arrayOrList , index , convertedValue , arrayReceiver ) ; Object newArray = arrayReceiver . getValue ( ) ; if ( newArray != null ) { if ( currentPath . parent . parent == null ) { throw new PojoPathCreationException ( state . rootPath . pojo , currentPath . getPojoPath ( ) ) ; } Object parentParentPojo ; if ( currentPath . parent . parent == null ) { parentParentPojo = state . rootPath . pojo ; } else { parentParentPojo = currentPath . parent . parent . pojo ; } set ( currentPath . parent , context , state , parentParentPojo , newArray ) ; } return result ; |
public class SubnetsInner { /** * Gets all subnets in a virtual network .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkName The name of the virtual network .
* @ 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 PagedList & lt ; SubnetInner & gt ; object if successful . */
public PagedList < SubnetInner > list ( final String resourceGroupName , final String virtualNetworkName ) { } } | ServiceResponse < Page < SubnetInner > > response = listSinglePageAsync ( resourceGroupName , virtualNetworkName ) . toBlocking ( ) . single ( ) ; return new PagedList < SubnetInner > ( response . body ( ) ) { @ Override public Page < SubnetInner > nextPage ( String nextPageLink ) { return listNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ; |
public class Quaternion { /** * Copies the elements of another quaternion .
* @ return a reference to this quaternion , for chaining . */
public Quaternion set ( IQuaternion other ) { } } | return set ( other . x ( ) , other . y ( ) , other . z ( ) , other . w ( ) ) ; |
public class FastHashMap { /** * Initializes this instance for the specified capacity .
* Once initialized , operations on this map should not create new objects
* ( unless the map ' s size exceeds the specified capacity ) .
* @ param capacity the initial capacity . */
@ SuppressWarnings ( "unchecked" ) private void initialize ( int capacity ) { } } | // Find a power of 2 > = capacity
int tableLength = 16 ; while ( tableLength < capacity ) { tableLength <<= 1 ; } // Allocates hash table .
_entries = new EntryImpl [ tableLength ] ; _mask = tableLength - 1 ; _capacity = capacity ; _size = 0 ; // Allocates views .
_values = new Values ( ) ; _entrySet = new EntrySet ( ) ; _keySet = new KeySet ( ) ; // Resets pointers .
_poolFirst = null ; _mapFirst = null ; _mapLast = null ; // Allocates entries .
for ( int i = 0 ; i < capacity ; i ++ ) { EntryImpl < K , V > entry = new EntryImpl < K , V > ( ) ; entry . _after = _poolFirst ; _poolFirst = entry ; } |
public class VehicleManager { /** * Change the active vehicle interface to a new type using the given
* resource .
* To disable all vehicle interfaces , pass null to this function .
* The only valid VehicleInterface types are those included with the library
* - the vehicle service running in a remote process is the one to actually
* instantiate the interfaces . Interfaces added with this method will be
* available for all other OpenXC applications running in the system .
* @ param vehicleInterfaceType A class implementing VehicleInterface that is
* included in the OpenXC library
* @ param resource A descriptor or a resource necessary to initialize the
* interface . See the specific implementation of { @ link VehicleService }
* to find the required format of this parameter . */
public void setVehicleInterface ( Class < ? extends VehicleInterface > vehicleInterfaceType , String resource ) throws VehicleServiceException { } } | Log . i ( TAG , "Setting VI to: " + vehicleInterfaceType ) ; String interfaceName = null ; if ( vehicleInterfaceType != null ) { interfaceName = vehicleInterfaceType . getName ( ) ; } if ( mRemoteService != null ) { try { mRemoteService . setVehicleInterface ( interfaceName , resource ) ; } catch ( RemoteException e ) { throw new VehicleServiceException ( "Unable to set vehicle interface" , e ) ; } } else { Log . w ( TAG , "Can't set vehicle interface, not connected to the " + "VehicleService" ) ; } |
public class HashinatorLite { /** * Given the type of the targeting partition parameter and an object ,
* coerce the object to the correct type and hash it .
* NOTE NOTE NOTE NOTE ! THIS SHOULD BE THE ONLY WAY THAT YOU FIGURE OUT
* THE PARTITIONING FOR A PARAMETER ! THIS IS SHARED BY SERVER AND CLIENT
* CLIENT USES direct instance method as it initializes its own per connection
* Hashinator .
* @ return The partition best set up to execute the procedure .
* @ throws VoltTypeException */
public int getHashedPartitionForParameter ( int partitionParameterType , Object partitionValue ) throws VoltTypeException { } } | final VoltType partitionParamType = VoltType . get ( ( byte ) partitionParameterType ) ; // Special cases :
// 1 ) if the user supplied a string for a number column ,
// try to do the conversion . This makes it substantially easier to
// load CSV data or other untyped inputs that match DDL without
// requiring the loader to know precise the schema .
// 2 ) For legacy hashinators , if we have a numeric column but the param is in a byte
// array , convert the byte array back to the numeric value
if ( partitionValue != null && partitionParamType . isAnyIntegerType ( ) ) { if ( partitionValue . getClass ( ) == String . class ) { try { partitionValue = Long . parseLong ( ( String ) partitionValue ) ; } catch ( NumberFormatException nfe ) { throw new VoltTypeException ( "getHashedPartitionForParameter: Unable to convert string " + ( ( String ) partitionValue ) + " to " + partitionParamType . getMostCompatibleJavaTypeName ( ) + " target parameter " ) ; } } else if ( partitionValue . getClass ( ) == byte [ ] . class ) { partitionValue = partitionParamType . bytesToValue ( ( byte [ ] ) partitionValue ) ; } } return hashToPartition ( partitionParamType , partitionValue ) ; |
public class JacksonDBCollection { /** * performs a map reduce operation
* Runs the command in REPLACE output mode ( saves to named collection )
* @ param map map function in javascript code
* @ param outputTarget optional - leave null if want to use temp collection
* @ param reduce reduce function in javascript code
* @ param query to match
* @ return The output
* @ throws MongoException If an error occurred */
@ Deprecated public com . mongodb . MapReduceOutput mapReduce ( String map , String reduce , String outputTarget , DBObject query ) throws MongoException { } } | return mapReduce ( new MapReduceCommand ( dbCollection , map , reduce , outputTarget , MapReduceCommand . OutputType . REPLACE , serializeFields ( query ) ) ) ; |
public class ExampleMenuAction { /** * { @ inheritDoc } */
@ Override public void execute ( final ActionEvent event ) { } } | if ( event . getActionObject ( ) == null ) { throw new IllegalStateException ( "Missing action object" ) ; } else { selectedMenuText . setText ( event . getActionObject ( ) . toString ( ) ) ; } |
public class PubSubInputHandler { /** * Add a msg reference to the proxy subscription reference stream .
* @ param msg
* @ param tran
* @ throws SIResourceException if there is a message store resource problem
* @ throws SIStoreException if there is a general problem with the message store . */
private MessageItemReference addProxyReference ( MessageItem msg , MessageProcessorSearchResults matchingPubsubOutputHandlers , TransactionCommon tran ) throws SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addProxyReference" , new Object [ ] { msg , tran } ) ; MessageItemReference ref = new MessageItemReference ( msg ) ; // This ensures that the persitence of the MessageItem cannot be downgaded
// by the consumerDispatcher because we have remote subscribers .
msg . addPersistentRef ( ) ; ref . setSearchResults ( matchingPubsubOutputHandlers ) ; try { ref . registerMessageEventListener ( MessageEvents . POST_COMMIT_ADD , this ) ; ref . registerMessageEventListener ( MessageEvents . POST_ROLLBACK_ADD , this ) ; Transaction msTran = _messageProcessor . resolveAndEnlistMsgStoreTransaction ( tran ) ; _proxyReferenceStream . add ( ref , msTran ) ; } catch ( OutOfCacheSpace e ) { // No FFDC code needed
SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addProxyReference" , "SIResourceException" ) ; throw new SIResourceException ( e ) ; } catch ( MessageStoreException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.PubSubInputHandler.addProxyReference" , "1:2315:1.329.1.1" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.PubSubInputHandler" , "1:2322:1.329.1.1" , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addProxyReference" , e ) ; throw new SIResourceException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.impl.PubSubInputHandler" , "1:2332:1.329.1.1" , e } , null ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addProxyReference" ) ; return ref ; |
public class RsaSignature { /** * See https : / / tools . ietf . org / html / rfc3447 # section - 5.2.2 */
protected BigInteger RSAVP1 ( RSAPublicKey key , BigInteger s ) { } } | if ( key == null ) { throw new IllegalArgumentException ( "key" ) ; } if ( s == null ) { throw new IllegalArgumentException ( "s" ) ; } BigInteger n = key . getModulus ( ) ; BigInteger e = key . getPublicExponent ( ) ; if ( s . compareTo ( BigInteger . ONE ) == - 1 || s . compareTo ( n ) != - 1 ) { throw new IllegalArgumentException ( "message representative out of range" ) ; } return s . modPow ( e , n ) ; |
public class ProjectApi { /** * Get a list of the project ' s issues .
* < pre > < code > GET / projects / : id / issues < / code > < / pre >
* @ param projectIdOrPath projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance , required
* @ return a list of project ' s issues
* @ throws GitLabApiException if any exception occurs
* @ deprecated Will be removed in version 5.0 , replaced by { @ link IssuesApi # getIssues ( Object ) } */
@ Deprecated public List < Issue > getIssues ( Object projectIdOrPath ) throws GitLabApiException { } } | return ( getIssues ( projectIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ; |
public class CoverageMethodVisitor { /** * METHOD VISITOR INTERFACE */
@ Override public void visitLdcInsn ( Object cst ) { } } | // We use this method to support accesses to . class .
if ( cst instanceof Type ) { int sort = ( ( Type ) cst ) . getSort ( ) ; if ( sort == Type . OBJECT ) { String className = Types . descToInternalName ( ( ( Type ) cst ) . getDescriptor ( ) ) ; insertTInvocation0 ( className , mProbeCounter . incrementAndGet ( ) ) ; } } mv . visitLdcInsn ( cst ) ; |
public class MutableDataPoint { /** * Resets with a new pair of a timestamp and a long value .
* @ param timestamp A timestamp .
* @ param value A double value . */
public static MutableDataPoint ofLongValue ( final long timestamp , final long value ) { } } | final MutableDataPoint dp = new MutableDataPoint ( ) ; dp . reset ( timestamp , value ) ; return dp ; |
public class Agg { /** * Get a { @ link Collector } that calculates the < code > MODE ( ) < / code > function . */
public static < T > Collector < T , ? , Optional < T > > mode ( ) { } } | return mode0 ( seq -> seq . maxBy ( t -> t . v2 ) . map ( t -> t . v1 ) ) ; |
public class ChangeLogActivity { /** * Configure the Appbar */
private void configAppBar ( ) { } } | setSupportActionBar ( mAppbar ) ; getSupportActionBar ( ) . setDisplayHomeAsUpEnabled ( true ) ; getSupportActionBar ( ) . setTitle ( R . string . changelog_activity_title ) ; mAppbar . setNavigationOnClickListener ( this ) ; |
public class Actors { /** * process messages on the mailbox / callback queue until timeout is reached . In case timeout is 0,
* process until mailbox + callback queue is empty .
* If called from a non - actor thread , either sleep until timeout or ( if timeout = = 0 ) its a NOP .
* @ param timeout */
public static void yield ( long timeout ) { } } | long endtime = 0 ; if ( timeout > 0 ) { endtime = System . currentTimeMillis ( ) + timeout ; } if ( Thread . currentThread ( ) instanceof DispatcherThread ) { DispatcherThread dt = ( DispatcherThread ) Thread . currentThread ( ) ; Scheduler scheduler = dt . getScheduler ( ) ; boolean term = false ; int idleCount = 0 ; while ( ! term ) { boolean hadSome = dt . pollQs ( ) ; if ( ! hadSome ) { idleCount ++ ; scheduler . pollDelay ( idleCount ) ; if ( endtime == 0 ) { term = true ; } } else { idleCount = 0 ; } if ( endtime != 0 && System . currentTimeMillis ( ) > endtime ) { term = true ; } } } else { if ( timeout > 0 ) { try { Thread . sleep ( timeout ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } |
public class ST_Perimeter { /** * Compute the perimeter
* @ param geometry
* @ return */
private static double computePerimeter ( Geometry geometry ) { } } | double sum = 0 ; for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry subGeom = geometry . getGeometryN ( i ) ; if ( subGeom instanceof Polygon ) { sum += ( ( Polygon ) subGeom ) . getExteriorRing ( ) . getLength ( ) ; } } return sum ; |
public class ComposableFutures { /** * Execute the producer on each element in the list in batches and return a stream of batch results .
* Every batch is executed in parallel and the next batch begins only after the previous one ended .
* The result of each batch is the next element in the stream .
* An error in one of the futures produced by the producer will end the stream with the error
* @ param elements the input to the producer
* @ param batchSize how many items will be processed in parallel
* @ param producer produces a future based on input from the element list
* @ param < T > the type of the elements in the input list
* @ param < R > the result type of the future returning from the producer
* @ return a stream containing the combined result of each batch */
public static < T , R > Observable < List < R > > batchToStream ( final List < T > elements , final int batchSize , final FutureSuccessHandler < T , R > producer ) { } } | return Observable . create ( subscriber -> batchToStream ( elements , batchSize , 0 , subscriber , producer ) ) ; |
public class RequestHelper { /** * Utility method that determines whether the request contains multipart
* content .
* @ param aHttpRequest
* The servlet request to be evaluated . Must be non - null .
* @ return < code > true < / code > if the request is multipart ; < code > false < / code >
* otherwise . */
public static boolean isMultipartContent ( @ Nonnull final HttpServletRequest aHttpRequest ) { } } | if ( getHttpMethod ( aHttpRequest ) != EHttpMethod . POST ) return false ; return isMultipartContent ( aHttpRequest . getContentType ( ) ) ; |
public class GenericEncodingStrategy { /** * Generates code to load a property value onto the operand stack .
* @ param info info for property to load
* @ param ordinal zero - based property ordinal , used only if instanceVar
* refers to an object array .
* @ param useReadMethod when true , access property by public read method
* instead of protected field
* @ param instanceVar local variable referencing Storable instance ,
* defaults to " this " if null . If variable type is an Object array , then
* property values are read from the runtime value of this array instead
* of a Storable instance .
* @ param adapterInstanceClass class containing static references to
* adapter instances - defaults to instanceVar
* @ param partialStartVar optional variable for supporting partial key
* generation . It must be an int , whose runtime value must be less than the
* properties array length . It marks the range start of the partial
* property range .
* @ return true if property was loaded from instance , false if loaded from
* value array */
protected boolean loadPropertyValue ( CodeAssembler a , StorablePropertyInfo info , int ordinal , boolean useReadMethod , LocalVariable instanceVar , Class < ? > adapterInstanceClass , LocalVariable partialStartVar ) { } } | if ( info . isDerived ( ) ) { useReadMethod = true ; } final TypeDesc type = info . getPropertyType ( ) ; final TypeDesc storageType = info . getStorageType ( ) ; final boolean isObjectArrayInstanceVar = instanceVar != null && instanceVar . getType ( ) == TypeDesc . forClass ( Object [ ] . class ) ; final boolean useAdapterInstance = adapterInstanceClass != null && info . getToStorageAdapter ( ) != null && ( useReadMethod || isObjectArrayInstanceVar ) ; if ( useAdapterInstance ) { // Push adapter instance to stack to be used later .
String fieldName = info . getPropertyName ( ) + ADAPTER_FIELD_ELEMENT + 0 ; TypeDesc adapterType = TypeDesc . forClass ( info . getToStorageAdapter ( ) . getDeclaringClass ( ) ) ; a . loadStaticField ( TypeDesc . forClass ( adapterInstanceClass ) , fieldName , adapterType ) ; } if ( instanceVar == null ) { a . loadThis ( ) ; if ( useReadMethod ) { info . addInvokeReadMethod ( a ) ; } else { // Access property value directly from protected field of " this " .
if ( info . getToStorageAdapter ( ) == null ) { a . loadField ( info . getPropertyName ( ) , type ) ; } else { // Invoke adapter method .
a . invokeVirtual ( info . getReadMethodName ( ) + '$' , storageType , null ) ; } } } else if ( ! isObjectArrayInstanceVar ) { a . loadLocal ( instanceVar ) ; if ( useReadMethod ) { info . addInvokeReadMethod ( a , instanceVar . getType ( ) ) ; } else { // Access property value directly from protected field of
// referenced instance . Assumes code is being defined in the
// same package or a subclass .
if ( info . getToStorageAdapter ( ) == null ) { a . loadField ( instanceVar . getType ( ) , info . getPropertyName ( ) , type ) ; } else { // Invoke adapter method .
a . invokeVirtual ( instanceVar . getType ( ) , info . getReadMethodName ( ) + '$' , storageType , null ) ; } } } else { // Access property value from object array .
a . loadLocal ( instanceVar ) ; a . loadConstant ( ordinal ) ; if ( ordinal > 0 && partialStartVar != null ) { a . loadLocal ( partialStartVar ) ; a . math ( Opcode . ISUB ) ; } a . loadFromArray ( TypeDesc . OBJECT ) ; a . checkCast ( type . toObjectType ( ) ) ; if ( type . isPrimitive ( ) ) { a . convert ( type . toObjectType ( ) , type ) ; } } if ( useAdapterInstance ) { // Invoke adapter method on instance pushed earlier .
a . invoke ( info . getToStorageAdapter ( ) ) ; } return ! isObjectArrayInstanceVar ; |
public class PropertiesConfigAdapter { /** * Get the value from the properties or use a fallback from the { @ code defaults } .
* @ param getter the getter for the properties
* @ param fallback the fallback method , usually super interface method reference
* @ param < V > the value type
* @ return the property or fallback value */
protected final < V > V get ( Function < T , V > getter , Supplier < V > fallback ) { } } | V value = getter . apply ( this . properties ) ; return ( value != null ) ? value : fallback . get ( ) ; |
public class CmsContentService { /** * Returns the change handler scopes . < p >
* @ param definition the content definition
* @ return the scopes */
private Set < String > getChangeHandlerScopes ( CmsXmlContentDefinition definition ) { } } | List < I_CmsXmlContentEditorChangeHandler > changeHandlers = definition . getContentHandler ( ) . getEditorChangeHandlers ( ) ; Set < String > scopes = new HashSet < String > ( ) ; for ( I_CmsXmlContentEditorChangeHandler handler : changeHandlers ) { String scope = handler . getScope ( ) ; scopes . addAll ( evaluateScope ( scope , definition ) ) ; } return scopes ; |
public class EncodedTransport { /** * Add this method param to the param list .
* ( By default , uses the property method . . . override this to use an app specific method ) .
* NOTE : The param name DOES NOT need to be saved , as params are always added and retrieved in order .
* @ param strParam The param name .
* @ param strValue The param value . */
public void addParam ( String strParam , String strValue ) { } } | if ( strValue == null ) strValue = NULL ; m_properties . setProperty ( strParam , strValue ) ; |
public class FastFuture { /** * Called at least once on complete */
public void onComplete ( final Consumer < OnComplete > fn ) { } } | this . forXOf = fn ; // set - could also be called on a separate thread
if ( done ) { // can be called again
fn . accept ( buildOnComplete ( ) ) ; } |
public class MessageDigestUtility { /** * Calculate the digest specified by byte array of data
* @ param messageDigest
* @ param data
* @ return digest in string with base64 encoding . */
public static String processMessageDigestForData ( MessageDigest messageDigest , byte [ ] data ) { } } | String output = "" ; // $ NON - NLS - 1 $
if ( messageDigest != null ) { // Get the digest for the given data
messageDigest . update ( data ) ; byte [ ] digest = messageDigest . digest ( ) ; output = Base64Coder . encode ( digest ) ; } return output ; |
public class BindingInstaller { /** * Ensure that the binding for key which exists in the parent Ginjector is also available to the
* child Ginjector . */
private void ensureAccessible ( Key < ? > key , GinjectorBindings parent , GinjectorBindings child ) { } } | // Parent will be null if it is was an optional dependency and it couldn ' t be created .
if ( parent != null && ! child . equals ( parent ) && ! child . isBound ( key ) ) { PrettyPrinter . log ( logger , TreeLogger . DEBUG , "In %s: inheriting binding for %s from the parent %s" , child , key , parent ) ; Context context = Context . format ( "Inheriting %s from parent" , key ) ; // We don ' t strictly need all the extra checks in addBinding , but it can ' t hurt . We know , for
// example , that there will not be any unresolved bindings for this key .
child . addBinding ( key , bindingFactory . getParentBinding ( key , parent , context ) ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link SphericalCSType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link SphericalCSType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "SphericalCS" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_CoordinateSystem" ) public JAXBElement < SphericalCSType > createSphericalCS ( SphericalCSType value ) { } } | return new JAXBElement < SphericalCSType > ( _SphericalCS_QNAME , SphericalCSType . class , null , value ) ; |
public class HtmlTree { /** * Generates a DT tag with some content .
* @ param body content for the tag
* @ return an HtmlTree object for the DT tag */
public static HtmlTree DT ( Content body ) { } } | HtmlTree htmltree = new HtmlTree ( HtmlTag . DT , nullCheck ( body ) ) ; return htmltree ; |
public class AsyncSocketConnection { /** * error = null = > ok */
void writeFinished ( Object error ) { } } | checkThread ( ) ; writingBuffer = null ; Promise wp = this . writePromise ; writePromise = null ; if ( ! wp . isSettled ( ) ) { if ( error != null ) wp . reject ( error ) ; else wp . resolve ( ) ; } |
public class Formatter { /** * 将Map转换成JSON , 调用对象的toString方法
* @ param map { @ link Map }
* @ return { @ link String } */
public static String mapToJsonArray ( Map < ? , ? > map ) { } } | JSONArray array = new JSONArray ( ) ; if ( Checker . isNotEmpty ( map ) ) { map . forEach ( ( key , value ) -> { JSONObject object = new JSONObject ( ) ; object . put ( "key" , key ) ; object . put ( "value" , value ) ; array . add ( object ) ; } ) ; } return formatJson ( array . toString ( ) ) ; |
public class MapMapping { /** * Delegates to the underlying { @ link java . util . Map } .
* @ see java . util . Map # put ( Object , Object ) */
@ Override public R put ( D key , R value ) { } } | return map . put ( key , value ) ; |
public class ShardedCounter { /** * Check if a resource counter has capacity to spare . Can be used as a cheaper check before starting an expensive
* operation , e . g . workflow instance dequeue . Note that even if this method returns true ,
* { @ link # updateCounter ( StorageTransaction , String , long ) } might throw { @ link CounterCapacityException } .
* @ throws RuntimeException if the resource does not exist or reading from storage fails .
* @ todo Throw checked exceptions for expected failures like resource not existing . */
public boolean counterHasSpareCapacity ( String resourceId ) throws IOException { } } | try { final CounterSnapshot counterSnapshot = getCounterSnapshot ( resourceId ) ; counterSnapshot . pickShardWithSpareCapacity ( 1 ) ; return true ; } catch ( CounterCapacityException e ) { return false ; } |
public class CommerceUserSegmentEntryPersistenceImpl { /** * Returns all the commerce user segment entries .
* @ return the commerce user segment entries */
@ Override public List < CommerceUserSegmentEntry > findAll ( ) { } } | return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class RootConsole { /** * Determines file locations . */
public void setProperties ( Properties properties ) { } } | baseDir = properties . getProperty ( "base_dir" , baseDir ) ; inputFileLocation = baseDir + '/' + properties . getProperty ( "input_file_location" , inputFileLocation ) ; outputFileLocation = baseDir + '/' + properties . getProperty ( "output_file_location" , outputFileLocation ) ; tempOutputFileLocation = baseDir + '/' + properties . getProperty ( "temp_output_file_location" , tempOutputFileLocation ) ; |
public class FleetsApi { /** * Create fleet squad Create a new squad in a fleet - - - SSO Scope :
* esi - fleets . write _ fleet . v1
* @ param fleetId
* ID for a fleet ( required )
* @ param wingId
* The wing _ id to create squad in ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return ApiResponse & lt ; FleetSquadCreatedResponse & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public ApiResponse < FleetSquadCreatedResponse > postFleetsFleetIdWingsWingIdSquadsWithHttpInfo ( Long fleetId , Long wingId , String datasource , String token ) throws ApiException { } } | com . squareup . okhttp . Call call = postFleetsFleetIdWingsWingIdSquadsValidateBeforeCall ( fleetId , wingId , datasource , token , null ) ; Type localVarReturnType = new TypeToken < FleetSquadCreatedResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class Num { /** * Scale both value to scale of number which have minimum scale .
* @ param value
* @ param autoscale
* @ return */
public boolean isEqual ( Object value , boolean autoscale ) { } } | Num numA = this ; Num numB = null ; if ( value instanceof Num ) numB = ( Num ) value ; else numB = new Num ( value ) ; int minScale = numA . remainderSize ( ) ; int bScale = numB . remainderSize ( ) ; if ( bScale < minScale ) minScale = bScale ; return isEqual ( value , minScale ) ; |
public class ApplicationListener { /** * { @ inheritDoc } */
@ Override public void applicationStarting ( ApplicationInfo appInfo ) throws StateChangeException { } } | if ( appProcessor != null ) { try { if ( OpenAPIUtils . isEventEnabled ( tc ) ) { Tr . event ( tc , "Application starting process started: " + appInfo ) ; } appProcessor . addApplication ( appInfo ) ; if ( OpenAPIUtils . isEventEnabled ( tc ) ) { Tr . event ( tc , "Application starting process ended: " + appInfo ) ; } } catch ( Throwable e ) { if ( OpenAPIUtils . isEventEnabled ( tc ) ) { Tr . event ( tc , "Failed to process application: " + e . getMessage ( ) ) ; } } } |
public class MailClient { /** * * writes BodyTag data to query , if there is a problem with encoding , encoding will removed a do
* it again
* @ param qry
* @ param columnName
* @ param row
* @ param bp
* @ param body
* @ throws IOException
* @ throws MessagingException / private void setBody ( Query qry , String columnName , int row , BodyPart
* bp , StringBuffer body ) throws IOException , MessagingException { String content = getConent ( bp ) ;
* qry . setAtEL ( columnName , row , content ) ; if ( body . length ( ) = = 0 ) body . append ( content ) ; */
private String getConent ( Part bp ) throws MessagingException { } } | InputStream is = null ; try { return getContent ( is = bp . getInputStream ( ) , CharsetUtil . toCharset ( getCharsetFromContentType ( bp . getContentType ( ) ) ) ) ; } catch ( IOException mie ) { IOUtil . closeEL ( is ) ; try { return getContent ( is = bp . getInputStream ( ) , SystemUtil . getCharset ( ) ) ; } catch ( IOException e ) { return "Can't read body of this message:" + e . getMessage ( ) ; } } finally { IOUtil . closeEL ( is ) ; } |
public class SipServletResponseImpl { /** * ( non - Javadoc )
* @ see java . io . Externalizable # writeExternal ( java . io . ObjectOutput ) */
public void writeExternal ( ObjectOutput out ) throws IOException { } } | super . writeExternal ( out ) ; if ( originalRequest == null ) { out . writeBoolean ( false ) ; } else { out . writeBoolean ( true ) ; out . writeObject ( originalRequest ) ; } if ( proxyBranch == null ) { out . writeBoolean ( false ) ; } else { out . writeBoolean ( true ) ; out . writeObject ( proxyBranch ) ; } out . writeBoolean ( isProxiedResponse ) ; out . writeBoolean ( isResponseForwardedUpstream ) ; out . writeBoolean ( isAckGenerated ) ; out . writeBoolean ( isPrackGenerated ) ; out . writeBoolean ( hasBeenReceived ) ; |
public class ThrowingRunnable { /** * / * ( non - Javadoc )
* @ see java . lang . Runnable # run ( ) */
@ Override public final void run ( ) { } } | try { this . runWithException ( ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Error e ) { throw e ; } catch ( Throwable t ) { throw new RuntimeException ( t ) ; } |
public class LanguageTag { /** * BNF in RFC5464
* Language - Tag = langtag ; normal language tags
* / privateuse ; private use tag
* / grandfathered ; grandfathered tags
* langtag = language
* [ " - " script ]
* [ " - " region ]
* * ( " - " variant )
* * ( " - " extension )
* [ " - " privateuse ]
* language = 2*3ALPHA ; shortest ISO 639 code
* [ " - " extlang ] ; sometimes followed by
* ; extended language subtags
* / 4ALPHA ; or reserved for future use
* / 5*8ALPHA ; or registered language subtag
* extlang = 3ALPHA ; selected ISO 639 codes
* * 2 ( " - " 3ALPHA ) ; permanently reserved
* script = 4ALPHA ; ISO 15924 code
* region = 2ALPHA ; ISO 3166-1 code
* / 3DIGIT ; UN M . 49 code
* variant = 5*8alphanum ; registered variants
* / ( DIGIT 3alphanum )
* extension = singleton 1 * ( " - " ( 2*8alphanum ) )
* ; Single alphanumerics
* ; " x " reserved for private use
* singleton = DIGIT ; 0 - 9
* / % x41-57 ; A - W
* / % x59-5A ; Y - Z
* / % x61-77 ; a - w
* / % x79-7A ; y - z
* privateuse = " x " 1 * ( " - " ( 1*8alphanum ) ) */
public static LanguageTag parse ( String languageTag , ParseStatus sts ) { } } | if ( sts == null ) { sts = new ParseStatus ( ) ; } else { sts . reset ( ) ; } StringTokenIterator itr ; // Check if the tag is grandfathered
String [ ] gfmap = GRANDFATHERED . get ( LocaleUtils . toLowerString ( languageTag ) ) ; if ( gfmap != null ) { // use preferred mapping
itr = new StringTokenIterator ( gfmap [ 1 ] , SEP ) ; } else { itr = new StringTokenIterator ( languageTag , SEP ) ; } LanguageTag tag = new LanguageTag ( ) ; // langtag must start with either language or privateuse
if ( tag . parseLanguage ( itr , sts ) ) { tag . parseExtlangs ( itr , sts ) ; tag . parseScript ( itr , sts ) ; tag . parseRegion ( itr , sts ) ; tag . parseVariants ( itr , sts ) ; tag . parseExtensions ( itr , sts ) ; } tag . parsePrivateuse ( itr , sts ) ; if ( ! itr . isDone ( ) && ! sts . isError ( ) ) { String s = itr . current ( ) ; sts . errorIndex = itr . currentStart ( ) ; if ( s . length ( ) == 0 ) { sts . errorMsg = "Empty subtag" ; } else { sts . errorMsg = "Invalid subtag: " + s ; } } return tag ; |
public class TokenList { /** * Adds a variable to the end of the token list
* @ param variable Variable which is to be added
* @ return The new Token created around variable */
public Token add ( Variable variable ) { } } | Token t = new Token ( variable ) ; push ( t ) ; return t ; |
public class RoleManager { /** * Delete the role with the passed ID
* @ param sRoleID
* The role ID to be deleted
* @ return { @ link EChange # CHANGED } if the passed role ID was found and deleted */
@ Nonnull public EChange deleteRole ( @ Nullable final String sRoleID ) { } } | Role aDeletedRole ; m_aRWLock . writeLock ( ) . lock ( ) ; try { aDeletedRole = internalDeleteItem ( sRoleID ) ; if ( aDeletedRole == null ) { AuditHelper . onAuditDeleteFailure ( Role . OT , "no-such-role-id" , sRoleID ) ; return EChange . UNCHANGED ; } BusinessObjectHelper . setDeletionNow ( aDeletedRole ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditDeleteSuccess ( Role . OT , sRoleID ) ; // Execute callback as the very last action
m_aCallbacks . forEach ( aCB -> aCB . onRoleDeleted ( aDeletedRole ) ) ; return EChange . CHANGED ; |
public class ListUtils { /** * Expands an integer list to a size equal to its value range and adds
* < code > null < / code > - value entries for every missing intermediate integer
* value . If < code > replace < / code > is not < code > null < / code > , all original
* values are replaced by < code > replace < / code > .
* @ param list
* List containing integer values
* @ param replace
* Replacement for existing values within < code > list < / code >
* @ return An expanded list containing null values for missing intermediate
* integer values and optionally replaced original values */
public static List < Integer > fillUpWithNulls ( List < Integer > list , Integer replace ) { } } | Collections . sort ( list ) ; int minValue = list . get ( 0 ) ; int maxValue = list . get ( list . size ( ) - 1 ) ; int range = ( int ) ( maxValue - Math . signum ( minValue ) * Math . abs ( minValue ) ) ; List < Integer > result = new ArrayList < > ( range + 1 ) ; for ( int i = 0 ; i < list . size ( ) - 1 ; i ++ ) { result . add ( replace != null ? replace : list . get ( i ) ) ; for ( int j = 0 ; j < list . get ( i + 1 ) - list . get ( i ) - 1 ; j ++ ) result . add ( null ) ; } result . add ( replace != null ? replace : maxValue ) ; return result ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.