signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class PathOverlay { /** * Draw a great circle . * Calculate a point for every 100km along the path . * @ param startPoint start point of the great circle * @ param endPoint end point of the great circle */ public void addGreatCircle ( final GeoPoint startPoint , final GeoPoint endPoint ) { } }
// get the great circle path length in meters final int greatCircleLength = ( int ) startPoint . distanceToAsDouble ( endPoint ) ; // add one point for every 100kms of the great circle path final int numberOfPoints = greatCircleLength / 100000 ; addGreatCircle ( startPoint , endPoint , numberOfPoints ) ;
public class DraweeHolder { /** * Callback used to notify about top - level - drawable ' s visibility changes . */ @ Override public void onVisibilityChange ( boolean isVisible ) { } }
if ( mIsVisible == isVisible ) { return ; } mEventTracker . recordEvent ( isVisible ? Event . ON_DRAWABLE_SHOW : Event . ON_DRAWABLE_HIDE ) ; mIsVisible = isVisible ; attachOrDetachController ( ) ;
public class Dispatcher { /** * - - methods called from handler */ void handlerProcessTask ( Task task ) { } }
assertDispatcherThread ( ) ; SerialTaskQueue taskQueue = mQueuesMap . get ( task . subscriberCallback . queue ) ; if ( taskQueue == null ) { taskQueue = new SerialTaskQueue ( task . subscriberCallback . queue ) ; mQueuesMap . put ( task . subscriberCallback . queue , taskQueue ) ; mQueuesList . add ( taskQueue ) ; } taskQueue . offer ( task ) ; processNextTask ( ) ;
public class CompiledFEELSemanticMappings { /** * Represent a [ e1 , e2 , e3 ] construct . */ @ SafeVarargs @ SuppressWarnings ( "varargs" ) public static < T > List < T > list ( T ... a ) { } }
ArrayList < T > result = new ArrayList < T > ( ) ; if ( a == null ) { result . add ( null ) ; return result ; } for ( T elem : a ) { result . add ( elem ) ; } return result ;
public class HtmlWriter { /** * Writes out a CSS property . * @ param prop a CSS property * @ param value the value of the CSS property * @ throws IOException */ protected void writeCssProperty ( String prop , String value ) throws IOException { } }
write ( new StringBuffer ( prop ) . append ( ": " ) . append ( value ) . append ( "; " ) . toString ( ) ) ;
public class GetDiscoveredResourceCountsResult { /** * The list of < code > ResourceCount < / code > objects . Each object is listed in descending order by the number of * resources . * @ param resourceCounts * The list of < code > ResourceCount < / code > objects . Each object is listed in descending order by the number of * resources . */ public void setResourceCounts ( java . util . Collection < ResourceCount > resourceCounts ) { } }
if ( resourceCounts == null ) { this . resourceCounts = null ; return ; } this . resourceCounts = new com . amazonaws . internal . SdkInternalList < ResourceCount > ( resourceCounts ) ;
public class ApiOvhTelephony { /** * Alter this object properties * REST : PUT / telephony / { billingAccount } / scheduler / { serviceName } * @ param body [ required ] New object properties * @ param billingAccount [ required ] The name of your billingAccount * @ param serviceName [ required ] */ public void billingAccount_scheduler_serviceName_PUT ( String billingAccount , String serviceName , OvhScheduler body ) throws IOException { } }
String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ;
public class ApiOvhXdsl { /** * Get this object properties * REST : GET / xdsl / spare / { spare } * @ param spare [ required ] The internal name of your spare */ public OvhXdslSpare spare_spare_GET ( String spare ) throws IOException { } }
String qPath = "/xdsl/spare/{spare}" ; StringBuilder sb = path ( qPath , spare ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhXdslSpare . class ) ;
public class UserManagedCacheBuilder { /** * Adds one or more { @ link CacheEventListenerConfiguration } to the returned builder . * @ param cacheEventListenerConfigurations the cache event listener configurations * @ return a new builders with the added event listener configurations * @ see # withEventDispatcher ( CacheEventDispatcher ) * @ see # withEventExecutors ( ExecutorService , ExecutorService ) * @ see # withEventListeners ( CacheEventListenerConfigurationBuilder ) */ public final UserManagedCacheBuilder < K , V , T > withEventListeners ( CacheEventListenerConfiguration ... cacheEventListenerConfigurations ) { } }
UserManagedCacheBuilder < K , V , T > otherBuilder = new UserManagedCacheBuilder < > ( this ) ; otherBuilder . eventListenerConfigurations . addAll ( Arrays . asList ( cacheEventListenerConfigurations ) ) ; return otherBuilder ;
public class RxLoaderManager { /** * Creates a new { @ link me . tatarka . rxloader . RxLoader } that manages the given { @ link * rx . Observable } . It uses the { @ link me . tatarka . rxloader . RxLoaderManager # DEFAULT } tag . This * should be called in { @ link android . app . Activity # onCreate ( android . os . Bundle ) } or similar . * @ param observableFunc the function that returns the observable to manage * @ param observer the observer that receives the observable ' s callbacks * @ param < T > the observable ' s value type * @ param < A > the argument ' s type . * @ return a new { @ code RxLoader } * @ see me . tatarka . rxloader . RxLoader */ public < A , T > RxLoader1 < A , T > create ( Func1 < A , Observable < T > > observableFunc , RxLoaderObserver < T > observer ) { } }
return new RxLoader1 < A , T > ( manager , DEFAULT , observableFunc , observer ) ;
public class SeekBar { @ Override public boolean onTouchEvent ( MotionEvent event ) { } }
if ( ! isEnabled ( ) ) return false ; if ( event . getAction ( ) == MotionEvent . ACTION_DOWN ) { if ( radiusAnimator != null ) radiusAnimator . end ( ) ; radiusAnimator = ValueAnimator . ofFloat ( thumbRadius , THUMB_RADIUS_DRAGGED ) ; radiusAnimator . setDuration ( 200 ) ; radiusAnimator . setInterpolator ( interpolator ) ; radiusAnimator . addUpdateListener ( animation -> { thumbRadius = ( float ) animation . getAnimatedValue ( ) ; postInvalidate ( ) ; } ) ; radiusAnimator . start ( ) ; ViewParent parent = getParent ( ) ; if ( parent != null ) parent . requestDisallowInterceptTouchEvent ( true ) ; if ( showLabel ) popup . show ( this ) ; } else if ( event . getAction ( ) == MotionEvent . ACTION_CANCEL || event . getAction ( ) == MotionEvent . ACTION_UP ) { if ( style == Style . Discrete ) { float val = ( float ) Math . floor ( ( value - min + step / 2 ) / step ) * step + min ; if ( valueAnimator != null ) valueAnimator . cancel ( ) ; valueAnimator = ValueAnimator . ofFloat ( value , val ) ; valueAnimator . setDuration ( 200 ) ; valueAnimator . setInterpolator ( interpolator ) ; valueAnimator . addUpdateListener ( animation -> { value = ( float ) animation . getAnimatedValue ( ) ; int thumbX = ( int ) ( ( value - min ) / ( max - min ) * ( getWidth ( ) - getPaddingLeft ( ) - getPaddingRight ( ) ) + getPaddingLeft ( ) ) ; int thumbY = getHeight ( ) / 2 ; int radius = rippleDrawable . getRadius ( ) ; rippleDrawable . setBounds ( thumbX - radius , thumbY - radius , thumbX + radius , thumbY + radius ) ; postInvalidate ( ) ; } ) ; valueAnimator . start ( ) ; } if ( radiusAnimator != null ) radiusAnimator . end ( ) ; radiusAnimator = ValueAnimator . ofFloat ( thumbRadius , THUMB_RADIUS ) ; radiusAnimator . setDuration ( 200 ) ; radiusAnimator . setInterpolator ( interpolator ) ; radiusAnimator . addUpdateListener ( animation -> { thumbRadius = ( float ) animation . getAnimatedValue ( ) ; postInvalidate ( ) ; } ) ; radiusAnimator . start ( ) ; ViewParent parent = getParent ( ) ; if ( parent != null ) parent . requestDisallowInterceptTouchEvent ( false ) ; if ( showLabel ) popup . dismiss ( ) ; } float v = ( event . getX ( ) - getPaddingLeft ( ) ) / ( getWidth ( ) - getPaddingLeft ( ) - getPaddingRight ( ) ) ; v = Math . max ( 0 , Math . min ( v , 1 ) ) ; float newValue = v * ( max - min ) + min ; int thumbX = ( int ) ( v * ( getWidth ( ) - getPaddingLeft ( ) - getPaddingRight ( ) ) + getPaddingLeft ( ) ) ; int thumbY = getHeight ( ) / 2 ; int radius = rippleDrawable . getRadius ( ) ; if ( showLabel ) { int [ ] location = new int [ 2 ] ; getLocationInWindow ( location ) ; popup . setText ( String . format ( labelFormat , newValue ) ) ; popup . update ( thumbX + location [ 0 ] - popup . getBubbleWidth ( ) / 2 , thumbY - radius + location [ 1 ] - popup . getHeight ( ) ) ; } if ( rippleDrawable != null ) { rippleDrawable . setHotspot ( event . getX ( ) , event . getY ( ) ) ; rippleDrawable . setBounds ( thumbX - radius , thumbY - radius , thumbX + radius , thumbY + radius ) ; } postInvalidate ( ) ; if ( newValue != value && onValueChangedListener != null ) { if ( style == Style . Discrete ) { int sv = stepValue ( newValue ) ; if ( stepValue ( value ) != sv ) onValueChangedListener . onValueChanged ( this , sv ) ; } else { onValueChangedListener . onValueChanged ( this , newValue ) ; } } value = newValue ; super . onTouchEvent ( event ) ; return true ;
public class Path { /** * Resolve original path if the path is a version history or launch path . * If the path does not point to any of these locations it is returned unchanged . * @ param path Path * @ param resourceResolver Resource resolver * @ return Path that is not a version history or launch path */ public static String getOriginalPath ( @ NotNull String path , @ NotNull ResourceResolver resourceResolver ) { } }
if ( StringUtils . isEmpty ( path ) ) { return null ; } Matcher versionHistoryMatcher = VERSION_HISTORY_PATTERN . matcher ( path ) ; if ( versionHistoryMatcher . matches ( ) ) { return "/content" + versionHistoryMatcher . group ( 1 ) ; } Matcher legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_PATTERN . matcher ( path ) ; if ( legacyVersionHistoryMatcher . matches ( ) ) { if ( isTenant ( resourceResolver ) ) { legacyVersionHistoryMatcher = LEGACY_VERSION_HISTORY_TENANT_PATTERN . matcher ( path ) ; } if ( legacyVersionHistoryMatcher . matches ( ) ) { return "/content" + legacyVersionHistoryMatcher . group ( 1 ) ; } } Matcher launchesMatcher = LAUNCHES_PATTERN . matcher ( path ) ; if ( launchesMatcher . matches ( ) ) { return launchesMatcher . group ( 1 ) ; } return path ;
public class CommsByteBuffer { /** * Puts a message into the byte buffer using the < code > encodeFast ( ) < / code > method of encoding * messages . This method takes account of any < i > capabilities < / i > negotiated at the point the * connection was established . * < p > This method is used for putting an entire message into the buffer . There are more efficient * ways of doing this to aid the Java memory manager that were introduced in FAP9 . These * methods should be used in favour of this one . @ see putDataSlice ( ) . * @ param message The message to encode . * @ param commsConnection The comms connection which is passed to MFP . * @ param conversation The conversation over which the encoded message data is to be transferred . * @ return Returns the message length . * @ exception MessageCopyFailedException * @ exception IncorrectMessageTypeException * @ exception MessageEncodeFailedException * @ exception UnsupportedEncodingException * @ exception SIConnectionDroppedException */ public synchronized int putMessage ( JsMessage message , CommsConnection commsConnection , Conversation conversation ) throws MessageCopyFailedException , IncorrectMessageTypeException , MessageEncodeFailedException , UnsupportedEncodingException , SIConnectionDroppedException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "putMessage" , new Object [ ] { message , commsConnection , conversation } ) ; int messageLength = putMessgeWithoutEncode ( encodeFast ( message , commsConnection , conversation ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "putMessage" , messageLength ) ; return messageLength ;
public class BytesMessageImpl { /** * / * ( non - Javadoc ) * @ see net . timewalker . ffmq4 . common . message . AbstractMessage # copy ( ) */ @ Override public AbstractMessage copy ( ) { } }
BytesMessageImpl clone = new BytesMessageImpl ( ) ; copyCommonFields ( clone ) ; tidyUp ( ) ; clone . body = this . body ; return clone ;
public class Scheduler { /** * Checks if the scheduler is initialized and started * @ return true if the scheduler is started , false otherwise * @ throws MangooSchedulerException if an error occurred accessing the scheduler */ public boolean isStarted ( ) throws MangooSchedulerException { } }
boolean started ; try { started = this . quartzScheduler != null && this . quartzScheduler . isStarted ( ) ; } catch ( SchedulerException e ) { throw new MangooSchedulerException ( e ) ; } return started ;
public class DeleteMethodHandler { /** * This method delete entity . * @ param entity is null always . If it is not null then returns BAD _ REQUEST status * @ return status of request * @ throws com . sdl . odata . api . processor . datasource . ODataDataSourceException in case of any error */ @ Override public ProcessorResult handleWrite ( Object entity ) throws ODataException { } }
if ( ODataUriUtil . isRefPathUri ( getoDataUri ( ) ) ) { return processLink ( ( ODataLink ) entity ) ; } else { if ( entity != null ) { throw new ODataBadRequestException ( "The body of a DELETE request must be empty." ) ; } return processEntity ( ) ; }
public class DatabaseUtils { /** * Partition by 1000 elements a list of input and execute a consumer on each part . * The goal is to prevent issue with ORACLE when there ' s more than 1000 elements in a ' in ( ' X ' , ' Y ' , . . . ) ' * and with MsSQL when there ' s more than 2000 parameters in a query * @ param inputs the whole list of elements to be partitioned * @ param consumer the mapper method to be executed , for example { @ code mapper ( dbSession ) : : selectByUuids } * @ param partitionSizeManipulations the function that computes the number of usages of a partition , for example * { @ code partitionSize - > partitionSize / 2 } when the partition of elements * in used twice in the SQL request . */ public static < INPUT extends Comparable < INPUT > > void executeLargeUpdates ( Collection < INPUT > inputs , Consumer < List < INPUT > > consumer , IntFunction < Integer > partitionSizeManipulations ) { } }
Iterable < List < INPUT > > partitions = toUniqueAndSortedPartitions ( inputs , partitionSizeManipulations ) ; for ( List < INPUT > partition : partitions ) { consumer . accept ( partition ) ; }
public class Path3f { /** * FIXME TO BE IMPLEMENTED IN POLYLINE */ public double length ( ) { } }
if ( this . isEmpty ( ) ) return 0 ; double length = 0 ; PathIterator3f pi = getPathIterator ( MathConstants . SPLINE_APPROXIMATION_RATIO ) ; AbstractPathElement3F pathElement = pi . next ( ) ; if ( pathElement . type != PathElementType . MOVE_TO ) { throw new IllegalArgumentException ( "missing initial moveto in path definition" ) ; } Path3f subPath ; double curx , cury , curz , movx , movy , movz , endx , endy , endz ; curx = movx = pathElement . getToX ( ) ; cury = movy = pathElement . getToY ( ) ; curz = movz = pathElement . getToZ ( ) ; while ( pi . hasNext ( ) ) { pathElement = pi . next ( ) ; switch ( pathElement . type ) { case MOVE_TO : movx = curx = pathElement . getToX ( ) ; movy = cury = pathElement . getToY ( ) ; movz = curz = pathElement . getToZ ( ) ; break ; case LINE_TO : endx = pathElement . getToX ( ) ; endy = pathElement . getToY ( ) ; endz = pathElement . getToZ ( ) ; length += FunctionalPoint3D . distancePointPoint ( curx , cury , curz , endx , endy , endz ) ; curx = endx ; cury = endy ; curz = endz ; break ; case QUAD_TO : endx = pathElement . getToX ( ) ; endy = pathElement . getToY ( ) ; endz = pathElement . getToZ ( ) ; subPath = new Path3f ( ) ; subPath . moveTo ( curx , cury , curz ) ; subPath . quadTo ( pathElement . getCtrlX1 ( ) , pathElement . getCtrlY1 ( ) , pathElement . getCtrlZ1 ( ) , endx , endy , endz ) ; length += subPath . length ( ) ; curx = endx ; cury = endy ; curz = endz ; break ; case CURVE_TO : endx = pathElement . getToX ( ) ; endy = pathElement . getToY ( ) ; endz = pathElement . getToZ ( ) ; subPath = new Path3f ( ) ; subPath . moveTo ( curx , cury , curz ) ; subPath . curveTo ( pathElement . getCtrlX1 ( ) , pathElement . getCtrlY1 ( ) , pathElement . getCtrlZ1 ( ) , pathElement . getCtrlX2 ( ) , pathElement . getCtrlY2 ( ) , pathElement . getCtrlZ2 ( ) , endx , endy , endz ) ; length += subPath . length ( ) ; curx = endx ; cury = endy ; curz = endz ; break ; case CLOSE : if ( curx != movx || cury != movy || curz != movz ) { length += FunctionalPoint3D . distancePointPoint ( curx , cury , curz , movx , movy , movz ) ; } curx = movx ; cury = movy ; cury = movz ; break ; default : } } return length ;
public class PentaTreeNode { /** * Clear the tree . * < p > Caution : this method also destroyes the * links between the child nodes inside the tree . * If you want to unlink the first - level * child node with * this node but leave the rest of the tree * unchanged , please call < code > setChildAt ( i , null ) < / code > . */ @ Override @ SuppressWarnings ( "checkstyle:magicnumber" ) public void clear ( ) { } }
if ( this . child1 != null ) { final N child = this . child1 ; setChildAt ( 0 , null ) ; child . clear ( ) ; } if ( this . child2 != null ) { final N child = this . child2 ; setChildAt ( 1 , null ) ; child . clear ( ) ; } if ( this . child3 != null ) { final N child = this . child3 ; setChildAt ( 2 , null ) ; child . clear ( ) ; } if ( this . child4 != null ) { final N child = this . child4 ; setChildAt ( 3 , null ) ; child . clear ( ) ; } if ( this . child5 != null ) { final N child = this . child5 ; setChildAt ( 4 , null ) ; child . clear ( ) ; } removeAllUserData ( ) ;
public class PerfCounterMap { /** * Tracks a generic call execution by reporting the execution duration . This method should be used for successful calls only . * @ param counter the name of the counter to update . * @ param executionDuration the duration of the execution call to track in this counter . * @ param success the flag indicating whether the execution call was successful . */ public void update ( String counter , long executionDuration , boolean success ) { } }
this . get ( counter ) . update ( executionDuration , success ) ;
public class PactDslRootValue { /** * Value that must match the given timestamp format * @ param format timestamp format */ public static PactDslRootValue timestamp ( String format ) { } }
PactDslRootValue value = new PactDslRootValue ( ) ; value . generators . addGenerator ( Category . BODY , "" , new DateTimeGenerator ( format ) ) ; FastDateFormat instance = FastDateFormat . getInstance ( format ) ; value . setValue ( instance . format ( new Date ( DATE_2000 ) ) ) ; value . setMatcher ( value . matchTimestamp ( format ) ) ; return value ;
public class cachepolicylabel_stats { /** * Use this API to fetch the statistics of all cachepolicylabel _ stats resources that are configured on netscaler . */ public static cachepolicylabel_stats [ ] get ( nitro_service service ) throws Exception { } }
cachepolicylabel_stats obj = new cachepolicylabel_stats ( ) ; cachepolicylabel_stats [ ] response = ( cachepolicylabel_stats [ ] ) obj . stat_resources ( service ) ; return response ;
public class CrdtValueDelegate { /** * Encodes the given value to a string for internal storage . * @ param value the value to encode * @ return the encoded value */ private String encode ( Object value ) { } }
return BaseEncoding . base16 ( ) . encode ( valueSerializer . encode ( value ) ) ;
public class CmsToolbarClipboardView { /** * Adds a modified entry . < p > * @ param entry the entry * @ param previousPath the previous path */ public void addModified ( CmsClientSitemapEntry entry , String previousPath ) { } }
removeDeleted ( entry . getId ( ) . toString ( ) ) ; removeModified ( entry . getId ( ) . toString ( ) ) ; getModified ( ) . insertItem ( createModifiedItem ( entry ) , 0 ) ; m_clipboardButton . enableClearModified ( true ) ;
public class WindowSpecificationImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . WINDOW_SPECIFICATION__FLAGS : return FLAGS_EDEFAULT == null ? flags != null : ! FLAGS_EDEFAULT . equals ( flags ) ; case AfplibPackage . WINDOW_SPECIFICATION__RES3 : return RES3_EDEFAULT == null ? res3 != null : ! RES3_EDEFAULT . equals ( res3 ) ; case AfplibPackage . WINDOW_SPECIFICATION__CFORMAT : return CFORMAT_EDEFAULT == null ? cformat != null : ! CFORMAT_EDEFAULT . equals ( cformat ) ; case AfplibPackage . WINDOW_SPECIFICATION__UBASE : return UBASE_EDEFAULT == null ? ubase != null : ! UBASE_EDEFAULT . equals ( ubase ) ; case AfplibPackage . WINDOW_SPECIFICATION__XRESOL : return XRESOL_EDEFAULT == null ? xresol != null : ! XRESOL_EDEFAULT . equals ( xresol ) ; case AfplibPackage . WINDOW_SPECIFICATION__YRESOL : return YRESOL_EDEFAULT == null ? yresol != null : ! YRESOL_EDEFAULT . equals ( yresol ) ; case AfplibPackage . WINDOW_SPECIFICATION__IMGXYRES : return IMGXYRES_EDEFAULT == null ? imgxyres != null : ! IMGXYRES_EDEFAULT . equals ( imgxyres ) ; case AfplibPackage . WINDOW_SPECIFICATION__XLWIND : return XLWIND_EDEFAULT == null ? xlwind != null : ! XLWIND_EDEFAULT . equals ( xlwind ) ; case AfplibPackage . WINDOW_SPECIFICATION__XRWIND : return XRWIND_EDEFAULT == null ? xrwind != null : ! XRWIND_EDEFAULT . equals ( xrwind ) ; case AfplibPackage . WINDOW_SPECIFICATION__YBWIND : return YBWIND_EDEFAULT == null ? ybwind != null : ! YBWIND_EDEFAULT . equals ( ybwind ) ; case AfplibPackage . WINDOW_SPECIFICATION__YTWIND : return YTWIND_EDEFAULT == null ? ytwind != null : ! YTWIND_EDEFAULT . equals ( ytwind ) ; } return super . eIsSet ( featureID ) ;
public class UriUtils { /** * Encodes the given URI host with the given encoding . * @ param host the host to be encoded * @ param encoding the character encoding to encode to * @ return the encoded host * @ throws UnsupportedEncodingException when the given encoding parameter is not supported */ public static String encodeHost ( String host , String encoding ) throws UnsupportedEncodingException { } }
return HierarchicalUriComponents . encodeUriComponent ( host , encoding , HierarchicalUriComponents . Type . HOST_IPV4 ) ;
public class Logging { /** * Log a message at the ' fine ' debugging level . * You should check isDebugging ( ) before building the message . * @ param message Informational log message . * @ param e Exception */ public void debug ( CharSequence message , Throwable e ) { } }
log ( Level . FINE , message , e ) ;
public class Utils { /** * The method copyFiles being defined */ public static void copyFiles ( File src , File dest ) throws IOException { } }
if ( src . isDirectory ( ) ) { dest . mkdirs ( ) ; String list [ ] = src . list ( ) ; for ( String fileName : list ) { String dest1 = dest . getPath ( ) + "/" + fileName ; String src1 = src . getPath ( ) + "/" + fileName ; // i . e : avoid . svn directory File src1_ = new File ( src1 ) ; File dest1_ = new File ( dest1 ) ; if ( ! src1_ . isHidden ( ) ) { copyFiles ( src1_ , dest1_ ) ; } } } else { FileInputStream fin = new FileInputStream ( src ) ; FileOutputStream fout = new FileOutputStream ( dest ) ; int c ; while ( ( c = fin . read ( ) ) >= 0 ) { fout . write ( c ) ; } fin . close ( ) ; fout . close ( ) ; }
public class AmazonEC2Client { /** * Associates a set of DHCP options ( that you ' ve previously created ) with the specified VPC , or associates no DHCP * options with the VPC . * After you associate the options with the VPC , any existing instances and all new instances that you launch in * that VPC use the options . You don ' t need to restart or relaunch the instances . They automatically pick up the * changes within a few hours , depending on how frequently the instance renews its DHCP lease . You can explicitly * renew the lease using the operating system on the instance . * For more information , see < a * href = " https : / / docs . aws . amazon . com / AmazonVPC / latest / UserGuide / VPC _ DHCP _ Options . html " > DHCP Options Sets < / a > in the * < i > Amazon Virtual Private Cloud User Guide < / i > . * @ param associateDhcpOptionsRequest * @ return Result of the AssociateDhcpOptions operation returned by the service . * @ sample AmazonEC2 . AssociateDhcpOptions * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / AssociateDhcpOptions " target = " _ top " > AWS API * Documentation < / a > */ @ Override public AssociateDhcpOptionsResult associateDhcpOptions ( AssociateDhcpOptionsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeAssociateDhcpOptions ( request ) ;
public class JAXBUtils { /** * Convert { @ link Date } to { @ link XMLGregorianCalendar } . * @ param date * XML entity */ public static XMLGregorianCalendar convertDateToXMLGregorianCalendar ( final Date date ) { } }
try { GregorianCalendar cal = new GregorianCalendar ( ) ; cal . setTime ( date ) ; XMLGregorianCalendar calXml = DatatypeFactory . newInstance ( ) . newXMLGregorianCalendar ( cal . get ( Calendar . YEAR ) , cal . get ( Calendar . MONTH ) + 1 , cal . get ( Calendar . DAY_OF_MONTH ) , cal . get ( Calendar . HOUR_OF_DAY ) , cal . get ( Calendar . MINUTE ) , cal . get ( Calendar . SECOND ) , cal . get ( Calendar . MILLISECOND ) , 0 ) ; return calXml ; } catch ( DatatypeConfigurationException e ) { throw new SwidException ( "Cannot convert date" , e ) ; }
public class DateTime { /** * Get this object as a DateTime , returning < code > this < / code > if possible . * @ param chronology chronology to apply , or ISOChronology if null * @ return a DateTime using the same millis */ public DateTime toDateTime ( Chronology chronology ) { } }
chronology = DateTimeUtils . getChronology ( chronology ) ; if ( getChronology ( ) == chronology ) { return this ; } return super . toDateTime ( chronology ) ;
public class Formula { /** * Generates a BDD from this formula with a given variable ordering . This is done by generating a new BDD factory , * generating the variable order for this formula , and building a new BDD . If more sophisticated operations should * be performed on the BDD or more than one formula should be constructed on the BDD , an own instance of * { @ link BDDFactory } should be created and used . * @ param variableOrdering the variable ordering * @ return the BDD for this formula with the given ordering */ public BDD bdd ( final VariableOrdering variableOrdering ) { } }
final int varNum = this . variables ( ) . size ( ) ; final BDDFactory factory = new BDDFactory ( varNum * 30 , varNum * 20 , this . factory ( ) ) ; if ( variableOrdering == null ) { factory . setNumberOfVars ( varNum ) ; } else { try { final VariableOrderingProvider provider = variableOrdering . provider ( ) . newInstance ( ) ; factory . setVariableOrder ( provider . getOrder ( this ) ) ; } catch ( final InstantiationException | IllegalAccessException e ) { throw new IllegalStateException ( "Could not generate the BDD variable ordering provider" , e ) ; } } return factory . build ( this ) ;
public class Settings { /** * Sets a property value only if the array value is not null and not empty . * @ param key the key for the property * @ param value the value for the property */ public void setArrayIfNotEmpty ( @ NotNull final String key , @ Nullable final List < String > value ) { } }
if ( null != value && ! value . isEmpty ( ) ) { setString ( key , new Gson ( ) . toJson ( value ) ) ; }
public class Graph { /** * Groups by vertex and computes a GroupReduce transformation over the edge values of each vertex . * The edgesFunction applied on the edges has access to both the id and the value * of the grouping vertex . * < p > For each vertex , the edgesFunction can iterate over all edges of this vertex * with the specified direction , and emit any number of output elements , including none . * @ param edgesFunction the group reduce function to apply to the neighboring edges of each vertex . * @ param direction the edge direction ( in - , out - , all - ) . * @ param < T > the output type * @ return a DataSet containing elements of type T * @ throws IllegalArgumentException */ public < T > DataSet < T > groupReduceOnEdges ( EdgesFunctionWithVertexValue < K , VV , EV , T > edgesFunction , EdgeDirection direction ) throws IllegalArgumentException { } }
switch ( direction ) { case IN : return vertices . coGroup ( edges ) . where ( 0 ) . equalTo ( 1 ) . with ( new ApplyCoGroupFunction < > ( edgesFunction ) ) . name ( "GroupReduce on in-edges" ) ; case OUT : return vertices . coGroup ( edges ) . where ( 0 ) . equalTo ( 0 ) . with ( new ApplyCoGroupFunction < > ( edgesFunction ) ) . name ( "GroupReduce on out-edges" ) ; case ALL : return vertices . coGroup ( edges . flatMap ( new EmitOneEdgePerNode < > ( ) ) . name ( "Emit edge" ) ) . where ( 0 ) . equalTo ( 0 ) . with ( new ApplyCoGroupFunctionOnAllEdges < > ( edgesFunction ) ) . name ( "GroupReduce on in- and out-edges" ) ; default : throw new IllegalArgumentException ( "Illegal edge direction" ) ; }
public class GetRouteResponseRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetRouteResponseRequest getRouteResponseRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getRouteResponseRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getRouteResponseRequest . getApiId ( ) , APIID_BINDING ) ; protocolMarshaller . marshall ( getRouteResponseRequest . getRouteId ( ) , ROUTEID_BINDING ) ; protocolMarshaller . marshall ( getRouteResponseRequest . getRouteResponseId ( ) , ROUTERESPONSEID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CmsDateRestrictionParser { /** * Parses a date . < p > * @ param dateLoc the location of the date * @ return the date , or null if it could not be parsed */ private Date parseDate ( CmsXmlContentValueLocation dateLoc ) { } }
if ( dateLoc == null ) { return null ; } String dateStr = dateLoc . getValue ( ) . getStringValue ( m_cms ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( dateStr ) ) { return null ; } try { return new Date ( Long . parseLong ( dateStr ) ) ; } catch ( Exception e ) { LOG . info ( e . getLocalizedMessage ( ) + " date = " + dateStr , e ) ; return null ; }
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link GridType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link GridType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "Grid" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "_ImplicitGeometry" ) public JAXBElement < GridType > createGrid ( GridType value ) { } }
return new JAXBElement < GridType > ( _Grid_QNAME , GridType . class , null , value ) ;
public class FairSchedulerServlet { /** * Print the filter information for pools and users * @ param out Where the output is dumped * @ param poolFilter Comma separated list of pools , null for none * @ param userSet Comma separated list of users , null for none * @ param showAllLink Link to show everything */ static void printFilterInfo ( PrintWriter out , String poolFilter , String userFilter , String showAllLink ) { } }
if ( userFilter != null || poolFilter != null ) { StringBuilder customizedInfo = new StringBuilder ( "Only showing " ) ; if ( poolFilter != null ) { customizedInfo . append ( "pool(s) " + poolFilter ) ; } if ( userFilter != null ) { if ( customizedInfo . length ( ) != 0 ) { customizedInfo . append ( " and " ) ; } customizedInfo . append ( "user(s) " + userFilter ) ; } out . printf ( "<h3>%s <a href=\"%s\">(show all pools and users)</a></h3>" , customizedInfo . toString ( ) , showAllLink ) ; }
public class HamtPMap { /** * Returns a new map with the given key - value pair added . If the value is already present , then * this same map will be returned . */ @ Override public HamtPMap < K , V > plus ( K key , V value ) { } }
return ! isEmpty ( ) ? plus ( key , hash ( key ) , checkNotNull ( value ) ) : new HamtPMap < > ( key , hash ( key ) , value , 0 , emptyChildren ( ) ) ;
public class DescribeSpotFleetInstancesResult { /** * The running instances . This list is refreshed periodically and might be out of date . * @ return The running instances . This list is refreshed periodically and might be out of date . */ public java . util . List < ActiveInstance > getActiveInstances ( ) { } }
if ( activeInstances == null ) { activeInstances = new com . amazonaws . internal . SdkInternalList < ActiveInstance > ( ) ; } return activeInstances ;
public class MockEc2Controller { /** * List mock ec2 instances in current aws - mock . * @ param instanceIDs * a filter of specified instance IDs for the target instance to describe * @ return a collection of { @ link AbstractMockEc2Instance } with specified instance IDs , or all of the mock ec2 * instances if no instance IDs as filtered */ public Collection < AbstractMockEc2Instance > describeInstances ( final Set < String > instanceIDs ) { } }
if ( null == instanceIDs || instanceIDs . size ( ) == 0 ) { return allMockEc2Instances . values ( ) ; } else { return getInstances ( instanceIDs ) ; }
public class A_CmsPatternPanelController { /** * Sets the interval . * @ param interval the interval to set . */ void setInterval ( String interval ) { } }
final int i = CmsSerialDateUtil . toIntWithDefault ( interval , - 1 ) ; if ( m_model . getInterval ( ) != i ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setInterval ( i ) ; onValueChange ( ) ; } } ) ; }
public class CommerceCountryPersistenceImpl { /** * Removes the commerce country with the primary key from the database . Also notifies the appropriate model listeners . * @ param primaryKey the primary key of the commerce country * @ return the commerce country that was removed * @ throws NoSuchCountryException if a commerce country with the primary key could not be found */ @ Override public CommerceCountry remove ( Serializable primaryKey ) throws NoSuchCountryException { } }
Session session = null ; try { session = openSession ( ) ; CommerceCountry commerceCountry = ( CommerceCountry ) session . get ( CommerceCountryImpl . class , primaryKey ) ; if ( commerceCountry == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchCountryException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return remove ( commerceCountry ) ; } catch ( NoSuchCountryException nsee ) { throw nsee ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; }
public class NetworkInterfacesInner { /** * Gets all route tables applied to a network interface . * @ param resourceGroupName The name of the resource group . * @ param networkInterfaceName The name of the network interface . * @ 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 EffectiveRouteListResultInner object if successful . */ public EffectiveRouteListResultInner beginGetEffectiveRouteTable ( String resourceGroupName , String networkInterfaceName ) { } }
return beginGetEffectiveRouteTableWithServiceResponseAsync ( resourceGroupName , networkInterfaceName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class LocalQPConsumerKey { /** * Make this key not ready */ public void markNotReady ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "markNotReady" ) ; ready = false ; if ( keyGroup != null ) keyGroup . markNotReady ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "markNotReady" ) ;
public class CmsShellCommands { /** * Sets a site parameter and writes back the updated system configuration . < p > * @ param siteRoot the root path used to identify the site * @ param key the parameter key * @ param value the parameter value */ public void setSiteParam ( String siteRoot , String key , String value ) { } }
CmsSite site = OpenCms . getSiteManager ( ) . getSiteForRootPath ( siteRoot ) ; if ( site == null ) { throw new IllegalArgumentException ( "No site found for path: " + siteRoot ) ; } else { site . getParameters ( ) . put ( key , value ) ; OpenCms . writeConfiguration ( CmsSitesConfiguration . class ) ; }
public class WebhookClient { /** * Sends the provided { @ code byte [ ] } data to this webhook . * < br > Use { @ link WebhookMessage # files ( String , Object , Object . . . ) } to send up to 10 files ! * @ param data * The file data to send * @ param fileName * The name that should be used for this file * @ throws java . lang . IllegalArgumentException * If the provided data is { @ code null } or exceeds the limit of 8MB * @ throws java . util . concurrent . RejectedExecutionException * If this client was closed * @ return { @ link net . dv8tion . jda . core . requests . RequestFuture RequestFuture } representing the execution task , * this will be completed once the message was sent . */ public RequestFuture < ? > send ( byte [ ] data , String fileName ) { } }
return send ( new WebhookMessageBuilder ( ) . addFile ( fileName , data ) . build ( ) ) ;
public class Table { /** * Appends a column range to the linked list of column ranges . * @ param colRange the range to append */ private void appendColumnRange ( ColumnRange colRange ) { } }
if ( last == null ) { first = colRange ; last = colRange ; } else { last . setNext ( colRange ) ; last = colRange ; }
public class HMac { /** * 生成摘要 * @ param data 数据bytes * @ return 摘要bytes */ public byte [ ] digest ( byte [ ] data ) { } }
byte [ ] result ; try { result = mac . doFinal ( data ) ; } finally { mac . reset ( ) ; } return result ;
public class PKITrustManagerFactory { /** * Initializes this factory with a source of certificate authorities and * related trust material . * @ param keyStore * The key store or null * @ throws KeyStoreException * if the initialization fails . */ @ Override protected void engineInit ( KeyStore keyStore ) throws KeyStoreException { } }
try { this . engineInit ( new CertPathTrustManagerParameters ( new X509ProxyCertPathParameters ( keyStore , null , null , false ) ) ) ; } catch ( InvalidAlgorithmParameterException e ) { throw new KeyStoreException ( e ) ; }
public class JournalSegment { /** * Starts checkpoint processing . A checkpoint start changes the epoch * ID for new journal entries , but does not yet close the previous epoch . * Journal entries written between checkpointStart ( ) and checkpointEnd ( ) * belong to the successor epoch . */ public void checkpointStart ( ) { } }
if ( _isWhileCheckpoint ) { throw new IllegalStateException ( ) ; } _isWhileCheckpoint = true ; long sequence = ++ _sequence ; setSequence ( sequence ) ; byte [ ] headerBuffer = _headerBuffer ; BitsUtil . writeInt16 ( headerBuffer , 0 , CHECKPOINT_START ) ; writeImpl ( headerBuffer , 0 , 2 ) ; _lastCheckpointStart = _index - _startAddress ;
public class ResolvedTargetsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ResolvedTargets resolvedTargets , ProtocolMarshaller protocolMarshaller ) { } }
if ( resolvedTargets == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resolvedTargets . getParameterValues ( ) , PARAMETERVALUES_BINDING ) ; protocolMarshaller . marshall ( resolvedTargets . getTruncated ( ) , TRUNCATED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CommerceOrderNoteUtil { /** * Removes the commerce order note with the primary key from the database . Also notifies the appropriate model listeners . * @ param commerceOrderNoteId the primary key of the commerce order note * @ return the commerce order note that was removed * @ throws NoSuchOrderNoteException if a commerce order note with the primary key could not be found */ public static CommerceOrderNote remove ( long commerceOrderNoteId ) throws com . liferay . commerce . exception . NoSuchOrderNoteException { } }
return getPersistence ( ) . remove ( commerceOrderNoteId ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EEnum getIfcActuatorTypeEnum ( ) { } }
if ( ifcActuatorTypeEnumEEnum == null ) { ifcActuatorTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 907 ) ; } return ifcActuatorTypeEnumEEnum ;
public class LoggingService { /** * - - - - - Service methods */ @ Override protected void initService ( ) { } }
RESTService . instance ( ) . registerCommands ( Arrays . asList ( LogServiceAppCmd . class ) ) ; RESTService . instance ( ) . registerCommands ( cmdClasses , this ) ;
public class JmesPathEvaluationVisitor { /** * Evaluates a subexpression by evaluating the expression on * the left with the original JSON document and then evaluating * the expression on the right with the result of the left * expression evaluation . * @ param subExpression JmesPath subexpression type * @ param input Input json node against which evaluation is done * @ return Result of the subexpression evaluation * @ throws InvalidTypeException */ @ Override public JsonNode visit ( JmesPathSubExpression subExpression , JsonNode input ) throws InvalidTypeException { } }
JsonNode prelimnaryResult = subExpression . getExpressions ( ) . get ( 0 ) . accept ( this , input ) ; for ( int i = 1 ; i < subExpression . getExpressions ( ) . size ( ) ; i ++ ) { prelimnaryResult = subExpression . getExpressions ( ) . get ( i ) . accept ( this , prelimnaryResult ) ; } return prelimnaryResult ;
public class RxPresenter { /** * Starts the given restartable . * @ param restartableId id of the restartable */ public void start ( int restartableId ) { } }
stop ( restartableId ) ; requested . add ( restartableId ) ; restartableSubscriptions . put ( restartableId , restartables . get ( restartableId ) . call ( ) ) ;
public class AbstractPropertyEditor { /** * Given the name of a property ' s name as indicated in the OWL file , this method converts the name * to a Java compatible name . * @ param owlName the property name as a string * @ return the Java compatible name of the property */ private static String getJavaName ( String owlName ) { } }
// Since java does not allow ' - ' replace them all with ' _ ' String s = owlName . replaceAll ( "-" , "_" ) ; s = s . substring ( 0 , 1 ) . toUpperCase ( ) + s . substring ( 1 ) ; return s ;
public class MethodSimulator { /** * Simulates the size change instruction . * @ param instruction The instruction to simulate */ private void simulateSizeChange ( final SizeChangingInstruction instruction ) { } }
IntStream . range ( 0 , instruction . getNumberOfPops ( ) ) . forEach ( i -> runtimeStack . pop ( ) ) ; IntStream . range ( 0 , instruction . getNumberOfPushes ( ) ) . forEach ( i -> runtimeStack . push ( new Element ( ) ) ) ;
public class Syncer { /** * Gets the indexes of the sync fields into a single integer . * @ param handler the handler * @ param syncNames the sync names * @ return the field indexes */ private int getFieldIndexes ( ISyncHandler < ? , ? extends ISyncableData > handler , String ... syncNames ) { } }
int indexes = 0 ; for ( String str : syncNames ) { ObjectData od = handler . getObjectData ( str ) ; if ( od != null ) indexes |= 1 << od . getIndex ( ) ; } return indexes ;
public class TimeParametersImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case BpsimPackage . TIME_PARAMETERS__TRANSFER_TIME : setTransferTime ( ( Parameter ) null ) ; return ; case BpsimPackage . TIME_PARAMETERS__QUEUE_TIME : setQueueTime ( ( Parameter ) null ) ; return ; case BpsimPackage . TIME_PARAMETERS__WAIT_TIME : setWaitTime ( ( Parameter ) null ) ; return ; case BpsimPackage . TIME_PARAMETERS__SET_UP_TIME : setSetUpTime ( ( Parameter ) null ) ; return ; case BpsimPackage . TIME_PARAMETERS__PROCESSING_TIME : setProcessingTime ( ( Parameter ) null ) ; return ; case BpsimPackage . TIME_PARAMETERS__VALIDATION_TIME : setValidationTime ( ( Parameter ) null ) ; return ; case BpsimPackage . TIME_PARAMETERS__REWORK_TIME : setReworkTime ( ( Parameter ) null ) ; return ; } super . eUnset ( featureID ) ;
public class StackUtilities { /** * Returns the { @ link StackTraceElement } of the caller . * You should consider use of this method carefully . Unwinding the stack * should be considered an expensive operation . * @ return StackTraceElement of the caller * @ see StackTraceElement */ public static StackTraceElement callerFrame ( ) { } }
final Thread me = currentThread ( ) ; StackTraceElement [ ] se = me . getStackTrace ( ) ; for ( int i = 0 ; i < se . length ; i ++ ) { String sClass = se [ i ] . getClassName ( ) ; if ( ! sClass . equals ( CLASS ) ) continue ; String method = se [ i ] . getMethodName ( ) ; if ( ! "callerFrame" . equals ( method ) ) continue ; if ( i + 2 < se . length ) return se [ i + 2 ] ; } throw new IllegalStateException ( "bad stack" ) ;
public class ThreadUtils { /** * Just suspend the current thread for defined interval in milliseconds . * @ param milliseconds milliseconds to sleep * @ return false if the sleep has been interrupted by InterruptedException , true otherwise . * @ see Thread # sleep ( long ) * @ since 1.0 */ @ Weight ( Weight . Unit . VARIABLE ) public static boolean silentSleep ( final long milliseconds ) { } }
boolean result = true ; try { Thread . sleep ( milliseconds ) ; } catch ( InterruptedException ex ) { result = false ; Thread . currentThread ( ) . interrupt ( ) ; } return result ;
public class WDDXConverter { /** * serialize a Object to his xml Format represenation * @ param object Object to serialize * @ param done * @ return serialized Object * @ throws ConverterException */ private String _serialize ( Object object , Set < Object > done ) throws ConverterException { } }
String rtn ; deep ++ ; // NULL if ( object == null ) { rtn = goIn ( ) + "<null/>" ; deep -- ; return rtn ; } // String if ( object instanceof String ) { rtn = goIn ( ) + "<string>" + XMLUtil . escapeXMLString ( object . toString ( ) ) + "</string>" ; deep -- ; return rtn ; } // Number if ( object instanceof Number ) { rtn = goIn ( ) + "<number>" + ( ( Number ) object ) . doubleValue ( ) + "</number>" ; deep -- ; return rtn ; } // Boolean if ( object instanceof Boolean ) { rtn = goIn ( ) + "<boolean value=" + del + ( ( Boolean ) object ) . booleanValue ( ) + del + "/>" ; deep -- ; return rtn ; } // DateTime if ( object instanceof DateTime ) { rtn = _serializeDateTime ( ( DateTime ) object ) ; deep -- ; return rtn ; } // Date if ( object instanceof Date ) { rtn = _serializeDate ( ( Date ) object ) ; deep -- ; return rtn ; } // Date if ( Decision . isCastableToBinary ( object , false ) ) { rtn = _serializeBinary ( Caster . toBinary ( object , null ) ) ; deep -- ; return rtn ; } Object raw = LazyConverter . toRaw ( object ) ; if ( done . contains ( raw ) ) { rtn = goIn ( ) + "<null/>" ; deep -- ; return rtn ; } done . add ( raw ) ; try { // Component if ( object instanceof Component ) { rtn = _serializeComponent ( ( Component ) object , done ) ; deep -- ; return rtn ; } // Struct if ( object instanceof Struct ) { rtn = _serializeStruct ( ( Struct ) object , done ) ; deep -- ; return rtn ; } // Map if ( object instanceof Map ) { rtn = _serializeMap ( ( Map ) object , done ) ; deep -- ; return rtn ; } // Array if ( object instanceof Array ) { rtn = _serializeArray ( ( Array ) object , done ) ; deep -- ; return rtn ; } // List if ( object instanceof List ) { rtn = _serializeList ( ( List ) object , done ) ; deep -- ; return rtn ; } // Query if ( object instanceof Query ) { rtn = _serializeQuery ( ( Query ) object , done ) ; deep -- ; return rtn ; } } finally { done . remove ( raw ) ; } // Others rtn = "<struct type=" + del + "L" + object . getClass ( ) . getName ( ) + ";" + del + "></struct>" ; deep -- ; return rtn ;
public class SparseMatrix { /** * Remove item in row , column position int the matrix * @ param row item row position * @ param column item column position */ void remove ( int row , int column ) { } }
SparseArrayCompat < TObj > array = mData . get ( row ) ; if ( array != null ) { array . remove ( column ) ; }
public class DefaultHandlerExceptionManager { /** * { @ inheritDoc } */ @ Override public void handle ( Throwable throwable , Map < String , Object > parameters ) { } }
if ( handlers . size ( ) == 0 ) { register ( Exception . class , new HandlerException ( ) { @ Override public void handle ( Throwable throwable , Map < String , Object > parameters ) { throwable . printStackTrace ( ) ; } } ) ; } if ( throwable != null ) { Class < ? > throwableClass = throwable . getClass ( ) ; while ( throwableClass != null ) { if ( handlers . containsKey ( throwableClass . getName ( ) ) ) { HandlerException handler = handlers . get ( throwableClass . getName ( ) ) ; if ( parameters == null ) { parameters = new HashMap < String , Object > ( ) ; } handler . handle ( throwable , parameters ) ; return ; } else { throwableClass = throwableClass . getSuperclass ( ) ; } } }
public class SystemProperties { /** * Gets a system property boolean , or a replacement value if the property is * null or blank or not parseable as a boolean . * @ param key * @ param valueIfNull * @ return */ public static boolean getBoolean ( String key , boolean valueIfNull ) { } }
String value = System . getProperty ( key ) ; if ( Strings . isNullOrEmpty ( value ) ) { return valueIfNull ; } value = value . trim ( ) . toLowerCase ( ) ; if ( "true" . equals ( value ) ) { return true ; } else if ( "false" . equals ( value ) ) { return false ; } return valueIfNull ;
public class HuffmanTable { /** * build up HuffTab [ t ] [ c ] using L and V . */ private void buildHuffTable ( final int tab [ ] , final int L [ ] , final int V [ ] [ ] ) throws IOException { } }
int temp = 256 ; int k = 0 ; for ( int i = 0 ; i < 8 ; i ++ ) { // i + 1 is Code length for ( int j = 0 ; j < L [ i ] ; j ++ ) { for ( int n = 0 ; n < ( temp >> ( i + 1 ) ) ; n ++ ) { tab [ k ] = V [ i ] [ j ] | ( ( i + 1 ) << 8 ) ; k ++ ; } } } for ( int i = 1 ; k < 256 ; i ++ , k ++ ) { tab [ k ] = i | MSB ; } int currentTable = 1 ; k = 0 ; for ( int i = 8 ; i < 16 ; i ++ ) { // i + 1 is Code length for ( int j = 0 ; j < L [ i ] ; j ++ ) { for ( int n = 0 ; n < ( temp >> ( i - 7 ) ) ; n ++ ) { tab [ ( currentTable * 256 ) + k ] = V [ i ] [ j ] | ( ( i + 1 ) << 8 ) ; k ++ ; } if ( k >= 256 ) { if ( k > 256 ) { throw new IIOException ( "JPEG Huffman Table error" ) ; } k = 0 ; currentTable ++ ; } } }
public class CmsElementView { /** * Returns the element view title . < p > * @ param cms the cms context * @ param locale the locale * @ return the title */ public String getTitle ( CmsObject cms , Locale locale ) { } }
if ( m_titleKey == null ) { return m_title ; } else { return OpenCms . getWorkplaceManager ( ) . getMessages ( locale ) . key ( m_titleKey ) ; }
public class CharOperation { /** * Answers a new array which is a copy of the given array starting at the given start and ending at the given end . * The given start is inclusive and the given end is exclusive . Answers null if start is greater than end , if start * is lower than 0 or if end is greater than the length of the given array . If end equals - 1 , it is converted to the * array length . < br > * < br > * For example : * < ol > * < li > * < pre > * array = { { ' a ' } , { ' b ' } } * start = 0 * end = 1 * result = & gt ; { { ' a ' } } * < / pre > * < / li > * < li > * < pre > * array = { { ' a ' } , { ' b ' } } * start = 0 * end = - 1 * result = & gt ; { { ' a ' } , { ' b ' } } * < / pre > * < / li > * < / ol > * @ param array * the given array * @ param start * the given starting index * @ param end * the given ending index * @ return a new array which is a copy of the given array starting at the given start and ending at the given end * @ throws NullPointerException * if the given array is null */ public static final char [ ] [ ] subarray ( char [ ] [ ] array , int start , int end ) { } }
if ( end == - 1 ) { end = array . length ; } if ( start > end ) { return null ; } if ( start < 0 ) { return null ; } if ( end > array . length ) { return null ; } char [ ] [ ] result = new char [ end - start ] [ ] ; System . arraycopy ( array , start , result , 0 , end - start ) ; return result ;
public class EncodingResult { /** * Adds a clause to the result * @ param literals the literals of the clause */ public void addClause ( final Literal ... literals ) { } }
if ( this . miniSat == null && this . cleaneLing == null ) this . result . add ( this . f . clause ( literals ) ) ; else if ( this . miniSat != null ) { final LNGIntVector clauseVec = new LNGIntVector ( literals . length ) ; for ( final Literal lit : literals ) { int index = this . miniSat . underlyingSolver ( ) . idxForName ( lit . name ( ) ) ; if ( index == - 1 ) { index = this . miniSat . underlyingSolver ( ) . newVar ( ! this . miniSat . initialPhase ( ) , true ) ; this . miniSat . underlyingSolver ( ) . addName ( lit . name ( ) , index ) ; } final int litNum ; if ( lit instanceof EncodingAuxiliaryVariable ) litNum = ! ( ( EncodingAuxiliaryVariable ) lit ) . negated ? index * 2 : ( index * 2 ) ^ 1 ; else litNum = lit . phase ( ) ? index * 2 : ( index * 2 ) ^ 1 ; clauseVec . push ( litNum ) ; } this . miniSat . underlyingSolver ( ) . addClause ( clauseVec , null ) ; this . miniSat . setSolverToUndef ( ) ; } else { for ( final Literal lit : literals ) { final int index = this . cleaneLing . getOrCreateVarIndex ( lit . variable ( ) ) ; if ( lit instanceof EncodingAuxiliaryVariable ) this . cleaneLing . underlyingSolver ( ) . addlit ( ! ( ( EncodingAuxiliaryVariable ) lit ) . negated ? index : - index ) ; else this . cleaneLing . underlyingSolver ( ) . addlit ( lit . phase ( ) ? index : - index ) ; } this . cleaneLing . underlyingSolver ( ) . addlit ( CleaneLing . CLAUSE_TERMINATOR ) ; this . cleaneLing . setSolverToUndef ( ) ; }
public class TransferManager { /** * Resumes an upload operation . This upload operation uses the same * configuration { @ link TransferManagerConfiguration } as the original * upload . Any data already uploaded will be skipped , and only the remaining * will be uploaded to Amazon S3. * @ param persistableUpload * the upload to resume . * @ return A new < code > Upload < / code > object to use to check the state of the * upload , listen for progress notifications , and otherwise manage * the upload . * @ throws AmazonClientException * If any errors are encountered in the client while making the * request or handling the response . * @ throws AmazonServiceException * If any errors occurred in Amazon S3 while processing the * request . */ public Upload resumeUpload ( PersistableUpload persistableUpload ) { } }
assertParameterNotNull ( persistableUpload , "PauseUpload is mandatory to resume a upload." ) ; configuration . setMinimumUploadPartSize ( persistableUpload . getPartSize ( ) ) ; configuration . setMultipartUploadThreshold ( persistableUpload . getMutlipartUploadThreshold ( ) ) ; return doUpload ( new PutObjectRequest ( persistableUpload . getBucketName ( ) , persistableUpload . getKey ( ) , new File ( persistableUpload . getFile ( ) ) ) , null , null , persistableUpload ) ;
public class OrCriterion { @ Override public List < Criterion > getCriteria ( ) { } }
if ( criteria == null ) { criteria = new ArrayList < Criterion > ( ) ; } return criteria ;
public class Toothpick { /** * Detach a scope from its parent , this will trigger the garbage collection of this scope and it ' s * sub - scopes * if they are not referenced outside of Toothpick . * @ param name the name of the scope to close . */ public static void closeScope ( Object name ) { } }
// we remove the scope first , so that other threads don ' t see it , and see the next snapshot of the tree ScopeNode scope = ( ScopeNode ) MAP_KEY_TO_SCOPE . remove ( name ) ; if ( scope != null ) { ScopeNode parentScope = scope . getParentScope ( ) ; if ( parentScope != null ) { parentScope . removeChild ( scope ) ; } else { ConfigurationHolder . configuration . onScopeForestReset ( ) ; } removeScopeAndChildrenFromMap ( scope ) ; }
public class XmlFieldExtractor { /** * Runs a wildcard xpath ( i . e . " / / field " ) to locate the provided field in the * document and returns the text content of the first matching node . * @ param doc Document to process . * @ param field Field to look for . * @ return Text content of first matching node or null for no match . * @ throws XPathExpressionException If expression is invalid . */ @ Nullable private String extract ( Document doc , String field ) throws XPathExpressionException { } }
XPathExpression expr = xpathSupplier . get ( ) . compile ( "//" + field ) ; NodeList nl = ( NodeList ) expr . evaluate ( doc , XPathConstants . NODESET ) ; if ( nl . getLength ( ) > 0 ) { return nl . item ( 0 ) . getTextContent ( ) ; } return null ;
public class Bzip2BlockDecompressor { /** * Reads the Huffman encoded data from the input stream , performs Run - Length Decoding and * applies the Move To Front transform to reconstruct the Burrows - Wheeler Transform array . */ boolean decodeHuffmanData ( final Bzip2HuffmanStageDecoder huffmanDecoder ) { } }
final Bzip2BitReader reader = this . reader ; final byte [ ] bwtBlock = this . bwtBlock ; final byte [ ] huffmanSymbolMap = this . huffmanSymbolMap ; final int streamBlockSize = this . bwtBlock . length ; final int huffmanEndOfBlockSymbol = this . huffmanEndOfBlockSymbol ; final int [ ] bwtByteCounts = this . bwtByteCounts ; final Bzip2MoveToFrontTable symbolMTF = this . symbolMTF ; int bwtBlockLength = this . bwtBlockLength ; int repeatCount = this . repeatCount ; int repeatIncrement = this . repeatIncrement ; int mtfValue = this . mtfValue ; for ( ; ; ) { if ( ! reader . hasReadableBits ( HUFFMAN_DECODE_MAX_CODE_LENGTH ) ) { this . bwtBlockLength = bwtBlockLength ; this . repeatCount = repeatCount ; this . repeatIncrement = repeatIncrement ; this . mtfValue = mtfValue ; return false ; } final int nextSymbol = huffmanDecoder . nextSymbol ( ) ; if ( nextSymbol == HUFFMAN_SYMBOL_RUNA ) { repeatCount += repeatIncrement ; repeatIncrement <<= 1 ; } else if ( nextSymbol == HUFFMAN_SYMBOL_RUNB ) { repeatCount += repeatIncrement << 1 ; repeatIncrement <<= 1 ; } else { if ( repeatCount > 0 ) { if ( bwtBlockLength + repeatCount > streamBlockSize ) { throw new DecompressionException ( "block exceeds declared block size" ) ; } final byte nextByte = huffmanSymbolMap [ mtfValue ] ; bwtByteCounts [ nextByte & 0xff ] += repeatCount ; while ( -- repeatCount >= 0 ) { bwtBlock [ bwtBlockLength ++ ] = nextByte ; } repeatCount = 0 ; repeatIncrement = 1 ; } if ( nextSymbol == huffmanEndOfBlockSymbol ) { break ; } if ( bwtBlockLength >= streamBlockSize ) { throw new DecompressionException ( "block exceeds declared block size" ) ; } mtfValue = symbolMTF . indexToFront ( nextSymbol - 1 ) & 0xff ; final byte nextByte = huffmanSymbolMap [ mtfValue ] ; bwtByteCounts [ nextByte & 0xff ] ++ ; bwtBlock [ bwtBlockLength ++ ] = nextByte ; } } this . bwtBlockLength = bwtBlockLength ; initialiseInverseBWT ( ) ; return true ;
public class BitsStreamGenerator { /** * Returns a pseudorandom , uniformly distributed < tt > long < / tt > value * between 0 ( inclusive ) and the specified value ( exclusive ) , drawn from * this random number generator ' s sequence . * @ param n the bound on the random number to be returned . Must be * positive . * @ return a pseudorandom , uniformly distributed < tt > long < / tt > * value between 0 ( inclusive ) and n ( exclusive ) . * @ throws IllegalArgumentException if n is not positive . */ public long nextLong ( long n ) throws IllegalArgumentException { } }
if ( n > 0 ) { long bits ; long val ; do { bits = ( ( long ) next ( 31 ) ) << 32 ; bits = bits | ( ( ( long ) next ( 32 ) ) & 0xffffffffL ) ; val = bits % n ; } while ( bits - val + ( n - 1 ) < 0 ) ; return val ; } throw new RuntimeException ( "Not strictly positive: " + n ) ;
public class ListIPSetsResult { /** * An array of < a > IPSetSummary < / a > objects . * @ param iPSets * An array of < a > IPSetSummary < / a > objects . */ public void setIPSets ( java . util . Collection < IPSetSummary > iPSets ) { } }
if ( iPSets == null ) { this . iPSets = null ; return ; } this . iPSets = new java . util . ArrayList < IPSetSummary > ( iPSets ) ;
public class HiveMetaStoreBridge { /** * Create a new table instance in Atlas * @ param dbReference reference to a created Hive database { @ link Referenceable } to which this table belongs * @ param hiveTable reference to the Hive { @ link Table } from which to map properties * @ return Newly created Hive reference * @ throws Exception */ public Referenceable createTableInstance ( Referenceable dbReference , Table hiveTable ) throws AtlasHookException { } }
return createOrUpdateTableInstance ( dbReference , null , hiveTable ) ;
public class AbstractTemporalCellConverterFactory { /** * アノテーションを元にフォーマッタを作成する 。 * @ param converterAnno 変換用のアノテーション 。 * @ return フォーマッタ */ protected DateTimeFormatter createFormatter ( final Optional < XlsDateTimeConverter > converterAnno ) { } }
final boolean lenient = converterAnno . map ( a -> a . lenient ( ) ) . orElse ( false ) ; final ResolverStyle style = lenient ? ResolverStyle . LENIENT : ResolverStyle . STRICT ; if ( ! converterAnno . isPresent ( ) ) { return DateTimeFormatter . ofPattern ( getDefaultJavaPattern ( ) ) . withResolverStyle ( style ) ; } String pattern = converterAnno . get ( ) . javaPattern ( ) ; if ( pattern . isEmpty ( ) ) { pattern = getDefaultJavaPattern ( ) ; } final Locale locale = Utils . getLocale ( converterAnno . get ( ) . locale ( ) ) ; final ZoneId zone = converterAnno . get ( ) . timezone ( ) . isEmpty ( ) ? ZoneId . systemDefault ( ) : TimeZone . getTimeZone ( converterAnno . get ( ) . timezone ( ) ) . toZoneId ( ) ; return DateTimeFormatter . ofPattern ( pattern , locale ) . withResolverStyle ( style ) . withZone ( zone ) ;
public class SarlSkillBuilderImpl { /** * Create a SarlConstructor . * @ return the builder . */ public ISarlConstructorBuilder addSarlConstructor ( ) { } }
ISarlConstructorBuilder builder = this . iSarlConstructorBuilderProvider . get ( ) ; builder . eInit ( getSarlSkill ( ) , getTypeResolutionContext ( ) ) ; return builder ;
public class JarURLConnectionImpl { /** * Returns the content length of the resource . Test cases reveal that if the URL is referring to * a Jar file , this method answers a content - length returned by URLConnection . For a jar entry * it returns the entry ' s size if it can be represented as an { @ code int } . Otherwise , it will * return - 1. */ @ Override public int getContentLength ( ) { } }
try { connect ( ) ; if ( jarEntry == null ) { return jarFileURLConnection . getContentLength ( ) ; } return ( int ) getJarEntry ( ) . getSize ( ) ; } catch ( IOException e ) { // Ignored } return - 1 ;
public class Application { /** * < p > readModeConfig . < / p > * @ param properties a { @ link java . util . Properties } object . * @ param mode a { @ link ameba . core . Application . Mode } object . */ @ SuppressWarnings ( "unchecked" ) public static void readModeConfig ( Properties properties , Mode mode ) { } }
// 读取相应模式的配置文件 Enumeration < java . net . URL > confs = IOUtils . getResources ( "conf/" + mode . name ( ) . toLowerCase ( ) + ".conf" ) ; while ( confs . hasMoreElements ( ) ) { InputStream in = null ; try { URLConnection connection = confs . nextElement ( ) . openConnection ( ) ; if ( mode . isDev ( ) ) { connection . setUseCaches ( false ) ; } in = connection . getInputStream ( ) ; properties . load ( in ) ; } catch ( IOException e ) { logger . warn ( Messages . get ( "info.module.conf.error" , "conf/" + mode . name ( ) . toLowerCase ( ) + ".conf" ) , e ) ; } finally { closeQuietly ( in ) ; } }
public class AbstractAttributeDefinitionBuilder { /** * Adds { @ link AttributeDefinition # getArbitraryDescriptors ( ) arbitrary descriptor } . * @ param arbitraryDescriptor the arbitrary descriptor name . * @ param value the value of the arbitrary descriptor . * @ return a builder that can be used to continue building the attribute definition */ @ SuppressWarnings ( "deprecation" ) public BUILDER addArbitraryDescriptor ( String arbitraryDescriptor , ModelNode value ) { } }
if ( this . arbitraryDescriptors == null ) { this . arbitraryDescriptors = Collections . singletonMap ( arbitraryDescriptor , value ) ; } else { if ( this . arbitraryDescriptors . size ( ) == 1 ) { this . arbitraryDescriptors = new HashMap < > ( this . arbitraryDescriptors ) ; } arbitraryDescriptors . put ( arbitraryDescriptor , value ) ; } return ( BUILDER ) this ;
public class StorageType { /** * List of limits that are applicable for given storage type . * @ param storageTypeLimits * List of limits that are applicable for given storage type . */ public void setStorageTypeLimits ( java . util . Collection < StorageTypeLimit > storageTypeLimits ) { } }
if ( storageTypeLimits == null ) { this . storageTypeLimits = null ; return ; } this . storageTypeLimits = new java . util . ArrayList < StorageTypeLimit > ( storageTypeLimits ) ;
public class SecretShare { /** * NOTE : you should prefer createAppropriateModulusForSecret ( ) over this method . * @ param secret as biginteger * @ return prime modulus big enough for secret */ public static BigInteger createRandomModulusForSecret ( BigInteger secret ) { } }
Random random = new SecureRandom ( ) ; return createRandomModulusForSecret ( secret , random ) ;
public class Node { /** * Provides lookup of elements by non - namespaced name * @ param key the name ( or shortcut key ) of the node ( s ) of interest * @ return the nodes which match key */ public Object get ( String key ) { } }
if ( key != null && key . charAt ( 0 ) == '@' ) { String attributeName = key . substring ( 1 ) ; return attributes ( ) . get ( attributeName ) ; } if ( ".." . equals ( key ) ) { return parent ( ) ; } if ( "*" . equals ( key ) ) { return children ( ) ; } if ( "**" . equals ( key ) ) { return depthFirst ( ) ; } return getByName ( key ) ;
public class TemplateNode { /** * Construct a StackTraceElement that will point to the given source location of the current * template . */ public StackTraceElement createStackTraceElement ( SourceLocation srcLocation ) { } }
return new StackTraceElement ( /* declaringClass = */ soyFileHeaderInfo . namespace , // The partial template name begins with a ' . ' that causes the stack trace element to // print " namespace . . templateName " otherwise . /* methodName = */ partialTemplateName . substring ( 1 ) , srcLocation . getFileName ( ) , srcLocation . getBeginLine ( ) ) ;
public class Properties { /** * Calculates value of the property corresponding to cmis domain . * @ param pdef property definition as declared in cmis repository . * @ param jcrName the name of the property in jcr domain * @ param document connectors ' s view of properties in jcr domain . * @ return value as declared by property definition . */ public Object cmisValue ( PropertyDefinition < ? > pdef , String jcrName , Document document ) { } }
switch ( pdef . getPropertyType ( ) ) { case STRING : return document . getString ( jcrName ) ; case BOOLEAN : return document . getBoolean ( jcrName ) ; case DECIMAL : return BigDecimal . valueOf ( document . getLong ( jcrName ) ) ; case INTEGER : return document . getInteger ( jcrName ) ; case DATETIME : // FIXME return new GregorianCalendar ( ) ; case URI : try { return new URI ( document . getString ( jcrName ) ) ; } catch ( Exception e ) { } break ; case ID : return document . getString ( jcrName ) ; case HTML : return document . getString ( jcrName ) ; } return null ;
public class TeamDataClient { /** * Removes scope - owners ( teams ) from the collection which have went to an * non - active state * @ param teamId * A given Team ID that went inactive and should be removed from * the data collection */ private void removeInactiveScopeOwnerByTeamId ( String teamId ) { } }
if ( ! StringUtils . isEmpty ( teamId ) && teamRepo . findByTeamId ( teamId ) != null ) { ObjectId inactiveTeamId = teamRepo . findByTeamId ( teamId ) . getId ( ) ; if ( inactiveTeamId != null ) { teamRepo . delete ( inactiveTeamId ) ; } }
public class AggregatorExtension { /** * / * ( non - Javadoc ) * @ see com . ibm . jaggr . service . IAggregator . ILoadedExtension # getAttribute ( java . lang . String ) */ @ Override public String getAttribute ( String name ) { } }
final String sourceMethod = "getAttribute" ; // $ NON - NLS - 1 $ boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( AggregatorExtension . class . getName ( ) , sourceMethod , new Object [ ] { name } ) ; } String result = attributes . getProperty ( name ) ; if ( result != null && aggregator != null ) { result = aggregator . substituteProps ( result ) ; } if ( isTraceLogging ) { log . exiting ( AggregatorExtension . class . getName ( ) , sourceMethod , result ) ; } return result ;
public class HistoryStore { /** * Return a fresh map */ private JSONObject addAttributeFromSingleValue ( HistoryKey pKey , String pAttrName , Object pValue , long pTimestamp ) { } }
HistoryEntry entry = getEntry ( pKey , pValue , pTimestamp ) ; return entry != null ? addToHistoryEntryAndGetCurrentHistory ( new JSONObject ( ) , entry , pAttrName , pValue , pTimestamp ) : null ;
public class SimpleMimeTypeDetector { /** * Return { @ code true } if { @ code bytes } looks like a beginning of a * binary file . * < p > Looks for well - known binary format MAGICs . < / p > * @ param bytes array of bytes . * @ return detected mimetype , or { @ code null } if no binary * format is detected . */ private String detectBinaryTypes ( byte [ ] bytes ) { } }
// NB : there are a lot of specific mimetypes we can detect by file // magic , but we don ' t want to make too much effort here . // " application / octet - stream " is fine if file looks very much like // binary but don ' t know what exactly . Returned value is not really // used beyond being non - null . We ' re only concerned with file formats // frequently sent out with imprecise Content - Type . switch ( bytes [ 0 ] ) { case ( byte ) 0xFF : if ( bytes [ 1 ] == ( byte ) 0xFE ) { // UTF - 16LE BOM return null ; } else if ( ( bytes [ 1 ] & 0xFE ) == ( byte ) 0xFA ) { // audio / mp3 return "audio/mp3" ; } else if ( bytes [ 1 ] == ( byte ) 0xD8 ) { // image / jpeg - commonly < FF > < D8 > < FF > < E0 > or < FF > < D8 > < FF > < E1 > return "image/jpeg" ; } // WordPerfect ( < FF > WPC ) falls in this category . // ( WordPerfect also has < D8 > WPC return BINARY_FILE ; case ( byte ) 0xFE : if ( bytes [ 1 ] == ( byte ) 0xFF ) { // UTF - 16BE BOM return null ; } break ; case ( byte ) 0xF7 : if ( bytes [ 1 ] == 0x02 && bytes [ 2 ] == 0x01 ) { // unconfirmed . return "application/x-dvi" ; } break ; case ( byte ) 0xEF : if ( bytes [ 1 ] == ( byte ) 0xBB && bytes [ 2 ] == ( byte ) 0xBF ) { // UTF - 8 BOM return null ; } break ; case ( byte ) 0xD0 : if ( bytes [ 1 ] == ( byte ) 0xCF && bytes [ 2 ] == 0x11 && bytes [ 2 ] == ( byte ) 0xE1 ) { // MS Word . Document . 8 return BINARY_FILE ; } break ; case ( byte ) 0xCA : if ( bytes [ 1 ] == ( byte ) 0xFE && bytes [ 2 ] == ( byte ) 0xBA && bytes [ 3 ] == ( byte ) 0xBE ) { // application / java ( class files ) return "application/java" ; } break ; case ( byte ) 0x89 : if ( bytes [ 1 ] == 'P' && bytes [ 2 ] == 'N' && bytes [ 3 ] == 'G' ) { return "image/png" ; } break ; case 0x00 : if ( bytes [ 1 ] == 0x00 ) { // Windows icon resource falls in this category . return BINARY_FILE ; } else if ( bytes [ 1 ] == 0x01 ) { // TTF ? return BINARY_FILE ; } break ; case 0x01 : if ( bytes [ 1 ] == ( byte ) 0xB3 || bytes [ 1 ] == ( byte ) 0xBA ) { return "video/mpeg" ; } else if ( bytes [ 1 ] == 0x00 ) { // very likely is a binary file return BINARY_FILE ; } break ; case 0x1F : if ( bytes [ 1 ] == ( byte ) 0x8B ) { return "application/x-gzip" ; } else if ( bytes [ 1 ] == ( byte ) 0x9D ) { // followed by 0x90 return "application/x-compress" ; } break ; case '%' : if ( bytes [ 1 ] == 'P' && bytes [ 2 ] == 'D' && bytes [ 3 ] == 'F' && bytes [ 4 ] == '-' ) { return "application/pdf" ; } else if ( bytes [ 1 ] == '!' && bytes [ 2 ] == 'P' && bytes [ 3 ] == 'S' && bytes [ 4 ] == '-' ) { // application / postscript , Type 1 font . return "application/postscript" ; } break ; case 'B' : if ( bytes [ 1 ] == 'Z' && bytes [ 2 ] == 'h' ) { return "application/x-bzip2" ; } break ; case 'F' : if ( bytes [ 1 ] == 'W' && bytes [ 2 ] == 'S' ) { // followed by < 04 > or < 05 > . Also ' CWS < 07 > ? return "application/x-shockwave-flash" ; } else if ( bytes [ 1 ] == 'L' && bytes [ 2 ] == 'V' && bytes [ 3 ] == 0x01 ) { return "video/x-flv" ; } break ; case 'G' : if ( bytes [ 1 ] == 'I' && bytes [ 2 ] == 'F' && bytes [ 3 ] == '8' ) { // GIF87a or GIF89a return "image/gif" ; } break ; case 'M' : if ( bytes [ 1 ] == 'Z' ) { // MS - DOS Executable ( MZ < 00 - FF > < 00-01 > ) if ( bytes [ 3 ] == 0x00 || bytes [ 3 ] == 0x01 ) { return "application/x-dosexec" ; } } else if ( bytes [ 1 ] == 'S' && bytes [ 2 ] == 'C' && bytes [ 3 ] == 'F' ) { // MS cab file return "application/vnd.ms-cab-compressed" ; } else if ( bytes [ 1 ] == 'T' && bytes [ 2 ] == 'h' && bytes [ 3 ] == 'd' ) { // MIDI return "audio/midi" ; // or " application / x - midi " } break ; case 'P' : if ( bytes [ 1 ] == 'K' && bytes [ 2 ] == 0x03 && bytes [ 3 ] == 0x04 ) { return "application/zip" ; } else if ( bytes [ 1 ] == 'E' && bytes [ 2 ] == 0x00 && bytes [ 3 ] == 0x00 && bytes [ 4 ] == 'M' && bytes [ 5 ] == 'S' ) { // Windows PE return BINARY_FILE ; } break ; case 'm' : if ( bytes [ 1 ] == 'o' && bytes [ 2 ] == 'o' && bytes [ 3 ] == 'v' ) { return "video/quicktime" ; } else if ( bytes [ 1 ] == 'd' && bytes [ 2 ] == 'a' && bytes [ 3 ] == 't' ) { return "video/quicktime" ; } break ; case '{' : if ( bytes [ 1 ] == '\\' && bytes [ 2 ] == 'r' && bytes [ 3 ] == 't' && bytes [ 4 ] == 'f' && bytes [ 5 ] == '1' ) { return "application/rtf" ; } break ; } if ( bytes [ 2 ] == '-' && bytes [ 3 ] == 'l' && bytes [ 4 ] == 'h' && bytes [ 5 ] == '5' && bytes [ 6 ] == '-' ) { // LZH archive return BINARY_FILE ; } // Other formats we may want to add // " RIFF " < ? > < ? > < ? > < ? > " WAVEfmt " - " audio / wav " // < DB > < A5 > < 2D > < 00 > - commonly with suffix . doc . files command doesn ' t know this format . // < C5 > < D0 > < D3 > < C6 > < 1E > < 00 > < 00 > < 00 > - some EPS has a binary header starting with this , before " % ! PS - " return null ;
public class GrailsWebRequest { /** * Returns the context path of the request . * @ return the path */ @ Override public String getContextPath ( ) { } }
final HttpServletRequest request = getCurrentRequest ( ) ; String appUri = ( String ) request . getAttribute ( GrailsApplicationAttributes . APP_URI_ATTRIBUTE ) ; if ( appUri == null ) { appUri = urlHelper . getContextPath ( request ) ; } return appUri ;
public class TrecEvalParser { /** * A method that parses a line from the file . * @ param line the line to be parsed * @ param dataset the dataset where the information parsed from the line * will be stored into . */ private void parseLine ( final String line , final DataModelIF < Long , Long > dataset ) { } }
String [ ] toks = line . split ( "\t" ) ; // user long userId = Long . parseLong ( toks [ USER_TOK ] ) ; // item long itemId = Long . parseLong ( toks [ ITEM_TOK ] ) ; // preference double preference = Double . parseDouble ( toks [ RATING_TOK ] ) ; // update information dataset . addPreference ( userId , itemId , preference ) ; // no timestamp info
public class CglibLazyInitializer { /** * Gets the proxy factory . * @ param persistentClass * the persistent class * @ param interfaces * the interfaces * @ return the proxy factory * @ throws PersistenceException * the persistence exception */ public static Class getProxyFactory ( Class persistentClass , Class [ ] interfaces ) throws PersistenceException { } }
Enhancer e = new Enhancer ( ) ; e . setSuperclass ( interfaces . length == 1 ? persistentClass : null ) ; e . setInterfaces ( interfaces ) ; e . setCallbackTypes ( new Class [ ] { InvocationHandler . class , NoOp . class , } ) ; e . setCallbackFilter ( FINALIZE_FILTER ) ; e . setUseFactory ( false ) ; e . setInterceptDuringConstruction ( false ) ; return e . createClass ( ) ;
public class SQLStore { /** * { @ inheritDoc } */ @ Override public void onCreate ( SQLiteDatabase db ) { } }
db . execSQL ( String . format ( CREATE_PROPERTIES_TABLE , className ) ) ; db . execSQL ( String . format ( CREATE_PROPERTIES_INDEXES , className , className , className , className , className , className ) ) ;
public class SqlQuery { /** * { @ inheritDoc } */ public SqlQuery params ( Map < String , Object > newParams ) { } }
this . params = CollectUtils . newHashMap ( newParams ) ; return this ;
public class UrlPatternAnalyzer { protected void assertEndBraceExists ( Method executeMethod , String urlPattern , int index ) { } }
if ( index >= 0 ) { throwUrlPatternEndBraceNotFoundException ( executeMethod , urlPattern , index ) ; }
public class ModelResource { /** * { @ inheritDoc } * find model history between start to end timestamp versions * need model mark { @ code @ History } */ @ GET @ Path ( "{id}/history/{start: " + DATE_REGEX + "}-{end: " + DATE_REGEX + "}" ) public Response fetchHistory ( @ PathParam ( "id" ) URI_ID id , @ PathParam ( "start" ) Timestamp start , @ PathParam ( "end" ) Timestamp end ) throws Exception { } }
return super . fetchHistory ( id , start , end ) ;