signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class FixtureFactory { /** * Creates new instance of fixture . * @ param clazz class to instantiate . * @ param constructorArgs arguments to pass to constructor of clazz . * @ param < T > type to create . * @ return instance of clazz ( subclass , actually ) that will have # aroundSlimInvoke ( ) invoked on each method call . */ public < T extends InteractionAwareFixture > T create ( Class < T > clazz , Object ... constructorArgs ) { } }
T result ; if ( constructorArgs != null && constructorArgs . length > 0 ) { Class < ? > [ ] types = new Class [ constructorArgs . length ] ; for ( int i = 0 ; i < constructorArgs . length ; i ++ ) { types [ i ] = constructorArgs [ i ] . getClass ( ) ; } result = create ( clazz , types , constructorArgs ) ; } else { result = create ( clazz , null , null ) ; } return result ;
public class JavaLexer { /** * $ ANTLR start " EscapeSequence " */ public final void mEscapeSequence ( ) throws RecognitionException { } }
try { // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1353:5 : ( ' \ \ \ \ ' ( ' b ' | ' t ' | ' n ' | ' f ' | ' r ' | ' \ \ \ " ' | ' \ \ ' ' | ' \ \ \ \ ' ) | UnicodeEscape | OctalEscape ) int alt24 = 3 ; int LA24_0 = input . LA ( 1 ) ; if ( ( LA24_0 == '\\' ) ) { switch ( input . LA ( 2 ) ) { case '\"' : case '\'' : case '\\' : case 'b' : case 'f' : case 'n' : case 'r' : case 't' : { alt24 = 1 ; } break ; case 'u' : { alt24 = 2 ; } break ; case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : { alt24 = 3 ; } break ; default : int nvaeMark = input . mark ( ) ; try { input . consume ( ) ; NoViableAltException nvae = new NoViableAltException ( "" , 24 , 1 , input ) ; throw nvae ; } finally { input . rewind ( nvaeMark ) ; } } } else { NoViableAltException nvae = new NoViableAltException ( "" , 24 , 0 , input ) ; throw nvae ; } switch ( alt24 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1353:9 : ' \ \ \ \ ' ( ' b ' | ' t ' | ' n ' | ' f ' | ' r ' | ' \ \ \ " ' | ' \ \ ' ' | ' \ \ \ \ ' ) { match ( '\\' ) ; if ( input . LA ( 1 ) == '\"' || input . LA ( 1 ) == '\'' || input . LA ( 1 ) == '\\' || input . LA ( 1 ) == 'b' || input . LA ( 1 ) == 'f' || input . LA ( 1 ) == 'n' || input . LA ( 1 ) == 'r' || input . LA ( 1 ) == 't' ) { input . consume ( ) ; } else { MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } } break ; case 2 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1354:9 : UnicodeEscape { mUnicodeEscape ( ) ; } break ; case 3 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1355:9 : OctalEscape { mOctalEscape ( ) ; } break ; } } finally { // do for sure before leaving }
public class AmazonCloudFormationClient { /** * Returns summary information about operations performed on a stack set . * @ param listStackSetOperationsRequest * @ return Result of the ListStackSetOperations operation returned by the service . * @ throws StackSetNotFoundException * The specified stack set doesn ' t exist . * @ sample AmazonCloudFormation . ListStackSetOperations * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cloudformation - 2010-05-15 / ListStackSetOperations " * target = " _ top " > AWS API Documentation < / a > */ @ Override public ListStackSetOperationsResult listStackSetOperations ( ListStackSetOperationsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListStackSetOperations ( request ) ;
public class FileUtil { /** * Returns the appropriate working directory for storing application data . The result of this method is platform * dependant : On linux , it will return ~ / applicationName , on windows , the working directory will be located in the * user ' s application data folder . For Mac OS systems , the working directory will be placed in the proper location * in " Library / Application Support " . * This method will also make sure that the working directory exists . When invoked , the directory and all required * subfolders will be created . * @ param applicationName Name of the application , used to determine the working directory . * @ return the appropriate working directory for storing application data . */ public static File getApplicationDataDirectory ( final String applicationName ) { } }
final String userHome = System . getProperty ( "user.home" , "." ) ; final File workingDirectory ; final String osName = System . getProperty ( "os.name" , "" ) . toLowerCase ( ) ; if ( osName . contains ( "windows" ) ) { final String applicationData = System . getenv ( "APPDATA" ) ; if ( applicationData != null ) workingDirectory = new File ( applicationData , applicationName + '/' ) ; else workingDirectory = new File ( userHome , '.' + applicationName + '/' ) ; } else if ( osName . contains ( "mac" ) ) { workingDirectory = new File ( userHome , "Library/Application Support/" + applicationName ) ; } else { workingDirectory = new File ( userHome , '.' + applicationName + '/' ) ; } if ( ! workingDirectory . exists ( ) ) if ( ! workingDirectory . mkdirs ( ) ) throw new RuntimeException ( "The working directory could not be created: " + workingDirectory ) ; return workingDirectory ;
public class ModelAdapter { /** * util function which recursively iterates over all items and subItems of the given adapter . * It executes the given ` predicate ` on every item and will either stop if that function returns true , or continue ( if stopOnMatch is false ) * @ param predicate the predicate to run on every item , to check for a match or do some changes ( e . g . select ) * @ param stopOnMatch defines if we should stop iterating after the first match * @ return Triple & lt ; Boolean , IItem , Integer & gt ; The first value is true ( it is always not null ) , the second contains the item and the third the position ( if the item is visible ) if we had a match , ( always false and null and null in case of stopOnMatch = = false ) */ @ NonNull public Triple < Boolean , Item , Integer > recursive ( AdapterPredicate < Item > predicate , boolean stopOnMatch ) { } }
int preItemCount = getFastAdapter ( ) . getPreItemCountByOrder ( getOrder ( ) ) ; for ( int i = 0 ; i < getAdapterItemCount ( ) ; i ++ ) { int globalPosition = i + preItemCount ; // retrieve the item + it ' s adapter FastAdapter . RelativeInfo < Item > relativeInfo = getFastAdapter ( ) . getRelativeInfo ( globalPosition ) ; Item item = relativeInfo . item ; if ( predicate . apply ( relativeInfo . adapter , globalPosition , item , globalPosition ) && stopOnMatch ) { return new Triple < > ( true , item , globalPosition ) ; } if ( item instanceof IExpandable ) { Triple < Boolean , Item , Integer > res = FastAdapter . recursiveSub ( relativeInfo . adapter , globalPosition , ( IExpandable ) item , predicate , stopOnMatch ) ; if ( res . first && stopOnMatch ) { return res ; } } } return new Triple < > ( false , null , null ) ;
public class FsCrawlerImpl { /** * Upgrade FSCrawler indices * @ return true if done successfully * @ throws Exception In case of error */ @ SuppressWarnings ( "deprecation" ) public boolean upgrade ( ) throws Exception { } }
// We need to start a client so we can send requests to elasticsearch try { esClient . start ( ) ; } catch ( Exception t ) { logger . fatal ( "We can not start Elasticsearch Client. Exiting." , t ) ; return false ; } // The upgrade script is for now a bit dumb . It assumes that you had an old version of FSCrawler ( < 2.3 ) and it will // simply move data from index / folder to index _ folder String index = settings . getElasticsearch ( ) . getIndex ( ) ; // Check that the old index actually exists if ( esClient . isExistingIndex ( index ) ) { // We check that the new indices don ' t exist yet or are empty String indexFolder = settings . getElasticsearch ( ) . getIndexFolder ( ) ; boolean indexExists = esClient . isExistingIndex ( indexFolder ) ; long numberOfDocs = 0 ; if ( indexExists ) { ESSearchResponse responseFolder = esClient . search ( new ESSearchRequest ( ) . withIndex ( indexFolder ) ) ; numberOfDocs = responseFolder . getTotalHits ( ) ; } if ( numberOfDocs > 0 ) { logger . warn ( "[{}] already exists and is not empty. No upgrade needed." , indexFolder ) ; } else { logger . debug ( "[{}] can be upgraded." , index ) ; // Create the new indices with the right mappings ( well , we don ' t read existing user configuration ) if ( ! indexExists ) { esClient . createIndices ( ) ; logger . info ( "[{}] has been created." , indexFolder ) ; } // Run reindex task for folders logger . info ( "Starting reindex folders..." ) ; int folders = esClient . reindex ( index , INDEX_TYPE_FOLDER , indexFolder ) ; logger . info ( "Done reindexing [{}] folders..." , folders ) ; // Run delete by query task for folders logger . info ( "Starting removing folders from [{}]..." , index ) ; esClient . deleteByQuery ( index , INDEX_TYPE_FOLDER ) ; logger . info ( "Done removing folders from [{}]" , index ) ; logger . info ( "You can now upgrade your elasticsearch cluster to >=6.0.0!" ) ; return true ; } } else { logger . info ( "[{}] does not exist. No upgrade needed." , index ) ; } return false ;
public class NameUtil { /** * Attempts to find the new file name originated from input oldName using the * the new modified BuzzHash algorithm . * This method detects if the oldName contains a valid trailing hashcode and * try to compute the new one . If the oldName has no valid hashcode in the * input name , null is return . * For ease of invocation regardless of the type of file passes in , this method * only changes the hash value and will not recreate the complete file name from * the EnterpriseBean . * @ return the new file name using the oldName but with a new hash code , or null if no * new name can be constructed . */ public static final String updateFilenameHashCode ( EnterpriseBean enterpriseBean , String oldName ) { } }
String newName = null ; int len = oldName . length ( ) ; int last_ = ( len > 9 && ( oldName . charAt ( len - 9 ) == '_' ) ) ? len - 9 : - 1 ; // input file name must have a trailing " _ " follows by 8 hex digits // and check to make sure the last 8 characters are all hex digits if ( last_ != - 1 && allHexDigits ( oldName , ++ last_ , len ) ) { String hashStr = getHashStr ( enterpriseBean ) ; newName = oldName . substring ( 0 , last_ ) + BuzzHash . computeHashStringMid32Bit ( hashStr , true ) ; } return newName ;
public class CmsSecure { /** * Builds the radio input to set the export and secure property . * @ param propName the name of the property to build the radio input for * @ return html for the radio input * @ throws CmsException if the reading of a property fails */ public String buildRadio ( String propName ) throws CmsException { } }
String propVal = readProperty ( propName ) ; StringBuffer result = new StringBuffer ( "<table border=\"0\"><tr>" ) ; result . append ( "<td><input type=\"radio\" value=\"true\" onClick=\"checkNoIntern()\" name=\"" ) . append ( propName ) . append ( "\" " ) . append ( Boolean . valueOf ( propVal ) . booleanValue ( ) ? "checked=\"checked\"" : "" ) . append ( "/></td><td id=\"tablelabel\">" ) . append ( key ( Messages . GUI_LABEL_TRUE_0 ) ) . append ( "</td>" ) ; result . append ( "<td><input type=\"radio\" value=\"false\" onClick=\"checkNoIntern()\" name=\"" ) . append ( propName ) . append ( "\" " ) . append ( Boolean . valueOf ( propVal ) . booleanValue ( ) ? "" : "checked=\"checked\"" ) . append ( "/></td><td id=\"tablelabel\">" ) . append ( key ( Messages . GUI_LABEL_FALSE_0 ) ) . append ( "</td>" ) ; result . append ( "<td><input type=\"radio\" value=\"\" onClick=\"checkNoIntern()\" name=\"" ) . append ( propName ) . append ( "\" " ) . append ( CmsStringUtil . isEmpty ( propVal ) ? "checked=\"checked\"" : "" ) . append ( "/></td><td id=\"tablelabel\">" ) . append ( getPropertyInheritanceInfo ( propName ) ) . append ( "</td></tr></table>" ) ; return result . toString ( ) ;
public class BaseProxy { /** * Retrieve this record from the key . * @ param strSeekSign Which way to seek null / = matches data also & gt ; , & lt ; , & gt ; = , and & lt ; = . * @ param strKeyArea The name of the key area to seek on . * @ param objKeyData The data for the seek ( The raw data if a single field , a BaseBuffer if multiple ) . * @ returns The record ( as a vector ) if successful , The return code ( as an Boolean ) if not . * @ exception DBException File exception . * @ exception RemoteException RMI exception . */ public Object checkDBException ( Object objData ) throws DBException , RemoteException { } }
if ( objData instanceof DBException ) throw ( DBException ) objData ; if ( objData instanceof RemoteException ) throw ( RemoteException ) objData ; return objData ;
public class CmsLocationController { /** * Opens the location picker popup . < p > */ void openPopup ( ) { } }
try { if ( m_popup == null ) { m_popup = new CmsPopup ( Messages . get ( ) . key ( Messages . GUI_LOCATION_DIALOG_TITLE_0 ) , hasMap ( ) ? 1020 : 420 ) ; m_popupContent = new CmsLocationPopupContent ( this , new CmsLocationSuggestOracle ( this ) , getModeItems ( ) , getTypeItems ( ) , getZoomItems ( ) ) ; setFieldVisibility ( ) ; m_popup . setMainContent ( m_popupContent ) ; m_popup . addDialogClose ( null ) ; } m_popup . center ( ) ; m_popup . show ( ) ; initialize ( ) ; updateForm ( ) ; } catch ( Throwable t ) { CmsErrorDialog . handleException ( t ) ; }
public class EntryStream { /** * Returns a { @ link Map } containing the elements of this stream . There are * no guarantees on the type or serializability of the { @ code Map } returned ; * if more control over the returned { @ code Map } is required , use * { @ link # toCustomMap ( Supplier ) } . * This is a < a href = " package - summary . html # StreamOps " > terminal < / a > * operation . * Returned { @ code Map } is guaranteed to be modifiable . * For parallel stream the concurrent { @ code Map } is created . * @ return a { @ code Map } containing the elements of this stream * @ throws IllegalStateException if this stream contains duplicate keys * ( according to { @ link Object # equals ( Object ) } ) * @ see Collectors # toMap ( Function , Function ) * @ see Collectors # toConcurrentMap ( Function , Function ) * @ see # toImmutableMap ( ) */ public Map < K , V > toMap ( ) { } }
Map < K , V > map = isParallel ( ) ? new ConcurrentHashMap < > ( ) : new HashMap < > ( ) ; forEach ( toMapConsumer ( map ) ) ; return map ;
public class Multimap { /** * The associated keys will be removed if null or empty values are returned by the specified < code > function < / code > . * @ param function */ public < X extends Exception > void replaceAll ( Try . BiFunction < ? super K , ? super V , ? extends V , X > function ) throws X { } }
List < K > keyToRemove = null ; V newVal = null ; for ( Map . Entry < K , V > entry : valueMap . entrySet ( ) ) { newVal = function . apply ( entry . getKey ( ) , entry . getValue ( ) ) ; if ( N . isNullOrEmpty ( newVal ) ) { if ( keyToRemove == null ) { keyToRemove = new ArrayList < > ( ) ; } keyToRemove . add ( entry . getKey ( ) ) ; } else { try { entry . setValue ( newVal ) ; } catch ( IllegalStateException ise ) { throw new ConcurrentModificationException ( ise ) ; } } } if ( N . notNullOrEmpty ( keyToRemove ) ) { for ( K key : keyToRemove ) { valueMap . remove ( key ) ; } }
public class FindBugs2 { /** * Configure analysis feature settings . */ private void configureAnalysisFeatures ( ) { } }
for ( AnalysisFeatureSetting setting : analysisOptions . analysisFeatureSettingList ) { setting . configure ( AnalysisContext . currentAnalysisContext ( ) ) ; } AnalysisContext . currentAnalysisContext ( ) . setBoolProperty ( AnalysisFeatures . MERGE_SIMILAR_WARNINGS , analysisOptions . mergeSimilarWarnings ) ;
public class LongRendererWithoutSeparator { /** * returns the instance . * @ return CurrencyDoubleRenderer */ public static final Renderer < Long > instance ( ) { } }
// NOPMD it ' s thread save ! if ( LongRendererWithoutSeparator . instanceRenderer == null ) { synchronized ( LongRendererWithoutSeparator . class ) { if ( LongRendererWithoutSeparator . instanceRenderer == null ) { LongRendererWithoutSeparator . instanceRenderer = new LongRendererWithoutSeparator ( ) ; } } } return LongRendererWithoutSeparator . instanceRenderer ;
public class VMath { /** * Computes component - wise v1 = v1 - v2 * s2, * overwriting the vector v1. * @ param v1 vector * @ param v2 another vector * @ param s2 scalar for v2 * @ return v1 = v1 - v2 * s2 */ public static double [ ] minusTimesEquals ( final double [ ] v1 , final double [ ] v2 , final double s2 ) { } }
assert v1 . length == v2 . length : ERR_VEC_DIMENSIONS ; for ( int i = 0 ; i < v1 . length ; i ++ ) { v1 [ i ] -= v2 [ i ] * s2 ; } return v1 ;
public class CrossChunkCodeMotion { /** * Is the expression of the form { @ code ' undefined ' ! = typeof Ref } ? * @ param expression * @ param reference Ref node must be equivalent to this node */ private boolean isUndefinedTypeofGuardFor ( Node expression , Node reference ) { } }
if ( expression . isNE ( ) ) { Node undefinedString = expression . getFirstChild ( ) ; Node typeofNode = expression . getLastChild ( ) ; return undefinedString . isString ( ) && undefinedString . getString ( ) . equals ( "undefined" ) && typeofNode . isTypeOf ( ) && typeofNode . getFirstChild ( ) . isEquivalentTo ( reference ) ; } else { return false ; }
public class HPAI { /** * Returns the byte representation of the whole HPAI structure . * @ return byte array containing structure */ public final byte [ ] toByteArray ( ) { } }
final ByteArrayOutputStream os = new ByteArrayOutputStream ( HPAI_SIZE ) ; os . write ( length ) ; os . write ( hostprot ) ; os . write ( address , 0 , address . length ) ; os . write ( port >> 8 ) ; os . write ( port ) ; return os . toByteArray ( ) ;
public class FormController { /** * Generate an available ID for the view . * Uses the same implementation as { @ link View # generateViewId } * @ return the next available view identifier . */ public static int generateViewId ( ) { } }
for ( ; ; ) { final int result = nextGeneratedViewId . get ( ) ; // aapt - generated IDs have the high byte nonzero ; clamp to the range under that . int newValue = result + 1 ; if ( newValue > 0x00FFFFFF ) newValue = 1 ; // Roll over to 1 , not 0. if ( nextGeneratedViewId . compareAndSet ( result , newValue ) ) { return result ; } }
public class CallActivityMock { /** * On execution , the MockProcess will execute the given consumer with a DelegateExecution . * @ param serviceId . . . the id of the mock delegate * @ param consumer delegate for service task * @ return self */ public CallActivityMock onExecutionDo ( final String serviceId , final Consumer < DelegateExecution > consumer ) { } }
flowNodeBuilder = flowNodeBuilder . serviceTask ( serviceId ) . camundaDelegateExpression ( "${id}" . replace ( "id" , serviceId ) ) ; registerInstance ( serviceId , ( JavaDelegate ) consumer :: accept ) ; return this ;
public class PatternUtils { /** * Adapted from http : / / stackoverflow . com / questions / 1247772 / is - there - an - equivalent - of - java - util - regex - for - glob - type - patterns */ @ Nonnull public static String convertGlobToRegEx ( @ Nonnull String line ) { } }
line = line . trim ( ) ; int strLen = line . length ( ) ; StringBuilder sb = new StringBuilder ( strLen ) ; // Remove beginning and ending * globs because they ' re useless if ( line . startsWith ( "*" ) ) { line = line . substring ( 1 ) ; strLen -- ; } if ( line . endsWith ( "*" ) ) { line = line . substring ( 0 , strLen - 1 ) ; strLen -- ; } boolean escaping = false ; int inCurlies = 0 ; CHAR : for ( char currentChar : line . toCharArray ( ) ) { switch ( currentChar ) { case '*' : if ( escaping ) sb . append ( "\\*" ) ; else sb . append ( ".*" ) ; break ; case '?' : if ( escaping ) sb . append ( "\\?" ) ; else sb . append ( '.' ) ; break ; case '.' : case '(' : case ')' : case '+' : case '|' : case '^' : case '$' : case '@' : case '%' : sb . append ( '\\' ) ; sb . append ( currentChar ) ; break ; case '\\' : if ( escaping ) sb . append ( "\\\\" ) ; else { escaping = true ; continue CHAR ; } break ; case '{' : if ( escaping ) sb . append ( "\\{" ) ; else { sb . append ( '(' ) ; inCurlies ++ ; } break ; case '}' : if ( escaping ) sb . append ( "\\}" ) ; else if ( inCurlies > 0 ) { sb . append ( ')' ) ; inCurlies -- ; } else sb . append ( "}" ) ; break ; case ',' : if ( escaping ) sb . append ( "\\," ) ; else if ( inCurlies > 0 ) sb . append ( '|' ) ; else sb . append ( "," ) ; break ; default : sb . append ( currentChar ) ; break ; } escaping = false ; } return sb . toString ( ) ;
public class ClassReflectionIndex { /** * Get a collection of methods declared on this object . * @ param name the name of the method * @ param paramTypeNames the parameter type names of the method * @ return the ( possibly empty ) collection of methods matching the description */ public Collection < Method > getMethods ( String name , String ... paramTypeNames ) { } }
final Map < ParamNameList , Map < String , Method > > nameMap = methodsByTypeName . get ( name ) ; if ( nameMap == null ) { return Collections . emptySet ( ) ; } final Map < String , Method > paramsMap = nameMap . get ( createParamNameList ( paramTypeNames ) ) ; if ( paramsMap == null ) { return Collections . emptySet ( ) ; } return Collections . unmodifiableCollection ( paramsMap . values ( ) ) ;
public class ArrayAdapterCompat { /** * Adds the specified items at the end of the array . * @ param items The items to add at the end of the array . */ public void addAll ( T ... items ) { } }
synchronized ( mLock ) { if ( mOriginalValues != null ) { Collections . addAll ( mOriginalValues , items ) ; } else { Collections . addAll ( mObjects , items ) ; } } if ( mNotifyOnChange ) notifyDataSetChanged ( ) ;
public class CouchbaseExecutor { /** * Always remember to set " < code > LIMIT 1 < / code > " in the sql statement for better performance . * @ param query * @ param parameters * @ return */ @ SafeVarargs public final ContinuableFuture < Boolean > asyncExists ( final String query , final Object ... parameters ) { } }
return asyncExecutor . execute ( new Callable < Boolean > ( ) { @ Override public Boolean call ( ) throws Exception { return exists ( query , parameters ) ; } } ) ;
public class Shape { /** * Get the combine normal of a given point * @ param index The index of the point whose normal should be retrieved * @ return The combined normal of a given point */ public float [ ] getNormal ( int index ) { } }
float [ ] current = getPoint ( index ) ; float [ ] prev = getPoint ( index - 1 < 0 ? getPointCount ( ) - 1 : index - 1 ) ; float [ ] next = getPoint ( index + 1 >= getPointCount ( ) ? 0 : index + 1 ) ; float [ ] t1 = getNormal ( prev , current ) ; float [ ] t2 = getNormal ( current , next ) ; if ( ( index == 0 ) && ( ! closed ( ) ) ) { return t2 ; } if ( ( index == getPointCount ( ) - 1 ) && ( ! closed ( ) ) ) { return t1 ; } float tx = ( t1 [ 0 ] + t2 [ 0 ] ) / 2 ; float ty = ( t1 [ 1 ] + t2 [ 1 ] ) / 2 ; float len = ( float ) Math . sqrt ( ( tx * tx ) + ( ty * ty ) ) ; return new float [ ] { tx / len , ty / len } ;
public class DefaultDmnDecisionContext { /** * Evaluate a decision with the given { @ link VariableContext } * @ param decision the decision to evaluate * @ param variableContext the available variable context * @ return the result of the decision evaluation */ public DmnDecisionResult evaluateDecision ( DmnDecision decision , VariableContext variableContext ) { } }
if ( decision . getKey ( ) == null ) { throw LOG . unableToFindAnyDecisionTable ( ) ; } VariableMap variableMap = buildVariableMapFromVariableContext ( variableContext ) ; List < DmnDecision > requiredDecisions = new ArrayList < DmnDecision > ( ) ; buildDecisionTree ( decision , requiredDecisions ) ; List < DmnDecisionLogicEvaluationEvent > evaluatedEvents = new ArrayList < DmnDecisionLogicEvaluationEvent > ( ) ; DmnDecisionResult evaluatedResult = null ; for ( DmnDecision evaluateDecision : requiredDecisions ) { DmnDecisionLogicEvaluationHandler handler = getDecisionEvaluationHandler ( evaluateDecision ) ; DmnDecisionLogicEvaluationEvent evaluatedEvent = handler . evaluate ( evaluateDecision , variableMap . asVariableContext ( ) ) ; evaluatedEvents . add ( evaluatedEvent ) ; evaluatedResult = handler . generateDecisionResult ( evaluatedEvent ) ; if ( decision != evaluateDecision ) { addResultToVariableContext ( evaluatedResult , variableMap , evaluateDecision ) ; } } generateDecisionEvaluationEvent ( evaluatedEvents ) ; return evaluatedResult ;
public class task_command_log { /** * Use this API to fetch filtered set of task _ command _ log resources . * filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */ public static task_command_log [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
task_command_log obj = new task_command_log ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; task_command_log [ ] response = ( task_command_log [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class CallbackWait { /** * Repeatedly applies this instance ' s input value to the given callable until one of the following * occurs : * < ol > < li > the function returns neither null nor false . < / li > < li > the function throws an unignored * exception . < / li > < li > the timeout expires . < / li > < li > the current thread is interrupted . < / li > * < / ol > * @ param condition the { @ link Callable } to evaluate * @ return the callable ' s return value */ public < X > X until ( Callable < X > condition ) { } }
long end = clock . laterBy ( timeout . in ( MILLISECONDS ) ) ; Exception lastException = null ; while ( true ) { try { X toReturn = condition . call ( ) ; if ( toReturn != null && Boolean . class . equals ( toReturn . getClass ( ) ) ) { if ( Boolean . TRUE . equals ( toReturn ) ) { return toReturn ; } } else if ( toReturn != null ) { return toReturn ; } } catch ( Exception e ) { lastException = propagateIfNotIgnored ( e ) ; } if ( ! clock . isNowBefore ( end ) ) { String toAppend = ( message == null ) ? " waiting for " + condition . toString ( ) : ": " + message ; String timeoutMessage = String . format ( "Timed out after %d milliseconds%s" , timeout . in ( MILLISECONDS ) , toAppend ) ; throw timeoutException ( timeoutMessage , lastException ) ; } try { sleeper . sleep ( interval ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new WebDriverException ( e ) ; } }
public class PlaybackService { /** * Resume the playback . */ private void resume ( ) { } }
if ( mIsPaused ) { mIsPaused = false ; mIsPausedAfterAudioFocusChanged = false ; // Try to gain the audio focus before preparing and starting the media player . if ( mAudioManager . requestAudioFocus ( this , AudioManager . STREAM_MUSIC , AudioManager . AUDIOFOCUS_GAIN ) == AudioManager . AUDIOFOCUS_REQUEST_GRANTED ) { mMediaPlayer . start ( ) ; Intent intent = new Intent ( PlaybackListener . ACTION_ON_TRACK_PLAYED ) ; intent . putExtra ( PlaybackListener . EXTRA_KEY_TRACK , mPlayerPlaylist . getCurrentTrack ( ) ) ; mLocalBroadcastManager . sendBroadcast ( intent ) ; updateNotification ( ) ; mMediaSession . setPlaybackState ( MediaSessionWrapper . PLAYBACK_STATE_PLAYING ) ; resumeTimer ( ) ; } }
public class comb { /** * Selects a random subset of size { @ code k } from the given base { @ code set } . * @ param set the base set * @ param k the size of the subset * @ param random the random number generator used * @ throws NullPointerException if { @ code set } or { @ code random } is * { @ code null } . * @ throws IllegalArgumentException if { @ code set . length < k } , * { @ code k = = 0 } or if { @ code set . length * k } will cause an integer * overflow . * @ return the subset array */ public static int [ ] subset ( final int [ ] set , final int k , final Random random ) { } }
final int [ ] sub = subset ( set . length , new int [ k ] , random ) ; for ( int i = 0 ; i < k ; ++ i ) { sub [ i ] = set [ sub [ i ] ] ; } return sub ;
public class CommercePriceListUserSegmentEntryRelLocalServiceWrapper { /** * Returns the commerce price list user segment entry rel matching the UUID and group . * @ param uuid the commerce price list user segment entry rel ' s UUID * @ param groupId the primary key of the group * @ return the matching commerce price list user segment entry rel , or < code > null < / code > if a matching commerce price list user segment entry rel could not be found */ @ Override public com . liferay . commerce . price . list . model . CommercePriceListUserSegmentEntryRel fetchCommercePriceListUserSegmentEntryRelByUuidAndGroupId ( String uuid , long groupId ) { } }
return _commercePriceListUserSegmentEntryRelLocalService . fetchCommercePriceListUserSegmentEntryRelByUuidAndGroupId ( uuid , groupId ) ;
public class PicocliBaseScript { /** * Create and returns a new CommandLine instance . * This method sets the command name in the usage help message to the script ' s class simple name ( unless * annotated with some other command name with the { @ code @ Command ( name = " . . . " ) } annotation ) . * Subclasses may override to register custom type converters or programmatically add subcommands . * @ return A CommandLine instance . */ public CommandLine createCommandLine ( ) { } }
CommandLine commandLine = new CommandLine ( this ) ; if ( commandLine . getCommandName ( ) . equals ( "<main class>" ) ) { // only if user did not specify @ Command ( name ) attribute commandLine . setCommandName ( this . getClass ( ) . getSimpleName ( ) ) ; } return commandLine ;
public class RSS091UserlandParser { /** * It looks for the ' image ' elements under the ' channel ' elemment . */ @ Override protected Element getImage ( final Element rssRoot ) { } }
final Element eChannel = rssRoot . getChild ( "channel" , getRSSNamespace ( ) ) ; if ( eChannel != null ) { return eChannel . getChild ( "image" , getRSSNamespace ( ) ) ; } else { return null ; }
public class Stream { /** * Terminal operation returning the only element in this Stream , or the default value * specified if there are no elements , multiple elements or an Exception occurs . * @ param defaultValue * the default value to return if a unique value cannot be extracted * @ return the only element in this Stream , or the default value in case that element does not * exist , there are multiple elements or an Exception occurs */ public final T getUnique ( final T defaultValue ) { } }
try { final T result = getUnique ( ) ; if ( result != null ) { return result ; } } catch ( final Throwable ex ) { // ignore } return defaultValue ;
public class AbstractFlagEncoder { /** * Defines bits used for edge flags used for access , speed etc . * @ return incremented shift value pointing behind the last used bit */ public void createEncodedValues ( List < EncodedValue > registerNewEncodedValue , String prefix , int index ) { } }
// define the first 2 speedBits in flags for routing registerNewEncodedValue . add ( accessEnc = new SimpleBooleanEncodedValue ( prefix + "access" , true ) ) ; roundaboutEnc = getBooleanEncodedValue ( EncodingManager . ROUNDABOUT ) ; encoderBit = 1L << index ;
public class SegmentationAreaTree { /** * Creates the area tree skeleton - selects the visible boxes and converts * them to areas */ public Area findBasicAreas ( ) { } }
AreaImpl rootarea = new AreaImpl ( 0 , 0 , 0 , 0 ) ; setRoot ( rootarea ) ; rootarea . setAreaTree ( this ) ; rootarea . setPage ( page ) ; for ( int i = 0 ; i < page . getRoot ( ) . getChildCount ( ) ; i ++ ) { Box cbox = page . getRoot ( ) . getChildAt ( i ) ; Area sub = new AreaImpl ( cbox ) ; if ( sub . getWidth ( ) > 1 || sub . getHeight ( ) > 1 ) { findStandaloneAreas ( page . getRoot ( ) . getChildAt ( i ) , sub ) ; rootarea . appendChild ( sub ) ; } } createGrids ( rootarea ) ; return rootarea ;
public class JedisRedisClient { /** * { @ inheritDoc } */ @ Override public void publish ( String topic , String message ) { } }
redisClient . publish ( topic , message ) ;
public class CounterSample { /** * Equivalent to { @ link org . javasimon . CounterImpl # toString ( ) } without state . */ public synchronized String simonToString ( ) { } }
return "Simon Counter: counter=" + counter + ", max=" + SimonUtils . presentMinMaxCount ( max ) + ", min=" + SimonUtils . presentMinMaxCount ( min ) + simonToStringCommon ( ) ;
public class AwsSecurityFindingFilters { /** * The identifier of the image related to a finding . * @ param resourceContainerImageId * The identifier of the image related to a finding . */ public void setResourceContainerImageId ( java . util . Collection < StringFilter > resourceContainerImageId ) { } }
if ( resourceContainerImageId == null ) { this . resourceContainerImageId = null ; return ; } this . resourceContainerImageId = new java . util . ArrayList < StringFilter > ( resourceContainerImageId ) ;
public class PhpDependencyResolver { /** * execute pre step command ( composer install ) */ private boolean executePreStepCommand ( String topLevelFolder ) { } }
String [ ] command ; if ( DependencyCollector . isWindows ( ) ) { command = getCommand ( COMPOSER_BAT ) ; } else { command = getCommand ( COMPOSER ) ; } String commandString = String . join ( Constants . WHITESPACE , command ) ; File file = new File ( topLevelFolder + FORWARD_SLASH + COMPOSER_JSON ) ; CommandLineProcess composerInstall = null ; if ( file . exists ( ) ) { logger . info ( "Running install command : {}" , commandString ) ; composerInstall = new CommandLineProcess ( topLevelFolder , command ) ; } try { composerInstall . executeProcessWithoutOutput ( ) ; } catch ( IOException e ) { logger . warn ( "Could not run {} in folder {} : {}" , commandString , topLevelFolder , e . getMessage ( ) ) ; return true ; } return composerInstall . isErrorInProcess ( ) ;
public class AbstractCorsPolicyBuilder { /** * Specifies HTTP response headers that should be added to a CORS preflight response . * < p > An intermediary like a load balancer might require that a CORS preflight request * have certain headers set . This enables such headers to be added . * @ param name the name of the HTTP header . * @ param values the values for the HTTP header . * @ return { @ code this } to support method chaining . */ public B preflightResponseHeader ( CharSequence name , Iterable < ? > values ) { } }
requireNonNull ( name , "name" ) ; requireNonNull ( values , "values" ) ; checkArgument ( ! Iterables . isEmpty ( values ) , "values should not be empty." ) ; final ImmutableList . Builder builder = new Builder ( ) ; int i = 0 ; for ( Object value : values ) { if ( value == null ) { throw new NullPointerException ( "value[" + i + ']' ) ; } builder . add ( value ) ; i ++ ; } preflightResponseHeaders . put ( HttpHeaderNames . of ( name ) , new ConstantValueSupplier ( builder . build ( ) ) ) ; return self ( ) ;
public class MsWordUtils { /** * 添加一张图片 * @ param imagePath 图片路径 * @ param pictureType 图片类型 * @ param width 宽度 * @ param height 长度 * @ param alignment 对齐方式 * @ throws IOException 异常 * @ throws InvalidFormatException 异常 */ public static void appendImage ( String imagePath , int pictureType , int width , int height , ParagraphAlignment alignment ) throws IOException , InvalidFormatException { } }
appendImage ( getNewRun ( alignment ) , imagePath , pictureType , width , height ) ;
public class ScrollAnimator { /** * Show the animated view using a " translationY " animation and configure an AnimatorListener to be notified during * the animation . */ public void showWithAnimationWithListener ( Animator . AnimatorListener animatorListener ) { } }
scrollDirection = SCROLL_TO_TOP ; ObjectAnimator objectAnimator = objectAnimatorFactory . getObjectAnimator ( animatedView , ANIMATION_TYPE , HIDDEN_Y_POSITION ) ; if ( animatorListener != null ) { objectAnimator . addListener ( animatorListener ) ; } objectAnimator . setDuration ( durationInMillis ) ; objectAnimator . start ( ) ;
public class OMVRBTree { /** * Balancing operations . * Implementations of rebalancings during insertion and deletion are slightly different than the CLR version . Rather than using * dummy nilnodes , we use a set of accessors that deal properly with null . They are used to avoid messiness surrounding nullness * checks in the main algorithms . */ private static < K , V > boolean colorOf ( final OMVRBTreeEntry < K , V > p ) { } }
return ( p == null ? BLACK : p . getColor ( ) ) ;
public class ApiOvhTelephony { /** * Delete the given screen list * REST : DELETE / telephony / { billingAccount } / timeCondition / { serviceName } / condition / { id } * @ param billingAccount [ required ] The name of your billingAccount * @ param serviceName [ required ] * @ param id [ required ] Id of the object */ public void billingAccount_timeCondition_serviceName_condition_id_DELETE ( String billingAccount , String serviceName , Long id ) throws IOException { } }
String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , id ) ; exec ( qPath , "DELETE" , sb . toString ( ) , null ) ;
public class StreamSegmentNameUtils { /** * Gets the name of the Segment that is used to store the Container ' s Segment Metadata . There is one such Segment * per container . * @ param containerId The Id of the Container . * @ return The Metadata Segment name . */ public static String getMetadataSegmentName ( int containerId ) { } }
Preconditions . checkArgument ( containerId >= 0 , "containerId must be a non-negative number." ) ; return String . format ( METADATA_SEGMENT_NAME_FORMAT , containerId ) ;
public class MapTilePathModel { /** * Get the group category . * @ param group The group name . * @ return The category name ( < code > null < / code > if undefined ) . */ private String getCategory ( String group ) { } }
for ( final PathCategory category : categories . values ( ) ) { if ( category . getGroups ( ) . contains ( group ) ) { return category . getName ( ) ; } } return null ;
public class XMLSerializer { /** * Writes a JSON value into a XML string with an specific encoding . < br > * If the encoding string is null it will use UTF - 8. * @ param json The JSON value to transform * @ param encoding The xml encoding to use * @ return a String representation of a well - formed xml document . * @ throws JSONException if the conversion from JSON to XML can ' t be made for * I / O reasons or the encoding is not supported . */ public String write ( JSON json , String encoding ) { } }
if ( keepArrayName && typeHintsEnabled ) { throw new IllegalStateException ( "Type Hints cannot be used together with 'keepArrayName'" ) ; } if ( JSONNull . getInstance ( ) . equals ( json ) ) { Element root = null ; root = newElement ( getRootName ( ) == null ? getObjectName ( ) : getRootName ( ) ) ; root . addAttribute ( new Attribute ( addJsonPrefix ( "null" ) , "true" ) ) ; Document doc = new Document ( root ) ; return writeDocument ( doc , encoding ) ; } else if ( json instanceof JSONArray ) { JSONArray jsonArray = ( JSONArray ) json ; Element root = processJSONArray ( jsonArray , newElement ( getRootName ( ) == null ? getArrayName ( ) : getRootName ( ) ) , expandableProperties ) ; Document doc = new Document ( root ) ; return writeDocument ( doc , encoding ) ; } else { JSONObject jsonObject = ( JSONObject ) json ; Element root = null ; if ( jsonObject . isNullObject ( ) ) { root = newElement ( getObjectName ( ) ) ; root . addAttribute ( new Attribute ( addJsonPrefix ( "null" ) , "true" ) ) ; } else { root = processJSONObject ( jsonObject , newElement ( getRootName ( ) == null ? getObjectName ( ) : getRootName ( ) ) , expandableProperties , true ) ; } Document doc = new Document ( root ) ; return writeDocument ( doc , encoding ) ; }
public class HypergraphSorter { /** * Turns a triple of longs into a 3 - hyperedge . * @ param triple a triple of intermediate hashes . * @ param seed the seed for the hash function . * @ param numVertices the number of vertices in the underlying hypergraph . * @ param partSize < code > numVertices < / code > / 3 ( to avoid a division ) . * @ param e an array to store the resulting edge . * @ see # bitVectorToEdge ( BitVector , long , int , int , int [ ] ) */ public static void tripleToEdge ( final long [ ] triple , final long seed , final int numVertices , final int partSize , final int e [ ] ) { } }
if ( numVertices == 0 ) { e [ 0 ] = e [ 1 ] = e [ 2 ] = - 1 ; return ; } final long [ ] hash = new long [ 3 ] ; Hashes . spooky4 ( triple , seed , hash ) ; e [ 0 ] = ( int ) ( ( hash [ 0 ] & 0x7FFFFFFFFFFFFFFFL ) % partSize ) ; e [ 1 ] = ( int ) ( partSize + ( hash [ 1 ] & 0x7FFFFFFFFFFFFFFFL ) % partSize ) ; e [ 2 ] = ( int ) ( ( partSize << 1 ) + ( hash [ 2 ] & 0x7FFFFFFFFFFFFFFFL ) % partSize ) ;
public class WebACFilter { /** * Get the membershipRelation from a PATCH request * @ param request the http request * @ return URI of the first ldp : membershipRelation object . * @ throws IOException converting the request body to a string . */ private URI getHasMemberFromPatch ( final HttpServletRequest request ) throws IOException { } }
final String sparqlString = IOUtils . toString ( request . getInputStream ( ) , UTF_8 ) ; final String baseURI = request . getRequestURL ( ) . toString ( ) . replace ( request . getContextPath ( ) , "" ) . replaceAll ( request . getPathInfo ( ) , "" ) . replaceAll ( "rest$" , "" ) ; final UpdateRequest sparqlUpdate = UpdateFactory . create ( sparqlString ) ; // The INSERT | DELETE DATA quads final Stream < Quad > insertDeleteData = sparqlUpdate . getOperations ( ) . stream ( ) . filter ( update -> update instanceof UpdateData ) . map ( update -> ( UpdateData ) update ) . flatMap ( update -> update . getQuads ( ) . stream ( ) ) ; // Get the UpdateModify instance to re - use below . final List < UpdateModify > updateModifyStream = sparqlUpdate . getOperations ( ) . stream ( ) . filter ( update -> ( update instanceof UpdateModify ) ) . peek ( update -> log . debug ( "Inspecting update statement for DELETE clause: {}" , update . toString ( ) ) ) . map ( update -> ( UpdateModify ) update ) . collect ( toList ( ) ) ; // The INSERT { } WHERE { } quads final Stream < Quad > insertQuadData = updateModifyStream . stream ( ) . flatMap ( update -> update . getInsertQuads ( ) . stream ( ) ) ; // The DELETE { } WHERE { } quads final Stream < Quad > deleteQuadData = updateModifyStream . stream ( ) . flatMap ( update -> update . getDeleteQuads ( ) . stream ( ) ) ; // The ldp : membershipResource triples . return Stream . concat ( Stream . concat ( insertDeleteData , insertQuadData ) , deleteQuadData ) . filter ( update -> update . getPredicate ( ) . equals ( MEMBERSHIP_RESOURCE . asNode ( ) ) && update . getObject ( ) . isURI ( ) ) . map ( update -> update . getObject ( ) . getURI ( ) ) . map ( update -> update . replace ( "file:///" , baseURI ) ) . findFirst ( ) . map ( URI :: create ) . orElse ( null ) ;
public class Slices { /** * Creates a slice over the specified array range . * @ param offset the array position at which the slice begins * @ param length the number of array positions to include in the slice */ public static Slice wrappedBuffer ( byte [ ] array , int offset , int length ) { } }
if ( length == 0 ) { return EMPTY_SLICE ; } return new Slice ( array , offset , length ) ;
public class OptionUtils { /** * Removes from the provided options all options that are instance of the provided class , returning the remaining * options . * @ param optionType class of the desired options to be removed * @ param options options to be filtered ( can be null or empty array ) * @ return array of remaining options ( never null ) after removing the desired type */ public static Option [ ] remove ( final Class < ? extends Option > optionType , final Option ... options ) { } }
final List < Option > filtered = new ArrayList < Option > ( ) ; for ( Option option : expand ( options ) ) { if ( ! optionType . isAssignableFrom ( option . getClass ( ) ) ) { filtered . add ( option ) ; } } return filtered . toArray ( new Option [ filtered . size ( ) ] ) ;
public class Hits { /** * Returns the attribute ' s value , { @ link RenderingHelper # shouldHighlight ( View , String ) highlighted } and { @ link RenderingHelper # shouldSnippet ( View , String ) snippetted } if required to . */ protected @ Nullable Spannable getFinalAttributeValue ( @ NonNull JSONObject hit , @ NonNull View view , @ NonNull String attribute , @ Nullable String attributeValue ) { } }
Spannable attributeText = null ; if ( attributeValue != null ) { if ( RenderingHelper . getDefault ( ) . shouldHighlight ( view , attribute ) ) { final int highlightColor = RenderingHelper . getDefault ( ) . getHighlightColor ( view , attribute ) ; final String prefix = BindingHelper . getPrefix ( view ) ; final String suffix = BindingHelper . getSuffix ( view ) ; final boolean snippetted = RenderingHelper . getDefault ( ) . shouldSnippet ( view , attribute ) ; attributeText = Highlighter . getDefault ( ) . setInput ( hit , attribute , prefix , suffix , false , snippetted ) . setStyle ( highlightColor ) . render ( ) ; } else { attributeText = new SpannableString ( attributeValue ) ; } } return attributeText ;
public class XmlElementWrapperPlugin { /** * Locate the candidates classes for substitution / removal . * @ return a map className - > Candidate */ private Collection < Candidate > findCandidateClasses ( Outline outline , JClass xmlElementDeclModelClass ) { } }
Map < String , ClassOutline > interfaceImplementations = new HashMap < String , ClassOutline > ( ) ; // Visit all classes to create a map " interfaceName - > ClassOutline " . // This map is later used to resolve implementations from interfaces . for ( ClassOutline classOutline : outline . getClasses ( ) ) { for ( Iterator < JClass > iter = classOutline . implClass . _implements ( ) ; iter . hasNext ( ) ; ) { JClass interfaceClass = iter . next ( ) ; if ( interfaceClass instanceof JDefinedClass ) { // Don ' t care if some interfaces collide : value classes have exactly one implementation interfaceImplementations . put ( interfaceClass . fullName ( ) , classOutline ) ; } } } Collection < Candidate > candidates = new ArrayList < Candidate > ( ) ; JClass collectionModelClass = outline . getCodeModel ( ) . ref ( Collection . class ) ; JClass xmlSchemaModelClass = outline . getCodeModel ( ) . ref ( XmlSchema . class ) ; // Visit all classes created by JAXB processing to collect all potential wrapper classes to be removed : for ( ClassOutline classOutline : outline . getClasses ( ) ) { JDefinedClass candidateClass = classOutline . implClass ; // * The candidate class should not extend any other model class ( as the total number of properties in this case will be more than 1) if ( ! isHiddenClass ( candidateClass . _extends ( ) ) ) { continue ; } JFieldVar field = null ; // * The candidate class should have exactly one property for ( JFieldVar f : candidateClass . fields ( ) . values ( ) ) { if ( ( f . mods ( ) . getValue ( ) & JMod . STATIC ) == JMod . STATIC ) { continue ; } // If there are at least two non - static fields , we discard this candidate : if ( field != null ) { field = null ; break ; } field = f ; } // " field " is null if there are no fields ( or all fields are static ) or there are more then two fields . // The only property should be a collection , hence it should be class : if ( field == null || ! ( field . type ( ) instanceof JClass ) ) { continue ; } JClass fieldType = ( JClass ) field . type ( ) ; // * The property should be a collection if ( ! collectionModelClass . isAssignableFrom ( fieldType ) ) { continue ; } List < JClass > fieldParametrisations = fieldType . getTypeParameters ( ) ; // FIXME : All known collections have exactly one parametrisation type . assert fieldParametrisations . size ( ) == 1 ; JDefinedClass fieldParametrisationClass = null ; JDefinedClass fieldParametrisationImpl = null ; // Parametrisations like " List < String > " or " List < Serialazable > " are not considered . // They are substituted as is and do not require moving of classes . if ( fieldParametrisations . get ( 0 ) instanceof JDefinedClass ) { fieldParametrisationClass = ( JDefinedClass ) fieldParametrisations . get ( 0 ) ; ClassOutline fieldParametrisationClassOutline = interfaceImplementations . get ( fieldParametrisationClass . fullName ( ) ) ; if ( fieldParametrisationClassOutline != null ) { assert fieldParametrisationClassOutline . ref == fieldParametrisationClass ; fieldParametrisationImpl = fieldParametrisationClassOutline . implClass ; } else { fieldParametrisationImpl = fieldParametrisationClass ; } } // We have a candidate class : Candidate candidate = new Candidate ( candidateClass , classOutline . target , field , fieldParametrisationClass , fieldParametrisationImpl , xmlElementDeclModelClass , xmlSchemaModelClass ) ; candidates . add ( candidate ) ; logger . debug ( "Found " + candidate ) ; } return candidates ;
public class QR { /** * Returns the upper triangular factor . */ public DenseMatrix getR ( ) { } }
int n = qr . ncols ( ) ; DenseMatrix R = Matrix . zeros ( n , n ) ; for ( int i = 0 ; i < n ; i ++ ) { R . set ( i , i , tau [ i ] ) ; for ( int j = i + 1 ; j < n ; j ++ ) { R . set ( i , j , qr . get ( i , j ) ) ; } } return R ;
public class IndexBuilder { /** * Should this doc element be added to the index map ? */ protected boolean shouldAddToIndexMap ( Doc element ) { } }
if ( javafx ) { if ( element . tags ( "treatAsPrivate" ) . length > 0 ) { return false ; } } if ( element instanceof PackageDoc ) // Do not add to index map if - nodeprecated option is set and the // package is marked as deprecated . return ! ( noDeprecated && Util . isDeprecated ( element ) ) ; else // Do not add to index map if - nodeprecated option is set and if the // Doc is marked as deprecated or the containing package is marked as // deprecated . return ! ( noDeprecated && ( Util . isDeprecated ( element ) || Util . isDeprecated ( ( ( ProgramElementDoc ) element ) . containingPackage ( ) ) ) ) ;
public class DatabasesInner { /** * Gets a database inside of an elastic pool . * @ 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 serverName The name of the server . * @ param elasticPoolName The name of the elastic pool to be retrieved . * @ param databaseName The name of the database to be retrieved . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the DatabaseInner object */ public Observable < ServiceResponse < DatabaseInner > > getByElasticPoolWithServiceResponseAsync ( String resourceGroupName , String serverName , String elasticPoolName , String databaseName ) { } }
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverName == null ) { throw new IllegalArgumentException ( "Parameter serverName is required and cannot be null." ) ; } if ( elasticPoolName == null ) { throw new IllegalArgumentException ( "Parameter elasticPoolName is required and cannot be null." ) ; } if ( databaseName == null ) { throw new IllegalArgumentException ( "Parameter databaseName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . getByElasticPool ( this . client . subscriptionId ( ) , resourceGroupName , serverName , elasticPoolName , databaseName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < DatabaseInner > > > ( ) { @ Override public Observable < ServiceResponse < DatabaseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < DatabaseInner > clientResponse = getByElasticPoolDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class TemplateUtils { /** * Builds CloudBigtableScanConfiguration from input runtime parameters for export job . */ public static CloudBigtableScanConfiguration BuildExportConfig ( ExportOptions options ) { } }
ValueProvider < ReadRowsRequest > request = new RequestValueProvider ( options ) ; CloudBigtableScanConfiguration . Builder configBuilder = new CloudBigtableScanConfiguration . Builder ( ) . withProjectId ( options . getBigtableProject ( ) ) . withInstanceId ( options . getBigtableInstanceId ( ) ) . withTableId ( options . getBigtableTableId ( ) ) . withAppProfileId ( options . getBigtableAppProfileId ( ) ) . withRequest ( request ) ; return configBuilder . build ( ) ;
public class JCudnn { /** * Helper function to return the minimum size of the workspace to be passed to the reduction given the input and output * tensors */ public static int cudnnGetReductionWorkspaceSize ( cudnnHandle handle , cudnnReduceTensorDescriptor reduceTensorDesc , cudnnTensorDescriptor aDesc , cudnnTensorDescriptor cDesc , long [ ] sizeInBytes ) { } }
return checkResult ( cudnnGetReductionWorkspaceSizeNative ( handle , reduceTensorDesc , aDesc , cDesc , sizeInBytes ) ) ;
public class TensorflowConversion { /** * Convert a { @ link INDArray } * to a { @ link TF _ Tensor } * using zero copy . * It will use the underlying * pointer with in nd4j . * @ param tensor the tensor to use * @ return */ public INDArray ndArrayFromTensor ( TF_Tensor tensor ) { } }
int rank = TF_NumDims ( tensor ) ; int [ ] ndShape ; if ( rank == 0 ) { // scalar ndShape = new int [ ] { 1 } ; } else { ndShape = new int [ rank ] ; for ( int i = 0 ; i < ndShape . length ; i ++ ) { ndShape [ i ] = ( int ) TF_Dim ( tensor , i ) ; } } int tfType = TF_TensorType ( tensor ) ; DataType nd4jType = typeFor ( tfType ) ; int length = ArrayUtil . prod ( ndShape ) ; INDArray array ; if ( nd4jType == DataType . UTF8 ) { String [ ] strings = new String [ length ] ; BytePointer data = new BytePointer ( TF_TensorData ( tensor ) ) . capacity ( TF_TensorByteSize ( tensor ) ) ; BytePointer str = new BytePointer ( ( Pointer ) null ) ; SizeTPointer size = new SizeTPointer ( 1 ) ; TF_Status status = TF_NewStatus ( ) ; for ( int i = 0 ; i < length ; i ++ ) { long offset = data . position ( 8 * i ) . getLong ( ) ; TF_StringDecode ( data . position ( 8 * length + offset ) , data . capacity ( ) - data . position ( ) , str , size , status ) ; if ( TF_GetCode ( status ) != TF_OK ) { throw new IllegalStateException ( "ERROR: Unable to convert tensor " + TF_Message ( status ) . getString ( ) ) ; } strings [ i ] = str . position ( 0 ) . capacity ( size . get ( ) ) . getString ( ) ; } TF_DeleteStatus ( status ) ; array = Nd4j . create ( strings ) ; } else { Pointer pointer = TF_TensorData ( tensor ) . capacity ( length ) ; Indexer indexer = indexerForType ( nd4jType , pointer ) ; DataBuffer d = Nd4j . createBuffer ( indexer . pointer ( ) , nd4jType , length , indexer ) ; array = Nd4j . create ( d , ndShape ) ; } Nd4j . getAffinityManager ( ) . tagLocation ( array , AffinityManager . Location . HOST ) ; return array ;
public class ListGatewaysResult { /** * The gateways in the list . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setGateways ( java . util . Collection ) } or { @ link # withGateways ( java . util . Collection ) } if you want to override * the existing values . * @ param gateways * The gateways in the list . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListGatewaysResult withGateways ( GatewaySummary ... gateways ) { } }
if ( this . gateways == null ) { setGateways ( new java . util . ArrayList < GatewaySummary > ( gateways . length ) ) ; } for ( GatewaySummary ele : gateways ) { this . gateways . add ( ele ) ; } return this ;
public class BaseTable { /** * Init this table . * Add this table to the database and hook this table to the record . * NOTE : For linked tables , only the last table on the chain should be added to the database . * @ param database The database to add this table to . * @ param record The record to connect to this table . */ public void init ( BaseDatabase database , Record record ) { } }
m_database = database ; if ( m_database != null ) m_database . addTable ( this ) ; super . init ( record ) ; m_objectID = null ; m_bIsOpen = false ; m_iRecordStatus = DBConstants . RECORD_INVALID ;
public class CommerceOrderItemPersistenceImpl { /** * Returns the commerce order item with the primary key or returns < code > null < / code > if it could not be found . * @ param primaryKey the primary key of the commerce order item * @ return the commerce order item , or < code > null < / code > if a commerce order item with the primary key could not be found */ @ Override public CommerceOrderItem fetchByPrimaryKey ( Serializable primaryKey ) { } }
Serializable serializable = entityCache . getResult ( CommerceOrderItemModelImpl . ENTITY_CACHE_ENABLED , CommerceOrderItemImpl . class , primaryKey ) ; if ( serializable == nullModel ) { return null ; } CommerceOrderItem commerceOrderItem = ( CommerceOrderItem ) serializable ; if ( commerceOrderItem == null ) { Session session = null ; try { session = openSession ( ) ; commerceOrderItem = ( CommerceOrderItem ) session . get ( CommerceOrderItemImpl . class , primaryKey ) ; if ( commerceOrderItem != null ) { cacheResult ( commerceOrderItem ) ; } else { entityCache . putResult ( CommerceOrderItemModelImpl . ENTITY_CACHE_ENABLED , CommerceOrderItemImpl . class , primaryKey , nullModel ) ; } } catch ( Exception e ) { entityCache . removeResult ( CommerceOrderItemModelImpl . ENTITY_CACHE_ENABLED , CommerceOrderItemImpl . class , primaryKey ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return commerceOrderItem ;
public class NumberUtils { /** * Produces an array with a sequence of integer numbers . * @ param from value to start the sequence from * @ param to value to produce the sequence to * @ return the Integer [ ] sequence * @ since 1.1.2 */ public static Integer [ ] sequence ( final Integer from , final Integer to ) { } }
return sequence ( from , to , Integer . valueOf ( from <= to ? 1 : - 1 ) ) ;
public class ElementReferenceMapper { /** * and resolve the type by its name using a resolve method in the parser environment . */ @ Override public void endVisit ( VariableDeclarationFragment fragment ) { } }
// TODO ( malvania ) : Add field to elementReferenceMap when field detection is enabled and the // ElementUtil . getBinaryName ( ) method doesn ' t break when called on a static block ' s // ExecutableElement . // String fieldID = stitchFieldIdentifier ( fragment ) ; // elementReferenceMap . putIfAbsent ( fieldID , new FieldReferenceNode ( fragment ) ) ; Element element = fragment . getVariableElement ( ) . getEnclosingElement ( ) ; if ( element instanceof TypeElement ) { TypeElement type = ( TypeElement ) element ; if ( ElementUtil . isPublic ( fragment . getVariableElement ( ) ) ) { ClassReferenceNode node = ( ClassReferenceNode ) elementReferenceMap . get ( stitchClassIdentifier ( type ) ) ; if ( node == null ) { node = new ClassReferenceNode ( type ) ; } node . containsPublicField = true ; elementReferenceMap . putIfAbsent ( stitchClassIdentifier ( type ) , node ) ; } }
public class HsqlArrayList { /** * fredt @ users */ public void clear ( ) { } }
if ( minimizeOnClear && reserveElementData != null ) { elementData = reserveElementData ; reserveElementData = null ; elementCount = 0 ; return ; } for ( int i = 0 ; i < elementCount ; i ++ ) { elementData [ i ] = null ; } elementCount = 0 ;
public class ItemDocumentBuilder { /** * Adds an additional site link to the constructed document . * @ param title * the title of the linked page * @ param siteKey * identifier of the site , e . g . , " enwiki " * @ param badges * one or more badges */ public ItemDocumentBuilder withSiteLink ( String title , String siteKey , ItemIdValue ... badges ) { } }
withSiteLink ( factory . getSiteLink ( title , siteKey , Arrays . asList ( badges ) ) ) ; return this ;
public class XMLCaster { /** * casts a value to a XML Element Array * @ param doc XML Document * @ param o Object to cast * @ return XML Comment Array * @ throws PageException */ public static Node [ ] toNodeArray ( Document doc , Object o ) throws PageException { } }
if ( o instanceof Node ) return new Node [ ] { ( Node ) o } ; // Node [ ] if ( o instanceof Node [ ] ) { return ( Node [ ] ) o ; } // Collection else if ( o instanceof Collection ) { Collection coll = ( Collection ) o ; Iterator < Object > it = coll . valueIterator ( ) ; List < Node > nodes = new ArrayList < Node > ( ) ; while ( it . hasNext ( ) ) { nodes . add ( toNode ( doc , it . next ( ) , false ) ) ; } return nodes . toArray ( new Node [ nodes . size ( ) ] ) ; } // Node Map and List Node [ ] nodes = _toNodeArray ( doc , o ) ; if ( nodes != null ) return nodes ; // Single Text Node try { return new Node [ ] { toNode ( doc , o , false ) } ; } catch ( ExpressionException e ) { throw new XMLException ( "can't cast Object of type " + Caster . toClassName ( o ) + " to a XML Node Array" ) ; }
public class BundleUtils { /** * Returns a optional { @ link java . io . Serializable } . In other words , returns the value mapped by key if it exists and is a { @ link java . io . Serializable } . * The bundle argument is allowed to be { @ code null } . If the bundle is null , this method returns null . * @ param bundle a bundle . If the bundle is null , this method will return null . * @ param key a key for the value . * @ param fallback fallback value . * @ return a { @ link java . io . Serializable } { @ link java . util . ArrayList } value if exists , null otherwise . * @ see android . os . Bundle # getSerializable ( String ) */ @ Nullable @ SuppressWarnings ( "unchecked" ) // Bundle # getSerializable ( String ) returns Serializable object so it is safe to cast to a type which extends Serializable . public static < T extends Serializable > T optSerializable ( @ Nullable Bundle bundle , @ Nullable String key , @ Nullable T fallback ) { } }
if ( bundle == null ) { return fallback ; } return ( T ) bundle . getSerializable ( key ) ;
public class AbstractStream { /** * Creates a new { @ link PropertyChangeEvent } and delivers it to all currently registered state listeners . * @ param oldState * the { @ link StreamState } we had before the change * @ param newState * the { @ link StreamState } we had after the change */ protected void fireStateChange ( StreamState oldState , StreamState newState ) { } }
final PropertyChangeEvent evt = new PropertyChangeEvent ( this , "StreamState" , oldState , newState ) ; for ( PropertyChangeListener listener : stateListeners ) { listener . propertyChange ( evt ) ; }
public class Single { /** * Provides an API ( via a cold Completable ) that bridges the reactive world with the callback - style world . * < img width = " 640 " height = " 454 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . create . png " alt = " " > * Example : * < pre > < code > * Single . & lt ; Event & gt ; create ( emitter - & gt ; { * Callback listener = new Callback ( ) { * & # 64 ; Override * public void onEvent ( Event e ) { * emitter . onSuccess ( e ) ; * & # 64 ; Override * public void onFailure ( Exception e ) { * emitter . onError ( e ) ; * AutoCloseable c = api . someMethod ( listener ) ; * emitter . setCancellable ( c : : close ) ; * < / code > < / pre > * < dl > * < dt > < b > Scheduler : < / b > < / dt > * < dd > { @ code create } does not operate by default on a particular { @ link Scheduler } . < / dd > * < / dl > * @ param < T > the value type * @ param source the emitter that is called when a SingleObserver subscribes to the returned { @ code Single } * @ return the new Single instance * @ see SingleOnSubscribe * @ see Cancellable */ @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Single < T > create ( SingleOnSubscribe < T > source ) { } }
ObjectHelper . requireNonNull ( source , "source is null" ) ; return RxJavaPlugins . onAssembly ( new SingleCreate < T > ( source ) ) ;
public class LevelDbInputReader { /** * Copies a list of byteBuffers into a single new byteBuffer . */ private static ByteBuffer copyAll ( List < ByteBuffer > buffers ) { } }
int size = 0 ; for ( ByteBuffer b : buffers ) { size += b . remaining ( ) ; } ByteBuffer result = allocate ( size ) ; for ( ByteBuffer b : buffers ) { result . put ( b ) ; } result . flip ( ) ; return result ;
public class FPGrowth { /** * Insert a item to the front of an item set . * @ param itemset the original item set . * @ param item the new item to be inserted . * @ return the combined item set */ static int [ ] insert ( int [ ] itemset , int item ) { } }
if ( itemset == null ) { int [ ] newItemset = { item } ; return newItemset ; } else { int n = itemset . length + 1 ; int [ ] newItemset = new int [ n ] ; newItemset [ 0 ] = item ; System . arraycopy ( itemset , 0 , newItemset , 1 , n - 1 ) ; return newItemset ; }
public class SimpleValidationResultsReporter { /** * Get the message that should be reported . * Searching takes following rules into account : * < ul > * < li > Severity of the selected message is the most severe one ( INFO < * WARNING < ERROR ) . < / li > * < li > Timestamp of the selected message is the most recent one of the * result of the previous rule . < / li > * < / ul > * Any custom Severities will be placed in order according to their given * magnitude . * @ param resultsModel Search this model to find the message . * @ return the message to display on the Messagable . */ protected ValidationMessage getValidationMessage ( ValidationResults resultsModel ) { } }
ValidationMessage validationMessage = null ; for ( Iterator i = resultsModel . getMessages ( ) . iterator ( ) ; i . hasNext ( ) ; ) { ValidationMessage tmpMessage = ( ValidationMessage ) i . next ( ) ; if ( validationMessage == null || ( validationMessage . getSeverity ( ) . compareTo ( tmpMessage . getSeverity ( ) ) < 0 ) || ( ( validationMessage . getTimestamp ( ) < tmpMessage . getTimestamp ( ) ) && ( validationMessage . getSeverity ( ) == tmpMessage . getSeverity ( ) ) ) ) { validationMessage = tmpMessage ; } } return validationMessage ;
public class GIMDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . GIMD__DATA : return getDATA ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class NodeImpl { /** * Return Node corresponding to this Node . * @ param corrSession * session on corresponding Workspace * @ return NodeData corresponding Node * @ throws ItemNotFoundException * if corresponding Node not found * @ throws AccessDeniedException * if read impossible due to permisions * @ throws RepositoryException * if any other error occurs */ protected NodeData getCorrespondingNodeData ( SessionImpl corrSession ) throws ItemNotFoundException , AccessDeniedException , RepositoryException { } }
final QPath myPath = nodeData ( ) . getQPath ( ) ; final SessionDataManager corrDataManager = corrSession . getTransientNodesManager ( ) ; if ( this . isNodeType ( Constants . MIX_REFERENCEABLE ) ) { NodeData corrNode = ( NodeData ) corrDataManager . getItemData ( getUUID ( ) ) ; if ( corrNode != null ) { return corrNode ; } } else { NodeData ancestor = ( NodeData ) dataManager . getItemData ( Constants . ROOT_UUID ) ; for ( int i = 1 ; i < myPath . getDepth ( ) ; i ++ ) { ancestor = ( NodeData ) dataManager . getItemData ( ancestor , myPath . getEntries ( ) [ i ] , ItemType . NODE ) ; if ( corrSession . getWorkspace ( ) . getNodeTypesHolder ( ) . isNodeType ( Constants . MIX_REFERENCEABLE , ancestor . getPrimaryTypeName ( ) , ancestor . getMixinTypeNames ( ) ) ) { NodeData corrAncestor = ( NodeData ) corrDataManager . getItemData ( ancestor . getIdentifier ( ) ) ; if ( corrAncestor == null ) { throw new ItemNotFoundException ( "No corresponding path for ancestor " + ancestor . getQPath ( ) . getAsString ( ) + " in " + corrSession . getWorkspace ( ) . getName ( ) ) ; } NodeData corrNode = ( NodeData ) corrDataManager . getItemData ( corrAncestor , myPath . getRelPath ( myPath . getDepth ( ) - i ) , ItemType . NODE ) ; if ( corrNode != null ) { return corrNode ; } } } } NodeData corrNode = ( NodeData ) corrDataManager . getItemData ( myPath ) ; if ( corrNode != null ) { return corrNode ; } throw new ItemNotFoundException ( "No corresponding path for " + getPath ( ) + " in " + corrSession . getWorkspace ( ) . getName ( ) ) ;
public class Messenger { /** * Sending activation code via voice * @ param transactionHash transaction hash * @ return promice of Boolean */ @ NotNull @ ObjectiveCName ( "doSendCodeViaCall:" ) public Promise < Boolean > doSendCodeViaCall ( String transactionHash ) { } }
return modules . getAuthModule ( ) . doSendCall ( transactionHash ) ;
public class ArrayUtility { /** * Recursively appends all Items specified as a comma separated list to the specified { @ link Collection } . * @ param < Item > * type of the array items * @ param items * comma separated sequence of Items * @ param target * target { @ link Collection } of Items */ @ SafeVarargs public static < Item > void flatten ( final Collection < ? super Item > target , final Item ... items ) { } }
flattenAsStream ( items ) . forEachOrdered ( target :: add ) ;
public class Period { /** * Returns a new period with the specified number of millis . * This period instance is immutable and unaffected by this method call . * @ param millis the amount of millis to add , may be negative * @ return the new period with the increased millis * @ throws UnsupportedOperationException if the field is not supported */ public Period withMillis ( int millis ) { } }
int [ ] values = getValues ( ) ; // cloned getPeriodType ( ) . setIndexedField ( this , PeriodType . MILLI_INDEX , values , millis ) ; return new Period ( values , getPeriodType ( ) ) ;
public class PrequentialEvaluation { private static boolean isLearnerAndEvaluatorCompatible ( Learner learner , PerformanceEvaluator evaluator ) { } }
return ( learner instanceof RegressionLearner && evaluator instanceof RegressionPerformanceEvaluator ) || ( learner instanceof ClassificationLearner && evaluator instanceof ClassificationPerformanceEvaluator ) ;
public class UpdateUserPoolClientRequest { /** * A list of provider names for the identity providers that are supported on this client . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setSupportedIdentityProviders ( java . util . Collection ) } or * { @ link # withSupportedIdentityProviders ( java . util . Collection ) } if you want to override the existing values . * @ param supportedIdentityProviders * A list of provider names for the identity providers that are supported on this client . * @ return Returns a reference to this object so that method calls can be chained together . */ public UpdateUserPoolClientRequest withSupportedIdentityProviders ( String ... supportedIdentityProviders ) { } }
if ( this . supportedIdentityProviders == null ) { setSupportedIdentityProviders ( new java . util . ArrayList < String > ( supportedIdentityProviders . length ) ) ; } for ( String ele : supportedIdentityProviders ) { this . supportedIdentityProviders . add ( ele ) ; } return this ;
public class JSpinners { /** * Set whether the value of the given spinner may be changed with * mouse drags * @ param spinner The spinner * @ param enabled Whether dragging is enabled * @ throws IllegalArgumentException If the given spinner does not * have a SpinnerNumberModel */ public static void setSpinnerDraggingEnabled ( final JSpinner spinner , boolean enabled ) { } }
SpinnerModel spinnerModel = spinner . getModel ( ) ; if ( ! ( spinnerModel instanceof SpinnerNumberModel ) ) { throw new IllegalArgumentException ( "Dragging is only possible for spinners with a " + "SpinnerNumberModel, found " + spinnerModel . getClass ( ) ) ; } if ( enabled ) { disableSpinnerDragging ( spinner ) ; enableSpinnerDragging ( spinner ) ; } else { disableSpinnerDragging ( spinner ) ; }
public class GVRMesh { /** * A static method to generate a curved mesh along an arc . * Note the width and height arguments are used only as a means to * get the width : height ratio . * @ param gvrContext the current context * @ param width a number representing the width * @ param height a number representing the height * @ param centralAngle the central angle of the arc * @ param radius the radius of the circle * @ return */ public static GVRMesh createCurvedMesh ( GVRContext gvrContext , int width , int height , float centralAngle , float radius ) { } }
GVRMesh mesh = new GVRMesh ( gvrContext ) ; final float MAX_DEGREES_PER_SUBDIVISION = 10f ; float ratio = ( float ) width / ( float ) height ; int subdivisions = ( int ) Math . ceil ( centralAngle / MAX_DEGREES_PER_SUBDIVISION ) ; float degreesPerSubdivision = centralAngle / subdivisions ; // Scale the number of subdivisions with the central angle size // Let each subdivision represent a constant number of degrees on the arc double startDegree = - centralAngle / 2.0 ; float h = ( float ) ( radius * Math . toRadians ( centralAngle ) ) / ratio ; float yTop = h / 2 ; float yBottom = - yTop ; float [ ] vertices = new float [ ( subdivisions + 1 ) * 6 ] ; float [ ] normals = new float [ ( subdivisions + 1 ) * 6 ] ; float [ ] texCoords = new float [ ( subdivisions + 1 ) * 4 ] ; char [ ] triangles = new char [ subdivisions * 6 ] ; /* * The following diagram illustrates the construction method * Let s be the number of subdivisions , then we create s pairs of vertices * like so * { 0 } { 2 } { 4 } . . . { 2s - 1} * { 1 } { 3 } { 5 } . . . { 2s } | _ _ _ x + */ for ( int i = 0 ; i <= subdivisions ; i ++ ) { double angle = Math . toRadians ( - 90 + startDegree + degreesPerSubdivision * i ) ; double cos = Math . cos ( angle ) ; double sin = Math . sin ( angle ) ; float x = ( float ) ( radius * cos ) ; float z = ( float ) ( ( radius * sin ) + radius ) ; vertices [ 6 * i ] = x ; vertices [ 6 * i + 1 ] = yTop ; vertices [ 6 * i + 2 ] = z ; normals [ 6 * i ] = ( float ) - cos ; normals [ 6 * i + 1 ] = 0.0f ; normals [ 6 * i + 2 ] = ( float ) - sin ; texCoords [ 4 * i ] = ( float ) i / subdivisions ; texCoords [ 4 * i + 1 ] = 0.0f ; vertices [ 6 * i + 3 ] = x ; vertices [ 6 * i + 4 ] = yBottom ; vertices [ 6 * i + 5 ] = z ; normals [ 6 * i + 3 ] = ( float ) - cos ; normals [ 6 * i + 4 ] = 0.0f ; normals [ 6 * i + 5 ] = ( float ) - sin ; texCoords [ 4 * i + 2 ] = ( float ) i / subdivisions ; texCoords [ 4 * i + 3 ] = 1.0f ; } /* * Referring to the diagram above , we create two triangles * for each pair of consecutive pairs of vertices * ( e . g . we create two triangles with { 0 , 1 } and { 2 , 3} * and two triangles with { 2 , 3 } and { 4 , 5 } ) * { 0 } - - { 2 } - - { 4 } - . . . - { 2s - 1} * { 1 } - - { 3 } - - { 5 } - . . . - { 2s } | _ _ _ x + */ for ( int i = 0 ; i < subdivisions ; i ++ ) { triangles [ 6 * i ] = ( char ) ( 2 * ( i + 1 ) + 1 ) ; triangles [ 6 * i + 1 ] = ( char ) ( 2 * ( i ) ) ; triangles [ 6 * i + 2 ] = ( char ) ( 2 * ( i ) + 1 ) ; triangles [ 6 * i + 3 ] = ( char ) ( 2 * ( i + 1 ) + 1 ) ; triangles [ 6 * i + 4 ] = ( char ) ( 2 * ( i + 1 ) ) ; triangles [ 6 * i + 5 ] = ( char ) ( 2 * ( i ) ) ; } mesh . setVertices ( vertices ) ; mesh . setNormals ( normals ) ; mesh . setTexCoords ( texCoords ) ; mesh . setIndices ( triangles ) ; return mesh ;
public class SimpleHTTPRequestParser { /** * This function returns the file info from the request data . * @ param inputData * The input data * @ return The file info */ @ Override protected FileInfo getFileInfoFromInputDataImpl ( HTTPRequest inputData ) { } }
// get parameters text as map Map < String , String > queryStringMap = this . convertParametersTextToMap ( inputData ) ; // get file info FileInfo fileInfo = this . getFileInfoFromRequestImpl ( inputData , queryStringMap ) ; return fileInfo ;
public class TrieNode { /** * Gets parent . * @ return the parent */ public TrieNode getParent ( ) { } }
if ( 0 == index ) return null ; if ( null == parent && - 1 == depth ) { synchronized ( this ) { if ( null == parent ) { parent = newNode ( trie . parentIndex [ index ] ) ; assert ( parent . index < index ) ; } } } return parent ;
public class FilterByteBuffer { /** * Skips output so that position % align = = 0 * @ param align * @ throws IOException */ public void alignInput ( int align ) throws IOException { } }
int mod = position % align ; if ( mod > 0 ) { skipInput ( align - mod ) ; }
public class FileMetadata { /** * For testing purpose */ public Metadata readMetadata ( Reader reader ) { } }
LineCounter lineCounter = new LineCounter ( "fromString" , StandardCharsets . UTF_16 ) ; FileHashComputer fileHashComputer = new FileHashComputer ( "fromString" ) ; LineOffsetCounter lineOffsetCounter = new LineOffsetCounter ( ) ; CharHandler [ ] handlers = { lineCounter , fileHashComputer , lineOffsetCounter } ; try { read ( reader , handlers ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Should never occur" , e ) ; } return new Metadata ( lineCounter . lines ( ) , lineCounter . nonBlankLines ( ) , fileHashComputer . getHash ( ) , lineOffsetCounter . getOriginalLineStartOffsets ( ) , lineOffsetCounter . getOriginalLineEndOffsets ( ) , lineOffsetCounter . getLastValidOffset ( ) ) ;
public class BatchHelper { /** * Sends any currently remaining requests in the batch ; should be called at the end of any series * of batched requests to ensure everything has been sent . */ public void flush ( ) throws IOException { } }
try { flushIfPossible ( true ) ; checkState ( pendingRequests . isEmpty ( ) , "pendingRequests should be empty after flush" ) ; checkState ( responseFutures . isEmpty ( ) , "responseFutures should be empty after flush" ) ; } finally { requestsExecutor . shutdown ( ) ; try { if ( ! requestsExecutor . awaitTermination ( 1 , TimeUnit . SECONDS ) ) { logger . atWarning ( ) . log ( "Forcibly shutting down batch helper thread pool." ) ; requestsExecutor . shutdownNow ( ) ; } } catch ( InterruptedException e ) { logger . atFine ( ) . withCause ( e ) . log ( "Failed to await termination: forcibly shutting down batch helper thread pool." ) ; requestsExecutor . shutdownNow ( ) ; } }
public class SeparatorSet { /** * Analyzes the area and detects the separators that are implemented as borders * or background changes . */ private void analyzeAreaSeparators ( AreaImpl area ) { } }
boolean isep = area . isExplicitlySeparated ( ) || area . isBackgroundSeparated ( ) ; if ( isep || area . separatedUp ( ) ) bsep . add ( new Separator ( Separator . BOXH , area . getX1 ( ) , area . getY1 ( ) , area . getX2 ( ) , area . getY1 ( ) + ART_SEP_WIDTH - 1 ) ) ; if ( isep || area . separatedDown ( ) ) bsep . add ( new Separator ( Separator . BOXH , area . getX1 ( ) , area . getY2 ( ) - ART_SEP_WIDTH + 1 , area . getX2 ( ) , area . getY2 ( ) ) ) ; if ( isep || area . separatedLeft ( ) ) bsep . add ( new Separator ( Separator . BOXV , area . getX1 ( ) , area . getY1 ( ) , area . getX1 ( ) + ART_SEP_WIDTH - 1 , area . getY2 ( ) ) ) ; if ( isep || area . separatedRight ( ) ) bsep . add ( new Separator ( Separator . BOXV , area . getX2 ( ) - ART_SEP_WIDTH + 1 , area . getY1 ( ) , area . getX2 ( ) , area . getY2 ( ) ) ) ;
public class Util { /** * Checks whether the given resource is a Java artifact ( i . e . either a Java * source file or a Java class file ) . * @ param resource * The resource to check . * @ return < code > true < / code > if the given resource is a Java artifact . * < code > false < / code > otherwise . */ public static boolean isJavaArtifact ( IResource resource ) { } }
if ( resource == null || ( resource . getType ( ) != IResource . FILE ) ) { return false ; } String ex = resource . getFileExtension ( ) ; if ( "java" . equalsIgnoreCase ( ex ) || "class" . equalsIgnoreCase ( ex ) ) { return true ; } String name = resource . getName ( ) ; return Archive . isArchiveFileName ( name ) ;
public class DialogPreference { /** * Sets the scrollable area of the preference ' s dialog . * @ param top * The top scrollable area , which should be set , as a value of the enum Area or null , if * no scrollable area should be set * @ param bottom * The bottom scrollable area , which should be set , as a value of the enum Area or null , * if no scrollable area should be set . The index of the bottom area must be at leas the * index of the top area . If the top area is null , the bottom area must be null as well */ public final void setDialogScrollableArea ( @ Nullable final Area top , @ Nullable final Area bottom ) { } }
this . dialogScrollableArea = ScrollableArea . create ( top , bottom ) ;
public class IntegerFieldOption { /** * / * ( non - Javadoc ) * @ see ca . eandb . util . args . AbstractFieldOption # getOptionValue ( java . util . Queue ) */ @ Override protected Object getOptionValue ( Queue < String > argq ) { } }
return Integer . parseInt ( argq . remove ( ) ) ;
public class UserAgent { /** * Returns UserAgent based on specified unique id * @ param id Id value of the user agent . * @ return UserAgent */ public static UserAgent valueOf ( int id ) { } }
OperatingSystem operatingSystem = OperatingSystem . valueOf ( ( short ) ( id >> 16 ) ) ; Browser browser = Browser . valueOf ( ( short ) ( id & 0x0FFFF ) ) ; return new UserAgent ( operatingSystem , browser ) ;
public class DoublesPmfCdfImpl { /** * This one does a linear time simultaneous walk of the samples and splitPoints . Because this * internal procedure is called multiple times , we require the caller to ensure these 3 properties : * < ol > * < li > samples array must be sorted . < / li > * < li > splitPoints must be unique and sorted < / li > * < li > number of SplitPoints + 1 = = counters . length < / li > * < / ol > * @ param samples DoublesBufferAccessor holding an array of samples * @ param weight of the samples * @ param splitPoints must be unique and sorted . Number of splitPoints + 1 = counters . length . * @ param counters array of counters */ static void linearTimeIncrementHistogramCounters ( final DoublesBufferAccessor samples , final long weight , final double [ ] splitPoints , final double [ ] counters ) { } }
int i = 0 ; int j = 0 ; while ( i < samples . numItems ( ) && j < splitPoints . length ) { if ( samples . get ( i ) < splitPoints [ j ] ) { counters [ j ] += weight ; // this sample goes into this bucket i ++ ; // move on to next sample and see whether it also goes into this bucket } else { j ++ ; // no more samples for this bucket . move on the next bucket . } } // now either i = = numSamples ( we are out of samples ) , or // j = = numSplitPoints ( out of buckets , but there are more samples remaining ) // we only need to do something in the latter case . if ( j == splitPoints . length ) { counters [ j ] += ( weight * ( samples . numItems ( ) - i ) ) ; }
public class BeanPropertyPathExtension { /** * If the type is optional of number | null | undefined , or list of * of integer , we want to be able to recognize it as number * to link the member to another class . * = > extract the original type while ignoring the | null | undefined * and optional informations . */ private static TsType extractOriginalTsType ( TsType type ) { } }
if ( type instanceof TsType . OptionalType ) { return extractOriginalTsType ( ( ( TsType . OptionalType ) type ) . type ) ; } if ( type instanceof TsType . UnionType ) { TsType . UnionType union = ( TsType . UnionType ) type ; List < TsType > originalTypes = new ArrayList < > ( ) ; for ( TsType curType : union . types ) { if ( isOriginalTsType ( curType ) ) { originalTypes . add ( curType ) ; } } return originalTypes . size ( ) == 1 ? extractOriginalTsType ( originalTypes . get ( 0 ) ) : type ; } if ( type instanceof TsType . BasicArrayType ) { return extractOriginalTsType ( ( ( TsType . BasicArrayType ) type ) . elementType ) ; } return type ;
public class LCharToIntFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */ @ Nonnull public static LCharToIntFunction charToIntFunctionFrom ( Consumer < LCharToIntFunctionBuilder > buildingFunction ) { } }
LCharToIntFunctionBuilder builder = new LCharToIntFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ;
public class SecurityServletConfiguratorHelper { /** * process the @ LoginConfig annotation . */ protected void configureMpJwt ( boolean doFeatureCheck ) { } }
if ( doFeatureCheck && ! MpJwtHelper . isMpJwtFeatureActive ( ) ) { return ; } String annoName = "org.eclipse.microprofile.auth.LoginConfig" ; Set < String > annotatedClasses = null ; InfoStore annosInfo = null ; try { annotatedClasses = configurator . getWebAnnotations ( ) . getAnnotationTargets ( ) . getAnnotatedClasses ( annoName ) ; annosInfo = configurator . getWebAnnotations ( ) . getInfoStore ( ) ; } catch ( UnableToAdaptException e ) { // ffdc and return return ; } if ( annotatedClasses . size ( ) == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "no annotated classes found, return" ) ; } return ; } if ( loginConfiguration != null && ! loginConfiguration . isAuthenticationMethodDefaulted ( ) ) { // we already have something from web . xml , annos don ' t matter . if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "already have auth method determined, return" ) ; } return ; } // we have an annotation and no DD , so check it out String className = annotatedClasses . iterator ( ) . next ( ) ; ClassInfo ci = annosInfo . getDelayableClassInfo ( className ) ; boolean isValid = false ; while ( ci != null ) { if ( "javax.ws.rs.core.Application" . equals ( ci . getSuperclassName ( ) ) ) { isValid = true ; break ; } ci = ci . getSuperclass ( ) ; } ci = annosInfo . getDelayableClassInfo ( className ) ; if ( ! isValid ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "loginConfig annotation found, but on wrong class, " + ci . getSuperclassName ( ) + ", return" ) ; } return ; } AnnotationInfo ai = ci . getAnnotation ( annoName ) ; AnnotationValue authMethod , realmName ; authMethod = ai . getValue ( "authMethod" ) ; realmName = ai . getValue ( "realmName" ) ; String authMethodString = authMethod == null ? null : authMethod . getStringValue ( ) ; String realmNameString = realmName == null ? null : realmName . getStringValue ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "setting authMethod and realm to: " + authMethodString + " " + realmNameString ) ; } loginConfiguration = new LoginConfigurationImpl ( authMethodString , realmNameString , null ) ;
public class RandomAccessFileBuffer { /** * Puts a single byte in the buffer . */ @ Override // @ NotThreadSafe public void put ( long position , byte value ) throws IOException { } }
if ( position >= capacity ( ) ) throw new BufferOverflowException ( ) ; raf . seek ( position ) ; raf . write ( value ) ;
public class PrcBankStatementLineSave { /** * < p > Makes BSL result description . < / p > * @ param pResAct action * @ param pDateFormat Date Formatter * @ param pRecord Record * @ param pDate Date * @ param pLangDef language * @ return description */ public final String makeBslResDescr ( final EBankEntryResultAction pResAct , final DateFormat pDateFormat , final APersistableBase pRecord , final Date pDate , final String pLangDef ) { } }
StringBuffer sb = new StringBuffer ( ) ; if ( EBankEntryResultAction . MATCH . equals ( pResAct ) ) { sb . append ( getSrvI18n ( ) . getMsg ( "Found" , pLangDef ) ) ; } else { sb . append ( getSrvI18n ( ) . getMsg ( "Created" , pLangDef ) ) ; } sb . append ( " " + getSrvI18n ( ) . getMsg ( pRecord . getClass ( ) . getSimpleName ( ) + "short" , pLangDef ) ) ; sb . append ( "#" + pRecord . getIdDatabaseBirth ( ) + "-" + pRecord . getItsId ( ) + ", " + pDateFormat . format ( pDate ) ) ; return sb . toString ( ) ;
public class Matrix4d { /** * / * ( non - Javadoc ) * @ see org . joml . Matrix4dc # mulLocal ( org . joml . Matrix4dc , org . joml . Matrix4d ) */ public Matrix4d mulLocal ( Matrix4dc left , Matrix4d dest ) { } }
if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . set ( left ) ; else if ( ( left . properties ( ) & PROPERTY_IDENTITY ) != 0 ) return dest . set ( this ) ; else if ( ( properties & PROPERTY_AFFINE ) != 0 && ( left . properties ( ) & PROPERTY_AFFINE ) != 0 ) return mulLocalAffine ( left , dest ) ; return mulLocalGeneric ( left , dest ) ;
public class MicroServiceTemplateSupport { /** * � � � ҵ � � id � � � � � ݼ � 1 ⁄ 4 * @ param bizid ҵ � � � � � * @ param tableName � � � � � * @ param bizCol ҵ � � � � � * @ param requestParamMap � ύ � � � � * @ param cusCondition � � � � � ַ � * @ param cusSetStr � � � � set � ַ � * @ param modelName ģ � � � � � * @ return * @ throws Exception */ public Integer updateInfoByBizIdServiceInner ( String bizId , String tableName , String bizCol , Map requestParamMap , String cusCondition , String cusSetStr , String modelName ) throws Exception { } }
// add 20170829 ninghao Integer filterViewRet = filterView ( tableName , requestParamMap , bizId , bizCol , TYPE_UPDATE_BIZID ) ; if ( filterViewRet != null && filterViewRet > 0 ) { return filterViewRet ; } // add 20170627 ninghao filterParam ( tableName , requestParamMap ) ; String tempDbType = calcuDbType ( ) ; String condition = Cutil . rep ( bizCol + "=?" , bizId ) ; if ( modelName == null || "" . equals ( modelName ) ) { modelName = tableName ; } // add 201807 ning // Map requestParamMap = changeCase4Param ( requestParamMap0 ) ; Map modelEntryMap = getModelEntryMap ( requestParamMap , tableName , modelName , dbName ) ; List placeList = new ArrayList ( ) ; String setStr = createUpdateInStr ( requestParamMap , modelEntryMap , placeList ) ; String nCondition = Cutil . jn ( " and " , cusCondition , condition ) ; String nSetStr = Cutil . jn ( "," , setStr , cusSetStr ) ; placeList . add ( bizId ) ; Integer retStatus = getInnerDao ( ) . updateObjByCondition ( tableName , nCondition , nSetStr , placeList . toArray ( ) ) ; return retStatus ;