signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ST_XMin { /** * Returns the minimal x - value of the given geometry .
* @ param geom Geometry
* @ return The minimal x - value of the given geometry , or null if the geometry is null . */
public static Double getMinX ( Geometry geom ) { } } | if ( geom != null ) { return geom . getEnvelopeInternal ( ) . getMinX ( ) ; } else { return null ; } |
public class SanitizedContents { /** * Creates JS from a number .
* < p > Soy prints numbers as floats and it wraps them in spaces . This is undesirable if the source
* code is presented to the user , e . g . in { @ code < textarea > } . This function allows converting the
* number to JS which is then printed as is . */
public static SanitizedContent numberJs ( final long number ) { } } | return SanitizedContent . create ( String . valueOf ( number ) , ContentKind . JS ) ; |
public class AbstractAmazonKinesisFirehoseDelivery { /** * Method to create the record object for given data .
* @ param data the content data
* @ return the Record object */
private static Record createRecord ( String data ) { } } | return new Record ( ) . withData ( ByteBuffer . wrap ( data . getBytes ( ) ) ) ; |
public class AsmUtils { /** * Determines whether the class with the given descriptor is assignable to the given type .
* @ param classInternalName the class descriptor
* @ param type the type
* @ return true if the class with the given descriptor is assignable to the given type */
public static boolean isAssignableTo ( String classInternalName , Class < ? > type ) { } } | checkArgNotNull ( classInternalName , "classInternalName" ) ; checkArgNotNull ( type , "type" ) ; return type . isAssignableFrom ( getClassForInternalName ( classInternalName ) ) ; |
public class GlobusPathMatchingResourcePatternResolver { /** * This method takes a location string and returns a GlobusResource of the
* corresponding location . This method does not accept any patterns for the location string .
* @ param location An absolute or relative location in the style classpath : / folder / className . class ,
* file : / folder / fileName . ext , or folder / folder / fileName . ext
* @ return A GlobusResource type object of the corresponding location string . */
public GlobusResource getResource ( String location ) { } } | GlobusResource returnResource ; URL resourceURL ; if ( location . startsWith ( "classpath:" ) ) { resourceURL = getClass ( ) . getClassLoader ( ) . getResource ( location . replaceFirst ( "classpath:/" , "" ) ) ; returnResource = new GlobusResource ( resourceURL . getPath ( ) ) ; } else if ( location . startsWith ( "file:" ) ) { returnResource = new GlobusResource ( location . replaceFirst ( "file:" , "" ) ) ; } else returnResource = new GlobusResource ( location ) ; return returnResource ; |
public class BigDecimalAccessor { /** * ( non - Javadoc )
* @ see
* com . impetus . kundera . property . PropertyAccessor # toBytes ( java . lang . Object ) */
@ Override public byte [ ] toBytes ( Object object ) { } } | if ( object == null ) { return null ; } BigDecimal b = ( BigDecimal ) object ; final int scale = b . scale ( ) ; final BigInteger unscaled = b . unscaledValue ( ) ; final byte [ ] value = unscaled . toByteArray ( ) ; final byte [ ] bytes = new byte [ value . length + 4 ] ; bytes [ 0 ] = ( byte ) ( scale >>> 24 ) ; bytes [ 1 ] = ( byte ) ( scale >>> 16 ) ; bytes [ 2 ] = ( byte ) ( scale >>> 8 ) ; bytes [ 3 ] = ( byte ) ( scale >>> 0 ) ; System . arraycopy ( value , 0 , bytes , 4 , value . length ) ; return bytes ; |
public class AttributeValueImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . ATTRIBUTE_VALUE__RESERVED0 : setReserved0 ( ( Integer ) newValue ) ; return ; case AfplibPackage . ATTRIBUTE_VALUE__ATT_VAL : setAttVal ( ( String ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class BigtableBufferedMutatorHelper { /** * Being a Mutation . This method will block if either of the following are true :
* 1 ) There are more than { @ code maxInflightRpcs } RPCs in flight
* 2 ) There are more than { @ link # getWriteBufferSize ( ) } bytes pending
* @ param mutation a { @ link Mutation } object .
* @ return a { @ link ApiFuture } object . */
public ApiFuture < ? > mutate ( final Mutation mutation ) { } } | closedReadLock . lock ( ) ; try { if ( closed ) { throw new IllegalStateException ( "Cannot mutate when the BufferedMutator is closed." ) ; } return offer ( mutation ) ; } finally { closedReadLock . unlock ( ) ; } |
public class DateContext { /** * Compare one date to another for equality in year , month and date . Note
* that this ignores all other values including the time . If either value
* is < code > null < / code > , including if both are < code > null < / code > , then
* < code > false < / code > is returned .
* @ param date1 The first date to compare .
* @ param date2 The second date to compare .
* @ return < code > true < / code > if both dates have the same year / month / date ,
* < code > false < / code > if not . */
public boolean compareDate ( Date date1 , Date date2 ) { } } | if ( date1 == null || date2 == null ) { return false ; } boolean result ; GregorianCalendar cal1 = new GregorianCalendar ( ) ; GregorianCalendar cal2 = new GregorianCalendar ( ) ; cal1 . setTime ( date1 ) ; cal2 . setTime ( date2 ) ; if ( cal1 . get ( Calendar . YEAR ) == cal2 . get ( Calendar . YEAR ) && cal1 . get ( Calendar . MONTH ) == cal2 . get ( Calendar . MONTH ) && cal1 . get ( Calendar . DATE ) == cal2 . get ( Calendar . DATE ) ) { result = true ; } else { result = false ; } return result ; |
public class ClassLoaders { /** * Adds and returns all classes contained in the given package ( and its
* sub - packages ) .
* @ param pkg
* @ param classForClassLoader
* @ return
* @ throws IOException */
public static List < Class < ? > > getClassesForPackage ( Package pkg , Class classForClassLoader ) throws IOException { } } | return getClassesForPackage ( pkg . getName ( ) , classForClassLoader ) ; |
public class StringHelper { /** * Break apart a string using a tokenizer into a { @ code List } of { @ code String } s .
* @ param inputString a string containing zero or or more segments
* @ param seperator seperator to use for the split , or null for the default
* @ return a { @ code List } of { @ code String } s . An emtpy list is returned if < i > inputString < / i > is null . */
public static List < String > tokenizeString ( final String inputString , final String seperator ) { } } | if ( inputString == null || inputString . length ( ) < 1 ) { return Collections . emptyList ( ) ; } final List < String > values = new ArrayList < String > ( ) ; values . addAll ( Arrays . asList ( inputString . split ( seperator ) ) ) ; return Collections . unmodifiableList ( values ) ; |
public class GradientActivity { /** * Demonstrates how to draw visuals */
@ Override protected void onDrawFrame ( SurfaceView view , Canvas canvas ) { } } | super . onDrawFrame ( view , canvas ) ; // Display info on the image being process and how fast input camera
// stream ( probably in YUV420 ) is converted into a BoofCV format
int width = bitmap . getWidth ( ) ; int height = bitmap . getHeight ( ) ; canvas . drawText ( String . format ( Locale . getDefault ( ) , "%d x %d Convert: %4.1f (ms)" , width , height , periodConvert . getAverage ( ) ) , 0 , 120 , paintText ) ; // Pro tip : Run in app fast or release mode for a dramatic speed up !
// In Android Studio expand " Build Variants " tab on left . |
public class CameraPinholeBrown { /** * If true then distortion parameters are specified . */
public boolean isDistorted ( ) { } } | if ( radial != null && radial . length > 0 ) { for ( int i = 0 ; i < radial . length ; i ++ ) { if ( radial [ i ] != 0 ) return true ; } } return t1 != 0 || t2 != 0 ; |
public class FxUiManager { /** * Simple utility class to load an { @ link FxmlNode } as a { @ link Scene } for use with { @ link # mainComponent ( ) }
* @ param node the node to load in the { @ link Scene }
* @ return The ready - to - use { @ link Scene }
* @ throws RuntimeException if the scene could not be loaded properly */
protected Scene getScene ( final FxmlNode node ) { } } | return easyFxml . loadNode ( node ) . getNode ( ) . map ( Scene :: new ) . getOrElseThrow ( ( Function < ? super Throwable , RuntimeException > ) RuntimeException :: new ) ; |
public class GenericUtils { /** * 将 GenericObject 转换为具体对象
* @ param genericObject 待转换的GenericObject
* @ return 转换后结果 */
public static < T > T convertToObject ( Object genericObject ) { } } | try { return ( T ) innerToConvertObject ( genericObject , new IdentityHashMap < Object , Object > ( ) ) ; } catch ( Throwable t ) { throw new ConvertException ( t ) ; } |
public class PacketBuilder { /** * Adds a boolean
* @ param b Boolean
* @ throws IllegalStateException see { @ link # checkBuilt ( ) } */
public synchronized PacketBuilder withBoolean ( final boolean b ) { } } | checkBuilt ( ) ; try { dataOutputStream . writeBoolean ( b ) ; } catch ( final IOException e ) { logger . error ( "Unable to add boolean: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; |
public class SaltScanner { /** * Starts all of the scanners asynchronously and returns the data fetched
* once all of the scanners have completed . Note that the result may be an
* exception if one or more of the scanners encountered an exception . The
* first error will be returned , others will be logged .
* @ return A deferred to wait on for results . */
public Deferred < TreeMap < byte [ ] , Span > > scan ( ) { } } | start_time = System . currentTimeMillis ( ) ; int i = 0 ; for ( final Scanner scanner : scanners ) { new ScannerCB ( scanner , i ++ ) . scan ( ) ; } return results ; |
public class Latkes { /** * Initializes Latke framework . */
public static synchronized void init ( ) { } } | if ( inited ) { return ; } inited = true ; LOGGER . log ( Level . TRACE , "Initializing Latke" ) ; loadLatkeProps ( ) ; loadLocalProps ( ) ; if ( null == runtimeMode ) { final String runtimeModeValue = getLatkeProperty ( "runtimeMode" ) ; if ( null != runtimeModeValue ) { runtimeMode = RuntimeMode . valueOf ( runtimeModeValue ) ; } else { LOGGER . log ( Level . TRACE , "Can't parse runtime mode in latke.properties, default to [PRODUCTION]" ) ; runtimeMode = RuntimeMode . PRODUCTION ; } } if ( Latkes . RuntimeMode . DEVELOPMENT == getRuntimeMode ( ) ) { LOGGER . warn ( "!!!!Runtime mode is [" + Latkes . RuntimeMode . DEVELOPMENT + "], please make sure configured it with [" + Latkes . RuntimeMode . PRODUCTION + "] in latke.properties if deployed on production environment!!!!" ) ; } else { LOGGER . log ( Level . DEBUG , "Runtime mode is [{0}]" , getRuntimeMode ( ) ) ; } final RuntimeDatabase runtimeDatabase = getRuntimeDatabase ( ) ; LOGGER . log ( Level . DEBUG , "Runtime database is [{0}]" , runtimeDatabase ) ; if ( RuntimeDatabase . H2 == runtimeDatabase ) { final String newTCPServer = getLocalProperty ( "newTCPServer" ) ; if ( "true" . equals ( newTCPServer ) ) { LOGGER . log ( Level . DEBUG , "Starting H2 TCP server" ) ; final String jdbcURL = getLocalProperty ( "jdbc.URL" ) ; if ( StringUtils . isBlank ( jdbcURL ) ) { throw new IllegalStateException ( "The jdbc.URL in local.properties is required" ) ; } final String [ ] parts = jdbcURL . split ( ":" ) ; if ( 5 != parts . length ) { throw new IllegalStateException ( "jdbc.URL should like [jdbc:h2:tcp://localhost:8250/~/] (the port part is required)" ) ; } String port = parts [ parts . length - 1 ] ; port = StringUtils . substringBefore ( port , "/" ) ; LOGGER . log ( Level . TRACE , "H2 TCP port [{0}]" , port ) ; try { h2 = org . h2 . tools . Server . createTcpServer ( new String [ ] { "-tcpPort" , port , "-tcpAllowOthers" } ) . start ( ) ; } catch ( final SQLException e ) { final String msg = "H2 TCP server create failed" ; LOGGER . log ( Level . ERROR , msg , e ) ; throw new IllegalStateException ( msg ) ; } LOGGER . log ( Level . DEBUG , "Started H2 TCP server" ) ; } } final RuntimeCache runtimeCache = getRuntimeCache ( ) ; LOGGER . log ( Level . INFO , "Runtime cache is [{0}]" , runtimeCache ) ; locale = new Locale ( "en_US" ) ; LOGGER . log ( Level . INFO , "Initialized Latke" ) ; |
public class DoubleTupleFunctions { /** * Performs an inclusive scan on the elements of the given tuple , using
* the provided associative accumulation function , and returns the
* result . < br >
* < br >
* If the given < code > result < / code > tuple is < code > null < / code > , then a
* new tuple will be created and returned . < br >
* < br >
* The < code > result < / code > tuple may be identical to the input tuple .
* @ param t0 The tuple
* @ param op The accumulation function
* @ param result The result
* @ return The result
* @ throws IllegalArgumentException If the given result tuple is not
* < code > null < / code > and has a different { @ link Tuple # getSize ( ) size }
* than the input tuple */
public static MutableDoubleTuple inclusiveScan ( DoubleTuple t0 , DoubleBinaryOperator op , MutableDoubleTuple result ) { } } | result = DoubleTuples . validate ( t0 , result ) ; int n = t0 . getSize ( ) ; if ( n > 0 ) { result . set ( 0 , t0 . get ( 0 ) ) ; for ( int i = 1 ; i < n ; i ++ ) { double operand0 = result . get ( i - 1 ) ; double operand1 = t0 . get ( i ) ; double r = op . applyAsDouble ( operand0 , operand1 ) ; result . set ( i , r ) ; } } return result ; |
public class OpenShiftAssistant { /** * Gets the URL of the route with given name .
* @ param routeName to return its URL
* @ return URL backed by the route with given name . */
public Optional < URL > getRoute ( String routeName ) { } } | Route route = getClient ( ) . routes ( ) . inNamespace ( namespace ) . withName ( routeName ) . get ( ) ; return route != null ? Optional . ofNullable ( createUrlFromRoute ( route ) ) : Optional . empty ( ) ; |
public class DefaultEurekaServerConfig { /** * ( non - Javadoc )
* @ see com . netflix . eureka . EurekaServerConfig # getAWSAccessId ( ) */
@ Override public String getAWSSecretKey ( ) { } } | String aWSSecretKey = configInstance . getStringProperty ( namespace + "awsSecretKey" , null ) . get ( ) ; if ( null != aWSSecretKey ) { return aWSSecretKey . trim ( ) ; } else { return null ; } |
public class ShapeGenerator { /** * Return a path for a rectangle with rounded corners .
* @ param x the X coordinate of the upper - left corner of the rectangle
* @ param y the Y coordinate of the upper - left corner of the rectangle
* @ param w the width of the rectangle
* @ param h the height of the rectangle
* @ param size the CornerSize value representing the amount of rounding
* @ return a path representing the shape . */
public Shape createRoundRectangle ( final int x , final int y , final int w , final int h , final CornerSize size ) { } } | return createRoundRectangle ( x , y , w , h , size , CornerStyle . ROUNDED , CornerStyle . ROUNDED , CornerStyle . ROUNDED , CornerStyle . ROUNDED ) ; |
public class TransactionIsolation { /** * Static method to get an instance
* @ param v The value
* @ return The instance */
public static TransactionIsolation forName ( String v ) { } } | if ( v != null && ! v . trim ( ) . equals ( "" ) ) { if ( "TRANSACTION_READ_UNCOMMITTED" . equalsIgnoreCase ( v ) || "1" . equalsIgnoreCase ( v ) ) { return TRANSACTION_READ_UNCOMMITTED ; } else if ( "TRANSACTION_READ_COMMITTED" . equalsIgnoreCase ( v ) || "2" . equalsIgnoreCase ( v ) ) { return TRANSACTION_READ_COMMITTED ; } else if ( "TRANSACTION_REPEATABLE_READ" . equalsIgnoreCase ( v ) || "4" . equalsIgnoreCase ( v ) ) { return TRANSACTION_REPEATABLE_READ ; } else if ( "TRANSACTION_SERIALIZABLE" . equalsIgnoreCase ( v ) || "8" . equalsIgnoreCase ( v ) ) { return TRANSACTION_SERIALIZABLE ; } else if ( "TRANSACTION_NONE" . equalsIgnoreCase ( v ) || "0" . equalsIgnoreCase ( v ) ) { return TRANSACTION_NONE ; } } return null ; |
public class ConfigExportDeliveryInfoMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ConfigExportDeliveryInfo configExportDeliveryInfo , ProtocolMarshaller protocolMarshaller ) { } } | if ( configExportDeliveryInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( configExportDeliveryInfo . getLastStatus ( ) , LASTSTATUS_BINDING ) ; protocolMarshaller . marshall ( configExportDeliveryInfo . getLastErrorCode ( ) , LASTERRORCODE_BINDING ) ; protocolMarshaller . marshall ( configExportDeliveryInfo . getLastErrorMessage ( ) , LASTERRORMESSAGE_BINDING ) ; protocolMarshaller . marshall ( configExportDeliveryInfo . getLastAttemptTime ( ) , LASTATTEMPTTIME_BINDING ) ; protocolMarshaller . marshall ( configExportDeliveryInfo . getLastSuccessfulTime ( ) , LASTSUCCESSFULTIME_BINDING ) ; protocolMarshaller . marshall ( configExportDeliveryInfo . getNextDeliveryTime ( ) , NEXTDELIVERYTIME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CollectionFactory { /** * Create the most appropriate collection for the given collection type .
* < p > Creates an ArrayList , TreeSet or linked Set for a List , SortedSet
* or Set , respectively .
* @ param collectionType the desired type of the target Collection
* @ param initialCapacity the initial capacity
* @ return the new Collection instance
* @ see java . util . ArrayList
* @ see java . util . TreeSet
* @ see java . util . LinkedHashSet */
public static Collection createCollection ( Class < ? > collectionType , int initialCapacity ) { } } | if ( collectionType . isInterface ( ) ) { if ( List . class . equals ( collectionType ) ) { return new ArrayList ( initialCapacity ) ; } else if ( SortedSet . class . equals ( collectionType ) || collectionType . equals ( navigableSetClass ) ) { return new TreeSet ( ) ; } else if ( Set . class . equals ( collectionType ) || Collection . class . equals ( collectionType ) ) { return new LinkedHashSet ( initialCapacity ) ; } else { throw new IllegalArgumentException ( "Unsupported Collection interface: " + collectionType . getName ( ) ) ; } } else { if ( ! Collection . class . isAssignableFrom ( collectionType ) ) { throw new IllegalArgumentException ( "Unsupported Collection type: " + collectionType . getName ( ) ) ; } try { return ( Collection ) collectionType . newInstance ( ) ; } catch ( Exception ex ) { throw new IllegalArgumentException ( "Could not instantiate Collection type: " + collectionType . getName ( ) , ex ) ; } } |
public class RESTAppListener { /** * { @ inheritDoc } */
@ Override public void contextRootAdded ( String contextRoot , VirtualHost virtualHost ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Added contextRoot {0} to virtual host {1}" , contextRoot , virtualHost . getName ( ) ) ; } // Check that our app got installed
if ( contextRoot != null && contextRoot . contains ( APIConstants . JMX_CONNECTOR_API_ROOT_PATH ) && "default_host" . equals ( virtualHost . getName ( ) ) ) { registeredContextRoot = contextRoot ; if ( secureVirtualHost == virtualHost ) { createJMXWorkAreaResourceIfChanged ( virtualHost ) ; } } |
public class JSON { /** * write json .
* @ param obj object .
* @ param properties property name array .
* @ param writer writer .
* @ throws IOException . */
public static void json ( Object obj , final String [ ] properties , Writer writer , boolean writeClass , Converter < Object , Map < String , Object > > mc ) throws IOException { } } | if ( obj == null ) writer . write ( NULL ) ; else json ( obj , properties , new JSONWriter ( writer ) , writeClass , mc ) ; |
public class TagService { /** * Returns the { @ link Tag } with the provided name . */
public Tag findTag ( String tagName ) { } } | if ( null == tagName ) throw new IllegalArgumentException ( "Looking for null tag name." ) ; return definedTags . get ( Tag . normalizeName ( tagName ) ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcProfileProperties ( ) { } } | if ( ifcProfilePropertiesEClass == null ) { ifcProfilePropertiesEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 458 ) ; } return ifcProfilePropertiesEClass ; |
public class AccountHeaderBuilder { /** * method to build the header view
* @ return */
public AccountHeader build ( ) { } } | // if the user has not set a accountHeader use the default one : D
if ( mAccountHeaderContainer == null ) { withAccountHeader ( - 1 ) ; } // get the header view within the container
mAccountHeader = mAccountHeaderContainer . findViewById ( R . id . material_drawer_account_header ) ; mStatusBarGuideline = mAccountHeaderContainer . findViewById ( R . id . material_drawer_statusbar_guideline ) ; // the default min header height by default 148dp
int defaultHeaderMinHeight = mActivity . getResources ( ) . getDimensionPixelSize ( R . dimen . material_drawer_account_header_height ) ; int statusBarHeight = UIUtils . getStatusBarHeight ( mActivity , true ) ; // handle the height for the header
int height ; if ( mHeight != null ) { height = mHeight . asPixel ( mActivity ) ; } else { if ( mCompactStyle ) { height = mActivity . getResources ( ) . getDimensionPixelSize ( R . dimen . material_drawer_account_header_height_compact ) ; } else { // calculate the header height by getting the optimal drawer width and calculating it * 9 / 16
height = ( int ) ( DrawerUIUtils . getOptimalDrawerWidth ( mActivity ) * AccountHeader . NAVIGATION_DRAWER_ACCOUNT_ASPECT_RATIO ) ; // if we are lower than api 19 ( > = 19 we have a translucentStatusBar ) the height should be a bit lower
// probably even if we are non translucent on > 19 devices ?
if ( Build . VERSION . SDK_INT < 19 ) { int tempHeight = height - statusBarHeight ; // if we are lower than api 19 we are not able to have a translucent statusBar so we remove the height of the statusBar from the padding
// to prevent display issues we only reduce the height if we still fit the required minHeight of 148dp ( R . dimen . material _ drawer _ account _ header _ height )
// we remove additional 8dp from the defaultMinHeaderHeight as there is some buffer in the header and to prevent to large spacings
if ( tempHeight > defaultHeaderMinHeight - UIUtils . convertDpToPixel ( 8 , mActivity ) ) { height = tempHeight ; } } } } // handle everything if we have a translucent status bar which only is possible on API > = 19
if ( mTranslucentStatusBar && Build . VERSION . SDK_INT >= 21 ) { mStatusBarGuideline . setGuidelineBegin ( statusBarHeight ) ; // in fact it makes no difference if we have a translucent statusBar or not . we want 9/16 just if we are not compact
if ( mCompactStyle ) { height = height + statusBarHeight ; } else if ( ( height - statusBarHeight ) <= defaultHeaderMinHeight ) { // if the height + statusBar of the header is lower than the required 148dp + statusBar we change the height to be able to display all the data
height = defaultHeaderMinHeight + statusBarHeight ; } } // set the height for the header
setHeaderHeight ( height ) ; // get the background view
mAccountHeaderBackground = mAccountHeaderContainer . findViewById ( R . id . material_drawer_account_header_background ) ; // set the background
ImageHolder . applyTo ( mHeaderBackground , mAccountHeaderBackground , DrawerImageLoader . Tags . ACCOUNT_HEADER . name ( ) ) ; if ( mHeaderBackgroundScaleType != null ) { mAccountHeaderBackground . setScaleType ( mHeaderBackgroundScaleType ) ; } // get the text color to use for the text section
int textColor = ColorHolder . color ( mTextColor , mActivity , R . attr . material_drawer_header_selection_text , R . color . material_drawer_header_selection_text ) ; int subTextColor = ColorHolder . color ( mTextColor , mActivity , R . attr . material_drawer_header_selection_subtext , R . color . material_drawer_header_selection_subtext ) ; mAccountHeaderTextSectionBackgroundResource = UIUtils . getSelectableBackgroundRes ( mActivity ) ; handleSelectionView ( mCurrentProfile , true ) ; // set the arrow : D
mAccountSwitcherArrow = mAccountHeaderContainer . findViewById ( R . id . material_drawer_account_header_text_switcher ) ; mAccountSwitcherArrow . setImageDrawable ( new IconicsDrawable ( mActivity , MaterialDrawerFont . Icon . mdf_arrow_drop_down ) . sizeRes ( R . dimen . material_drawer_account_header_dropdown ) . paddingRes ( R . dimen . material_drawer_account_header_dropdown_padding ) . color ( subTextColor ) ) ; // get the fields for the name
mCurrentProfileView = mAccountHeader . findViewById ( R . id . material_drawer_account_header_current ) ; mCurrentProfileName = mAccountHeader . findViewById ( R . id . material_drawer_account_header_name ) ; mCurrentProfileEmail = mAccountHeader . findViewById ( R . id . material_drawer_account_header_email ) ; // set the typeface for the AccountHeader
if ( mNameTypeface != null ) { mCurrentProfileName . setTypeface ( mNameTypeface ) ; } else if ( mTypeface != null ) { mCurrentProfileName . setTypeface ( mTypeface ) ; } if ( mEmailTypeface != null ) { mCurrentProfileEmail . setTypeface ( mEmailTypeface ) ; } else if ( mTypeface != null ) { mCurrentProfileEmail . setTypeface ( mTypeface ) ; } mCurrentProfileName . setTextColor ( textColor ) ; mCurrentProfileEmail . setTextColor ( subTextColor ) ; mProfileFirstView = mAccountHeader . findViewById ( R . id . material_drawer_account_header_small_first ) ; mProfileSecondView = mAccountHeader . findViewById ( R . id . material_drawer_account_header_small_second ) ; mProfileThirdView = mAccountHeader . findViewById ( R . id . material_drawer_account_header_small_third ) ; // calculate the profiles to set
calculateProfiles ( ) ; // process and build the profiles
buildProfiles ( ) ; // try to restore all saved values again
if ( mSavedInstance != null ) { int selection = mSavedInstance . getInt ( AccountHeader . BUNDLE_SELECTION_HEADER , - 1 ) ; if ( selection != - 1 ) { // predefine selection ( should be the first element
if ( mProfiles != null && ( selection ) > - 1 && selection < mProfiles . size ( ) ) { switchProfiles ( mProfiles . get ( selection ) ) ; } } } // everything created . now set the header
if ( mDrawer != null ) { mDrawer . setHeader ( mAccountHeaderContainer , mPaddingBelowHeader , mDividerBelowHeader ) ; } // forget the reference to the activity
mActivity = null ; return new AccountHeader ( this ) ; |
public class AbstractValidate { /** * < p > Validate that the specified argument object fall between the two exclusive values specified ; otherwise , throws an exception . < / p >
* < pre > Validate . exclusiveBetween ( 0 , 2 , 1 ) ; < / pre >
* @ param < T >
* the type of the argument start and end values
* @ param < V >
* the type of the value
* @ param start
* the exclusive start value , not null
* @ param end
* the exclusive end value , not null
* @ param value
* the object to validate , not null
* @ return the value
* @ throws IllegalArgumentValidationException
* if the value falls outside the boundaries
* @ see # exclusiveBetween ( Object , Object , Comparable , String , Object . . . ) */
public < T , V extends Comparable < T > > V exclusiveBetween ( final T start , final T end , final V value ) { } } | if ( value . compareTo ( start ) <= 0 || value . compareTo ( end ) >= 0 ) { fail ( String . format ( DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE , value , start , end ) ) ; } return value ; |
public class ExternalProgramsPanel { /** * Validates the 7Zip settings */
private void validate7ZipSettings ( ) { } } | boolean flag = controller . is7ZipEnabled ( ) ; sevenZipEnableBox . setSelected ( flag ) ; sevenZipLabel . setEnabled ( flag ) ; sevenZipPathField . setEnabled ( flag ) ; sevenZipSearchButton . setEnabled ( flag ) ; |
public class ICUHumanize { /** * Formats a monetary amount with currency plural names , for example ,
* " US dollar " or " US dollars " for America .
* @ param value
* Number to be formatted
* @ return String representing the monetary amount */
public static String formatPluralCurrency ( final Number value ) { } } | DecimalFormat decf = context . get ( ) . getPluralCurrencyFormat ( ) ; return stripZeros ( decf , decf . format ( value ) ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcSurfaceStyleShading ( ) { } } | if ( ifcSurfaceStyleShadingEClass == null ) { ifcSurfaceStyleShadingEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 582 ) ; } return ifcSurfaceStyleShadingEClass ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcHumidifierTypeEnum ( ) { } } | if ( ifcHumidifierTypeEnumEEnum == null ) { ifcHumidifierTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 847 ) ; } return ifcHumidifierTypeEnumEEnum ; |
public class FeatureController { /** * REST endpoint for retrieving all features for a given sprint and team
* ( the sprint is derived )
* @ param teamId
* A given scope - owner ' s source - system ID
* @ return A data response list of type Feature containing all features for
* the given team and current sprint */
@ RequestMapping ( value = "/feature/{number}" , method = GET , produces = APPLICATION_JSON_VALUE ) public DataResponse < List < Feature > > story ( @ RequestParam ( value = "component" , required = true ) String cId , @ PathVariable ( value = "number" ) String storyNumber ) { } } | ObjectId componentId = new ObjectId ( cId ) ; return this . featureService . getStory ( componentId , storyNumber ) ; |
public class DeepWaterModelInfo { /** * Internal helper to create a native backend , and fill its state
* @ param network user - given network topology
* @ param parameters user - given network state ( weights / biases ) */
private void javaToNative ( byte [ ] network , byte [ ] parameters ) { } } | long now = System . currentTimeMillis ( ) ; // existing state is fine
if ( _backend != null // either not overwriting with user - given ( new ) state , or we already are in sync
&& ( network == null || Arrays . equals ( network , _network ) ) && ( parameters == null || Arrays . equals ( parameters , _modelparams ) ) ) { Log . warn ( "No need to move the state from Java to native." ) ; return ; } if ( _backend == null ) { _backend = createDeepWaterBackend ( get_params ( ) . _backend . toString ( ) ) ; // new ImageTrain ( _ width , _ height , _ channels , _ deviceID , ( int ) parameters . getOrMakeRealSeed ( ) , _ gpu ) ;
if ( _backend == null ) throw new IllegalArgumentException ( "No backend found. Cannot build a Deep Water model." ) ; } if ( network == null ) network = _network ; if ( parameters == null ) parameters = _modelparams ; if ( network == null || parameters == null ) return ; Log . info ( "Java state -> native backend." ) ; initModel ( network , parameters ) ; long time = System . currentTimeMillis ( ) - now ; Log . info ( "Took: " + PrettyPrint . msecs ( time , true ) ) ; |
public class ConvertImage { /** * Converts a { @ link Planar } into the equivalent { @ link InterleavedF32}
* @ param input ( Input ) Planar image that is being converted . Not modified .
* @ param output ( Optional ) The output image . If null a new image is created . Modified .
* @ return Converted image . */
public static InterleavedF32 convertU8F32 ( Planar < GrayU8 > input , InterleavedF32 output ) { } } | if ( output == null ) { output = new InterleavedF32 ( input . width , input . height , input . getNumBands ( ) ) ; } else { output . reshape ( input . width , input . height , input . getNumBands ( ) ) ; } if ( BoofConcurrency . USE_CONCURRENT ) { ImplConvertImage_MT . convertU8F32 ( input , output ) ; } else { ImplConvertImage . convertU8F32 ( input , output ) ; } return output ; |
public class DynamoDBTableMapper { /** * Scans through an Amazon DynamoDB table and returns a single page of
* matching results .
* @ param scanExpression The scan expression .
* @ return The scan results .
* @ see com . amazonaws . services . dynamodbv2 . datamodeling . DynamoDBMapper # scanPage */
public ScanResultPage < T > scanPage ( DynamoDBScanExpression scanExpression ) { } } | return mapper . < T > scanPage ( model . targetType ( ) , scanExpression ) ; |
public class GregorianCalendar { /** * Gets the date of the first week for the specified year .
* @ param year This is year - 1900 as returned by Date . getYear ( )
* @ return */
@ SuppressWarnings ( "deprecation" ) private Date getWeekOne ( int year ) { } } | GregorianCalendar weekOne = new GregorianCalendar ( ) ; weekOne . setFirstDayOfWeek ( getFirstDayOfWeek ( ) ) ; weekOne . setMinimalDaysInFirstWeek ( getMinimalDaysInFirstWeek ( ) ) ; weekOne . setTime ( new Date ( year , 0 , 1 ) ) ; // can we use the week of 1/1 / year as week one ?
int dow = weekOne . get ( DAY_OF_WEEK ) ; if ( dow < weekOne . getFirstDayOfWeek ( ) ) dow += 7 ; int eow = weekOne . getFirstDayOfWeek ( ) + 7 ; if ( ( eow - dow ) < weekOne . getMinimalDaysInFirstWeek ( ) ) { // nope , week one is the following week
weekOne . add ( DATE , 7 ) ; } weekOne . set ( DAY_OF_WEEK , weekOne . getFirstDayOfWeek ( ) ) ; return weekOne . getTime ( ) ; |
public class CommercePriceListUserSegmentEntryRelPersistenceImpl { /** * Returns all the commerce price list user segment entry rels .
* @ return the commerce price list user segment entry rels */
@ Override public List < CommercePriceListUserSegmentEntryRel > findAll ( ) { } } | return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class ResponseGetDownloadAgentStatus { /** * Get the status for the download agent .
* @ return type for the download agent status */
public final TypeDownloadAgentStatus getDownloadAgentStatus ( ) { } } | // Initialization with default status to unknown
TypeDownloadAgentStatus typeStatus = TypeDownloadAgentStatus . UNKNOWN ; // Find the type by the error id
TypeDownloadAgentStatus typeStatusFoundByCode = TypeDownloadAgentStatus . findById ( status ) ; if ( null != typeStatusFoundByCode ) { typeStatus = typeStatusFoundByCode ; } return typeStatus ; |
public class SecurityDomainJBossASClient { /** * Convenience method that removes a security domain by name . Useful when changing the characteristics of the
* login modules .
* @ param securityDomainName the name of the new security domain
* @ throws Exception if failed to remove the security domain */
public void removeSecurityDomain ( String securityDomainName ) throws Exception { } } | // If not there just return
if ( ! isSecurityDomain ( securityDomainName ) ) { return ; } final Address addr = Address . root ( ) . add ( SUBSYSTEM , SUBSYSTEM_SECURITY , SECURITY_DOMAIN , securityDomainName ) ; ModelNode removeSecurityDomainNode = createRequest ( REMOVE , addr ) ; final ModelNode results = execute ( removeSecurityDomainNode ) ; if ( ! isSuccess ( results ) ) { throw new FailureException ( results , "Failed to remove security domain [" + securityDomainName + "]" ) ; } return ; |
public class PlayRecordContext { /** * Defines a key sequence consisting of a command key optionally followed by zero or more keys . This key sequence has the
* following action : discard any digits collected or recordings in progress and resume digit collection or recording .
* < b > No default . < / b >
* An application that defines more than one command key sequence , will typically use the same command key for all command
* key sequences .
* If more than one command key sequence is defined , then all key sequences must consist of a command key plus at least one
* other key .
* @ return */
public char getReinputKey ( ) { } } | String value = Optional . fromNullable ( getParameter ( SignalParameters . REINPUT_KEY . symbol ( ) ) ) . or ( "" ) ; return value . isEmpty ( ) ? ' ' : value . charAt ( 0 ) ; |
public class MapConverter { /** * getDate .
* @ param data a { @ link java . util . Map } object .
* @ param name a { @ link java . lang . String } object .
* @ return a { @ link java . sql . Date } object . */
public java . sql . Date getDate ( Map < String , Object > data , String name ) { } } | return get ( data , name , java . sql . Date . class ) ; |
public class BimServerClient { public SLongCheckinActionState checkinSync ( long poid , String comment , long deserializerOid , boolean merge , long fileSize , String filename , InputStream inputStream ) throws UserException , ServerException { } } | return channel . checkinSync ( baseAddress , token , poid , comment , deserializerOid , merge , fileSize , filename , inputStream ) ; |
public class AsmUtils { /** * Changes the access level for the specified method for a class .
* @ param clazz the clazz
* @ param methodName the method name
* @ param srgName the srg name
* @ param params the params
* @ return the method */
public static Method changeMethodAccess ( Class < ? > clazz , String methodName , String srgName , String params ) { } } | return changeMethodAccess ( clazz , methodName , srgName , false , new MethodDescriptor ( params ) . getParams ( ) ) ; |
public class ManagedBackupShortTermRetentionPoliciesInner { /** * Updates a managed database ' s short term retention policy .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param managedInstanceName The name of the managed instance .
* @ param databaseName The name of the database .
* @ param retentionDays The backup retention period in days . This is how many days Point - in - Time Restore will be supported .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < ManagedBackupShortTermRetentionPolicyInner > beginCreateOrUpdateAsync ( String resourceGroupName , String managedInstanceName , String databaseName , Integer retentionDays , final ServiceCallback < ManagedBackupShortTermRetentionPolicyInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , managedInstanceName , databaseName , retentionDays ) , serviceCallback ) ; |
public class ChunkedInputStream { /** * Read the next chunk .
* @ throws IOException If an IO error occurs . */
private void nextChunk ( ) throws IOException { } } | if ( ! this . bof ) { this . readCrlf ( ) ; } this . size = ChunkedInputStream . chunkSize ( this . origin ) ; this . bof = false ; this . pos = 0 ; if ( this . size == 0 ) { this . eof = true ; } |
public class ParserDDL { /** * / adding support for indexed expressions . */
private java . util . List < Expression > XreadExpressions ( java . util . List < Boolean > ascDesc , boolean allowEmpty ) { } } | readThis ( Tokens . OPENBRACKET ) ; java . util . List < Expression > indexExprs = new java . util . ArrayList < > ( ) ; while ( true ) { if ( allowEmpty && readIfThis ( Tokens . CLOSEBRACKET ) ) { // empty bracket
return indexExprs ; } Expression expression = XreadValueExpression ( ) ; indexExprs . add ( expression ) ; if ( token . tokenType == Tokens . DESC ) { throw unexpectedToken ( ) ; } // A VoltDB extension to the " readColumnList ( table , true ) " support for descending - value indexes ,
// that similarly parses the asc / desc indicators but COLLECTS them so they can be ignored later ,
// rather than ignoring them on the spot .
if ( ascDesc != null ) { Boolean is_asc = Boolean . TRUE ; if ( token . tokenType == Tokens . ASC || token . tokenType == Tokens . DESC ) { read ( ) ; is_asc = ( token . tokenType == Tokens . ASC ) ; } ascDesc . add ( is_asc ) ; } if ( readIfThis ( Tokens . COMMA ) ) { continue ; } break ; } readThis ( Tokens . CLOSEBRACKET ) ; return indexExprs ; |
public class JSONKeystore { /** * Read the instance ' s associated keystore file into memory . */
public void loadStoreFile ( ) { } } | try { BufferedInputStream bis = new BufferedInputStream ( new FileInputStream ( this . storeFile ) ) ; JSONTokener jsonTokener = new JSONTokener ( new InputStreamReader ( bis ) ) ; JSONArray array = new JSONArray ( jsonTokener ) ; bis . close ( ) ; // Init our keys array with the correct size .
this . keys = new ConcurrentHashMap < String , Key > ( array . length ( ) ) ; for ( int i = 0 , j = array . length ( ) ; i < j ; i += 1 ) { JSONObject obj = array . getJSONObject ( i ) ; Key key = new Key ( obj . getString ( "name" ) , obj . getString ( "data" ) ) ; log . debug ( "Adding {} key to keystore." , key . name ( ) ) ; this . addKey ( key ) ; } } catch ( FileNotFoundException e ) { log . error ( "Could not find JSONKeystore file!" ) ; log . debug ( e . toString ( ) ) ; } catch ( JSONException e ) { log . error ( "Error parsing JSON!" ) ; log . debug ( e . toString ( ) ) ; } catch ( IOException e ) { log . error ( "Could not close JSONKeystore file!" ) ; log . debug ( e . toString ( ) ) ; } |
public class ObjectManagerState { /** * Create or update a copy of the ObjectManagerState in each ObjectStore .
* The caller must be synchronised on objectStores .
* @ param transaction controlling the update .
* @ throws ObjectManagerException */
protected void saveClonedState ( Transaction transaction ) throws ObjectManagerException { } } | final String methodName = "saveClonedState" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName , transaction ) ; // Loop over all of the ObjecStores .
java . util . Iterator objectStoreIterator = objectStores . values ( ) . iterator ( ) ; while ( objectStoreIterator . hasNext ( ) ) { ObjectStore objectStore = ( ObjectStore ) objectStoreIterator . next ( ) ; // Don ' t bother with ObjectStores that can ' t be used for recovery .
if ( objectStore . getContainsRestartData ( ) ) { // Locate any existing copy .
Token objectManagerStateCloneToken = new Token ( objectStore , ObjectStore . objectManagerStateIdentifier . longValue ( ) ) ; // Swap for the definitive Token , if there is one .
objectManagerStateCloneToken = objectStore . like ( objectManagerStateCloneToken ) ; ObjectManagerState objectManagerStateClone = ( ObjectManagerState ) objectManagerStateCloneToken . getManagedObject ( ) ; // Does the cloned state already exist ?
if ( objectManagerStateClone == null ) { objectManagerStateClone = new ObjectManagerState ( ) ; objectManagerStateClone . objectStores = objectStores ; objectManagerStateClone . becomeCloneOf ( this ) ; objectManagerStateCloneToken . setManagedObject ( objectManagerStateClone ) ; transaction . add ( objectManagerStateClone ) ; } else { transaction . lock ( objectManagerStateClone ) ; objectManagerStateClone . objectStores = objectStores ; objectManagerStateClone . becomeCloneOf ( this ) ; transaction . replace ( objectManagerStateClone ) ; } // if ( objectManagerStateClone = = null ) .
} // if ( objectStore . getContainsRestartData ( ) ) .
} // While objectStoreIterator . hasNext ( ) .
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName ) ; |
public class TransformerImpl { /** * Set the content event handler .
* NEEDSDOC @ param handler
* @ throws java . lang . NullPointerException If the handler
* is null .
* @ see org . xml . sax . XMLReader # setContentHandler */
public void setContentHandler ( ContentHandler handler ) { } } | if ( handler == null ) { throw new NullPointerException ( XSLMessages . createMessage ( XSLTErrorResources . ER_NULL_CONTENT_HANDLER , null ) ) ; // " Null content handler " ) ;
} else { m_outputContentHandler = handler ; if ( null == m_serializationHandler ) { ToXMLSAXHandler h = new ToXMLSAXHandler ( ) ; h . setContentHandler ( handler ) ; h . setTransformer ( this ) ; m_serializationHandler = h ; } else m_serializationHandler . setContentHandler ( handler ) ; } |
public class TableRef { /** * Creates an instance from a table name
* < p > The table name must have the format [ & LT ; catalog & GT ; . ] [ & LT ; schema & GT ; . ] & LT ; tablename & GT ; .
* if the catalog or schema component is empty , the catalog or schema will be set to
* < code > null < / code > . < / p >
* @ param tableName the table name
* @ return a < code > TableRef < / code > for the table identified by the specified table name .
* @ throws IllegalArgumentException if the tableName parameter is null */
public static TableRef valueOf ( String tableName ) { } } | if ( tableName == null ) { throw new IllegalArgumentException ( "TableName cannot be null." ) ; } String [ ] components = tableName . split ( "\\." ) ; return TableRef . valueOf ( components ) ; |
public class Helper { /** * Determines if the specified ByteBuffer is one which maps to a file ! */
public static boolean isFileMapped ( ByteBuffer bb ) { } } | if ( bb instanceof MappedByteBuffer ) { try { ( ( MappedByteBuffer ) bb ) . isLoaded ( ) ; return true ; } catch ( UnsupportedOperationException ex ) { } } return false ; |
public class ExtensionSpider { /** * Returns the first URI that is out of scope in the given { @ code target } or { @ code contextSpecificObjects } .
* @ param target the target that will be checked
* @ param contextSpecificObjects other { @ code Objects } used to enhance the target
* @ return a { @ code String } with the first URI out of scope , { @ code null } if none found
* @ since 2.5.0
* @ see Session # isInScope ( String ) */
protected String getTargetUriOutOfScope ( Target target , Object [ ] contextSpecificObjects ) { } } | List < StructuralNode > nodes = target . getStartNodes ( ) ; if ( nodes != null ) { for ( StructuralNode node : nodes ) { if ( node == null ) { continue ; } if ( node instanceof StructuralSiteNode ) { SiteNode siteNode = ( ( StructuralSiteNode ) node ) . getSiteNode ( ) ; if ( ! siteNode . isIncludedInScope ( ) ) { return node . getURI ( ) . toString ( ) ; } } else { String uri = node . getURI ( ) . toString ( ) ; if ( ! isTargetUriInScope ( uri ) ) { return uri ; } } } } if ( contextSpecificObjects != null ) { for ( Object obj : contextSpecificObjects ) { if ( obj instanceof URI ) { String uri = ( ( URI ) obj ) . toString ( ) ; if ( ! isTargetUriInScope ( uri ) ) { return uri ; } } } } return null ; |
public class PDFView { /** * Draw a given PagePart on the canvas */
private void drawPart ( Canvas canvas , PagePart part ) { } } | // Can seem strange , but avoid lot of calls
RectF pageRelativeBounds = part . getPageRelativeBounds ( ) ; Bitmap renderedBitmap = part . getRenderedBitmap ( ) ; // Move to the target page
float localTranslationX = 0 ; float localTranslationY = 0 ; if ( swipeVertical ) localTranslationY = toCurrentScale ( part . getUserPage ( ) * optimalPageHeight ) ; else localTranslationX = toCurrentScale ( part . getUserPage ( ) * optimalPageWidth ) ; canvas . translate ( localTranslationX , localTranslationY ) ; Rect srcRect = new Rect ( 0 , 0 , renderedBitmap . getWidth ( ) , renderedBitmap . getHeight ( ) ) ; float offsetX = toCurrentScale ( pageRelativeBounds . left * optimalPageWidth ) ; float offsetY = toCurrentScale ( pageRelativeBounds . top * optimalPageHeight ) ; float width = toCurrentScale ( pageRelativeBounds . width ( ) * optimalPageWidth ) ; float height = toCurrentScale ( pageRelativeBounds . height ( ) * optimalPageHeight ) ; // If we use float values for this rectangle , there will be
// a possible gap between page parts , especially when
// the zoom level is high .
RectF dstRect = new RectF ( ( int ) offsetX , ( int ) offsetY , ( int ) ( offsetX + width ) , ( int ) ( offsetY + height ) ) ; // Check if bitmap is in the screen
float translationX = currentXOffset + localTranslationX ; float translationY = currentYOffset + localTranslationY ; if ( translationX + dstRect . left >= getWidth ( ) || translationX + dstRect . right <= 0 || translationY + dstRect . top >= getHeight ( ) || translationY + dstRect . bottom <= 0 ) { canvas . translate ( - localTranslationX , - localTranslationY ) ; return ; } canvas . drawBitmap ( renderedBitmap , srcRect , dstRect , paint ) ; if ( Constants . DEBUG_MODE ) { debugPaint . setColor ( part . getUserPage ( ) % 2 == 0 ? Color . RED : Color . BLUE ) ; canvas . drawRect ( dstRect , debugPaint ) ; } // Restore the canvas position
canvas . translate ( - localTranslationX , - localTranslationY ) ; |
import java . util . ArrayList ; class DuplicateList { /** * A Java function to replicate a list from a single list .
* > > > duplicateList ( [ 1 , 2 , 3 ] )
* [ 1 , 2 , 3]
* > > > duplicateList ( [ 4 , 8 , 2 , 10 , 15 , 18 ] )
* [ 4 , 8 , 2 , 10 , 15 , 18]
* > > > duplicateList ( [ 4 , 5 , 6 ] )
* [ 4 , 5 , 6] */
public static ArrayList < Object > duplicateList ( ArrayList < Object > inputList ) { } } | return new ArrayList < > ( inputList ) ; |
public class ReferenceEntityLockService { /** * Extends the expiration time of the lock by some service - defined increment .
* @ param lock IEntityLock
* @ exception LockingException */
@ Override public void renew ( IEntityLock lock , int duration ) throws LockingException { } } | if ( isValid ( lock ) ) { Date newExpiration = getNewExpiration ( duration ) ; getLockStore ( ) . update ( lock , newExpiration ) ; ( ( EntityLockImpl ) lock ) . setExpirationTime ( newExpiration ) ; } else { throw new LockingException ( "Could not renew " + lock + " : lock is invalid." ) ; } |
public class AipOcr { /** * 表格识别结果接口
* 获取表格文字识别结果
* @ param requestId - 发送表格文字识别请求时返回的request id
* @ param options - 可选参数对象 , key : value都为string类型
* options - options列表 :
* result _ type 期望获取结果的类型 , 取值为 “ excel ” 时返回xls文件的地址 , 取值为 “ json ” 时返回json格式的字符串 , 默认为 ” excel ”
* @ return JSONObject */
public JSONObject tableResultGet ( String requestId , HashMap < String , String > options ) { } } | AipRequest request = new AipRequest ( ) ; preOperation ( request ) ; request . addBody ( "request_id" , requestId ) ; if ( options != null ) { request . addBody ( options ) ; } request . setUri ( OcrConsts . TABLE_RESULT_GET ) ; postOperation ( request ) ; return requestServer ( request ) ; |
public class CmsResourceManager { /** * Sets the folder , the file and the XSD translator . < p >
* @ param folderTranslator the folder translator to set
* @ param fileTranslator the file translator to set
* @ param xsdTranslator the XSD translator to set */
public void setTranslators ( CmsResourceTranslator folderTranslator , CmsResourceTranslator fileTranslator , CmsResourceTranslator xsdTranslator ) { } } | m_folderTranslator = folderTranslator ; m_fileTranslator = fileTranslator ; m_xsdTranslator = xsdTranslator ; |
public class Optionals { /** * Combine an Optional with the provided Iterable ( selecting one element if present ) using the supplied BiFunction
* < pre >
* { @ code
* Optionals . zip ( Optional . of ( 10 ) , Arrays . asList ( 20 ) , this : : add )
* / / Optional [ 30]
* private int add ( int a , int b ) {
* return a + b ;
* < / pre >
* @ param f Optional to combine with first element in Iterable ( if present )
* @ param v Iterable to combine
* @ param fn Combining function
* @ return Optional combined with supplied Iterable , or zero Optional if no value present */
public static < T1 , T2 , R > Optional < R > zip ( final Optional < ? extends T1 > f , final Iterable < ? extends T2 > v , final BiFunction < ? super T1 , ? super T2 , ? extends R > fn ) { } } | return narrow ( Option . fromOptional ( f ) . zip ( v , fn ) . toOptional ( ) ) ; |
public class FilesInner { /** * Update a file .
* This method updates an existing file .
* @ param groupName Name of the resource group
* @ param serviceName Name of the service
* @ param projectName Name of the project
* @ param fileName Name of the File
* @ param parameters Information about the file
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ApiErrorException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ProjectFileInner object if successful . */
public ProjectFileInner update ( String groupName , String serviceName , String projectName , String fileName , ProjectFileInner parameters ) { } } | return updateWithServiceResponseAsync ( groupName , serviceName , projectName , fileName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class FileSystemGroupStore { /** * Returns all directories under dir . */
private void primGetAllDirectoriesBelow ( File dir , Set allDirectories ) { } } | File [ ] files = dir . listFiles ( fileFilter ) ; for ( int i = 0 ; i < files . length ; i ++ ) { if ( files [ i ] . isDirectory ( ) ) { primGetAllDirectoriesBelow ( files [ i ] , allDirectories ) ; allDirectories . add ( files [ i ] ) ; } } |
public class DefaultSchemaOperations { /** * ( non - Javadoc )
* @ see org . springframework . data . solr . core . schema . SchemaOperations # addField ( org . springframework . data . solr . core . schema . SchemaDefinition . SchemaField ) */
@ Override public void addField ( final SchemaField field ) { } } | if ( field instanceof FieldDefinition ) { addField ( ( FieldDefinition ) field ) ; } else if ( field instanceof CopyFieldDefinition ) { addCopyField ( ( CopyFieldDefinition ) field ) ; } |
public class CancelStepsResult { /** * A list of < a > CancelStepsInfo < / a > , which shows the status of specified cancel requests for each
* < code > StepID < / code > specified .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setCancelStepsInfoList ( java . util . Collection ) } or { @ link # withCancelStepsInfoList ( java . util . Collection ) }
* if you want to override the existing values .
* @ param cancelStepsInfoList
* A list of < a > CancelStepsInfo < / a > , which shows the status of specified cancel requests for each
* < code > StepID < / code > specified .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CancelStepsResult withCancelStepsInfoList ( CancelStepsInfo ... cancelStepsInfoList ) { } } | if ( this . cancelStepsInfoList == null ) { setCancelStepsInfoList ( new com . amazonaws . internal . SdkInternalList < CancelStepsInfo > ( cancelStepsInfoList . length ) ) ; } for ( CancelStepsInfo ele : cancelStepsInfoList ) { this . cancelStepsInfoList . add ( ele ) ; } return this ; |
public class ContentMatcher { /** * Direct method for a complete ContentMatcher instance creation .
* @ param xmlInputStream the stream of the XML file that need to be used for initialization
* @ return a ContentMatcher instance */
public static ContentMatcher getInstance ( InputStream xmlInputStream ) { } } | ContentMatcher cm = new ContentMatcher ( ) ; // Load the pattern definitions from an XML file
try { cm . loadXMLPatternDefinitions ( xmlInputStream ) ; } catch ( JDOMException | IOException ex ) { throw new IllegalArgumentException ( "Failed to initialize the ContentMatcher object using that stream" , ex ) ; } return cm ; |
public class UserHandlerImpl { /** * { @ inheritDoc } */
public ListAccess < User > findUsersByQuery ( Query query , UserStatus status ) throws Exception { } } | return query . isEmpty ( ) ? new SimpleJCRUserListAccess ( service , status ) : new UserByQueryJCRUserListAccess ( service , query , status ) ; |
public class GenStrutsApp { /** * Tell whether the struts output file ( struts - config - * . xml ) is out of date , based on the
* file times of the source file and the ( optional ) struts - merge file . */
public boolean isStale ( File mergeFile ) { } } | // We can write to the file if it doesn ' t exist yet .
if ( ! _strutsConfigFile . exists ( ) ) { return true ; } long lastWrite = _strutsConfigFile . lastModified ( ) ; if ( mergeFile != null && mergeFile . exists ( ) && mergeFile . lastModified ( ) > lastWrite ) { return true ; } if ( _sourceFile . lastModified ( ) > lastWrite ) { return true ; } return false ; |
public class MCCRGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setStopnum ( Integer newStopnum ) { } } | Integer oldStopnum = stopnum ; stopnum = newStopnum ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . MCCRG__STOPNUM , oldStopnum , stopnum ) ) ; |
public class AbstractBigtableAdmin { /** * { @ inheritDoc } */
@ Override public void deleteTableSnapshots ( String tableNameRegex , String snapshotNameRegex ) throws IOException { } } | deleteTableSnapshots ( Pattern . compile ( tableNameRegex ) , Pattern . compile ( snapshotNameRegex ) ) ; |
public class LolChat { /** * Gets a list of user that you ' ve sent friend requests but haven ' t answered
* yet .
* @ return A list of Friends . */
public List < Friend > getPendingFriendRequests ( ) { } } | return getFriends ( new Filter < Friend > ( ) { public boolean accept ( Friend friend ) { return friend . getFriendStatus ( ) == FriendStatus . ADD_REQUEST_PENDING ; } } ) ; |
public class Type { /** * This is the setter method for instance variable { @ link # mainTable } .
* @ param _ mainTable new value for instance variable { @ link # mainTable }
* @ see # getMainTable
* @ see # mainTable */
private void setMainTable ( final SQLTable _mainTable ) { } } | SQLTable table = _mainTable ; while ( table . getMainTable ( ) != null ) { table = table . getMainTable ( ) ; } this . mainTable = table ; |
public class SftpFsHelper { /** * Create new channel every time a command needs to be executed . This is required to support execution of multiple
* commands in parallel . All created channels are cleaned up when the session is closed .
* @ return a new { @ link ChannelSftp }
* @ throws SftpException */
public ChannelSftp getSftpChannel ( ) throws SftpException { } } | try { ChannelSftp channelSftp = ( ChannelSftp ) this . session . openChannel ( "sftp" ) ; channelSftp . connect ( ) ; return channelSftp ; } catch ( JSchException e ) { throw new SftpException ( 0 , "Cannot open a channel to SFTP server" , e ) ; } |
public class IMMImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . IMM__MMP_NAME : setMMPName ( ( String ) newValue ) ; return ; case AfplibPackage . IMM__TRIPLETS : getTriplets ( ) . clear ( ) ; getTriplets ( ) . addAll ( ( Collection < ? extends Triplet > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class FactoryPointTracker { /** * TODO remove maxTracks ? Use number of detected instead */
public static < I extends ImageGray < I > > PointTracker < I > dda_FH_SURF_Fast ( ConfigFastHessian configDetector , ConfigSurfDescribe . Speed configDescribe , ConfigAverageIntegral configOrientation , Class < I > imageType ) { } } | ScoreAssociation < TupleDesc_F64 > score = FactoryAssociation . scoreEuclidean ( TupleDesc_F64 . class , true ) ; AssociateSurfBasic assoc = new AssociateSurfBasic ( FactoryAssociation . greedy ( score , 5 , true ) ) ; AssociateDescription2D < BrightFeature > generalAssoc = new AssociateDescTo2D < > ( new WrapAssociateSurfBasic ( assoc ) ) ; DetectDescribePoint < I , BrightFeature > fused = FactoryDetectDescribe . surfFast ( configDetector , configDescribe , configOrientation , imageType ) ; DdaManagerDetectDescribePoint < I , BrightFeature > manager = new DdaManagerDetectDescribePoint < > ( fused ) ; return new DetectDescribeAssociate < > ( manager , generalAssoc , new ConfigTrackerDda ( ) ) ; |
public class JavaParser { Rule InterfaceDeclaration ( ) { } } | return Sequence ( INTERFACE , Identifier ( ) , Optional ( TypeParameters ( ) ) , Optional ( EXTENDS , ClassTypeList ( ) ) , InterfaceBody ( ) ) ; |
public class RgbaColor { /** * Returns a triple of hue [ 0-360 ) , saturation [ 0-100 ] , and
* lightness [ 0-100 ] . These are kept as float [ ] so that for any
* RgbaColor color ,
* color . equals ( RgbaColor . fromHsl ( color . convertToHsl ( ) ) ) is true .
* < i > Implementation based on < a
* href = " http : / / en . wikipedia . org / wiki / HSL _ and _ HSV "
* > wikipedia < / a > < / i > */
public float [ ] convertToHsl ( ) { } } | float H , S , L ; // first normalize [ 0,1]
float R = r / 255f ; float G = g / 255f ; float B = b / 255f ; // compute min and max
float M = max ( R , G , B ) ; float m = min ( R , G , B ) ; L = ( M + m ) / 2f ; if ( M == m ) { // grey
H = S = 0 ; } else { float diff = M - m ; S = ( L < 0.5 ) ? diff / ( 2f * L ) : diff / ( 2f - 2f * L ) ; if ( M == R ) { H = ( G - B ) / diff ; } else if ( M == G ) { H = ( B - R ) / diff + 2f ; } else { H = ( R - G ) / diff + 4f ; } H *= 60 ; } H = hueCheck ( H ) ; S = slCheck ( S * 100f ) ; L = slCheck ( L * 100f ) ; return new float [ ] { H , S , L } ; |
public class FixedDelayRestartStrategy { /** * Creates a FixedDelayRestartStrategy from the given Configuration .
* @ param configuration Configuration containing the parameter values for the restart strategy
* @ return Initialized instance of FixedDelayRestartStrategy
* @ throws Exception */
public static FixedDelayRestartStrategyFactory createFactory ( Configuration configuration ) throws Exception { } } | int maxAttempts = configuration . getInteger ( ConfigConstants . RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS , 1 ) ; String delayString = configuration . getString ( ConfigConstants . RESTART_STRATEGY_FIXED_DELAY_DELAY ) ; long delay ; try { delay = Duration . apply ( delayString ) . toMillis ( ) ; } catch ( NumberFormatException nfe ) { throw new Exception ( "Invalid config value for " + ConfigConstants . RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString + ". Value must be a valid duration (such as '100 milli' or '10 s')" ) ; } return new FixedDelayRestartStrategyFactory ( maxAttempts , delay ) ; |
public class Index { /** * Search for synonyms
* @ param query the query */
public JSONObject searchSynonyms ( SynonymQuery query ) throws AlgoliaException , JSONException { } } | return this . searchSynonyms ( query , RequestOptions . empty ) ; |
public class BaseTransport { /** * Convert this java object to a String .
* @ param obj The java object to convert .
* @ return The object represented as a string . */
public String objectToString ( Object obj ) { } } | String string = BaseTransport . convertObjectToString ( obj ) ; return string ; |
public class RuleUpdate { /** * Set to < code > null < / code > or empty set to remove existing tags . */
public RuleUpdate setTags ( @ Nullable Set < String > tags ) { } } | this . tags = tags ; this . changeTags = true ; return this ; |
public class DataReader { /** * Parse number and some currency data for locale . */
private NumberData parseNumberData ( LocaleID id , String code , JsonObject root ) { } } | NumberData data = getNumberData ( id ) ; JsonObject numbers = resolve ( root , "numbers" ) ; data . minimumGroupingDigits = Integer . valueOf ( string ( numbers , "minimumGroupingDigits" ) ) ; JsonObject symbols = resolve ( numbers , "symbols-numberSystem-latn" ) ; data . decimal = string ( symbols , "decimal" ) ; data . group = string ( symbols , "group" ) ; data . percent = string ( symbols , "percentSign" ) ; data . plus = string ( symbols , "plusSign" ) ; data . minus = string ( symbols , "minusSign" ) ; data . exponential = string ( symbols , "exponential" ) ; data . superscriptingExponent = string ( symbols , "superscriptingExponent" ) ; data . perMille = string ( symbols , "perMille" ) ; data . infinity = string ( symbols , "infinity" ) ; data . nan = string ( symbols , "nan" ) ; // The fields ' currencyDecimal ' and ' currencyGroup ' are only defined for a few locales
data . currencyDecimal = string ( symbols , "currencyDecimal" , data . decimal ) ; data . currencyGroup = string ( symbols , "currencyGroup" , data . group ) ; JsonObject decimalFormats = resolve ( numbers , "decimalFormats-numberSystem-latn" ) ; data . decimalFormatStandard = getNumberPattern ( string ( decimalFormats , "standard" ) ) ; data . decimalFormatShort = getPluralNumberPattern ( resolve ( decimalFormats , "short" , "decimalFormat" ) ) ; data . decimalFormatLong = getPluralNumberPattern ( resolve ( decimalFormats , "long" , "decimalFormat" ) ) ; JsonObject percentFormats = resolve ( numbers , "percentFormats-numberSystem-latn" ) ; data . percentFormatStandard = getNumberPattern ( string ( percentFormats , "standard" ) ) ; JsonObject currencyFormats = resolve ( numbers , "currencyFormats-numberSystem-latn" ) ; data . currencyFormatStandard = getNumberPattern ( string ( currencyFormats , "standard" ) ) ; data . currencyFormatAccounting = getNumberPattern ( string ( currencyFormats , "accounting" ) ) ; data . currencyFormatShort = getPluralNumberPattern ( resolve ( currencyFormats , "short" , "standard" ) ) ; data . currencyUnitPattern = new HashMap < > ( ) ; for ( String key : objectKeys ( currencyFormats ) ) { if ( key . startsWith ( "unitPattern-count" ) ) { data . currencyUnitPattern . put ( key , string ( currencyFormats , key ) ) ; } } return data ; |
public class DecorLayoutInflater { /** * The LayoutInflater onCreateView is the fourth port of call for LayoutInflation .
* BUT only for none CustomViews .
* Basically if this method doesn ' t inflate the View nothing probably will . */
@ Override protected View onCreateView ( String name , AttributeSet attrs ) throws ClassNotFoundException { } } | // This mimics the { @ code PhoneLayoutInflater } in the way it tries to inflate the base
// classes , if this fails its pretty certain the app will fail at this point .
View view = null ; for ( String prefix : CLASS_PREFIX_LIST ) { try { view = createView ( name , prefix , attrs ) ; } catch ( ClassNotFoundException ignored ) { } } // In this case we want to let the base class take a crack
// at it .
if ( view == null ) view = super . onCreateView ( name , attrs ) ; return mDecorFactory . onViewCreated ( view , name , null , view . getContext ( ) , attrs ) ; |
public class DirectoryHelper { /** * Returns the files list of whole directory including its sub directories .
* @ param srcPath
* source path
* @ return List
* @ throws IOException
* if any exception occurred */
public static List < File > listFiles ( File srcPath ) throws IOException { } } | List < File > result = new ArrayList < File > ( ) ; if ( ! srcPath . isDirectory ( ) ) { throw new IOException ( srcPath . getAbsolutePath ( ) + " is a directory" ) ; } for ( File subFile : srcPath . listFiles ( ) ) { result . add ( subFile ) ; if ( subFile . isDirectory ( ) ) { result . addAll ( listFiles ( subFile ) ) ; } } return result ; |
public class ServerConfiguration { /** * Calls modify ( ) on elements in the configuration that implement the ModifiableConfigElement interface .
* @ throws Exception when the update fails */
public void updateDatabaseArtifacts ( ) throws Exception { } } | List < ModifiableConfigElement > mofiableElementList = new ArrayList < ModifiableConfigElement > ( ) ; findModifiableConfigElements ( this , mofiableElementList ) ; for ( ModifiableConfigElement element : mofiableElementList ) { element . modify ( this ) ; } |
public class JMXQuery { protected Status report ( final Exception ex , final PrintStream out ) { } } | if ( ex instanceof ParseError ) { out . print ( UNKNOWN_STRING + " " ) ; reportException ( ex , out ) ; out . println ( " Usage: check_jmx -help " ) ; return Status . UNKNOWN ; } else { out . print ( CRITICAL_STRING + " " ) ; reportException ( ex , out ) ; out . println ( ) ; return Status . CRITICAL ; } |
public class vpnglobal_authenticationcertpolicy_binding { /** * Use this API to fetch a vpnglobal _ authenticationcertpolicy _ binding resources . */
public static vpnglobal_authenticationcertpolicy_binding [ ] get ( nitro_service service ) throws Exception { } } | vpnglobal_authenticationcertpolicy_binding obj = new vpnglobal_authenticationcertpolicy_binding ( ) ; vpnglobal_authenticationcertpolicy_binding response [ ] = ( vpnglobal_authenticationcertpolicy_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class BotAliasMetadataMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BotAliasMetadata botAliasMetadata , ProtocolMarshaller protocolMarshaller ) { } } | if ( botAliasMetadata == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( botAliasMetadata . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( botAliasMetadata . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( botAliasMetadata . getBotVersion ( ) , BOTVERSION_BINDING ) ; protocolMarshaller . marshall ( botAliasMetadata . getBotName ( ) , BOTNAME_BINDING ) ; protocolMarshaller . marshall ( botAliasMetadata . getLastUpdatedDate ( ) , LASTUPDATEDDATE_BINDING ) ; protocolMarshaller . marshall ( botAliasMetadata . getCreatedDate ( ) , CREATEDDATE_BINDING ) ; protocolMarshaller . marshall ( botAliasMetadata . getChecksum ( ) , CHECKSUM_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Nodes { /** * Obtains an element ' s attributes as Map . */
public static Map < QName , String > getAttributes ( Node n ) { } } | Map < QName , String > map = new LinkedHashMap < QName , String > ( ) ; NamedNodeMap m = n . getAttributes ( ) ; if ( m != null ) { final int len = m . getLength ( ) ; for ( int i = 0 ; i < len ; i ++ ) { Attr a = ( Attr ) m . item ( i ) ; map . put ( getQName ( a ) , a . getValue ( ) ) ; } } return map ; |
public class TupleComparator { @ Override public int hash ( T value ) { } } | int i = 0 ; try { int code = this . comparators [ 0 ] . hash ( value . getField ( keyPositions [ 0 ] ) ) ; for ( i = 1 ; i < this . keyPositions . length ; i ++ ) { code *= HASH_SALT [ i & 0x1F ] ; // salt code with ( i % HASH _ SALT . length ) - th salt component
code += this . comparators [ i ] . hash ( value . getField ( keyPositions [ i ] ) ) ; } return code ; } catch ( NullPointerException npex ) { throw new NullKeyFieldException ( keyPositions [ i ] ) ; } catch ( IndexOutOfBoundsException iobex ) { throw new KeyFieldOutOfBoundsException ( keyPositions [ i ] ) ; } |
public class DefaultCacheableResourceService { /** * Copy the resource to the system ' s temporary resources .
* @ param resource { @ link File } , the resource to copy from
* @ param resourceLocation { @ link String } , the resource location
* @ return the resource copy { @ link File } ready for processing
* @ throws ResourceDownloadError Throw if an error occurred copying the
* resource */
private File copyResource ( final File resource , final String resourceLocation ) throws ResourceDownloadError { } } | final String tmpPath = asPath ( getSystemConfiguration ( ) . getCacheDirectory ( ) . getAbsolutePath ( ) , ResourceType . TMP_FILE . getResourceFolderName ( ) ) ; final String uuidDirName = UUID . randomUUID ( ) . toString ( ) ; // load copy file and create parent directories
final File copyFile = new File ( asPath ( tmpPath , uuidDirName , resource . getName ( ) ) ) ; // copy to temp directory
File resourceCopy = copyToDirectory ( resource , resourceLocation , copyFile ) ; // hash uuid temp directory for cleanup later
tempResources . add ( new File ( asPath ( tmpPath , uuidDirName ) ) ) ; return resourceCopy ; |
public class ClassGenericsUtil { /** * Instantiate the first available implementation of an interface .
* Only supports public and parameterless constructors .
* @ param clz Class to instantiate .
* @ return Instance */
public static < T > T instantiateLowlevel ( Class < ? extends T > clz ) { } } | Exception last = null ; for ( Class < ? > c : ELKIServiceRegistry . findAllImplementations ( clz ) ) { try { return clz . cast ( c . newInstance ( ) ) ; } catch ( Exception e ) { last = e ; } } throw new AbortException ( "Cannot find a usable implementation of " + clz . toString ( ) , last ) ; |
public class MDMoleculeConvention { /** * Add parsing of elements in mdmolecule :
* mdmolecule
* chargeGroup
* id
* cgNumber
* atomArray
* switchingAtom
* residue
* id
* title
* resNumber
* atomArray
* @ cdk . todo The JavaDoc of this class needs to be converted into HTML */
@ Override public void startElement ( CMLStack xpath , String uri , String local , String raw , Attributes atts ) { } } | // < molecule convention = " md : mdMolecule "
// xmlns = " http : / / www . xml - cml . org / schema "
// xmlns : md = " http : / / www . bioclipse . org / mdmolecule " >
// < atomArray >
// < atom id = " a1 " elementType = " C " / >
// < atom id = " a2 " elementType = " C " / >
// < / atomArray >
// < molecule dictRef = " md : chargeGroup " id = " cg1 " >
// < scalar dictRef = " md : cgNumber " > 5 < / scalar >
// < atomArray >
// < atom ref = " a1 " / >
// < atom ref = " a2 " > < scalar dictRef = " md : switchingAtom " / > < / atom >
// < / atomArray >
// < / molecule >
// < molecule dictRef = " md : residue " id = " r1 " title = " resName " >
// < scalar dictRef = " md : resNumber " > 3 < / scalar >
// < atomArray >
// < atom ref = " a1 " / >
// < atom ref = " a2 " / >
// < / atomArray >
// < / molecule >
// < / molecule >
// let the CMLCore convention deal with things first
if ( "molecule" . equals ( local ) ) { // the copy the parsed content into a new MDMolecule
if ( atts . getValue ( "convention" ) != null && atts . getValue ( "convention" ) . equals ( "md:mdMolecule" ) ) { // System . out . println ( " creating a MDMolecule " ) ;
super . startElement ( xpath , uri , local , raw , atts ) ; currentMolecule = new MDMolecule ( currentMolecule ) ; } else { DICTREF = atts . getValue ( "dictRef" ) != null ? atts . getValue ( "dictRef" ) : "" ; // If residue or chargeGroup , set up a new one
if ( DICTREF . equals ( "md:chargeGroup" ) ) { // System . out . println ( " Creating a new charge group . . . " ) ;
currentChargeGroup = new ChargeGroup ( ) ; } else if ( DICTREF . equals ( "md:residue" ) ) { // System . out . println ( " Creating a new residue group . . . " ) ;
currentResidue = new Residue ( ) ; if ( atts . getValue ( "title" ) != null ) currentResidue . setName ( atts . getValue ( "title" ) ) ; } } } else // We have a scalar element . Now check who it belongs to
if ( "scalar" . equals ( local ) ) { DICTREF = atts . getValue ( "dictRef" ) ; // Switching Atom
if ( "md:switchingAtom" . equals ( DICTREF ) ) { // Set current atom as switching atom
currentChargeGroup . setSwitchingAtom ( currentAtom ) ; } else { super . startElement ( xpath , uri , local , raw , atts ) ; } } else if ( "atom" . equals ( local ) ) { if ( currentChargeGroup != null ) { String id = atts . getValue ( "ref" ) ; if ( id != null ) { // ok , an atom is referenced ; look it up
currentAtom = null ; // System . out . println ( " # atoms : " + currentMolecule . getAtomCount ( ) ) ;
for ( IAtom nextAtom : currentMolecule . atoms ( ) ) { if ( nextAtom . getID ( ) . equals ( id ) ) { currentAtom = nextAtom ; } } if ( currentAtom == null ) { logger . error ( "Could not found the referenced atom '" + id + "' for this charge group!" ) ; } else { currentChargeGroup . addAtom ( currentAtom ) ; } } } else if ( currentResidue != null ) { String id = atts . getValue ( "ref" ) ; if ( id != null ) { // ok , an atom is referenced ; look it up
IAtom referencedAtom = null ; // System . out . println ( " # atoms : " + currentMolecule . getAtomCount ( ) ) ;
for ( IAtom nextAtom : currentMolecule . atoms ( ) ) { if ( nextAtom . getID ( ) . equals ( id ) ) { referencedAtom = nextAtom ; } } if ( referencedAtom == null ) { logger . error ( "Could not found the referenced atom '" + id + "' for this residue!" ) ; } else { currentResidue . addAtom ( referencedAtom ) ; } } } else { // ok , fine , just add it to the currentMolecule
super . startElement ( xpath , uri , local , raw , atts ) ; } } else { super . startElement ( xpath , uri , local , raw , atts ) ; } |
public class JmsDestinationImpl { /** * This method returns the " List containing SIDestinationAddress " form of the
* forward routing path that will be set into the message .
* Note that this takes the ' big ' destination as being the end of the forward
* routing path . */
protected List getConvertedFRP ( ) { } } | List theList = null ; StringArrayWrapper saw = ( StringArrayWrapper ) properties . get ( FORWARD_ROUTING_PATH ) ; if ( saw != null ) { // This list is the forward routing path for the message .
theList = saw . getMsgForwardRoutingPath ( ) ; } return theList ; |
public class IPv4Framer { /** * { @ inheritDoc } */
@ Override public IPv4Packet frame ( final Packet parent , final Buffer payload ) throws IOException { } } | if ( parent == null ) { throw new IllegalArgumentException ( "The parent frame cannot be null" ) ; } // the ipv4 headers are always 20 bytes unless
// the length is greater than 5
final Buffer headers = payload . readBytes ( 20 ) ; // byte 1 , contains the version and the length
final byte b = headers . getByte ( 0 ) ; // final int version = ( ( i > > > 28 ) & 0x0F ) ;
// final int length = ( ( i > > > 24 ) & 0x0F ) ;
final int version = b >>> 5 & 0x0F ; final int headerLength = b & 0x0F ; // byte 2 - dscp and ecn
final byte tos = headers . getByte ( 1 ) ; // final int dscp = ( ( tos > > > 6 ) & 0x3B ) ;
// final int ecn = ( tos & 0x03 ) ;
// byte 3 - 4
final int totalLength = headers . getUnsignedShort ( 2 ) ; // byte 5 - 6
// final short id = headers . readShort ( ) ;
// this one contains flags + fragment offset
// byte 7 - 8
// final short flagsAndFragement = headers . readShort ( ) ;
// byte 9
// final byte ttl = headers . readByte ( ) ;
// byte 10
// final byte protocol = headers . getByte ( 9 ) ;
// byte 11 - 12
// final int checkSum = headers . readUnsignedShort ( ) ;
// byte 13 - 16
// final int sourceIp = headers . readInt ( ) ;
// byte 17 - 20
// final int destIp = headers . readInt ( ) ;
// if the length is greater than 5 , then the frame
// contains extra options so read those as well
int options = 0 ; if ( headerLength > 5 ) { // remember , this may have to be treated as unsigned
// final int options = headers . readInt ( ) ;
options = payload . readInt ( ) ; } // Trim off any padding from the upper layer , e . g . Ethernet padding for small packets .
// If the captured frame was truncated , then use the truncated size for the data buffer , instead of what the
// IPv4 header says its length should be .
final int tcpLength = payload . getReaderIndex ( ) + totalLength - ( headerLength * 4 ) ; final Buffer data = payload . slice ( Math . min ( tcpLength , payload . capacity ( ) ) ) ; return new IPv4PacketImpl ( parent , headers , options , data ) ; |
public class AnnotationAwareRetryOperationsInterceptor { /** * Resolve the specified value if possible .
* @ see ConfigurableBeanFactory # resolveEmbeddedValue */
private String resolve ( String value ) { } } | if ( this . beanFactory != null && this . beanFactory instanceof ConfigurableBeanFactory ) { return ( ( ConfigurableBeanFactory ) this . beanFactory ) . resolveEmbeddedValue ( value ) ; } return value ; |
public class MatrixVectorReader { /** * Reads a double */
private double getDouble ( ) throws IOException { } } | st . nextToken ( ) ; if ( st . ttype == StreamTokenizer . TT_WORD ) return Double . parseDouble ( st . sval ) ; else if ( st . ttype == StreamTokenizer . TT_EOF ) throw new EOFException ( "End-of-File encountered during parsing" ) ; else throw new IOException ( "Unknown token found during parsing" ) ; |
public class Transaction { /** * Returns the confidence object for this transaction from the { @ link TxConfidenceTable } */
public TransactionConfidence getConfidence ( TxConfidenceTable table ) { } } | if ( confidence == null ) confidence = table . getOrCreate ( getTxId ( ) ) ; return confidence ; |
public class IOGroovyMethods { /** * Creates a reader for this input stream , using the specified
* charset as the encoding .
* @ param self an input stream
* @ param charset the charset for this input stream
* @ return a reader
* @ throws UnsupportedEncodingException if the encoding specified is not supported
* @ since 1.6.0 */
public static BufferedReader newReader ( InputStream self , String charset ) throws UnsupportedEncodingException { } } | return new BufferedReader ( new InputStreamReader ( self , charset ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.