signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class MethodCallImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case SimpleExpressionsPackage . METHOD_CALL__VALUE : setValue ( VALUE_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ;
public class cacheglobal_cachepolicy_binding { /** * Use this API to fetch filtered set of cacheglobal _ cachepolicy _ binding resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static cacheglobal_cachepolicy_binding [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
cacheglobal_cachepolicy_binding obj = new cacheglobal_cachepolicy_binding ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; cacheglobal_cachepolicy_binding [ ] response = ( cacheglobal_cachepolicy_binding [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class MLEDependencyGrammar { /** * Return the probability ( as a real number between 0 and 1 ) of stopping * rather than generating another argument at this position . * @ param dependency The dependency used as the basis for stopping on . * Tags are assumed to be in the TagProjection space . * @ return The probability of generating this stop probability */ protected double getStopProb ( IntDependency dependency ) { } }
short binDistance = distanceBin ( dependency . distance ) ; IntTaggedWord unknownHead = new IntTaggedWord ( - 1 , dependency . head . tag ) ; IntTaggedWord anyHead = new IntTaggedWord ( ANY_WORD_INT , dependency . head . tag ) ; IntDependency temp = new IntDependency ( dependency . head , stopTW , dependency . leftHeaded , binDistance ) ; double c_stop_hTWds = stopCounter . getCount ( temp ) ; temp = new IntDependency ( unknownHead , stopTW , dependency . leftHeaded , binDistance ) ; double c_stop_hTds = stopCounter . getCount ( temp ) ; temp = new IntDependency ( dependency . head , wildTW , dependency . leftHeaded , binDistance ) ; double c_hTWds = stopCounter . getCount ( temp ) ; temp = new IntDependency ( anyHead , wildTW , dependency . leftHeaded , binDistance ) ; double c_hTds = stopCounter . getCount ( temp ) ; double p_stop_hTds = ( c_hTds > 0.0 ? c_stop_hTds / c_hTds : 1.0 ) ; double pb_stop_hTWds = ( c_stop_hTWds + smooth_stop * p_stop_hTds ) / ( c_hTWds + smooth_stop ) ; if ( verbose ) { System . out . println ( " c_stop_hTWds: " + c_stop_hTWds + "; c_hTWds: " + c_hTWds + "; c_stop_hTds: " + c_stop_hTds + "; c_hTds: " + c_hTds ) ; System . out . println ( " Generate STOP prob: " + pb_stop_hTWds ) ; } return pb_stop_hTWds ;
public class UriEscape { /** * Perform am URI path segment < strong > unescape < / strong > operation * on a < tt > String < / tt > input . * This method will unescape every percent - encoded ( < tt > % HH < / tt > ) sequences present in input , * even for those characters that do not need to be percent - encoded in this context ( unreserved characters * can be percent - encoded even if / when this is not required , though it is not generally considered a * good practice ) . * This method will use specified < tt > encoding < / tt > in order to determine the characters specified in the * percent - encoded byte sequences . * This method is < strong > thread - safe < / strong > . * @ param text the < tt > String < / tt > to be unescaped . * @ param encoding the encoding to be used for unescaping . * @ return The unescaped result < tt > String < / tt > . As a memory - performance improvement , will return the exact * same object as the < tt > text < / tt > input argument if no unescaping modifications were required ( and * no additional < tt > String < / tt > objects will be created during processing ) . Will * return < tt > null < / tt > if input is < tt > null < / tt > . */ public static String unescapeUriPathSegment ( final String text , final String encoding ) { } }
if ( encoding == null ) { throw new IllegalArgumentException ( "Argument 'encoding' cannot be null" ) ; } return UriEscapeUtil . unescape ( text , UriEscapeUtil . UriEscapeType . PATH_SEGMENT , encoding ) ;
public class KTypeHashSet { /** * @ see # indexOf * @ param index The index of a given key , as returned from { @ link # indexOf } . * @ return Returns < code > true < / code > if the index corresponds to an existing key * or false otherwise . This is equivalent to checking whether the index is * a positive value ( existing keys ) or a negative value ( non - existing keys ) . */ public boolean indexExists ( int index ) { } }
assert index < 0 || ( index >= 0 && index <= mask ) || ( index == mask + 1 && hasEmptyKey ) ; return index >= 0 ;
public class HBaseSchemaManager { /** * ( non - Javadoc ) * @ see * com . impetus . kundera . configure . schema . api . AbstractSchemaManager # validate * ( java . util . List ) */ @ Override protected void validate ( List < TableInfo > tableInfos ) { } }
try { if ( isNamespaceAvailable ( databaseName ) ) { for ( TableInfo tableInfo : tableInfos ) { if ( tableInfo != null ) { HTableDescriptor hTableDescriptor = admin . getTableDescriptor ( ( databaseName + ":" + tableInfo . getTableName ( ) ) . getBytes ( ) ) ; boolean columnFamilyFound = false ; Boolean f = false ; for ( HColumnDescriptor columnDescriptor : hTableDescriptor . getColumnFamilies ( ) ) { if ( ! columnFamilyFound && columnDescriptor . getNameAsString ( ) . equalsIgnoreCase ( tableInfo . getTableName ( ) ) ) { columnFamilyFound = true ; } for ( CollectionColumnInfo cci : tableInfo . getCollectionColumnMetadatas ( ) ) { if ( columnDescriptor . getNameAsString ( ) . equalsIgnoreCase ( cci . getCollectionColumnName ( ) ) ) { f = true ; break ; } } if ( ! ( columnFamilyFound || f ) ) { throw new SchemaGenerationException ( "column " + tableInfo . getTableName ( ) + " does not exist in table " + databaseName + "" , "Hbase" , databaseName , tableInfo . getTableName ( ) ) ; } // TODO make a check for sec table } } } } else { throw new SchemaGenerationException ( "Namespace" + databaseName + "does not exist" , "HBase" , databaseName ) ; } } catch ( TableNotFoundException tnfex ) { throw new SchemaGenerationException ( "table " + databaseName + " does not exist " , tnfex , "Hbase" ) ; } catch ( IOException ioe ) { logger . error ( "Either check for network connection or table isn't in enabled state, Caused by:" , ioe ) ; throw new SchemaGenerationException ( ioe , "Hbase" ) ; }
public class PrcRefreshItemsInList { /** * < p > Retrieve Item Places ( outdated or all ) . < / p > * @ param < T > item place type * @ param pReqVars additional param * @ param pLuv last updated version or null for all * @ param pItemPlaceCl Item Place Class * @ return Outdated Item Place list * @ throws Exception - an exception */ public final < T extends AItemPlace < ? , ? > > List < T > retrieveItemPlaceLst ( final Map < String , Object > pReqVars , final Long pLuv , final Class < T > pItemPlaceCl ) throws Exception { } }
List < T > result = null ; try { this . srvDatabase . setIsAutocommit ( false ) ; this . srvDatabase . setTransactionIsolation ( ISrvDatabase . TRANSACTION_READ_UNCOMMITTED ) ; this . srvDatabase . beginTransaction ( ) ; String tblNm = pItemPlaceCl . getSimpleName ( ) . toUpperCase ( ) ; String verCond ; if ( pLuv != null ) { verCond = " where " + tblNm + ".ITSVERSION>" + pLuv . toString ( ) ; } else { verCond = "" ; } result = getSrvOrm ( ) . retrieveListWithConditions ( pReqVars , pItemPlaceCl , verCond + " order by " + tblNm + ".ITSVERSION" ) ; this . srvDatabase . commitTransaction ( ) ; } catch ( Exception ex ) { if ( ! this . srvDatabase . getIsAutocommit ( ) ) { this . srvDatabase . rollBackTransaction ( ) ; } throw ex ; } finally { this . srvDatabase . releaseResources ( ) ; } return result ;
public class WebDavServletController { /** * Convenience function to stop this servlet . * @ throws ServerLifecycleException If the servlet could not be stopped for any unexpected reason . */ public void stop ( ) throws ServerLifecycleException { } }
try { contextHandler . stop ( ) ; contextHandlerCollection . removeHandler ( contextHandler ) ; contextHandlerCollection . mapContexts ( ) ; LOG . info ( "WebDavServlet stopped: " + contextPath ) ; } catch ( Exception e ) { throw new ServerLifecycleException ( "Servlet couldn't be stopped" , e ) ; }
public class BSHPrimarySuffix { /** * Perform a suffix operation on the given object and return the * new value . * obj will be a Node when suffix evaluation begins , allowing us to * interpret it contextually . ( e . g . for . class ) Thereafter it will be * an value object or LHS ( as determined by toLHS ) . * We must handle the toLHS case at each point here . */ public Object doSuffix ( Object obj , boolean toLHS , CallStack callstack , Interpreter interpreter ) throws EvalError { } }
// Handle " . class " suffix operation // Prefix must be a BSHType if ( operation == CLASS ) if ( obj instanceof BSHType ) { if ( toLHS ) throw new EvalError ( "Can't assign .class" , this , callstack ) ; return ( ( BSHType ) obj ) . getType ( callstack , interpreter ) ; } else throw new EvalError ( "Attempt to use .class suffix on non class." , this , callstack ) ; /* Evaluate our prefix if it needs evaluating first . If this is the first evaluation our prefix mayb be a Node ( directly from the PrimaryPrefix ) - eval ( ) it to an object . If it ' s an LHS , resolve to a value . Note : The ambiguous name construct is now necessary where the node may be an ambiguous name . If this becomes common we might want to make a static method nodeToObject ( ) or something . The point is that we can ' t just eval ( ) - we need to direct the evaluation to the context sensitive type of result ; namely object , class , etc . */ if ( obj instanceof SimpleNode ) if ( obj instanceof BSHAmbiguousName ) obj = ( ( BSHAmbiguousName ) obj ) . toObject ( callstack , interpreter ) ; else obj = ( ( SimpleNode ) obj ) . eval ( callstack , interpreter ) ; else if ( obj instanceof LHS ) try { obj = ( ( LHS ) obj ) . getValue ( ) ; } catch ( UtilEvalError e ) { throw e . toEvalError ( this , callstack ) ; } try { switch ( operation ) { case INDEX : return doIndex ( obj , toLHS , callstack , interpreter ) ; case NAME : return doName ( obj , toLHS , callstack , interpreter ) ; case PROPERTY : return doProperty ( toLHS , obj , callstack , interpreter ) ; case NEW : return doNewInner ( obj , toLHS , callstack , interpreter ) ; default : throw new InterpreterError ( "Unknown suffix type" ) ; } } catch ( ReflectError e ) { throw new EvalError ( "reflection error: " + e , this , callstack , e ) ; }
public class Environment { /** * Gets the default login shell used by a unix user . * @ return the Mac user ' s default shell as referenced by cmd : * ' nidump passwd / ' * @ throws EnvironmentException if os information is not resolvable */ private static String getUnixUserShell ( ) throws EnvironmentException { } }
if ( null != m_SHELL ) { return m_SHELL ; } String [ ] args = { "cat" , "/etc/passwd" } ; return readShellFromPasswdFile ( args ) ;
public class FacebookAlbumListFragment { /** * Asynchronously and recursively requests the albums associated with each { @ link PageAccount } . * Calls { @ link # requestProfileAlbums ( java . util . List ) } when all Page album listings are completed . * @ param pageAccounts a list of Page accounts to recursively list albums for . * @ param pageAlbums a list of Page albums to append to . */ private void requestPageAlbums ( final Queue < PageAccount > pageAccounts , final List < Object [ ] > pageAlbums ) { } }
final PageAccount account = pageAccounts . poll ( ) ; if ( account != null ) { Callback callback = new Callback ( ) { @ Override public void onCompleted ( Response response ) { FacebookSettingsActivity activity = ( FacebookSettingsActivity ) getActivity ( ) ; if ( activity == null || activity . isFinishing ( ) ) { return ; } if ( response != null && response . getError ( ) == null ) { GraphObject graphObject = response . getGraphObject ( ) ; if ( graphObject != null ) { JSONObject jsonObject = graphObject . getInnerJSONObject ( ) ; try { JSONArray jsonArray = jsonObject . getJSONArray ( FacebookEndpoint . ALBUMS_LISTING_RESULT_DATA_KEY ) ; long cursorId = 1L + pageAlbums . size ( ) ; for ( int i = 0 ; i < jsonArray . length ( ) ; i ++ ) { try { // Get data from json . JSONObject album = jsonArray . getJSONObject ( i ) ; String id = album . getString ( FacebookEndpoint . ALBUMS_LISTING_FIELD_ID ) ; String name = album . getString ( FacebookEndpoint . ALBUMS_LISTING_FIELD_NAME ) ; String type = album . getString ( FacebookEndpoint . ALBUMS_LISTING_FIELD_TYPE ) ; String privacy = album . getString ( FacebookEndpoint . ALBUMS_LISTING_FIELD_PRIVACY ) ; boolean canUpload = album . getBoolean ( FacebookEndpoint . ALBUMS_LISTING_FIELD_CAN_UPLOAD ) ; // Filter out albums that do not allow upload . if ( canUpload && id != null && id . length ( ) > 0 && name != null && name . length ( ) > 0 && type != null && type . length ( ) > 0 && privacy != null && privacy . length ( ) > 0 ) { String graphPath = id + FacebookEndpoint . TO_UPLOAD_PHOTOS_GRAPH_PATH ; pageAlbums . add ( new Object [ ] { cursorId , FacebookEndpoint . DestinationId . PAGE_ALBUM , activity . getString ( R . string . wings_facebook__destination_page_album_name_template , account . mName , name ) , graphPath , privacy , account . mPageAccessToken } ) ; cursorId ++ ; } } catch ( JSONException e ) { // Do nothing . } } // Handle next Page account . requestPageAlbums ( pageAccounts , pageAlbums ) ; } catch ( JSONException e ) { // Do nothing . } } } else { // Finish Activity with error . activity . mHasErrorOccurred = true ; activity . tryFinish ( ) ; } } } ; mFacebookEndpoint . requestAlbums ( account . mId , callback ) ; } else { // Exit recursively calls and move on to requesting Profile albums . requestProfileAlbums ( pageAlbums ) ; }
public class AbstractProjectWriter { /** * { @ inheritDoc } */ @ Override public void write ( ProjectFile projectFile , File file ) throws IOException { } }
FileOutputStream fos = new FileOutputStream ( file ) ; write ( projectFile , fos ) ; fos . flush ( ) ; fos . close ( ) ;
public class BundleScannerProvisionOption { /** * { @ inheritDoc } */ public String getURL ( ) { } }
return new StringBuilder ( ) . append ( SCHEMA ) . append ( SEPARATOR_SCHEME ) . append ( super . getURL ( ) ) . append ( getOptions ( this ) ) . toString ( ) ;
public class JcNumber { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > enclose an expression with brackets < / i > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > e . g . < b > a . numberProperty ( " amount " ) . div ( b . numberProperty ( " amount " ) ) < br / > . enclose ( ) . mult ( 2 ) < / b > < / i > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > maps to an expression < b > ( a . amount / b . amount ) * 2 < / b > < / i > < / div > * < br / > */ public JcNumber enclose ( ) { } }
JcNumber ret = new JcNumber ( null , this , new FunctionInstance ( FUNCTION . Common . ENCLOSE , 1 ) ) ; QueryRecorder . recordInvocationConditional ( this , "enclose" , ret ) ; return ret ;
public class HttpConnectionHelper { /** * 从回复中获取Object * @ param httpURLConnection * @ return * @ throws java . lang . Exception */ public Object getObjectResponse ( HttpURLConnection httpURLConnection ) throws Exception { } }
Object object = null ; try { ObjectInputStream ois = new ObjectInputStream ( httpURLConnection . getInputStream ( ) ) ; object = ois . readObject ( ) ; ois . close ( ) ; } catch ( Exception ex ) { Debug . logError ( ex , module ) ; throw new Exception ( ex ) ; } return object ;
public class VertxConnectionImpl { /** * Get connection from factory * @ return VertxConnection instance * @ exception ResourceException * Thrown if a connection can ' t be obtained */ @ Override public VertxEventBus vertxEventBus ( ) throws ResourceException { } }
log . finest ( "getConnection()" ) ; if ( this . mc != null ) { return this . mc . getVertxEventBus ( ) ; } throw new ResourceException ( "Vertx Managed Connection has been closed." ) ;
public class HttpClient { /** * Setup a callback called after { @ link HttpClientResponse } headers have been * received * @ param doOnResponse a consumer observing connected events * @ return a new { @ link HttpClient } */ public final HttpClient doOnResponse ( BiConsumer < ? super HttpClientResponse , ? super Connection > doOnResponse ) { } }
Objects . requireNonNull ( doOnResponse , "doOnResponse" ) ; return new HttpClientDoOn ( this , null , null , doOnResponse , null ) ;
public class UsersApi { /** * Get users . * Get [ CfgPerson ] ( https : / / docs . genesys . com / Documentation / PSDK / latest / ConfigLayerRef / CfgPerson ) objects based on the specified filters . * @ param limit Limit the number of users the Provisioning API should return . ( optional ) * @ param offset The number of matches the Provisioning API should skip in the returned users . ( optional ) * @ param order The sort order . ( optional ) * @ param sortBy A comma - separated list of fields to sort on . Possible values are firstName , lastName , and userName . ( optional ) * @ param filterName The name of a filter to use on the results . ( optional ) * @ param filterParameters A part of the users first or last name , if you use the FirstNameOrLastNameMatches filter . ( optional ) * @ param roles Return only users who have the Workspace Web Edition roles . The roles can be specified in a comma - separated list . Possible values are ROLE _ AGENT and ROLE _ ADMIN , ROLE _ SUPERVISOR . ( optional ) * @ param skills Return only users who have these skills . The skills can be specified in a comma - separated list . ( optional ) * @ param userEnabled Return only enabled or disabled users . ( optional ) * @ param userValid Return only valid or invalid users . ( optional ) * @ return The list of users found for the given parameters . * @ throws ProvisioningApiException if the call is unsuccessful . */ public List < User > getUsers ( Integer limit , Integer offset , String order , String sortBy , String filterName , String filterParameters , String roles , String skills , Boolean userEnabled , String userValid ) throws ProvisioningApiException { } }
List < User > out = new ArrayList ( ) ; try { GetUsersSuccessResponse resp = usersApi . getUsers ( limit , offset , order , sortBy , filterName , filterParameters , roles , skills , userEnabled , userValid ) ; if ( ! resp . getStatus ( ) . getCode ( ) . equals ( 0 ) ) { throw new ProvisioningApiException ( "Error getting users. Code: " + resp . getStatus ( ) . getCode ( ) ) ; } for ( Object i : resp . getData ( ) . getUsers ( ) ) { out . add ( new User ( ( Map < String , Object > ) i ) ) ; } } catch ( ApiException e ) { throw new ProvisioningApiException ( "Error getting users" , e ) ; } return out ;
public class DRL5Parser { /** * Matches a type name * type : = ID typeArguments ? ( DOT ID typeArguments ? ) * ( LEFT _ SQUARE RIGHT _ SQUARE ) * * @ return * @ throws RecognitionException */ public String type ( ) throws RecognitionException { } }
String type = "" ; try { int first = input . index ( ) , last = first ; match ( input , DRL5Lexer . ID , null , new int [ ] { DRL5Lexer . DOT , DRL5Lexer . LESS } , DroolsEditorType . IDENTIFIER ) ; if ( state . failed ) return type ; if ( input . LA ( 1 ) == DRL5Lexer . LESS ) { typeArguments ( ) ; if ( state . failed ) return type ; } while ( input . LA ( 1 ) == DRL5Lexer . DOT && input . LA ( 2 ) == DRL5Lexer . ID ) { match ( input , DRL5Lexer . DOT , null , new int [ ] { DRL5Lexer . ID } , DroolsEditorType . IDENTIFIER ) ; if ( state . failed ) return type ; match ( input , DRL5Lexer . ID , null , new int [ ] { DRL5Lexer . DOT } , DroolsEditorType . IDENTIFIER ) ; if ( state . failed ) return type ; if ( input . LA ( 1 ) == DRL5Lexer . LESS ) { typeArguments ( ) ; if ( state . failed ) return type ; } } while ( input . LA ( 1 ) == DRL5Lexer . LEFT_SQUARE && input . LA ( 2 ) == DRL5Lexer . RIGHT_SQUARE ) { match ( input , DRL5Lexer . LEFT_SQUARE , null , new int [ ] { DRL5Lexer . RIGHT_SQUARE } , DroolsEditorType . IDENTIFIER ) ; if ( state . failed ) return type ; match ( input , DRL5Lexer . RIGHT_SQUARE , null , null , DroolsEditorType . IDENTIFIER ) ; if ( state . failed ) return type ; } last = input . LT ( - 1 ) . getTokenIndex ( ) ; type = input . toString ( first , last ) ; type = type . replace ( " " , "" ) ; } catch ( RecognitionException re ) { reportError ( re ) ; } return type ;
public class FlowLoaderUtils { /** * Helper method to recursively find props from node bean . * @ param nodeBean the node bean * @ param pathList the path list * @ param idx the idx * @ param propsList the props list * @ return the boolean */ private static boolean findPropsFromNodeBean ( final NodeBean nodeBean , final String [ ] pathList , final int idx , final List < Props > propsList ) { } }
if ( idx < pathList . length && nodeBean . getName ( ) . equals ( pathList [ idx ] ) ) { if ( idx == pathList . length - 1 ) { propsList . add ( nodeBean . getProps ( ) ) ; return true ; } for ( final NodeBean bean : nodeBean . getNodes ( ) ) { if ( findPropsFromNodeBean ( bean , pathList , idx + 1 , propsList ) ) { return true ; } } } return false ;
public class ForwardingBigQueryFileOutputFormat { /** * Gets the cached OutputCommitter , creating a new one if it doesn ' t exist . */ @ Override public synchronized OutputCommitter getOutputCommitter ( TaskAttemptContext context ) throws IOException { } }
// Cache the committer . if ( committer == null ) { committer = createCommitter ( context ) ; } return committer ;
public class DAOManager { @ Override public < O extends TransientObject > Collection < O > get ( String objectType , String ... keys ) throws DAOException { } }
Collection < O > results = serverDao . get ( objectType , keys ) ; eventManager . fire ( new GET_EVENT < O > ( results ) ) ; return results ;
public class RecordingChanges { /** * Marks this change set as frozen ( aka . closed ) . This means it should not accept any more changes . * @ param userId the username from the session which originated the changes ; may not be null * @ param userData a Map which can contains arbitrary information ; may be null * @ param timestamp a { @ link DateTime } at which the changes set was created . */ public void freeze ( String userId , Map < String , String > userData , DateTime timestamp ) { } }
this . userId = userId ; if ( userData != null ) { this . userData = Collections . unmodifiableMap ( userData ) ; } this . timestamp = timestamp ;
public class ValueNumberFrameModelingVisitor { /** * This is the default instruction modeling method . */ @ Override public void modelNormalInstruction ( Instruction ins , int numWordsConsumed , int numWordsProduced ) { } }
int flags = 0 ; if ( ins instanceof InvokeInstruction ) { flags = ValueNumber . RETURN_VALUE ; } else if ( ins instanceof ArrayInstruction ) { flags = ValueNumber . ARRAY_VALUE ; } else if ( ins instanceof ConstantPushInstruction ) { flags = ValueNumber . CONSTANT_VALUE ; } // Get the input operands to this instruction . ValueNumber [ ] inputValueList = popInputValues ( numWordsConsumed ) ; // See if we have the output operands in the cache . // If not , push default ( fresh ) values for the output , // and add them to the cache . ValueNumber [ ] outputValueList = getOutputValues ( inputValueList , numWordsProduced , flags ) ; if ( VERIFY_INTEGRITY ) { checkConsumedAndProducedValues ( ins , inputValueList , outputValueList ) ; } // Push output operands on stack . pushOutputValues ( outputValueList ) ;
public class Collectors { /** * Returns a { @ code Collector } that produces the minimal element according * to a given { @ code Comparator } , described as an { @ code Optional < T > } . * @ implSpec * This produces a result equivalent to : * < pre > { @ code * reducing ( BinaryOperator . minBy ( comparator ) ) * } < / pre > * @ param < T > the type of the input elements * @ param comparator a { @ code Comparator } for comparing elements * @ return a { @ code Collector } that produces the minimal value */ public static < T > Collector < T , ? , Optional < T > > minBy ( Comparator < ? super T > comparator ) { } }
return reducing ( BinaryOperator . minBy ( comparator ) ) ;
public class JavaInput { /** * Posts a key event received from elsewhere ( i . e . a native UI component ) . This is useful for * applications that are using GL in Canvas mode and sharing keyboard focus with other ( non - GL ) * components . The event will be queued and dispatched on the next frame , after GL keyboard * events . * @ param time the time ( in millis since epoch ) at which the event was generated , or 0 if N / A . * @ param key the key that was pressed or released , or null for a char typed event * @ param pressed whether the key was pressed or released , ignored if key is null * @ param typedCh the character that was typed , ignored if key is not null * @ param modFlags modifier key state flags ( generated by { @ link # modifierFlags } ) */ public void postKey ( long time , Key key , boolean pressed , char typedCh , int modFlags ) { } }
kevQueue . add ( key == null ? new Keyboard . TypedEvent ( modFlags , time , typedCh ) : new Keyboard . KeyEvent ( modFlags , time , key , pressed ) ) ;
public class MESubscription { /** * Returns the value of the topic space name . * @ return The topic space name */ final String getTopicSpaceName ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getTopicSpaceName" ) ; SibTr . exit ( tc , "getTopicSpaceName" , _topicSpaceName ) ; } return _topicSpaceName ;
public class YokeRequest { /** * Returns the ip address of the client , when trust - proxy is true ( default ) then first look into X - Forward - For * Header */ public String ip ( ) { } }
Boolean trustProxy = ( Boolean ) context . get ( "trust-proxy" ) ; if ( trustProxy != null && trustProxy ) { String xForwardFor = getHeader ( "x-forward-for" ) ; if ( xForwardFor != null ) { String [ ] ips = xForwardFor . split ( " *, *" ) ; if ( ips . length > 0 ) { return ips [ 0 ] ; } } } return request . remoteAddress ( ) . host ( ) ;
public class Schema { /** * Validates the given value and returns a ValidationException if errors were * found . * @ param correlationId ( optional ) transaction id to trace execution through * call chain . * @ param value a value to be validated . * @ param strict true to treat warnings as errors . * @ throws ValidationException when errors occured in validation */ public void validateAndThrowException ( String correlationId , Object value , boolean strict ) throws ValidationException { } }
List < ValidationResult > results = validate ( value ) ; ValidationException . throwExceptionIfNeeded ( correlationId , results , strict ) ;
public class PageIteratorSolver { /** * create a PageIterator instance * @ param queryParam * the value of sqlquery ' s " ? " * @ param sqlqueryAllCount * the sql for query all count that fit for condition * @ param sqlquery * the sql for query that fit for condtion , return id collection * @ param start * @ param count * @ return PageIterator * @ throws java . lang . Exception */ public PageIterator getDatas ( String queryParam , String sqlqueryAllCount , String sqlquery , int start , int count ) { } }
if ( UtilValidate . isEmpty ( sqlqueryAllCount ) ) { Debug . logError ( " the parameter sqlqueryAllCount is null" , module ) ; return new PageIterator ( ) ; } if ( UtilValidate . isEmpty ( sqlquery ) ) { Debug . logError ( " the parameter sqlquery is null" , module ) ; return new PageIterator ( ) ; } Collection queryParams = new ArrayList ( ) ; if ( ! UtilValidate . isEmpty ( queryParam ) ) queryParams . add ( queryParam ) ; return getPageIterator ( sqlqueryAllCount , sqlquery , queryParams , start , count ) ;
public class TransitionManager { /** * Convenience method to animate to a new scene defined by all changes within * the given scene root between calling this method and the next rendering frame . * Calling this method causes TransitionManager to capture current values in the * scene root and then post a request to run a transition on the next frame . * At that time , the new values in the scene root will be captured and changes * will be animated . There is no need to create a Scene ; it is implied by * changes which take place between calling this method and the next frame when * the transition begins . * < p > Calling this method several times before the next frame ( for example , if * unrelated code also wants to make dynamic changes and run a transition on * the same scene root ) , only the first call will trigger capturing values * and exiting the current scene . Subsequent calls to the method with the * same scene root during the same frame will be ignored . < / p > * < p > Passing in < code > null < / code > for the transition parameter will * cause the TransitionManager to use its default transition . < / p > * @ param sceneRoot The root of the View hierarchy to run the transition on . * @ param transition The transition to use for this change . A * value of null causes the TransitionManager to use the default transition . */ public static void beginDelayedTransition ( final @ NonNull ViewGroup sceneRoot , @ Nullable Transition transition ) { } }
if ( ! sPendingTransitions . contains ( sceneRoot ) && ViewUtils . isLaidOut ( sceneRoot , true ) ) { if ( Transition . DBG ) { Log . d ( LOG_TAG , "beginDelayedTransition: root, transition = " + sceneRoot + ", " + transition ) ; } sPendingTransitions . add ( sceneRoot ) ; if ( transition == null ) { transition = sDefaultTransition ; } final Transition transitionClone = transition . clone ( ) ; sceneChangeSetup ( sceneRoot , transitionClone ) ; Scene . setCurrentScene ( sceneRoot , null ) ; sceneChangeRunTransition ( sceneRoot , transitionClone ) ; }
public class Table { /** * Creates a global secondary index ( GSI ) with both a hash key and a range * key on this table . Involves network calls . This table must be in the * < code > ACTIVE < / code > state for this operation to succeed . Creating a * global secondary index is an asynchronous operation ; while executing the * operation , the index is in the < code > CREATING < / code > state . Once created , * the index will be in < code > ACTIVE < / code > state . * @ param create * used to specify the details of the index creation * @ param hashKeyDefinition * used to specify the attribute for describing the key schema * for the hash key of the GSI to be created for this table . * @ param rangeKeyDefinition * used to specify the attribute for describing the key schema * for the range key of the GSI to be created for this table . * @ return the index being created */ public Index createGSI ( CreateGlobalSecondaryIndexAction create , AttributeDefinition hashKeyDefinition , AttributeDefinition rangeKeyDefinition ) { } }
return doCreateGSI ( create , hashKeyDefinition , rangeKeyDefinition ) ;
public class CommerceOrderPersistenceImpl { /** * Returns an ordered range of all the commerce orders where billingAddressId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceOrderModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param billingAddressId the billing address ID * @ param start the lower bound of the range of commerce orders * @ param end the upper bound of the range of commerce orders ( not inclusive ) * @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > ) * @ return the ordered range of matching commerce orders */ @ Override public List < CommerceOrder > findByBillingAddressId ( long billingAddressId , int start , int end , OrderByComparator < CommerceOrder > orderByComparator ) { } }
return findByBillingAddressId ( billingAddressId , start , end , orderByComparator , true ) ;
public class ScriptExecutorActivity { /** * Execute scripts in supported languages . */ public void execute ( ) throws ActivityException { } }
try { String language = getLanguage ( ) ; String script = getScript ( ) ; Object retObj = executeScript ( script , language , null , null ) ; if ( retObj != null ) setReturnCode ( retObj . toString ( ) ) ; } catch ( ActivityException ex ) { throw ex ; } catch ( Exception ex ) { logger . severeException ( ex . getMessage ( ) , ex ) ; throw new ActivityException ( - 1 , ex . getMessage ( ) , ex ) ; }
public class Version { /** * < pre > * Desired runtime . Example : ` python27 ` . * < / pre > * < code > string runtime = 10 ; < / code > */ public com . google . protobuf . ByteString getRuntimeBytes ( ) { } }
java . lang . Object ref = runtime_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; runtime_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; }
public class Bean { /** * Read Bean firmware version * @ param callback the callback for the version string */ public void readHardwareVersion ( final Callback < String > callback ) { } }
gattClient . getDeviceProfile ( ) . getHardwareVersion ( new DeviceProfile . VersionCallback ( ) { @ Override public void onComplete ( String version ) { callback . onResult ( version ) ; } } ) ;
public class AbstractIoBuffer { /** * { @ inheritDoc } */ @ Override public Object getObject ( final ClassLoader classLoader ) throws ClassNotFoundException { } }
if ( ! prefixedDataAvailable ( 4 ) ) { throw new BufferUnderflowException ( ) ; } int length = getInt ( ) ; if ( length <= 4 ) { throw new BufferDataException ( "Object length should be greater than 4: " + length ) ; } int oldLimit = limit ( ) ; limit ( position ( ) + length ) ; try { ObjectInputStream in = new ObjectInputStream ( asInputStream ( ) ) { @ Override protected ObjectStreamClass readClassDescriptor ( ) throws IOException , ClassNotFoundException { int type = read ( ) ; if ( type < 0 ) { throw new EOFException ( ) ; } switch ( type ) { case 0 : // Primitive types return super . readClassDescriptor ( ) ; case 1 : // Non - primitive types String className = readUTF ( ) ; Class < ? > clazz = Class . forName ( className , true , classLoader ) ; return ObjectStreamClass . lookup ( clazz ) ; default : throw new StreamCorruptedException ( "Unexpected class descriptor type: " + type ) ; } } @ Override protected Class < ? > resolveClass ( ObjectStreamClass desc ) throws IOException , ClassNotFoundException { String name = desc . getName ( ) ; try { return Class . forName ( name , false , classLoader ) ; } catch ( ClassNotFoundException ex ) { return super . resolveClass ( desc ) ; } } } ; return in . readObject ( ) ; } catch ( IOException e ) { throw new BufferDataException ( e ) ; } finally { limit ( oldLimit ) ; }
public class JsonSerializationProcessor { /** * Closes the output . Should be called after the JSON serialization was * finished . * @ throws IOException * if there was a problem closing the output */ public void close ( ) throws IOException { } }
System . out . println ( "Serialized " + this . jsonSerializer . getEntityDocumentCount ( ) + " item documents to JSON file " + OUTPUT_FILE_NAME + "." ) ; this . jsonSerializer . close ( ) ;
public class StringMessage { /** * UTF - 8 encodes the message . */ @ Override public ByteArray encodeAsByteArray ( ) { } }
if ( message . isEmpty ( ) ) return ByteArray . EMPTY_BYTE_ARRAY ; return new ByteArray ( message . getBytes ( CHARSET ) ) ;
public class TextRankSentence { /** * 一句话调用接口 * @ param document 目标文档 * @ param size 需要的关键句的个数 * @ param sentence _ separator 句子分隔符 , 正则格式 , 如 : [ 。 ? ? ! ! ; ; ] * @ return 关键句列表 */ public static List < String > getTopSentenceList ( String document , int size , String sentence_separator ) { } }
List < String > sentenceList = splitSentence ( document , sentence_separator ) ; List < List < String > > docs = convertSentenceListToDocument ( sentenceList ) ; TextRankSentence textRank = new TextRankSentence ( docs ) ; int [ ] topSentence = textRank . getTopSentence ( size ) ; List < String > resultList = new LinkedList < String > ( ) ; for ( int i : topSentence ) { resultList . add ( sentenceList . get ( i ) ) ; } return resultList ;
public class FileUtils { /** * 关闭文件流 */ public static final void closeOutputStream ( OutputStream os ) { } }
if ( os != null ) { try { os . close ( ) ; } catch ( Exception e ) { logger . warn ( e . toString ( ) ) ; } }
public class CoGroupWithSolutionSetSecondDriver { @ Override @ SuppressWarnings ( "unchecked" ) public void initialize ( ) throws Exception { } }
final TypeComparator < IT2 > solutionSetComparator ; // grab a handle to the hash table from the iteration broker if ( taskContext instanceof AbstractIterativeTask ) { AbstractIterativeTask < ? , ? > iterativeTaskContext = ( AbstractIterativeTask < ? , ? > ) taskContext ; String identifier = iterativeTaskContext . brokerKey ( ) ; Object table = SolutionSetBroker . instance ( ) . get ( identifier ) ; if ( table instanceof CompactingHashTable ) { this . hashTable = ( CompactingHashTable < IT2 > ) table ; solutionSetSerializer = this . hashTable . getBuildSideSerializer ( ) ; solutionSetComparator = this . hashTable . getBuildSideComparator ( ) . duplicate ( ) ; } else if ( table instanceof JoinHashMap ) { this . objectMap = ( JoinHashMap < IT2 > ) table ; solutionSetSerializer = this . objectMap . getBuildSerializer ( ) ; solutionSetComparator = this . objectMap . getBuildComparator ( ) . duplicate ( ) ; } else { throw new RuntimeException ( "Unrecognized solution set index: " + table ) ; } } else { throw new Exception ( "The task context of this driver is no iterative task context." ) ; } TaskConfig config = taskContext . getTaskConfig ( ) ; ClassLoader classLoader = taskContext . getUserCodeClassLoader ( ) ; TypeComparatorFactory < IT1 > probeSideComparatorFactory = config . getDriverComparator ( 0 , classLoader ) ; this . probeSideSerializer = taskContext . < IT1 > getInputSerializer ( 0 ) . getSerializer ( ) ; this . probeSideComparator = probeSideComparatorFactory . createComparator ( ) ; ExecutionConfig executionConfig = taskContext . getExecutionConfig ( ) ; objectReuseEnabled = executionConfig . isObjectReuseEnabled ( ) ; if ( objectReuseEnabled ) { solutionSideRecord = solutionSetSerializer . createInstance ( ) ; } ; TypePairComparatorFactory < IT1 , IT2 > factory = taskContext . getTaskConfig ( ) . getPairComparatorFactory ( taskContext . getUserCodeClassLoader ( ) ) ; pairComparator = factory . createComparator12 ( this . probeSideComparator , solutionSetComparator ) ;
public class ConfigRuleEvaluationStatusMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ConfigRuleEvaluationStatus configRuleEvaluationStatus , ProtocolMarshaller protocolMarshaller ) { } }
if ( configRuleEvaluationStatus == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( configRuleEvaluationStatus . getConfigRuleName ( ) , CONFIGRULENAME_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getConfigRuleArn ( ) , CONFIGRULEARN_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getConfigRuleId ( ) , CONFIGRULEID_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getLastSuccessfulInvocationTime ( ) , LASTSUCCESSFULINVOCATIONTIME_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getLastFailedInvocationTime ( ) , LASTFAILEDINVOCATIONTIME_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getLastSuccessfulEvaluationTime ( ) , LASTSUCCESSFULEVALUATIONTIME_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getLastFailedEvaluationTime ( ) , LASTFAILEDEVALUATIONTIME_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getFirstActivatedTime ( ) , FIRSTACTIVATEDTIME_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getLastErrorCode ( ) , LASTERRORCODE_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getLastErrorMessage ( ) , LASTERRORMESSAGE_BINDING ) ; protocolMarshaller . marshall ( configRuleEvaluationStatus . getFirstEvaluationStarted ( ) , FIRSTEVALUATIONSTARTED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class LightWeightHashSet { /** * Resize the internal table to given capacity . */ @ SuppressWarnings ( "unchecked" ) private void resize ( int cap ) { } }
int newCapacity = computeCapacity ( cap ) ; if ( newCapacity == this . capacity ) { return ; } this . capacity = newCapacity ; this . expandThreshold = ( int ) ( capacity * maxLoadFactor ) ; this . shrinkThreshold = ( int ) ( capacity * minLoadFactor ) ; this . hash_mask = capacity - 1 ; LinkedElement < T > [ ] temp = entries ; entries = new LinkedElement [ capacity ] ; for ( int i = 0 ; i < temp . length ; i ++ ) { LinkedElement < T > curr = temp [ i ] ; while ( curr != null ) { LinkedElement < T > next = curr . next ; int index = getIndex ( curr . hashCode ) ; curr . next = entries [ index ] ; entries [ index ] = curr ; curr = next ; } }
public class CallTreeNode { /** * Returns a child node with given name or creates it if it does not exists . * @ param name Simon name * @ return Child node */ public CallTreeNode getOrAddChild ( String name ) { } }
CallTreeNode child = getChild ( name ) ; if ( child == null ) { child = addChild ( name ) ; } return child ;
public class ApiOvhIp { /** * Get this object properties * REST : GET / ip / { ip } / firewall / { ipOnFirewall } * @ param ip [ required ] * @ param ipOnFirewall [ required ] */ public OvhFirewallIp ip_firewall_ipOnFirewall_GET ( String ip , String ipOnFirewall ) throws IOException { } }
String qPath = "/ip/{ip}/firewall/{ipOnFirewall}" ; StringBuilder sb = path ( qPath , ip , ipOnFirewall ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhFirewallIp . class ) ;
public class RouterClient { /** * Retrieves runtime Nat mapping information of VM endpoints . * < p > Sample code : * < pre > < code > * try ( RouterClient routerClient = RouterClient . create ( ) ) { * ProjectRegionRouterName router = ProjectRegionRouterName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ ROUTER ] " ) ; * for ( VmEndpointNatMappings element : routerClient . getNatMappingInfoRouters ( router ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param router Name of the Router resource to query for Nat Mapping information of VM endpoints . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final GetNatMappingInfoRoutersPagedResponse getNatMappingInfoRouters ( ProjectRegionRouterName router ) { } }
GetNatMappingInfoRoutersHttpRequest request = GetNatMappingInfoRoutersHttpRequest . newBuilder ( ) . setRouter ( router == null ? null : router . toString ( ) ) . build ( ) ; return getNatMappingInfoRouters ( request ) ;
public class TagValTextParser { /** * Calls the getValue method first and the converts to an integer . * @ param keyIdField the key to obtain * @ return the integer value associated */ public int getValueAsIntWithDefault ( String keyIdField , int defaultVal ) throws IOException { } }
if ( keyToValue . containsKey ( keyIdField ) ) { return Integer . parseInt ( getValue ( keyIdField ) ) ; } else return defaultVal ;
public class FastDateFormat { /** * 获得 { @ link FastDateFormat } 实例 < br > * 支持缓存 * @ param dateStyle date style : FULL , LONG , MEDIUM , or SHORT * @ param timeStyle time style : FULL , LONG , MEDIUM , or SHORT * @ param locale { @ link Locale } 日期地理位置 * @ return 本地化 { @ link FastDateFormat } */ public static FastDateFormat getDateTimeInstance ( final int dateStyle , final int timeStyle , final Locale locale ) { } }
return cache . getDateTimeInstance ( dateStyle , timeStyle , null , locale ) ;
public class OrdersInner { /** * Creates or updates an order . * @ param deviceName The device name . * @ param resourceGroupName The resource group name . * @ param order The order to be created or updated . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < OrderInner > createOrUpdateAsync ( String deviceName , String resourceGroupName , OrderInner order ) { } }
return createOrUpdateWithServiceResponseAsync ( deviceName , resourceGroupName , order ) . map ( new Func1 < ServiceResponse < OrderInner > , OrderInner > ( ) { @ Override public OrderInner call ( ServiceResponse < OrderInner > response ) { return response . body ( ) ; } } ) ;
public class NumberUI { /** * { @ inheritDoc } */ @ Override public String validateValue ( final UIValue _value ) { } }
String ret = null ; try { if ( _value . getDbValue ( ) != null ) { Long . valueOf ( String . valueOf ( _value . getDbValue ( ) ) ) ; } } catch ( final NumberFormatException e ) { ret = DBProperties . getProperty ( NumberUI . class . getName ( ) + ".InvalidValue" ) ; } return ret ;
public class ReplicaGlobalSecondaryIndexSettingsDescriptionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ReplicaGlobalSecondaryIndexSettingsDescription replicaGlobalSecondaryIndexSettingsDescription , ProtocolMarshaller protocolMarshaller ) { } }
if ( replicaGlobalSecondaryIndexSettingsDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( replicaGlobalSecondaryIndexSettingsDescription . getIndexName ( ) , INDEXNAME_BINDING ) ; protocolMarshaller . marshall ( replicaGlobalSecondaryIndexSettingsDescription . getIndexStatus ( ) , INDEXSTATUS_BINDING ) ; protocolMarshaller . marshall ( replicaGlobalSecondaryIndexSettingsDescription . getProvisionedReadCapacityUnits ( ) , PROVISIONEDREADCAPACITYUNITS_BINDING ) ; protocolMarshaller . marshall ( replicaGlobalSecondaryIndexSettingsDescription . getProvisionedReadCapacityAutoScalingSettings ( ) , PROVISIONEDREADCAPACITYAUTOSCALINGSETTINGS_BINDING ) ; protocolMarshaller . marshall ( replicaGlobalSecondaryIndexSettingsDescription . getProvisionedWriteCapacityUnits ( ) , PROVISIONEDWRITECAPACITYUNITS_BINDING ) ; protocolMarshaller . marshall ( replicaGlobalSecondaryIndexSettingsDescription . getProvisionedWriteCapacityAutoScalingSettings ( ) , PROVISIONEDWRITECAPACITYAUTOSCALINGSETTINGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Sftp { /** * 初始化 * @ param channel { @ link ChannelSftp } * @ param charset 编码 */ public void init ( ChannelSftp channel , Charset charset ) { } }
this . charset = charset ; try { channel . setFilenameEncoding ( charset . toString ( ) ) ; } catch ( SftpException e ) { throw new JschRuntimeException ( e ) ; } this . channel = channel ;
public class CPAttachmentFileEntryPersistenceImpl { /** * Removes all the cp attachment file entries where uuid = & # 63 ; and companyId = & # 63 ; from the database . * @ param uuid the uuid * @ param companyId the company ID */ @ Override public void removeByUuid_C ( String uuid , long companyId ) { } }
for ( CPAttachmentFileEntry cpAttachmentFileEntry : findByUuid_C ( uuid , companyId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( cpAttachmentFileEntry ) ; }
public class DefaultOptionParser { /** * Parse the arguments according to the specified options and properties . * @ param options the specified Options * @ param args the command line arguments * @ param properties command line option name - value pairs * @ param skipParsingAtNonOption if { @ code true } an unrecognized argument stops * the parsing and the remaining arguments are added to the * { @ link ParsedOptions } s args list . If { @ code false } an unrecognized * argument triggers a ParseException . * @ return the list of atomic option and value tokens * @ throws OptionParserException if there are any problems encountered * while parsing the command line tokens */ public ParsedOptions parse ( Options options , String [ ] args , Properties properties , boolean skipParsingAtNonOption ) throws OptionParserException { } }
this . options = options ; this . skipParsingAtNonOption = skipParsingAtNonOption ; this . currentOption = null ; this . expectedOpts = new ArrayList < > ( options . getRequiredOptions ( ) ) ; // clear the data from the groups for ( OptionGroup group : options . getOptionGroups ( ) ) { group . setSelected ( null ) ; } this . parsedOptions = new ParsedOptions ( ) ; if ( args != null ) { for ( String argument : args ) { handleToken ( argument ) ; } } // check the arguments of the last option checkRequiredOptionValues ( ) ; // add the default options handleProperties ( properties ) ; checkRequiredOptions ( ) ; return this . parsedOptions ;
public class GVRBillboard { /** * Set the model matrix of the owner object to face the main camera rig . * Does two cross products : First , between the world up vector and the camera * to object vector . This gives one of the axis of the local rotation of the * object . A second cross product between the object to camera * vector and this axis gives the up vector of the object . Together , * with the object position , this yields the desired model matrix */ private void faceObjectToCamera ( ) { } }
GVRSceneObject ownerObject = getOwnerObject ( ) ; GVRTransform ownerTrans = ownerObject . getTransform ( ) ; float camX = mMainCameraRig . getTransform ( ) . getPositionX ( ) ; float camY = mMainCameraRig . getTransform ( ) . getPositionY ( ) ; float camZ = mMainCameraRig . getTransform ( ) . getPositionZ ( ) ; float ownerX = ownerTrans . getPositionX ( ) ; float ownerY = ownerTrans . getPositionY ( ) ; float ownerZ = ownerTrans . getPositionZ ( ) ; float scaleX = ownerTrans . getScaleX ( ) ; float scaleY = ownerTrans . getScaleY ( ) ; float scaleZ = ownerTrans . getScaleZ ( ) ; lookat . set ( camX - ownerX , camY - ownerY , camZ - ownerZ ) ; lookat = lookat . normalize ( ) ; up . cross ( lookat . x , lookat . y , lookat . z , ownerXaxis ) ; ownerXaxis = ownerXaxis . normalize ( ) ; lookat . cross ( ownerXaxis . x , ownerXaxis . y , ownerXaxis . z , ownerYaxis ) ; ownerYaxis = ownerYaxis . normalize ( ) ; ownerTrans . setModelMatrix ( new float [ ] { ownerXaxis . x , ownerXaxis . y , ownerXaxis . z , 0.0f , ownerYaxis . x , ownerYaxis . y , ownerYaxis . z , 0.0f , lookat . x , lookat . y , lookat . z , 0.0f , ownerX , ownerY , ownerZ , 1.0f } ) ; ownerTrans . setScale ( scaleX , scaleY , scaleZ ) ;
public class AbstractBinaryMemcacheDecoder { /** * Helper method to create a content chunk indicating a invalid decoding result . * @ param cause the cause of the decoding failure . * @ return a valid content chunk indicating failure . */ private MemcacheContent invalidChunk ( Exception cause ) { } }
state = State . BAD_MESSAGE ; MemcacheContent chunk = new DefaultLastMemcacheContent ( Unpooled . EMPTY_BUFFER ) ; chunk . setDecoderResult ( DecoderResult . failure ( cause ) ) ; return chunk ;
public class SAMkNN { /** * Returns the Euclidean distance . */ private double getDistance ( Instance sample , Instance sample2 ) { } }
double sum = 0 ; for ( int i = 0 ; i < sample . numInputAttributes ( ) ; i ++ ) { double diff = sample . valueInputAttribute ( i ) - sample2 . valueInputAttribute ( i ) ; sum += diff * diff ; } return Math . sqrt ( sum ) ;
public class AlbumUtils { /** * Get the file extension in url . * @ param url file url . * @ return extension . */ public static String getExtension ( String url ) { } }
url = TextUtils . isEmpty ( url ) ? "" : url . toLowerCase ( ) ; String extension = MimeTypeMap . getFileExtensionFromUrl ( url ) ; return TextUtils . isEmpty ( extension ) ? "" : extension ;
public class PipelineContextMarshaller { /** * Marshall the given parameter object . */ public void marshall ( PipelineContext pipelineContext , ProtocolMarshaller protocolMarshaller ) { } }
if ( pipelineContext == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( pipelineContext . getPipelineName ( ) , PIPELINENAME_BINDING ) ; protocolMarshaller . marshall ( pipelineContext . getStage ( ) , STAGE_BINDING ) ; protocolMarshaller . marshall ( pipelineContext . getAction ( ) , ACTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DOM3TreeWalker { /** * Checks if a comment node is well - formed * @ param data The contents of the comment node * @ return a boolean indiacating if the comment is well - formed or not . */ protected void isCommentWellFormed ( String data ) { } }
if ( data == null || ( data . length ( ) == 0 ) ) { return ; } char [ ] dataarray = data . toCharArray ( ) ; int datalength = dataarray . length ; // version of the document is XML 1.1 if ( fIsXMLVersion11 ) { // we need to check all chracters as per production rules of XML11 int i = 0 ; while ( i < datalength ) { char c = dataarray [ i ++ ] ; if ( XML11Char . isXML11Invalid ( c ) ) { // check if this is a supplemental character if ( XMLChar . isHighSurrogate ( c ) && i < datalength ) { char c2 = dataarray [ i ++ ] ; if ( XMLChar . isLowSurrogate ( c2 ) && XMLChar . isSupplemental ( XMLChar . supplemental ( c , c2 ) ) ) { continue ; } } String msg = Utils . messages . createMessage ( MsgKey . ER_WF_INVALID_CHARACTER_IN_COMMENT , new Object [ ] { new Character ( c ) } ) ; if ( fErrorHandler != null ) { fErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , msg , MsgKey . ER_WF_INVALID_CHARACTER , null , null , null ) ) ; } } else if ( c == '-' && i < datalength && dataarray [ i ] == '-' ) { String msg = Utils . messages . createMessage ( MsgKey . ER_WF_DASH_IN_COMMENT , null ) ; if ( fErrorHandler != null ) { fErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , msg , MsgKey . ER_WF_INVALID_CHARACTER , null , null , null ) ) ; } } } } // version of the document is XML 1.0 else { // we need to check all chracters as per production rules of XML 1.0 int i = 0 ; while ( i < datalength ) { char c = dataarray [ i ++ ] ; if ( XMLChar . isInvalid ( c ) ) { // check if this is a supplemental character if ( XMLChar . isHighSurrogate ( c ) && i < datalength ) { char c2 = dataarray [ i ++ ] ; if ( XMLChar . isLowSurrogate ( c2 ) && XMLChar . isSupplemental ( XMLChar . supplemental ( c , c2 ) ) ) { continue ; } } String msg = Utils . messages . createMessage ( MsgKey . ER_WF_INVALID_CHARACTER_IN_COMMENT , new Object [ ] { new Character ( c ) } ) ; if ( fErrorHandler != null ) { fErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , msg , MsgKey . ER_WF_INVALID_CHARACTER , null , null , null ) ) ; } } else if ( c == '-' && i < datalength && dataarray [ i ] == '-' ) { String msg = Utils . messages . createMessage ( MsgKey . ER_WF_DASH_IN_COMMENT , null ) ; if ( fErrorHandler != null ) { fErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , msg , MsgKey . ER_WF_INVALID_CHARACTER , null , null , null ) ) ; } } } } return ;
public class BigDecimal { /** * Internal printing routine */ private static void print ( String name , BigDecimal bd ) { } }
System . err . format ( "%s:\tintCompact %d\tintVal %d\tscale %d\tprecision %d%n" , name , bd . intCompact , bd . intVal , bd . scale , bd . precision ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcRelSchedulesCostItems ( ) { } }
if ( ifcRelSchedulesCostItemsEClass == null ) { ifcRelSchedulesCostItemsEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 481 ) ; } return ifcRelSchedulesCostItemsEClass ;
public class TypeValidator { /** * Check if the type of the JsonNode ' s value is number based on the * status of typeLoose flag . * @ param node the JsonNode to check * @ param isTypeLoose The flag to show whether typeLoose is enabled * @ return boolean to indicate if it is a number */ public static boolean isNumber ( JsonNode node , boolean isTypeLoose ) { } }
if ( node . isNumber ( ) ) { return true ; } else if ( isTypeLoose ) { if ( TypeFactory . getValueNodeType ( node ) == JsonType . STRING ) { return isNumeric ( node . textValue ( ) ) ; } } return false ;
public class ServiceObjectivesInner { /** * Returns database service objectives . * @ 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 . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the List & lt ; ServiceObjectiveInner & gt ; object */ public Observable < List < ServiceObjectiveInner > > listByServerAsync ( String resourceGroupName , String serverName ) { } }
return listByServerWithServiceResponseAsync ( resourceGroupName , serverName ) . map ( new Func1 < ServiceResponse < List < ServiceObjectiveInner > > , List < ServiceObjectiveInner > > ( ) { @ Override public List < ServiceObjectiveInner > call ( ServiceResponse < List < ServiceObjectiveInner > > response ) { return response . body ( ) ; } } ) ;
public class Cursor { /** * Fetches limited list of entities . * @ param limit Maximum amount of entities to fetch . * @ return List of fetched entities . * @ throws SQLException * @ throws InstantiationException * @ throws IllegalAccessException */ public List < T > fetchList ( int limit ) throws SQLException , InstantiationException , IllegalAccessException { } }
ArrayList < T > result = new ArrayList < T > ( ) ; if ( primitive ) { for ( int i = 0 ; i < limit ; i ++ ) { if ( ! finished ) { result . add ( fetchSingleInternal ( ) ) ; next ( ) ; } else { break ; } } } else { for ( int i = 0 ; i < limit ; i ++ ) { if ( ! finished ) { result . add ( fetchSingleInternal ( ) ) ; next ( ) ; } else { break ; } } } return result ;
public class BinaryTree { /** * Intern all the strings . */ public void intern ( ) { } }
symbol = symbol . intern ( ) ; if ( leftChild != null ) { leftChild . intern ( ) ; } if ( rightChild != null ) { rightChild . intern ( ) ; }
public class StringHelper { /** * Get a string that is filled at the end with the passed character until the * minimum length is reached . If the input string is empty , the result is a * string with the provided len only consisting of the passed characters . If the * input String is longer than the provided length , it is returned unchanged . * @ param sSrc * Source string . May be < code > null < / code > . * @ param nMinLen * Minimum length . Should be & gt ; 0. * @ param cEnd * The character to be used at the end * @ return A non - < code > null < / code > string that has at least nLen chars */ @ Nonnull public static String getWithTrailing ( @ Nullable final String sSrc , @ Nonnegative final int nMinLen , final char cEnd ) { } }
return _getWithLeadingOrTrailing ( sSrc , nMinLen , cEnd , false ) ;
public class AbstractWComponent { /** * Prepares this component and all child componenents for painting ( e . g . rendering to XML ) . This implementation * calls { @ link # preparePaintComponent ( Request ) } , then calls { @ link # preparePaint ( Request ) } on all its children . * Note that the this component ' s { @ link # preparePaintComponent ( Request ) } is called before the childrens ' * { @ link # preparePaintComponent ( Request ) } is called . * @ param request the request being responded to . */ @ Override public final void preparePaint ( final Request request ) { } }
// Don ' t prepare if it ' s invisible . if ( ! isVisible ( ) ) { return ; } // Prepare this component . preparePaintComponent ( request ) ; // Prepare its children . final ArrayList < WComponent > children = ( ArrayList < WComponent > ) getComponentModel ( ) . getChildren ( ) ; if ( children != null ) { final int size = children . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { children . get ( i ) . preparePaint ( request ) ; } // Chances are that the WComponent tree is fairly stable now , so take // the opportunity to trim the child list to size if we have one . // This is just a memory optimization - it won ' t prevent adding more // children later , of course . children . trimToSize ( ) ; }
public class SREsPreferencePage { /** * Compares the given name against current names and adds the appropriate numerical * suffix to ensure that it is unique . * @ param name the name with which to ensure uniqueness . * @ return the unique version of the given name . */ public String createUniqueName ( String name ) { } }
if ( ! isDuplicateName ( name ) ) { return name ; } if ( name . matches ( ".*\\(\\d*\\)" ) ) { // $ NON - NLS - 1 $ final int start = name . lastIndexOf ( '(' ) ; final int end = name . lastIndexOf ( ')' ) ; final String stringInt = name . substring ( start + 1 , end ) ; final int numericValue = Integer . parseInt ( stringInt ) ; final String newName = name . substring ( 0 , start + 1 ) + ( numericValue + 1 ) + ")" ; // $ NON - NLS - 1 $ return createUniqueName ( newName ) ; } return createUniqueName ( name + " (1)" ) ; // $ NON - NLS - 1 $
public class VecUtils { /** * Create a new { @ link Vec } of string values from a numeric { @ link Vec } . * Currently only uses a default pretty printer . Would be better if * it accepted a format string PUBDEV - 2211 * @ param src a numeric { @ link Vec } * @ return a string { @ link Vec } */ public static Vec numericToStringVec ( Vec src ) { } }
if ( src . isCategorical ( ) || src . isUUID ( ) ) throw new H2OIllegalValueException ( "Cannot convert a non-numeric column" + " using numericToStringVec() " , src ) ; Vec res = new MRTask ( ) { @ Override public void map ( Chunk chk , NewChunk newChk ) { if ( chk instanceof C0DChunk ) { // all NAs for ( int i = 0 ; i < chk . _len ; i ++ ) newChk . addNA ( ) ; } else { for ( int i = 0 ; i < chk . _len ; i ++ ) { if ( ! chk . isNA ( i ) ) newChk . addStr ( PrettyPrint . number ( chk , chk . atd ( i ) , 4 ) ) ; else newChk . addNA ( ) ; } } } } . doAll ( Vec . T_STR , src ) . outputFrame ( ) . anyVec ( ) ; assert res != null ; return res ;
public class MmffAtomTypeMatcher { /** * Hydrogen atom types are assigned based on their parent types . The mmff - symb - mapping file * provides this mapping . * @ param hdefIn input stream of mmff - symb - mapping . tsv * @ return mapping of parent to hydrogen definitions * @ throws IOException */ private Map < String , String > loadHydrogenDefinitions ( InputStream hdefIn ) throws IOException { } }
// maps of symbolic atom types to hydrogen atom types and internal types final Map < String , String > hdefs = new HashMap < String , String > ( 200 ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( hdefIn ) ) ; br . readLine ( ) ; // header String line = null ; while ( ( line = br . readLine ( ) ) != null ) { String [ ] cols = line . split ( "\t" ) ; hdefs . put ( cols [ 0 ] . trim ( ) , cols [ 3 ] . trim ( ) ) ; } // these associations list hydrogens that are not listed in MMFFSYMB . PAR but present in MMFFHDEF . PAR // N = O HNO , NO2 HNO2 , F HX , I HX , ONO2 HON , BR HX , ON = O HON , CL HX , SNO HSNO , and OC = S HOCS return hdefs ;
public class CmsFileUtil { /** * Returns the file name for a given VFS name that has to be written to a repository in the " real " file system , * by appending the VFS root path to the given base repository path , also adding an * folder for the " online " or " offline " project . < p > * @ param repository the base repository path * @ param vfspath the VFS root path to write to use * @ param online flag indicates if the result should be used for the online project ( < code > true < / code > ) or not * @ return The full uri to the JSP */ public static String getRepositoryName ( String repository , String vfspath , boolean online ) { } }
StringBuffer result = new StringBuffer ( 64 ) ; result . append ( repository ) ; result . append ( online ? CmsFlexCache . REPOSITORY_ONLINE : CmsFlexCache . REPOSITORY_OFFLINE ) ; result . append ( vfspath ) ; return result . toString ( ) ;
public class RequestToken { /** * Resumes a suspended asynchronous request , with the new * provided handler * @ param handler a handler to resume the request with . * @ return */ public boolean resume ( BaasHandler < ? > handler ) { } }
return BaasBox . getDefaultChecked ( ) . resume ( this , handler == null ? BaasHandler . NOOP : handler ) ;
public class AppModuleParser { /** * Parse JDOM element into module */ @ Override public Module parse ( final Element elem , final Locale locale ) { } }
final AppModule m = new AppModuleImpl ( ) ; final Element control = elem . getChild ( "control" , getContentNamespace ( ) ) ; if ( control != null ) { final Element draftElem = control . getChild ( "draft" , getContentNamespace ( ) ) ; if ( draftElem != null ) { if ( "yes" . equals ( draftElem . getText ( ) ) ) { m . setDraft ( Boolean . TRUE ) ; } if ( "no" . equals ( draftElem . getText ( ) ) ) { m . setDraft ( Boolean . FALSE ) ; } } } final Element edited = elem . getChild ( "edited" , getContentNamespace ( ) ) ; if ( edited != null ) { try { m . setEdited ( DateParser . parseW3CDateTime ( edited . getTextTrim ( ) , locale ) ) ; } catch ( final Exception ignored ) { } } return m ;
public class JMSManager { /** * Creates a Destination if the Destination has not already been created . * @ param name - the name of the destination to create * @ param type - the destination type ( topic or queue ) * @ param fTransacted - determines whether the session will maintain transactions * @ param ackMode - determines the session acknowledgment mode * @ throws MessagingException */ public Destination createDestination ( String name , DestinationType type , boolean fTransacted , int ackMode ) throws MessagingException { } }
// If the destination already exists , just return it JMSDestination jmsDest = jmsDestinations . get ( name ) ; if ( jmsDest != null ) { return jmsDest . destination ; } // Create the new destination and store it Session session ; try { session = connection . createSession ( fTransacted , ackMode ) ; } catch ( JMSException e ) { throw new MessagingException ( e . getMessage ( ) , e ) ; } // Look up the destination otherwise create it Destination destination = null ; try { destination = ( Destination ) jndiLookup ( name ) ; } catch ( MessagingException me ) { logger . debug ( "JNDI lookup for destination " + name + " failed. " + "Destination must be created." ) ; destination = null ; } if ( destination == null ) { // Create a topic or queue as specified try { if ( type . equals ( DestinationType . Queue ) ) { logger . debug ( "setupDestination() - creating Queue" + name ) ; destination = session . createQueue ( name ) ; } else { logger . debug ( "setupDestination() - creating Topic " + name ) ; destination = session . createTopic ( name ) ; } } catch ( JMSException e ) { throw new MessagingException ( e . getMessage ( ) , e ) ; } } jmsDest = new JMSDestination ( destination , session , null , null ) ; jmsDestinations . put ( name , jmsDest ) ; return destination ;
public class RSA { /** * 还原私钥 , PKCS8EncodedKeySpec 用于构建私钥的规范 * @ param keyBytes * @ return */ private static PrivateKey loadPrivateKey ( byte [ ] keyBytes ) { } }
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec ( keyBytes ) ; try { KeyFactory factory = KeyFactory . getInstance ( KEY_ALGORITHM ) ; PrivateKey privateKey = factory . generatePrivate ( pkcs8EncodedKeySpec ) ; return privateKey ; } catch ( NoSuchAlgorithmException | InvalidKeySpecException e ) { // TODO Auto - generated catch block e . printStackTrace ( ) ; } return null ;
public class OptionalWeak { /** * Returns inner value as optional of input type , if the inner value is absent or not an instance of the input * type an empty optional is returned * @ param type cast type * @ param < T > cast type * @ return inner value as optional of input type */ public < T > Optional < T > as ( Class < T > type ) { } }
return inner . filter ( d -> d . is ( type ) ) . map ( d -> d . as ( type ) ) ;
public class CommonOps_DDRM { /** * Extracts the diagonal elements ' src ' write it to the ' dst ' vector . ' dst ' * can either be a row or column vector . * @ param src Matrix whose diagonal elements are being extracted . Not modified . * @ param dst A vector the results will be written into . Modified . */ public static void extractDiag ( DMatrixRMaj src , DMatrixRMaj dst ) { } }
int N = Math . min ( src . numRows , src . numCols ) ; if ( ! MatrixFeatures_DDRM . isVector ( dst ) || dst . numCols * dst . numCols != N ) { dst . reshape ( N , 1 ) ; } for ( int i = 0 ; i < N ; i ++ ) { dst . set ( i , src . unsafe_get ( i , i ) ) ; }
public class OpenWatcomCompiler { /** * Add warning switch . * @ param args * Vector command line arguments * @ param level * int warning level */ @ Override protected final void addWarningSwitch ( final Vector < String > args , final int level ) { } }
OpenWatcomProcessor . addWarningSwitch ( args , level ) ;
public class SpatialReferenceSystemDao { /** * Delete the collection of Spatial Reference Systems , cascading * @ param srsCollection * spatial reference system collection * @ return deleted count * @ throws SQLException * upon deletion failure */ public int deleteCascade ( Collection < SpatialReferenceSystem > srsCollection ) throws SQLException { } }
int count = 0 ; if ( srsCollection != null ) { for ( SpatialReferenceSystem srs : srsCollection ) { count += deleteCascade ( srs ) ; } } return count ;
public class JaxbConvertToNative { /** * Copy this XML structure to this result target . * @ param resultTarget The target to copy to . * @ return True if successful . */ public boolean copyMessageToResult ( javax . xml . transform . Result resultTarget ) { } }
Object root = m_message . getRawData ( ) ; try { String strSOAPPackage = ( String ) ( ( TrxMessageHeader ) this . getMessage ( ) . getMessageHeader ( ) ) . get ( SOAPMessageTransport . SOAP_PACKAGE ) ; Marshaller m = JaxbContexts . getJAXBContexts ( ) . getMarshaller ( strSOAPPackage ) ; if ( m != null ) { synchronized ( m ) { // Since the marshaller is shared ( may want to tweek this for multi - cpu implementations ) m . marshal ( root , resultTarget ) ; } return true ; // Success } } catch ( JAXBException ex ) { ex . printStackTrace ( ) ; } catch ( java . lang . IllegalArgumentException ex ) { ex . printStackTrace ( ) ; } return super . copyMessageToResult ( resultTarget ) ;
public class RandomMatrices_ZDRM { /** * Returns a matrix where all the elements are selected independently from * a uniform distribution between - 1 and 1 inclusive . * @ param numRow Number of rows in the new matrix . * @ param numCol Number of columns in the new matrix . * @ param rand Random number generator used to fill the matrix . * @ return The randomly generated matrix . */ public static ZMatrixRMaj rectangle ( int numRow , int numCol , Random rand ) { } }
return rectangle ( numRow , numCol , - 1 , 1 , rand ) ;
public class RandomDataInserter { /** * Run a loop inserting tuples into the database for the amount * of time specified in config . duration . */ public void run ( ) { } }
// Reset the stats managed by the client . periodicStatsContext . fetchAndResetBaseline ( ) ; // Run in a loop for config . duration seconds . final long benchmarkEndTime = app . startTS + ( 1000l * app . config . duration ) ; while ( benchmarkEndTime > System . currentTimeMillis ( ) ) { // GENERATE A RANDOM ROW // unique identifier and partition key String uuid = UUID . randomUUID ( ) . toString ( ) ; // millisecond timestamp Date now = new Date ( ) ; // for some odd reason , this will give LONG _ MAX if the // computed value is > LONG _ MAX . long val = ( long ) ( rand . nextGaussian ( ) * 1000.0 ) ; try { basicInsert ( uuid , val , now ) ; } catch ( IOException e ) { // Not being super picky about failure handling . If this // fails , it will show up in the client - side statistics we // print out in printReport ( ) . } } // When ready to end processing . . . try { // Block until all async calls have returned . client . drain ( ) ; // Clean close of the client connection . client . close ( ) ; } catch ( IOException | InterruptedException e ) { // Live dangerously and ignore this error that probably // won ' t happen at shutdown time . }
public class StringUtilities { /** * Calculate the Damerau - Levenshtein Distance between two strings . The basic difference * between this algorithm and the general Levenshtein algorithm is that damerau - Levenshtein * counts a swap of two characters next to each other as 1 instead of 2 . This breaks the * ' triangular equality ' , which makes it unusable for Metric trees . See Wikipedia pages on * both Levenshtein and Damerau - Levenshtein and then make your decision as to which algorithm * is appropriate for your situation . * @ param source Source input string * @ param target Target input string * @ return The number of substitutions it would take * to make the source string identical to the target * string */ public static int damerauLevenshteinDistance ( CharSequence source , CharSequence target ) { } }
if ( source == null || "" . equals ( source ) ) { return target == null || "" . equals ( target ) ? 0 : target . length ( ) ; } else if ( target == null || "" . equals ( target ) ) { return source . length ( ) ; } int srcLen = source . length ( ) ; int targetLen = target . length ( ) ; int [ ] [ ] distanceMatrix = new int [ srcLen + 1 ] [ targetLen + 1 ] ; // We need indexers from 0 to the length of the source string . // This sequential set of numbers will be the row " headers " // in the matrix . for ( int srcIndex = 0 ; srcIndex <= srcLen ; srcIndex ++ ) { distanceMatrix [ srcIndex ] [ 0 ] = srcIndex ; } // We need indexers from 0 to the length of the target string . // This sequential set of numbers will be the // column " headers " in the matrix . for ( int targetIndex = 0 ; targetIndex <= targetLen ; targetIndex ++ ) { // Set the value of the first cell in the column // equivalent to the current value of the iterator distanceMatrix [ 0 ] [ targetIndex ] = targetIndex ; } for ( int srcIndex = 1 ; srcIndex <= srcLen ; srcIndex ++ ) { for ( int targetIndex = 1 ; targetIndex <= targetLen ; targetIndex ++ ) { // If the current characters in both strings are equal int cost = source . charAt ( srcIndex - 1 ) == target . charAt ( targetIndex - 1 ) ? 0 : 1 ; // Find the current distance by determining the shortest path to a // match ( hence the ' minimum ' calculation on distances ) . distanceMatrix [ srcIndex ] [ targetIndex ] = ( int ) MathUtilities . minimum ( // Character match between current character in // source string and next character in target distanceMatrix [ srcIndex - 1 ] [ targetIndex ] + 1 , // Character match between next character in // source string and current character in target distanceMatrix [ srcIndex ] [ targetIndex - 1 ] + 1 , // No match , at current , add cumulative penalty distanceMatrix [ srcIndex - 1 ] [ targetIndex - 1 ] + cost ) ; // We don ' t want to do the next series of calculations on // the first pass because we would get an index out of bounds // exception . if ( srcIndex == 1 || targetIndex == 1 ) { continue ; } // transposition check ( if the current and previous // character are switched around ( e . g . : t [ se ] t and t [ es ] t ) . . . if ( source . charAt ( srcIndex - 1 ) == target . charAt ( targetIndex - 2 ) && source . charAt ( srcIndex - 2 ) == target . charAt ( targetIndex - 1 ) ) { // What ' s the minimum cost between the current distance // and a transposition . distanceMatrix [ srcIndex ] [ targetIndex ] = ( int ) MathUtilities . minimum ( // Current cost distanceMatrix [ srcIndex ] [ targetIndex ] , // Transposition distanceMatrix [ srcIndex - 2 ] [ targetIndex - 2 ] + cost ) ; } } } return distanceMatrix [ srcLen ] [ targetLen ] ;
public class InternalAnnotationDefinitionConverter { /** * { @ inheritDoc } */ @ Override public AnnotationDefinition convert ( XBELInternalAnnotationDefinition t ) { } }
if ( t == null ) { return null ; } String desc = t . getDescription ( ) ; String id = t . getId ( ) ; String use = t . getUsage ( ) ; AnnotationDefinition dest = null ; if ( t . isSetListAnnotation ( ) ) { XBELListAnnotation listAnnotation = t . getListAnnotation ( ) ; List < String > vals = listAnnotation . getListValue ( ) ; dest = new AnnotationDefinition ( id , desc , use , vals ) ; } else if ( t . isSetPatternAnnotation ( ) ) { String regex = t . getPatternAnnotation ( ) ; dest = new AnnotationDefinition ( id , REGULAR_EXPRESSION , desc , use ) ; dest . setValue ( regex ) ; } else { throw new UnsupportedOperationException ( "unhandled" ) ; } return dest ;
public class CommandLineArgumentParser { /** * other arguments that require validation . */ private List < NamedArgumentDefinition > validatePluginArgumentValues ( ) { } }
final List < NamedArgumentDefinition > actualArgumentDefinitions = new ArrayList < > ( ) ; for ( final NamedArgumentDefinition argumentDefinition : namedArgumentDefinitions ) { if ( ! argumentDefinition . isControlledByPlugin ( ) ) { actualArgumentDefinitions . add ( argumentDefinition ) ; } else { final boolean isAllowed = argumentDefinition . getDescriptorForControllingPlugin ( ) . isDependentArgumentAllowed ( argumentDefinition . getContainingObject ( ) . getClass ( ) ) ; if ( argumentDefinition . getHasBeenSet ( ) ) { if ( ! isAllowed ) { // dangling dependent argument ; a value was specified but it ' s containing // ( predecessor ) plugin argument wasn ' t specified throw new CommandLineException ( String . format ( "Argument \"%s/%s\" is only valid when the argument \"%s\" is specified" , argumentDefinition . getShortName ( ) , argumentDefinition . getLongName ( ) , argumentDefinition . getContainingObject ( ) . getClass ( ) . getSimpleName ( ) ) ) ; } actualArgumentDefinitions . add ( argumentDefinition ) ; } else if ( isAllowed ) { // the predecessor argument was seen , so this value is allowed but hasn ' t been set ; keep the // argument definition to allow validation to check for missing required args actualArgumentDefinitions . add ( argumentDefinition ) ; } } } // finally , give each plugin a chance to trim down any unseen instances from it ' s own list pluginDescriptors . entrySet ( ) . forEach ( e -> e . getValue ( ) . validateAndResolvePlugins ( ) ) ; // return the updated list of argument definitions with the new list return actualArgumentDefinitions ;
public class JSPExtensionClassLoader { /** * Load JSP class data from file . */ protected byte [ ] loadClassDataFromFile ( String fileName ) { } }
byte [ ] classBytes = null ; try { InputStream in = getResourceAsStream ( fileName ) ; if ( in == null ) { return null ; } ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; byte buf [ ] = new byte [ 1024 ] ; for ( int i = 0 ; ( i = in . read ( buf ) ) != - 1 ; ) baos . write ( buf , 0 , i ) ; in . close ( ) ; baos . close ( ) ; classBytes = baos . toByteArray ( ) ; } catch ( Exception ex ) { return null ; } return classBytes ;
public class ClientSocketFactory { /** * Open a stream to the target server for the load balancer . * @ return the socket ' s read / write pair . */ @ Override public ClientSocket open ( ) { } }
State state = _state ; if ( ! state . isInit ( ) ) return null ; ClientSocket stream = openRecycle ( ) ; if ( stream != null ) return stream ; return connect ( ) ;
public class ManagementPoliciesInner { /** * Sets the managementpolicy to the specified storage account . * @ param resourceGroupName The name of the resource group within the user ' s subscription . The name is case insensitive . * @ param accountName The name of the storage account within the specified resource group . Storage account names must be between 3 and 24 characters in length and use numbers and lower - case letters only . * @ param policy The Storage Account ManagementPolicy , in JSON format . See more details in : https : / / docs . microsoft . com / en - us / azure / storage / common / storage - lifecycle - managment - concepts . * @ 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 ManagementPolicyInner object if successful . */ public ManagementPolicyInner createOrUpdate ( String resourceGroupName , String accountName , ManagementPolicySchema policy ) { } }
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , accountName , policy ) . toBlocking ( ) . single ( ) . body ( ) ;
public class PdfStamper { /** * Sets the encryption options for this document . The userPassword and the * ownerPassword can be null or have zero length . In this case the ownerPassword * is replaced by a random string . The open permissions for the document can be * AllowPrinting , AllowModifyContents , AllowCopy , AllowModifyAnnotations , * AllowFillIn , AllowScreenReaders , AllowAssembly and AllowDegradedPrinting . * The permissions can be combined by ORing them . * @ param strength < code > true < / code > for 128 bit key length , < code > false < / code > for 40 bit key length * @ param userPassword the user password . Can be null or empty * @ param ownerPassword the owner password . Can be null or empty * @ param permissions the user permissions * @ throws DocumentException if anything was already written to the output */ public void setEncryption ( boolean strength , String userPassword , String ownerPassword , int permissions ) throws DocumentException { } }
setEncryption ( DocWriter . getISOBytes ( userPassword ) , DocWriter . getISOBytes ( ownerPassword ) , permissions , strength ) ;
public class Button { /** * Adds a URL parameter to the generated hyperlink . * @ param name the name of the parameter to be added . * @ param value the value of the parameter to be added ( a String or String [ ] ) . * @ param facet */ public void addParameter ( String name , Object value , String facet ) throws JspException { } }
assert ( name != null ) : "Parameter 'name' must not be null" ; if ( _params == null ) { _params = new HashMap ( ) ; } ParamHelper . addParam ( _params , name , value ) ;
public class ETAPrinter { /** * Initializes a progress bar . * { @ link java . lang . System } . out will be used to print the progress bar . * @ param elementName the name of the elements that are processed . It is used to display the speed . * @ param totalElementsToProcess the total number of items that are going to be processed . * @ return the initialized { @ link com . vdurmont . etaprinter . ETAPrinter } */ public static ETAPrinter init ( String elementName , long totalElementsToProcess ) { } }
return init ( elementName , totalElementsToProcess , System . out , false ) ;
public class JavaLexer { /** * $ ANTLR start " OctalEscape " */ public final void mOctalEscape ( ) throws RecognitionException { } }
try { // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1360:5 : ( ' \ \ \ \ ' ( ' 0 ' . . ' 3 ' ) ( ' 0 ' . . ' 7 ' ) ( ' 0 ' . . ' 7 ' ) | ' \ \ \ \ ' ( ' 0 ' . . ' 7 ' ) ( ' 0 ' . . ' 7 ' ) | ' \ \ \ \ ' ( ' 0 ' . . ' 7 ' ) ) int alt25 = 3 ; int LA25_0 = input . LA ( 1 ) ; if ( ( LA25_0 == '\\' ) ) { int LA25_1 = input . LA ( 2 ) ; if ( ( ( LA25_1 >= '0' && LA25_1 <= '3' ) ) ) { int LA25_2 = input . LA ( 3 ) ; if ( ( ( LA25_2 >= '0' && LA25_2 <= '7' ) ) ) { int LA25_4 = input . LA ( 4 ) ; if ( ( ( LA25_4 >= '0' && LA25_4 <= '7' ) ) ) { alt25 = 1 ; } else { alt25 = 2 ; } } else { alt25 = 3 ; } } else if ( ( ( LA25_1 >= '4' && LA25_1 <= '7' ) ) ) { int LA25_3 = input . LA ( 3 ) ; if ( ( ( LA25_3 >= '0' && LA25_3 <= '7' ) ) ) { alt25 = 2 ; } else { alt25 = 3 ; } } else { int nvaeMark = input . mark ( ) ; try { input . consume ( ) ; NoViableAltException nvae = new NoViableAltException ( "" , 25 , 1 , input ) ; throw nvae ; } finally { input . rewind ( nvaeMark ) ; } } } else { NoViableAltException nvae = new NoViableAltException ( "" , 25 , 0 , input ) ; throw nvae ; } switch ( alt25 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1360:9 : ' \ \ \ \ ' ( ' 0 ' . . ' 3 ' ) ( ' 0 ' . . ' 7 ' ) ( ' 0 ' . . ' 7 ' ) { match ( '\\' ) ; if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '3' ) ) { input . consume ( ) ; } else { MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; } else { MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { 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 : 1361:9 : ' \ \ \ \ ' ( ' 0 ' . . ' 7 ' ) ( ' 0 ' . . ' 7 ' ) { match ( '\\' ) ; if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; } else { MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; } else { MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } } break ; case 3 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 1362:9 : ' \ \ \ \ ' ( ' 0 ' . . ' 7 ' ) { match ( '\\' ) ; if ( ( input . LA ( 1 ) >= '0' && input . LA ( 1 ) <= '7' ) ) { input . consume ( ) ; } else { MismatchedSetException mse = new MismatchedSetException ( null , input ) ; recover ( mse ) ; throw mse ; } } break ; } } finally { // do for sure before leaving }
public class View { /** * Returns all the { @ link LabelAtomPropertyDescriptor } s that can be potentially configured * on this label . */ public List < ViewPropertyDescriptor > getApplicablePropertyDescriptors ( ) { } }
List < ViewPropertyDescriptor > r = new ArrayList < > ( ) ; for ( ViewPropertyDescriptor pd : ViewProperty . all ( ) ) { if ( pd . isEnabledFor ( this ) ) r . add ( pd ) ; } return r ;
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 638:1 : annotationTypeDeclaration : ' @ ' ' interface ' Identifier annotationTypeBody ; */ public final void annotationTypeDeclaration ( ) throws RecognitionException { } }
int annotationTypeDeclaration_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 71 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 639:5 : ( ' @ ' ' interface ' Identifier annotationTypeBody ) // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 639:7 : ' @ ' ' interface ' Identifier annotationTypeBody { match ( input , 58 , FOLLOW_58_in_annotationTypeDeclaration2475 ) ; if ( state . failed ) return ; match ( input , 93 , FOLLOW_93_in_annotationTypeDeclaration2477 ) ; if ( state . failed ) return ; match ( input , Identifier , FOLLOW_Identifier_in_annotationTypeDeclaration2479 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_annotationTypeBody_in_annotationTypeDeclaration2481 ) ; annotationTypeBody ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving if ( state . backtracking > 0 ) { memoize ( input , 71 , annotationTypeDeclaration_StartIndex ) ; } }
public class JdbcClient { private String getStringPredicate ( String fieldName , String filterValue , List < Object > prms ) { } }
if ( filterValue == null ) { return "" ; } return getStringPredicate ( fieldName , Arrays . asList ( filterValue ) , prms ) ;
public class LaunchSpecification { /** * One or more security groups . When requesting instances in a VPC , you must specify the IDs of the security groups . * When requesting instances in EC2 - Classic , you can specify the names or the IDs of the security groups . * @ param allSecurityGroups * One or more security groups . When requesting instances in a VPC , you must specify the IDs of the security * groups . When requesting instances in EC2 - Classic , you can specify the names or the IDs of the security * groups . */ public void setAllSecurityGroups ( java . util . Collection < GroupIdentifier > allSecurityGroups ) { } }
if ( allSecurityGroups == null ) { this . allSecurityGroups = null ; return ; } this . allSecurityGroups = new com . amazonaws . internal . SdkInternalList < GroupIdentifier > ( allSecurityGroups ) ;
public class ScenarioPortrayal { /** * Deletes a certain series of data from the histogram . * The index will be the order of the histogram . * @ param histogramID * @ param index - the index of the data */ public void removeDataSerieFromHistogram ( String histogramID , int index ) { } }
if ( this . histograms . containsKey ( histogramID ) ) { this . histograms . get ( histogramID ) . removeSeries ( index ) ; }
public class FSNamesystem { /** * Find how many of the containing nodes are " extra " , if any . * If there are any extras , call chooseExcessReplicates ( ) to * mark them in the excessReplicateMap . * @ param excessReplicateMapTmp replicas that can possibly be in excess * @ param originalDatanodes all currently valid replicas of this block */ private void findOverReplicatedReplicas ( Block block , short replication , DatanodeDescriptor addedNode , DatanodeDescriptor delNodeHint , List < DatanodeID > excessReplicateMapTmp , List < DatanodeID > originalDatanodes ) { } }
Collection < DatanodeDescriptor > nonExcess ; INodeFile inode ; readLock ( ) ; try { BlockInfo storedBlock = blocksMap . getBlockInfo ( block ) ; inode = ( storedBlock == null ) ? null : storedBlock . getINode ( ) ; if ( inode == null ) { return ; // file has been deleted already , nothing to do . } // if the caller did not specify what the target replication factor // of the file , then fetch it from the inode . This happens when invoked // by the ReplicationMonitor thread . if ( replication < 0 ) { replication = inode . getBlockReplication ( storedBlock ) ; } if ( addedNode == delNodeHint ) { delNodeHint = null ; } nonExcess = new ArrayList < DatanodeDescriptor > ( ) ; Collection < DatanodeDescriptor > corruptNodes = corruptReplicas . getNodes ( block ) ; for ( Iterator < DatanodeDescriptor > it = blocksMap . nodeIterator ( block ) ; it . hasNext ( ) ; ) { DatanodeDescriptor cur = it . next ( ) ; Collection < Block > excessBlocks = excessReplicateMap . get ( cur . getStorageID ( ) ) ; if ( excessBlocks == null || ! excessBlocks . contains ( block ) ) { if ( ! cur . isDecommissionInProgress ( ) && ! cur . isDecommissioned ( ) ) { // exclude corrupt replicas if ( corruptNodes == null || ! corruptNodes . contains ( cur ) ) { nonExcess . add ( cur ) ; originalDatanodes . add ( cur ) ; } } } } } finally { readUnlock ( ) ; } // this can be called without the FSnamesystem lock because it does not // use any global data structures . Also , the inode is passed as it is to // the Pluggable blockplacement policy . chooseExcessReplicates ( nonExcess , block , replication , addedNode , delNodeHint , inode , excessReplicateMapTmp ) ;