signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MathUtils { /** * Computes interpolation between two values , using the interpolation factor t .
* The interpolation formula is ( end - start ) * t + start .
* However , the computation ensures that t = 0 produces exactly start , and t = 1 , produces exactly end .
* It also guarantees that for 0 < = t < = 1 , the interpolated value v is between start and end . */
static void lerp ( Point2D start_ , Point2D end_ , double t , Point2D result ) { } } | assert ( start_ != result ) ; // When end = = start , we want result to be equal to start , for all t
// values . At the same time , when end ! = start , we want the result to be
// equal to start for t = = 0 and end for t = = 1.0
// The regular formula end _ * t + ( 1.0 - t ) * start _ , when end _ = =
// start _ , and t at 1/3 , produces value different from start
double rx , ry ; if ( t <= 0.5 ) { rx = start_ . x + ( end_ . x - start_ . x ) * t ; ry = start_ . y + ( end_ . y - start_ . y ) * t ; } else { rx = end_ . x - ( end_ . x - start_ . x ) * ( 1.0 - t ) ; ry = end_ . y - ( end_ . y - start_ . y ) * ( 1.0 - t ) ; } assert ( t < 0 || t > 1.0 || ( rx >= start_ . x && rx <= end_ . x ) || ( rx <= start_ . x && rx >= end_ . x ) ) ; assert ( t < 0 || t > 1.0 || ( ry >= start_ . y && ry <= end_ . y ) || ( ry <= start_ . y && ry >= end_ . y ) ) ; result . x = rx ; result . y = ry ; |
public class SubscriptionPublisherFactory { /** * Suppressing warnings allows to case a provider to SubscriptionPublisherInjection without template
* parameter . It is guaranteed by the generated joynr providers that the cast works as expected */
@ SuppressWarnings ( { } } | "unchecked" , "rawtypes" } ) public AbstractSubscriptionPublisher create ( final Object provider ) { String interfaceClassName = ProviderAnnotations . getProvidedInterface ( provider ) . getName ( ) ; String subscriptionPublisherClassName = interfaceClassName + SubscriptionPublisher . class . getSimpleName ( ) ; String subcriptionPublisherImplClassName = subscriptionPublisherClassName + "Impl" ; try { Class < ? > subscriptionPublisherImplClass = Class . forName ( subcriptionPublisherImplClassName ) ; AbstractSubscriptionPublisher subscriptionPublisherImpl = ( AbstractSubscriptionPublisher ) subscriptionPublisherImplClass . newInstance ( ) ; try { Class < ? > subscriptionPublisherInjectionClass = Class . forName ( subscriptionPublisherClassName + "Injection" ) ; if ( subscriptionPublisherInjectionClass . isInstance ( provider ) ) { ( ( SubscriptionPublisherInjection ) provider ) . setSubscriptionPublisher ( subscriptionPublisherImpl ) ; } } catch ( ClassNotFoundException exception ) { // if subscriptionPublisherInjectionClassname could not be found , we assume that the provider does not require a SubscriptionPublisher
} return subscriptionPublisherImpl ; } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException ( "For given provider of joynr interface \"" + interfaceClassName + "\", expected subscription publisher class of type \"" + subcriptionPublisherImplClassName + "\" could not be found by the classloader." + " Please ensure the class can be loaded." ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( "For given provider of joynr interface \"" + interfaceClassName + "\", expected subscription publisher class of type \"" + subcriptionPublisherImplClassName + "\" could not be instantiated due to the following error: " + e . getMessage ( ) ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "For given provider of joynr interface \"" + interfaceClassName + "\", expected subscription publisher class of type \"" + subcriptionPublisherImplClassName + "\" could not be accessed due to the following error: " + e . getMessage ( ) ) ; } |
public class IotHubResourcesInner { /** * Check if an IoT hub name is available .
* Check if an IoT hub name is available .
* @ param name The name of the IoT hub to check .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the IotHubNameAvailabilityInfoInner object */
public Observable < IotHubNameAvailabilityInfoInner > checkNameAvailabilityAsync ( String name ) { } } | return checkNameAvailabilityWithServiceResponseAsync ( name ) . map ( new Func1 < ServiceResponse < IotHubNameAvailabilityInfoInner > , IotHubNameAvailabilityInfoInner > ( ) { @ Override public IotHubNameAvailabilityInfoInner call ( ServiceResponse < IotHubNameAvailabilityInfoInner > response ) { return response . body ( ) ; } } ) ; |
public class Node { /** * Used internally . Applies the node ' s transform - related attributes
* to the current context , draws the node ( and it ' s children , if any )
* and restores the context . */
@ Override public void drawWithTransforms ( final Context2D context , final double alpha , final BoundingBox bounds ) { } } | if ( ( context . isSelection ( ) ) && ( false == isListening ( ) ) ) { return ; } if ( context . isDrag ( ) || isVisible ( ) ) { context . saveContainer ( ) ; final Transform xfrm = getPossibleNodeTransform ( ) ; if ( null != xfrm ) { context . transform ( xfrm ) ; } drawWithoutTransforms ( context , alpha , bounds ) ; context . restoreContainer ( ) ; } |
public class AbstractPageFactory { /** * < p > dispose . < / p >
* @ throws java . lang . IllegalStateException if any . */
public final void dispose ( ) throws IllegalStateException { } } | synchronized ( this ) { if ( pageServiceRegistration == null ) { throw new IllegalStateException ( String . format ( "%s [%s] has not been registered." , getClass ( ) . getSimpleName ( ) , this ) ) ; } pageServiceRegistration . unregister ( ) ; pageServiceRegistration = null ; if ( mountPointRegistration != null ) { mountPointRegistration . dispose ( ) ; mountPointRegistration = null ; } } |
public class DataTable { /** * getter for rowCount - gets the nr of rows
* @ generated
* @ return value of the feature */
public int getRowCount ( ) { } } | if ( DataTable_Type . featOkTst && ( ( DataTable_Type ) jcasType ) . casFeat_rowCount == null ) jcasType . jcas . throwFeatMissing ( "rowCount" , "ch.epfl.bbp.uima.types.DataTable" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( DataTable_Type ) jcasType ) . casFeatCode_rowCount ) ; |
public class MomentInterval { /** * / * [ deutsch ]
* < p > Interpretiert den angegebenen Text als Intervall mit Hilfe eines lokalisierten
* Intervallmusters . < / p >
* < p > Falls der angegebene Formatierer keine Referenz zu einer Sprach - und L & auml ; ndereinstellung hat , wird
* das Intervallmuster & quot ; { 0 } / { 1 } & quot ; verwendet . < / p >
* @ param text text to be parsed
* @ param parser format object for parsing start and end components
* @ return parsed interval
* @ throws IndexOutOfBoundsException if given text is empty
* @ throws ParseException if the text is not parseable
* @ since 3.9/4.6
* @ see # parse ( String , ChronoParser , String )
* @ see net . time4j . format . FormatPatternProvider # getIntervalPattern ( Locale ) */
public static MomentInterval parse ( String text , ChronoParser < Moment > parser ) throws ParseException { } } | return parse ( text , parser , IsoInterval . getIntervalPattern ( parser ) ) ; |
public class AbstractRestClient { /** * Create a customized ResponseErrorHandler that ignores HttpStatus . Series . CLIENT _ ERROR .
* That means responses with status codes like 400/404/401/403 / etc are not treated as error , therefore no exception will be thrown in those cases .
* Responses with status codes like 500/503 / etc will still cause exceptions to be thrown .
* @ return the ResponseErrorHandler that cares only HttpStatus . Series . SERVER _ ERROR */
protected ResponseErrorHandler buildServerErrorOnlyResponseErrorHandler ( ) { } } | return new DefaultResponseErrorHandler ( ) { @ Override protected boolean hasError ( HttpStatus statusCode ) { return statusCode . series ( ) == HttpStatus . Series . SERVER_ERROR ; } } ; |
public class ChunkTopicParser { /** * SAX methods */
@ Override public void startElement ( final String uri , final String localName , final String qName , final Attributes atts ) throws SAXException { } } | final String cls = atts . getValue ( ATTRIBUTE_NAME_CLASS ) ; final String id = atts . getValue ( ATTRIBUTE_NAME_ID ) ; if ( skip && skipLevel > 0 ) { skipLevel ++ ; } if ( TOPIC_TOPIC . matches ( cls ) ) { topicSpecSet . add ( qName ) ; processSelect ( id ) ; } if ( include ) { includelevel ++ ; final Attributes resAtts = processAttributes ( atts ) ; writeStartElement ( output , qName , resAtts ) ; } |
public class PropertiesUtils { /** * Get int type of property value by name .
* @ param propertyName
* name of the property to get
* @ return int type of value */
public static int getIntFromProperty ( final String propertyName ) { } } | try { return Integer . parseInt ( properties . getProperty ( propertyName ) ) ; } catch ( NumberFormatException e ) { log . error ( "NumberFormatException caught during reading property from properties file: " + e . getMessage ( ) ) ; return 0 ; } |
public class CefSyslogEmitter { /** * header needs to encode ' | ' , ' \ ' ' \ r ' , ' \ n ' */
protected String encodeCEFHeader ( String text ) { } } | String encoded = text ; // back - slash encode back - slashes ( needs to be first )
encoded = encoded . replace ( "\\" , "\\\\" ) ; // back - slash encode pipes
encoded = encoded . replace ( "|" , "\\|" ) ; // strip carriage returns and newlines
encoded = encoded . replace ( "\r" , "" ) ; encoded = encoded . replace ( "\n" , "" ) ; return encoded ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcStyleAssignmentSelect ( ) { } } | if ( ifcStyleAssignmentSelectEClass == null ) { ifcStyleAssignmentSelectEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 1164 ) ; } return ifcStyleAssignmentSelectEClass ; |
public class PriorityQueueJsonDeserializer { /** * < p > newInstance < / p >
* @ param deserializer { @ link JsonDeserializer } used to deserialize the objects inside the { @ link PriorityQueue } .
* @ param < T > Type of the elements inside the { @ link PriorityQueue }
* @ return a new instance of { @ link PriorityQueueJsonDeserializer } */
public static < T > PriorityQueueJsonDeserializer < T > newInstance ( JsonDeserializer < T > deserializer ) { } } | return new PriorityQueueJsonDeserializer < T > ( deserializer ) ; |
public class LogUtil { /** * * Converts from a numeric log severity level to a left justified * string
* of at least the given length . * *
* @ param level
* is the log severity level . *
* @ param length
* the minimum length of the resulting string .
* @ return TODO */
static public String fromLevel ( int level , int length ) { } } | StringBuffer sb = new StringBuffer ( length > 7 ? length : 7 ) ; switch ( level ) { case LogService . LOG_INFO : sb . append ( "info" ) ; break ; case LogService . LOG_DEBUG : sb . append ( "debug" ) ; break ; case LogService . LOG_WARNING : sb . append ( "Warning" ) ; break ; case LogService . LOG_ERROR : sb . append ( "ERROR" ) ; break ; case 0 : sb . append ( "DEFAULT" ) ; break ; default : sb . append ( "[" ) ; sb . append ( level ) ; sb . append ( "]" ) ; } for ( int i = sb . length ( ) ; i < length ; i ++ ) { sb . append ( " " ) ; } return sb . toString ( ) ; |
public class Session { /** * Gets the parameters of the given { @ code type } from the given { @ code message } .
* Parameters ' names and values are in decoded form .
* @ param msg the message whose parameters will be extracted from
* @ param type the type of parameters to extract
* @ return a { @ code List } containing the parameters
* @ throws IllegalArgumentException if any of the parameters is { @ code null } or if the given { @ code type } is not
* { @ link org . parosproxy . paros . network . HtmlParameter . Type # url url } or
* { @ link org . parosproxy . paros . network . HtmlParameter . Type # form form } .
* @ since 2.5.0
* @ see StandardParameterParser # getParameters ( HttpMessage , org . parosproxy . paros . network . HtmlParameter . Type ) */
public List < NameValuePair > getParameters ( HttpMessage msg , HtmlParameter . Type type ) { } } | if ( msg == null ) { throw new IllegalArgumentException ( "Parameter msg must not be null." ) ; } if ( type == null ) { throw new IllegalArgumentException ( "Parameter type must not be null." ) ; } switch ( type ) { case form : return this . getFormParamParser ( msg . getRequestHeader ( ) . getURI ( ) . toString ( ) ) . getParameters ( msg , type ) ; case url : return this . getUrlParamParser ( msg . getRequestHeader ( ) . getURI ( ) . toString ( ) ) . getParameters ( msg , type ) ; default : throw new IllegalArgumentException ( "The provided type is not supported: " + type ) ; } |
public class Table { /** * Returns the index of the Index object of the given name or - 1 if not found . */
int getIndexIndex ( String indexName ) { } } | Index [ ] indexes = indexList ; for ( int i = 0 ; i < indexes . length ; i ++ ) { if ( indexName . equals ( indexes [ i ] . getName ( ) . name ) ) { return i ; } } // no such index
return - 1 ; |
public class ProjectStageExtension { /** * Observes { @ link ProcessAnnotatedType } events and sends a veto if the type should be
* ignored due to the current project stage . */
public < T > void processAnnotatedType ( @ Observes ProcessAnnotatedType < T > pat ) { } } | // lazily obtain the project stage
if ( stage == null ) { stage = detectProjectStage ( ) ; } // the project stages explicitly specified on the type
Set < ProjectStage > validProjectStages = getProjectStagesForType ( pat . getAnnotatedType ( ) ) ; // veto the type if the current project stage doesn ' t match
if ( validProjectStages . size ( ) > 0 && ! validProjectStages . contains ( stage ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Preventing class " + pat . getAnnotatedType ( ) . getJavaClass ( ) . getName ( ) + " from being installed due to the current project stage" ) ; } // veto this type
pat . veto ( ) ; } |
public class Measure { /** * getter for unit - gets iso
* @ generated
* @ return value of the feature */
public String getUnit ( ) { } } | if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_unit == null ) jcasType . jcas . throwFeatMissing ( "unit" , "ch.epfl.bbp.uima.types.Measure" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_unit ) ; |
public class LynxPresenter { /** * Updates the filter used to know which Trace objects we have to show in the UI .
* @ param filter the filter to use */
public void updateFilter ( String filter ) { } } | if ( isInitialized ) { LynxConfig lynxConfig = lynx . getConfig ( ) ; lynxConfig . setFilter ( filter ) ; lynx . setConfig ( lynxConfig ) ; clearView ( ) ; restartLynx ( ) ; } |
public class ReliableSubscribeBus { /** * Acknowledgment Number is the next sequence number that the receiver is expecting */
private void scheduleAcknowledgment ( final String topic ) { } } | if ( ! acknowledgeScheduled . has ( topic ) ) { acknowledgeScheduled . set ( topic , true ) ; Platform . scheduler ( ) . scheduleDelay ( acknowledgeDelayMillis , new Handler < Void > ( ) { @ Override public void handle ( Void event ) { if ( acknowledgeScheduled . has ( topic ) ) { acknowledgeScheduled . remove ( topic ) ; // Check we ' re still out of date , and not already catching up .
double knownHeadSequence = knownHeadSequences . getNumber ( topic ) ; double currentSequence = currentSequences . getNumber ( topic ) ; if ( knownHeadSequence > currentSequence && ( ! acknowledgeNumbers . has ( topic ) || knownHeadSequence > acknowledgeNumbers . getNumber ( topic ) ) ) { acknowledgeNumbers . set ( topic , knownHeadSequence ) ; log . log ( Level . CONFIG , "Catching up to " + knownHeadSequence ) ; catchup ( topic , currentSequence ) ; } else { log . log ( Level . FINE , "No need to catchup" ) ; } } } } ) ; } |
public class SetOptions { /** * Returns the EncodingOptions to use for a set ( ) call . */
EncodingOptions getEncodingOptions ( ) { } } | if ( ! merge ) { return UserDataConverter . NO_DELETES ; } else if ( fieldMask == null ) { return UserDataConverter . ALLOW_ALL_DELETES ; } else { return new EncodingOptions ( ) { @ Override public boolean allowDelete ( FieldPath fieldPath ) { return fieldMask . contains ( fieldPath ) ; } @ Override public boolean allowTransform ( ) { return true ; } } ; } |
public class ValueMap { /** * Sets the value of the specified key in the current ValueMap to the
* boolean value . */
public ValueMap withBoolean ( String key , boolean val ) { } } | super . put ( key , Boolean . valueOf ( val ) ) ; return this ; |
public class IntensionalDataNodeImpl { /** * We assume all the variables are non - null . Ok for triple patterns .
* TODO : what about quads and default graphs ? */
@ Override public boolean isVariableNullable ( IntermediateQuery query , Variable variable ) { } } | if ( getVariables ( ) . contains ( variable ) ) return false ; else throw new IllegalArgumentException ( "The variable" + variable + " is not projected by " + this ) ; |
public class RecordFormatMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RecordFormat recordFormat , ProtocolMarshaller protocolMarshaller ) { } } | if ( recordFormat == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( recordFormat . getRecordFormatType ( ) , RECORDFORMATTYPE_BINDING ) ; protocolMarshaller . marshall ( recordFormat . getMappingParameters ( ) , MAPPINGPARAMETERS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MockInternetGatewayController { /** * Clear { @ link # allMockInternetGateways } and restore it from given a collection of instances .
* @ param internetGateways
* collection of MockInternetGateway to restore */
public void restoreAllInternetGateway ( final Collection < MockInternetGateway > internetGateways ) { } } | allMockInternetGateways . clear ( ) ; if ( null != internetGateways ) { for ( MockInternetGateway instance : internetGateways ) { allMockInternetGateways . put ( instance . getInternetGatewayId ( ) , instance ) ; } } |
public class ThreadUtils { /** * Causes the current Thread to join with the specified Thread . If the current Thread is interrupted while waiting
* for the specified Thread , then the current Threads interrupt bit will be set and this method will return false .
* Otherwise , the current Thread will wait on the specified Thread until it dies , or until the time period has expired
* and then the method will return true .
* @ param thread the Thread that the current Thread ( caller ) will join .
* @ param milliseconds the number of milliseconds the current Thread will wait during the join operation . If the
* number of milliseconds specified is 0 , then the current Thread will wait until the specified Thread dies , or the
* current Thread is interrupted .
* @ param nanoseconds the number of nanoseconds in addition to the milliseconds the current Thread will wait during
* the join operation .
* @ return a boolean condition indicating if the current Thread successfully joined the specified Thread without being
* interrupted .
* @ see java . lang . Thread # join ( long , int )
* @ see java . lang . Thread # interrupt ( ) */
@ NullSafe public static boolean join ( Thread thread , long milliseconds , int nanoseconds ) { } } | try { if ( thread != null ) { thread . join ( milliseconds , nanoseconds ) ; return true ; } } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } return false ; |
public class XMLRPCClient { /** * Create a call object from a given method string and parameters .
* @ param method The method that should be called .
* @ param params An array of parameters or null if no parameters needed .
* @ return A call object . */
private Call createCall ( String method , Object [ ] params ) { } } | if ( isFlagSet ( FLAGS_STRICT ) && ! method . matches ( "^[A-Za-z0-9\\._:/]*$" ) ) { throw new XMLRPCRuntimeException ( "Method name must only contain A-Z a-z . : _ / " ) ; } return new Call ( serializerHandler , method , params ) ; |
public class CmsSearchIndex { /** * Returns the language locale for the given resource in this index . < p >
* @ param cms the current OpenCms user context
* @ param resource the resource to check
* @ param availableLocales a list of locales supported by the resource
* @ return the language locale for the given resource in this index */
@ Override public Locale getLocaleForResource ( CmsObject cms , CmsResource resource , List < Locale > availableLocales ) { } } | Locale result ; List < Locale > defaultLocales = OpenCms . getLocaleManager ( ) . getDefaultLocales ( cms , resource ) ; List < Locale > locales = availableLocales ; if ( ( locales == null ) || ( locales . size ( ) == 0 ) ) { locales = defaultLocales ; } result = OpenCms . getLocaleManager ( ) . getBestMatchingLocale ( getLocale ( ) , defaultLocales , locales ) ; return result ; |
public class Serializers { /** * Get the serializer instance associated with < code > cls < / code > or null if not found .
* @ param cls object class
* @ return serializer instance or null if not found */
public Serializer getSerializer ( Class cls ) { } } | SerializerWrapper w = getSerializerWrapper ( cls ) ; if ( w != null ) { return w . serializer ; } return null ; |
public class SDVariable { /** * Get a variable with content equal to a specified sub - array of this variable . < br >
* Can be used ( for example ) to get rows , columns , sub - matrices , etc .
* @ param indices Indices to get
* @ return Sub - array variable */
public SDVariable get ( SDIndex ... indices ) { } } | int ndims = indices . length ; long [ ] begin = new long [ ndims ] ; long [ ] end = new long [ ndims ] ; long [ ] strides = new long [ ndims ] ; int [ ] begin_mask_arr = new int [ ndims ] ; int [ ] end_mask_arr = new int [ ndims ] ; int [ ] shrink_axis_mask_arr = new int [ ndims ] ; for ( int i = 0 ; i < ndims ; i ++ ) { strides [ i ] = 1 ; SDIndex index = indices [ i ] ; SDIndex . IndexType indexType = index . getIndexType ( ) ; if ( indexType == SDIndex . IndexType . ALL ) { begin_mask_arr [ i ] = 1 ; end_mask_arr [ i ] = 1 ; } else if ( indexType == SDIndex . IndexType . POINT ) { long pointIndex = index . getPointIndex ( ) ; begin [ i ] = pointIndex ; end [ i ] = pointIndex + 1 ; if ( ! index . isPointKeepDim ( ) ) { shrink_axis_mask_arr [ i ] = 1 ; } } else if ( indexType == SDIndex . IndexType . INTERVAL ) { if ( index . getIntervalBegin ( ) == null ) { begin_mask_arr [ i ] = 1 ; } else { begin [ i ] = index . getIntervalBegin ( ) ; } if ( index . getIntervalEnd ( ) == null ) { end_mask_arr [ i ] = 1 ; } else { end [ i ] = index . getIntervalEnd ( ) ; } if ( index . getIntervalStrides ( ) == null ) { strides [ i ] = 1 ; } else { strides [ i ] = index . getIntervalStrides ( ) ; } } } // convert binary int [ ] to int
int begin_mask = binArrToInt ( begin_mask_arr ) ; int end_mask = binArrToInt ( end_mask_arr ) ; int shrink_axis = binArrToInt ( shrink_axis_mask_arr ) ; return this . sameDiff . stridedSlice ( this , begin , end , strides , begin_mask , end_mask , 0 , 0 , shrink_axis ) ; |
public class SQLiteUpdateTaskHelper { /** * Read SQL from file .
* @ param fileName
* the file name
* @ return the list */
public static List < String > readSQLFromFile ( String fileName ) { } } | try { return readSQLFromFile ( new FileInputStream ( fileName ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; return null ; } |
public class JMFiles { /** * Read string string .
* @ param targetFile the target file
* @ param charsetName the charset name
* @ return the string */
public static String readString ( File targetFile , String charsetName ) { } } | return readString ( targetFile . toPath ( ) , charsetName ) ; |
public class TokenCompleteTextView { /** * A String of text that is shown before all the tokens inside the EditText
* ( Think " To : " in an email address field . I would advise against this : use a label and a hint .
* @ param p String with the hint */
public void setPrefix ( CharSequence p ) { } } | // Have to clear and set the actual text before saving the prefix to avoid the prefix filter
CharSequence prevPrefix = prefix ; prefix = p ; Editable text = getText ( ) ; if ( text != null ) { internalEditInProgress = true ; if ( prevPrefix != null ) { text . replace ( 0 , prevPrefix . length ( ) , p ) ; } else { text . insert ( 0 , p ) ; } internalEditInProgress = false ; } // prefix = p ;
updateHint ( ) ; |
public class PGPUtils { /** * Extracts the PGP public key from an encoded stream .
* @ param content stream to extract the key
* @ return key object
* @ throws IOException if there is an error reading the stream
* @ throws PGPException if the public key cannot be extracted */
public static PGPPublicKey getPublicKey ( InputStream content ) throws Exception { } } | InputStream in = PGPUtil . getDecoderStream ( content ) ; PGPPublicKeyRingCollection keyRingCollection = new PGPPublicKeyRingCollection ( in , new BcKeyFingerprintCalculator ( ) ) ; PGPPublicKey key = null ; Iterator < PGPPublicKeyRing > keyRings = keyRingCollection . getKeyRings ( ) ; while ( key == null && keyRings . hasNext ( ) ) { PGPPublicKeyRing keyRing = keyRings . next ( ) ; Iterator < PGPPublicKey > keys = keyRing . getPublicKeys ( ) ; while ( key == null && keys . hasNext ( ) ) { PGPPublicKey current = keys . next ( ) ; if ( current . isEncryptionKey ( ) ) { key = current ; } } } return key ; |
public class StringUtils { /** * Remove repeating strings that are appearing in the name .
* This is done by splitting words ( camel case ) and using each word once .
* @ param name The name to compact .
* @ return The compact name . */
public static final String compact ( String name ) { } } | Set < String > parts = new LinkedHashSet < String > ( ) ; for ( String part : name . split ( SPLITTER_REGEX ) ) { parts . add ( part ) ; } return join ( parts , "" ) ; |
public class Events { /** * Given a stream written by the serialization - writer library , extract all events .
* This assumes the file was written using ObjectOutputStream .
* @ param objectInputStream stream to deserialize
* @ return events contained in the file
* @ throws java . io . IOException generic IOException
* @ throws ClassNotFoundException if the underlying Event class is not in the classpath */
public static List < Event > fromObjectInputStream ( final ObjectInputStream objectInputStream ) throws IOException , ClassNotFoundException { } } | final List < Event > events = new ArrayList < Event > ( ) ; while ( objectInputStream . read ( ) != - 1 ) { final Event e = ( Event ) objectInputStream . readObject ( ) ; events . add ( e ) ; } objectInputStream . close ( ) ; return events ; |
public class OpenCmsCore { /** * Initializes the system with the OpenCms servlet . < p >
* This is the final step that is called on the servlets " init ( ) " method .
* It registers the servlets request handler and also outputs the final
* startup message . The servlet should auto - load since the & ltload - on - startup & gt ;
* parameter is set in the ' web . xml ' by default . < p >
* @ param servlet the OpenCms servlet */
protected void initServlet ( OpenCmsServlet servlet ) { } } | synchronized ( LOCK ) { // add the servlets request handler
addRequestHandler ( servlet ) ; // output the final ' startup is finished ' message
if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_SYSTEM_RUNNING_1 , CmsStringUtil . formatRuntime ( getSystemInfo ( ) . getRuntime ( ) ) ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_LINE_0 ) ) ; CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_DOT_0 ) ) ; } } |
public class PathFinderRequestControl { /** * Executes the given pathfinding request resuming it if needed .
* @ param request the pathfinding request
* @ return { @ code true } if this operation has completed ; { @ code false } if more time is needed to complete . */
public boolean execute ( PathFinderRequest < N > request ) { } } | request . executionFrames ++ ; while ( true ) { if ( DEBUG ) GdxAI . getLogger ( ) . debug ( TAG , "------" ) ; // Should perform search begin ?
if ( request . status == PathFinderRequest . SEARCH_NEW ) { long currentTime = TimeUtils . nanoTime ( ) ; timeToRun -= currentTime - lastTime ; if ( timeToRun <= timeTolerance ) return false ; if ( DEBUG ) GdxAI . getLogger ( ) . debug ( TAG , "search begin" ) ; if ( ! request . initializeSearch ( timeToRun ) ) return false ; request . changeStatus ( PathFinderRequest . SEARCH_INITIALIZED ) ; lastTime = currentTime ; } // Should perform search path ?
if ( request . status == PathFinderRequest . SEARCH_INITIALIZED ) { long currentTime = TimeUtils . nanoTime ( ) ; timeToRun -= currentTime - lastTime ; if ( timeToRun <= timeTolerance ) return false ; if ( DEBUG ) GdxAI . getLogger ( ) . debug ( TAG , "search path" ) ; if ( ! request . search ( pathFinder , timeToRun ) ) return false ; request . changeStatus ( PathFinderRequest . SEARCH_DONE ) ; lastTime = currentTime ; } // Should perform search end ?
if ( request . status == PathFinderRequest . SEARCH_DONE ) { long currentTime = TimeUtils . nanoTime ( ) ; timeToRun -= currentTime - lastTime ; if ( timeToRun <= timeTolerance ) return false ; if ( DEBUG ) GdxAI . getLogger ( ) . debug ( TAG , "search end" ) ; if ( ! request . finalizeSearch ( timeToRun ) ) return false ; request . changeStatus ( PathFinderRequest . SEARCH_FINALIZED ) ; // Search finished , send result to the client
if ( server != null ) { MessageDispatcher dispatcher = request . dispatcher != null ? request . dispatcher : MessageManager . getInstance ( ) ; dispatcher . dispatchMessage ( server , request . client , request . responseMessageCode , request ) ; } lastTime = currentTime ; if ( request . statusChanged && request . status == PathFinderRequest . SEARCH_NEW ) { if ( DEBUG ) GdxAI . getLogger ( ) . debug ( TAG , "search renew" ) ; continue ; } } return true ; } |
public class ReferenceContextImpl { /** * Gets the < code > InjectionTarget < / code > instances visible to the specified Class .
* If there are no < code > InjectionTarget < / code > instances visible to the Class ,
* then an empty ( non - null ) list is returned . */
@ Override public InjectionTarget [ ] getInjectionTargets ( final Class < ? > classToInjectInto ) throws InjectionException { } } | // This method attempts to cache the InjectTargets that are associated
// with the specified class , so that if this method is invoked again and
// the same class is specified , we can just grab the list from the Map
// and not re - calculate it .
// EJB container should not need this caching , because it caches the list
// of InjectionTargets in BeanMetaData and InterceptorMetaData .
// However , WebContainer will use this caching . Under most circumstances ,
// they only inject into a class once . . . but I WebContainer team lead says
// its possible to have multiple servlets share the same class , and in that
// scenario they would be injecting into the same class multiple times ,
// and take advantage of the caching .
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . entry ( tc , "getInjectionTargets: " + classToInjectInto + ", " + this ) ; InjectionTarget [ ] injectionTargetsForClass = ivInjectionTargetMap . get ( classToInjectInto ) ; if ( injectionTargetsForClass == null ) { synchronized ( ivInjectionTargetMap ) { injectionTargetsForClass = ivInjectionTargetMap . get ( classToInjectInto ) ; if ( injectionTargetsForClass == null ) { // If targets were not found in cache from app start , then rebuilding them
// needs to run privileged , as this may run in the context of tha appliation
try { injectionTargetsForClass = AccessController . doPrivileged ( new PrivilegedExceptionAction < InjectionTarget [ ] > ( ) { @ Override public InjectionTarget [ ] run ( ) throws Exception { return ivInjectionEngine . getInjectionTargets ( ivDeclaredInjectionTargets , classToInjectInto , ivCheckAppConfig ) ; } } ) ; } catch ( PrivilegedActionException ex ) { Throwable cause = ex . getCause ( ) ; if ( cause instanceof InjectionException ) { throw ( InjectionException ) cause ; } if ( cause instanceof RuntimeException ) { throw ( RuntimeException ) cause ; } throw new InjectionException ( cause ) ; } if ( ivInjectionTargetMap . size ( ) <= svInjTarMapCacheSize || injectionTargetsForClass . length > 0 ) { ivInjectionTargetMap . put ( classToInjectInto , injectionTargetsForClass ) ; } } } } if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . exit ( tc , "getInjectionTargets" , Arrays . asList ( injectionTargetsForClass ) ) ; return injectionTargetsForClass ; |
public class AttributeRenderer { /** * This method will render the values assocated with the div around a treeItem .
* @ param state
* @ param elem */
public void renderDiv ( DivTag . State state , TreeElement elem ) { } } | ArrayList al = _lists [ TreeHtmlAttributeInfo . HTML_LOCATION_DIV ] ; assert ( al != null ) ; if ( al . size ( ) == 0 ) return ; int cnt = al . size ( ) ; for ( int i = 0 ; i < cnt ; i ++ ) { TreeHtmlAttributeInfo attr = ( TreeHtmlAttributeInfo ) al . get ( i ) ; state . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , attr . getAttribute ( ) , attr . getValue ( ) ) ; } |
public class EMMImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . EMM__MM_NAME : setMMName ( MM_NAME_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class IntrospectionLevelMember { /** * Return the value of the member ' s field
* @ param field
* The field to be queried
* @ return The value of the field */
private Object getFieldValue ( final Field field ) { } } | Object field_value = AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { @ Override public Object run ( ) { try { Object value = field . get ( _member ) ; // Don ' t dump sensitive data
boolean sensitive = _member . getClass ( ) . isAnnotationPresent ( Sensitive . class ) || field . isAnnotationPresent ( Sensitive . class ) ; if ( value != null && sensitive ) { value = DataFormatHelper . sensitiveToString ( value ) ; } return value ; } catch ( IllegalAccessException e ) { // No FFDC code needed - we ' re in the middle of FFDC ' ing !
// Should not happen - if it does return a string : - )
return "/* Could not access " + field . getName ( ) + " */" ; } } } ) ; return field_value ; |
public class RebindConfiguration { /** * @ param clazz class to find the type
* @ return the { @ link JClassType } denoted by the class given in parameter */
private JClassType findClassType ( Class < ? > clazz ) { } } | JClassType mapperType = context . getTypeOracle ( ) . findType ( clazz . getCanonicalName ( ) ) ; if ( null == mapperType ) { logger . log ( Type . WARN , "Cannot find the type denoted by the class " + clazz . getCanonicalName ( ) + " or GWT compilation of that class failed. In the latter case, compile with -failOnError to discover the real error." ) ; return null ; } return mapperType ; |
public class FreightStreamer { /** * Compress a file . */
private int compress ( String argv [ ] , Configuration conf ) throws IOException { } } | int i = 0 ; String cmd = argv [ i ++ ] ; String srcf = argv [ i ++ ] ; String dstf = argv [ i ++ ] ; Path srcPath = new Path ( srcf ) ; FileSystem srcFs = srcPath . getFileSystem ( getConf ( ) ) ; Path dstPath = new Path ( dstf ) ; FileSystem dstFs = dstPath . getFileSystem ( getConf ( ) ) ; // Create codec
CompressionCodecFactory factory = new CompressionCodecFactory ( conf ) ; CompressionCodec codec = factory . getCodec ( dstPath ) ; if ( codec == null ) { System . err . println ( cmd . substring ( 1 ) + ": cannot find compression codec for " + dstf ) ; return 1 ; } // open input stream
InputStream in = srcFs . open ( srcPath ) ; // Create compression stream
OutputStream out = dstFs . create ( dstPath ) ; out = codec . createOutputStream ( out ) ; IOUtils . copyBytes ( in , out , conf , true ) ; return 0 ; |
public class Plane { /** * Sets this plane based on a point on the plane and the plane normal .
* @ return a reference to the plane ( for chaining ) . */
public Plane fromPointNormal ( IVector3 pt , IVector3 normal ) { } } | return set ( normal , - normal . dot ( pt ) ) ; |
public class HttpResponses { /** * Sends an error with a stack trace .
* @ see # errorWithoutStack */
@ SuppressWarnings ( { } } | "ThrowableInstanceNeverThrown" } ) public static HttpResponseException error ( int code , String errorMessage ) { return error ( code , new Exception ( errorMessage ) ) ; |
public class ExpressionValidator { /** * Resolves a boolean expression ( validation or visible expression )
* @ param expression JavaScript expression
* @ param entity entity used during expression evaluation
* @ return < code > true < / code > or < code > false < / code >
* @ throws MolgenisDataException if the script resolves to null or to a non boolean */
boolean resolveBooleanExpression ( String expression , Entity entity ) { } } | return resolveBooleanExpressions ( singletonList ( expression ) , entity ) . get ( 0 ) ; |
public class DeleteKnownHostKeysRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteKnownHostKeysRequest deleteKnownHostKeysRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteKnownHostKeysRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteKnownHostKeysRequest . getInstanceName ( ) , INSTANCENAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CollectionUtils { /** * Removes the first occurrence in the list of the specified object , using
* object identity ( = = ) not equality as the criterion for object presence . If
* this list does not contain the element , it is unchanged .
* @ param l
* The { @ link List } from which to remove the object
* @ param o
* The object to be removed .
* @ return Whether or not the List was changed . */
public static < T > boolean removeObject ( List < T > l , T o ) { } } | int i = 0 ; for ( Object o1 : l ) { if ( o == o1 ) { l . remove ( i ) ; return true ; } else i ++ ; } return false ; |
public class ClassWriter { /** * Generate everything after import statements .
* @ param entity The meta entity for which to write the body
* @ param context The processing context
* @ return body content */
private static StringBuffer generateBody ( MetaEntity entity , Context context ) { } } | StringWriter sw = new StringWriter ( ) ; PrintWriter pw = null ; try { pw = new PrintWriter ( sw ) ; if ( context . addGeneratedAnnotation ( ) ) { pw . println ( writeGeneratedAnnotation ( entity , context ) ) ; } if ( context . isAddSuppressWarningsAnnotation ( ) ) { pw . println ( writeSuppressWarnings ( ) ) ; } pw . println ( writeStaticMetaModelAnnotation ( entity ) ) ; printClassDeclaration ( entity , pw , context ) ; pw . println ( ) ; List < MetaAttribute > members = entity . getMembers ( ) ; for ( MetaAttribute metaMember : members ) { pw . println ( " " + metaMember . getDeclarationString ( ) ) ; } pw . println ( ) ; pw . println ( "}" ) ; return sw . getBuffer ( ) ; } finally { if ( pw != null ) { pw . close ( ) ; } } |
public class SSLInformationAssociationHandler { /** * Given the name of a TLS / SSL cipher suite , return an int representing it effective stream
* cipher key strength . i . e . How much entropy material is in the key material being fed into the
* encryption routines .
* http : / / www . thesprawl . org / research / tls - and - ssl - cipher - suites /
* @ param cipherSuite String name of the TLS cipher suite .
* @ return int indicating the effective key entropy bit - length . */
public static int getKeyLength ( String cipherSuite ) { } } | // Roughly ordered from most common to least common .
if ( cipherSuite == null ) { return 0 ; } else if ( cipherSuite . contains ( "WITH_AES_256_" ) ) { return 256 ; } else if ( cipherSuite . contains ( "WITH_RC4_128_" ) ) { return 128 ; } else if ( cipherSuite . contains ( "WITH_AES_128_" ) ) { return 128 ; } else if ( cipherSuite . contains ( "WITH_RC4_40_" ) ) { return 40 ; } else if ( cipherSuite . contains ( "WITH_3DES_EDE_CBC_" ) ) { return 168 ; } else if ( cipherSuite . contains ( "WITH_IDEA_CBC_" ) ) { return 128 ; } else if ( cipherSuite . contains ( "WITH_RC2_CBC_40_" ) ) { return 40 ; } else if ( cipherSuite . contains ( "WITH_DES40_CBC_" ) ) { return 40 ; } else if ( cipherSuite . contains ( "WITH_DES_CBC_" ) ) { return 56 ; } else { return 0 ; } |
public class ExcelDataProviderImpl { /** * This function will use the input string representing the keys to collect and return the correct excel sheet data
* rows as two dimensional object to be used as TestNG DataProvider .
* @ param keys
* the string represents the list of key for the search and return the wanted row . It is in the format of
* { " row1 " , " row3 " , " row5 " }
* @ return Object [ ] [ ] two dimensional object to be used with TestNG DataProvider */
@ Override public Object [ ] [ ] getDataByKeys ( String [ ] keys ) { } } | logger . entering ( Arrays . toString ( keys ) ) ; Object [ ] [ ] obj = new Object [ keys . length ] [ 1 ] ; for ( int i = 0 ; i < keys . length ; i ++ ) { obj [ i ] [ 0 ] = getSingleExcelRow ( getObject ( ) , keys [ i ] , true ) ; } logger . exiting ( ( Object [ ] ) obj ) ; return obj ; |
public class QueryHandler { /** * Parses the errors and warnings from the content stream as long as there are some to be found . */
private void parseQueryError ( boolean lastChunk ) { } } | while ( true ) { int openBracketPos = findNextChar ( responseContent , '{' ) ; if ( isEmptySection ( openBracketPos ) || ( lastChunk && openBracketPos < 0 ) ) { sectionDone ( ) ; queryParsingState = transitionToNextToken ( lastChunk ) ; // warnings or status
break ; } int closeBracketPos = findSectionClosingPosition ( responseContent , '{' , '}' ) ; if ( closeBracketPos == - 1 ) { break ; } int length = closeBracketPos - openBracketPos - responseContent . readerIndex ( ) + 1 ; responseContent . skipBytes ( openBracketPos ) ; ByteBuf resultSlice = responseContent . readSlice ( length ) ; queryErrorObservable . onNext ( resultSlice . copy ( ) ) ; } |
public class LifecycleEventConfigurationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LifecycleEventConfiguration lifecycleEventConfiguration , ProtocolMarshaller protocolMarshaller ) { } } | if ( lifecycleEventConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( lifecycleEventConfiguration . getShutdown ( ) , SHUTDOWN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MyEntitiesValidationReport { /** * Creates a new report , with an attribute added to the last added entity ;
* @ param attributeName name of the attribute to add
* @ param state state of the attribute to add
* @ return this report */
public MyEntitiesValidationReport addAttribute ( String attributeName , AttributeState state ) { } } | if ( getImportOrder ( ) . isEmpty ( ) ) { throw new IllegalStateException ( "Must add entity first" ) ; } String entityTypeId = getImportOrder ( ) . get ( getImportOrder ( ) . size ( ) - 1 ) ; valid = valid && state . isValid ( ) ; switch ( state ) { case IMPORTABLE : addField ( fieldsImportable , entityTypeId , attributeName ) ; break ; case UNKNOWN : addField ( fieldsUnknown , entityTypeId , attributeName ) ; break ; case AVAILABLE : addField ( fieldsAvailable , entityTypeId , attributeName ) ; break ; case REQUIRED : addField ( fieldsRequired , entityTypeId , attributeName ) ; break ; default : throw new UnexpectedEnumException ( state ) ; } return this ; |
public class TypeBindings { /** * Method for creating an instance that has same bindings as this object ,
* plus an indicator for additional type variable that may be unbound within
* this context ; this is needed to resolve recursive self - references . */
public TypeBindings withUnboundVariable ( String name ) { } } | int len = ( _unboundVariables == null ) ? 0 : _unboundVariables . length ; String [ ] names = ( len == 0 ) ? new String [ 1 ] : Arrays . copyOf ( _unboundVariables , len + 1 ) ; names [ len ] = name ; return new TypeBindings ( _names , _types , names ) ; |
public class GeometryService { /** * Validates a geometry , focusing on changes at a specific sub - level of the geometry . The sublevel is indicated by
* passing an index . The only checks are on intersection and containment , we don ' t check on too few coordinates as
* we want to support incremental creation of polygons .
* @ param geometry The geometry to check .
* @ param index index that points to a sub - geometry , edge , vertex , etc . . .
* @ return True or false .
* @ since 1.3.0 */
public static boolean isValid ( Geometry geometry , GeometryIndex index ) { } } | validate ( geometry , index ) ; return validationContext . isValid ( ) ; |
public class MaterializedViewFixInfo { /** * Check whether the results from a materialized view need to be
* re - aggregated on the coordinator by the view ' s GROUP BY columns
* prior to any of the processing specified by the query .
* This is normally the case when a mat view ' s source table is partitioned
* and the view ' s GROUP BY does not include the partition key .
* There is a special edge case where the query already contains the exact
* reaggregations that the added - cost fix would introduce , so the fix can
* be skipped as an optimization .
* Set the m _ needed flag to true , only if the reaggregation fix is needed .
* @ return The value of m _ needed */
public boolean processMVBasedQueryFix ( StmtTableScan mvTableScan , Set < SchemaColumn > scanColumns , JoinNode joinTree , List < ParsedColInfo > displayColumns , List < ParsedColInfo > groupByColumns ) { } } | // Check valid cases first
// @ TODO
if ( ! ( mvTableScan instanceof StmtTargetTableScan ) ) { return false ; } Table table = ( ( StmtTargetTableScan ) mvTableScan ) . getTargetTable ( ) ; assert ( table != null ) ; String mvTableName = table . getTypeName ( ) ; Table srcTable = table . getMaterializer ( ) ; if ( srcTable == null ) { return false ; } if ( table . getIsreplicated ( ) ) { return false ; } // Justify whether partition column is in group by column list or not
if ( table . getPartitioncolumn ( ) != null ) { return false ; } m_mvTableScan = mvTableScan ; Set < String > mvDDLGroupbyColumnNames = new HashSet < > ( ) ; List < Column > mvColumnArray = CatalogUtil . getSortedCatalogItems ( table . getColumns ( ) , "index" ) ; String mvTableAlias = getMVTableAlias ( ) ; // Get the number of group - by columns .
int numOfGroupByColumns ; MaterializedViewInfo mvInfo = srcTable . getViews ( ) . get ( mvTableName ) ; if ( mvInfo != null ) { // single table view
String complexGroupbyJson = mvInfo . getGroupbyexpressionsjson ( ) ; if ( complexGroupbyJson . length ( ) > 0 ) { List < AbstractExpression > mvComplexGroupbyCols = null ; try { mvComplexGroupbyCols = AbstractExpression . fromJSONArrayString ( complexGroupbyJson , null ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } numOfGroupByColumns = mvComplexGroupbyCols . size ( ) ; } else { numOfGroupByColumns = mvInfo . getGroupbycols ( ) . size ( ) ; } } else { // joined table view
MaterializedViewHandlerInfo mvHandlerInfo = table . getMvhandlerinfo ( ) . get ( "mvHandlerInfo" ) ; numOfGroupByColumns = mvHandlerInfo . getGroupbycolumncount ( ) ; } if ( scanColumns . isEmpty ( ) && numOfGroupByColumns == 0 ) { // This is an edge case that can happen if the view
// has no group by keys , and we are just
// doing a count ( * ) on the output of the view .
// Having no GB keys or scan columns would cause us to
// produce plan nodes that have a 0 - column output schema .
// We can ' t handle this in several places , so add the
// count ( * ) column from the view to the scan columns .
Column mvCol = mvColumnArray . get ( 0 ) ; // this is the " count ( * ) " column .
TupleValueExpression tve = new TupleValueExpression ( mvTableName , mvTableAlias , mvCol , 0 ) ; tve . setOrigStmtId ( mvTableScan . getStatementId ( ) ) ; String colName = mvCol . getName ( ) ; SchemaColumn scol = new SchemaColumn ( mvTableName , mvTableAlias , colName , colName , tve ) ; scanColumns . add ( scol ) ; } // Start to do real materialized view processing to fix the duplicates problem .
// (1 ) construct new projection columns for scan plan node .
Set < SchemaColumn > mvDDLGroupbyColumns = new HashSet < > ( ) ; NodeSchema inlineProjSchema = new NodeSchema ( ) ; for ( SchemaColumn scol : scanColumns ) { inlineProjSchema . addColumn ( scol ) ; } for ( int i = 0 ; i < numOfGroupByColumns ; i ++ ) { Column mvCol = mvColumnArray . get ( i ) ; String colName = mvCol . getName ( ) ; TupleValueExpression tve = new TupleValueExpression ( mvTableName , mvTableAlias , mvCol , i ) ; tve . setOrigStmtId ( mvTableScan . getStatementId ( ) ) ; mvDDLGroupbyColumnNames . add ( colName ) ; SchemaColumn scol = new SchemaColumn ( mvTableName , mvTableAlias , colName , colName , tve ) ; mvDDLGroupbyColumns . add ( scol ) ; if ( ! scanColumns . contains ( scol ) ) { scanColumns . add ( scol ) ; // construct new projection columns for scan plan node .
inlineProjSchema . addColumn ( scol ) ; } } // Record the re - aggregation type for each scan columns .
Map < String , ExpressionType > mvColumnReAggType = new HashMap < > ( ) ; for ( int i = numOfGroupByColumns ; i < mvColumnArray . size ( ) ; i ++ ) { Column mvCol = mvColumnArray . get ( i ) ; ExpressionType reAggType = ExpressionType . get ( mvCol . getAggregatetype ( ) ) ; if ( reAggType == ExpressionType . AGGREGATE_COUNT_STAR || reAggType == ExpressionType . AGGREGATE_COUNT ) { reAggType = ExpressionType . AGGREGATE_SUM ; } mvColumnReAggType . put ( mvCol . getName ( ) , reAggType ) ; } assert ( inlineProjSchema . size ( ) > 0 ) ; m_scanInlinedProjectionNode = new ProjectionPlanNode ( inlineProjSchema ) ; // (2 ) Construct the reAggregation Node .
// Construct the reAggregation plan node ' s aggSchema
m_reAggNode = new HashAggregatePlanNode ( ) ; int outputColumnIndex = 0 ; // inlineProjSchema contains the group by columns , while aggSchema may do not .
NodeSchema aggSchema = new NodeSchema ( ) ; // Construct reAggregation node ' s aggregation and group by list .
for ( SchemaColumn scol : inlineProjSchema ) { if ( mvDDLGroupbyColumns . contains ( scol ) ) { // Add group by expression .
m_reAggNode . addGroupByExpression ( scol . getExpression ( ) ) ; } else { ExpressionType reAggType = mvColumnReAggType . get ( scol . getColumnName ( ) ) ; assert ( reAggType != null ) ; AbstractExpression agg_input_expr = scol . getExpression ( ) ; assert ( agg_input_expr instanceof TupleValueExpression ) ; // Add aggregation information .
m_reAggNode . addAggregate ( reAggType , false , outputColumnIndex , agg_input_expr ) ; } aggSchema . addColumn ( scol ) ; outputColumnIndex ++ ; } assert ( aggSchema . size ( ) > 0 ) ; m_reAggNode . setOutputSchema ( aggSchema ) ; // Collect all TVEs that need to be do re - aggregation in coordinator .
List < TupleValueExpression > needReAggTVEs = new ArrayList < > ( ) ; List < AbstractExpression > aggPostExprs = new ArrayList < > ( ) ; for ( int i = numOfGroupByColumns ; i < mvColumnArray . size ( ) ; i ++ ) { Column mvCol = mvColumnArray . get ( i ) ; TupleValueExpression tve = new TupleValueExpression ( mvTableName , mvTableAlias , mvCol , - 1 ) ; tve . setOrigStmtId ( mvTableScan . getStatementId ( ) ) ; needReAggTVEs . add ( tve ) ; } collectReAggNodePostExpressions ( joinTree , needReAggTVEs , aggPostExprs ) ; AbstractExpression aggPostExpr = ExpressionUtil . combinePredicates ( aggPostExprs ) ; // Add post filters for the reAggregation node .
m_reAggNode . setPostPredicate ( aggPostExpr ) ; // ENG - 5386
if ( m_edgeCaseQueryNoFixNeeded && edgeCaseQueryNoFixNeeded ( mvDDLGroupbyColumnNames , mvColumnReAggType , displayColumns , groupByColumns ) ) { return false ; } m_needed = true ; return true ; |
public class JnlpFileHandler { /** * This code is heavily inspired by the stuff in HttpUtils . getRequestURL */
private String getUrlPrefix ( HttpServletRequest req ) { } } | StringBuilder url = new StringBuilder ( ) ; String scheme = req . getScheme ( ) ; int port = req . getServerPort ( ) ; url . append ( scheme ) ; // http , https
url . append ( "://" ) ; url . append ( req . getServerName ( ) ) ; if ( ( scheme . equals ( "http" ) && port != 80 ) || ( scheme . equals ( "https" ) && port != 443 ) ) { url . append ( ':' ) ; url . append ( req . getServerPort ( ) ) ; } return url . toString ( ) ; |
public class Job { /** * Get output dir .
* @ return absolute output dir */
public File getOutputDir ( ) { } } | if ( prop . containsKey ( PROPERTY_OUTPUT_DIR ) ) { return new File ( prop . get ( PROPERTY_OUTPUT_DIR ) . toString ( ) ) ; } return null ; |
public class RuleBasedTimeZone { /** * { @ inheritDoc } */
@ Override public int getOffset ( int era , int year , int month , int day , int dayOfWeek , int milliseconds ) { } } | if ( era == GregorianCalendar . BC ) { // Convert to extended year
year = 1 - year ; } long time = Grego . fieldsToDay ( year , month , day ) * Grego . MILLIS_PER_DAY + milliseconds ; int [ ] offsets = new int [ 2 ] ; getOffset ( time , true , LOCAL_DST , LOCAL_STD , offsets ) ; return ( offsets [ 0 ] + offsets [ 1 ] ) ; |
public class NamespaceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Namespace namespace , ProtocolMarshaller protocolMarshaller ) { } } | if ( namespace == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( namespace . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( namespace . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( namespace . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( namespace . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( namespace . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( namespace . getServiceCount ( ) , SERVICECOUNT_BINDING ) ; protocolMarshaller . marshall ( namespace . getProperties ( ) , PROPERTIES_BINDING ) ; protocolMarshaller . marshall ( namespace . getCreateDate ( ) , CREATEDATE_BINDING ) ; protocolMarshaller . marshall ( namespace . getCreatorRequestId ( ) , CREATORREQUESTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CmsSubscriptionCollector { /** * Returns the subscribed resources according to the collector parameter . < p >
* @ param cms the current users context
* @ param param an optional collector parameter
* @ param numResults the number of results
* @ return the subscribed resources according to the collector parameter
* @ throws CmsException if something goes wrong */
protected List < CmsResource > getSubscribedResources ( CmsObject cms , String param , int numResults ) throws CmsException { } } | List < CmsResource > result = OpenCms . getSubscriptionManager ( ) . readSubscribedResources ( cms , getSubscriptionFilter ( cms , param ) ) ; Collections . sort ( result , I_CmsResource . COMPARE_DATE_LAST_MODIFIED ) ; if ( numResults > 0 ) { result = shrinkToFit ( result , numResults ) ; } return result ; |
public class Ransac { /** * Performs a random draw in the dataSet . When an element is selected it is moved to the end of the list
* so that it can ' t be selected again .
* @ param dataSet List that points are to be selected from . Modified . */
public static < T > void randomDraw ( List < T > dataSet , int numSample , List < T > initialSample , Random rand ) { } } | initialSample . clear ( ) ; for ( int i = 0 ; i < numSample ; i ++ ) { // index of last element that has not been selected
int indexLast = dataSet . size ( ) - i - 1 ; // randomly select an item from the list which has not been selected
int indexSelected = rand . nextInt ( indexLast + 1 ) ; T a = dataSet . get ( indexSelected ) ; initialSample . add ( a ) ; // Swap the selected item with the last unselected item in the list . This way the selected
// item can ' t be selected again and the last item can now be selected
dataSet . set ( indexSelected , dataSet . set ( indexLast , a ) ) ; } |
public class HebrewTime { /** * / * [ deutsch ]
* < p > Ermittelt die aktuelle hebr & auml ; ische Uhrzeit in der Systemzeit und an der angegebenen
* geographischen Position . < / p >
* @ param geoLocation the geographical position as basis of the solar time
* @ return current Hebrew time at given location ( optional )
* @ see SystemClock # currentMoment ( )
* @ see # at ( SolarTime ) */
public static Optional < HebrewTime > now ( SolarTime geoLocation ) { } } | return HebrewTime . at ( geoLocation ) . apply ( SystemClock . currentMoment ( ) ) ; |
public class PronounFeats { /** * setter for case - sets Case
* @ generated
* @ param v value to set into the feature */
public void setCase ( String v ) { } } | if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_case == null ) jcasType . jcas . throwFeatMissing ( "case" , "de.julielab.jules.types.PronounFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_case , v ) ; |
public class TreeCoreset { /** * selects a leaf node ( using the kMeans + + distribution ) */
treeNode selectNode ( treeNode root , MTRandom clustererRandom ) { } } | // random number between 0 and 1
double random = clustererRandom . nextDouble ( ) ; while ( ! isLeaf ( root ) ) { if ( root . lc . cost == 0 && root . rc . cost == 0 ) { if ( root . lc . n == 0 ) { root = root . rc ; } else if ( root . rc . n == 0 ) { root = root . lc ; } else if ( random < 0.5 ) { random = clustererRandom . nextDouble ( ) ; root = root . lc ; } else { random = clustererRandom . nextDouble ( ) ; root = root . rc ; } } else { if ( random < root . lc . cost / root . cost ) { root = root . lc ; } else { root = root . rc ; } } } return root ; |
public class DrilldownProcessor { /** * Adds the drilldown options stored in the context to a javascript array . */
private void addDrilldownOptionsArray ( OptionsProcessorContext context ) { } } | JsonRenderer renderer = JsonRendererFactory . getInstance ( ) . getRenderer ( ) ; response . render ( JavaScriptHeaderItem . forScript ( MessageFormat . format ( "var {0};\n var {1};" , JS_DRILLDOWN_ARRAY_NAME , getDrilldownArrayName ( component ) ) , JS_DRILLDOWN_ARRAY_NAME + "-init" ) ) ; response . render ( OnDomReadyHeaderItem . forScript ( MessageFormat . format ( "{0} = {1};" , getDrilldownArrayName ( component ) , renderer . toJson ( context . getDrilldownOptions ( ) ) ) ) ) ; |
public class PageContentHelper { /** * Shortcut method for adding all the headline entries stored in the WHeaders .
* @ param writer the writer to write to .
* @ param headers contains all the headline entries . */
public static void addAllHeadlines ( final PrintWriter writer , final Headers headers ) { } } | PageContentHelper . addHeadlines ( writer , headers . getHeadLines ( ) ) ; PageContentHelper . addJsHeadlines ( writer , headers . getHeadLines ( Headers . JAVASCRIPT_HEADLINE ) ) ; PageContentHelper . addCssHeadlines ( writer , headers . getHeadLines ( Headers . CSS_HEADLINE ) ) ; |
public class AWSLogsClient { /** * Lists the subscription filters for the specified log group . You can list all the subscription filters or filter
* the results by prefix . The results are ASCII - sorted by filter name .
* @ param describeSubscriptionFiltersRequest
* @ return Result of the DescribeSubscriptionFilters operation returned by the service .
* @ throws InvalidParameterException
* A parameter is specified incorrectly .
* @ throws ResourceNotFoundException
* The specified resource does not exist .
* @ throws ServiceUnavailableException
* The service cannot complete the request .
* @ sample AWSLogs . DescribeSubscriptionFilters
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / logs - 2014-03-28 / DescribeSubscriptionFilters "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeSubscriptionFiltersResult describeSubscriptionFilters ( DescribeSubscriptionFiltersRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeSubscriptionFilters ( request ) ; |
public class ExpandoMetaClass { /** * Overrides default implementation just in case setProperty method has been overridden by ExpandoMetaClass
* @ see MetaClassImpl # setProperty ( Class , Object , String , Object , boolean , boolean ) */
public void setProperty ( Class sender , Object object , String name , Object newValue , boolean useSuper , boolean fromInsideClass ) { } } | if ( setPropertyMethod != null && ! name . equals ( META_CLASS_PROPERTY ) && getJavaClass ( ) . isInstance ( object ) ) { setPropertyMethod . invoke ( object , new Object [ ] { name , newValue } ) ; return ; } super . setProperty ( sender , object , name , newValue , useSuper , fromInsideClass ) ; |
public class BaseStreamingClient { /** * A Streaming Put call
* @ param key - The key
* @ param value - The value */
@ SuppressWarnings ( { } } | } ) public synchronized void streamingPut ( ByteArray key , Versioned < byte [ ] > value ) { if ( MARKED_BAD ) { logger . error ( "Cannot stream more entries since Recovery Callback Failed!" ) ; throw new VoldemortException ( "Cannot stream more entries since Recovery Callback Failed!" ) ; } for ( String store : storeNames ) { streamingPut ( key , value , store ) ; } |
public class AnnotatedMethodInvoker { /** * Get all annotation on the given class , plus all annotations on the parent classes
* @ param clazz
* @ param annotation
* @ return */
public static < A extends Annotation > List < AnnotatedClass < A > > allTypeAnnotations ( final Class < ? > clazz , final Class < A > annotation , final boolean recurse ) { } } | final List < AnnotatedClass < A > > ret = new ArrayList < > ( ) ; final A curClassAnnotation = clazz . getAnnotation ( annotation ) ; if ( curClassAnnotation != null ) ret . add ( new AnnotatedClass < A > ( clazz , curClassAnnotation ) ) ; if ( ! recurse ) return ret ; final Class < ? > superClazz = clazz . getSuperclass ( ) ; if ( superClazz != null ) ret . addAll ( allTypeAnnotations ( superClazz , annotation , recurse ) ) ; // Now do the interfaces .
final Class < ? > [ ] ifaces = clazz . getInterfaces ( ) ; if ( ifaces != null && ifaces . length > 0 ) Arrays . stream ( ifaces ) . forEach ( iface -> ret . addAll ( allTypeAnnotations ( iface , annotation , recurse ) ) ) ; return ret ; |
public class Table { /** * Set a config item
* @ param name the item name
* @ param type the item type
* @ param value the item value */
public void setConfigItem ( final String name , final String type , final String value ) { } } | this . builder . setConfigItem ( name , type , value ) ; |
public class BigDecimalAccessor { /** * ( non - Javadoc )
* @ see com . impetus . kundera . property . PropertyAccessor # fromBytes ( byte [ ] ) */
@ Override public BigDecimal fromBytes ( Class targetClass , byte [ ] bytes ) { } } | if ( bytes == null ) { return null ; } int scale = ( ( ( bytes [ 0 ] ) << 24 ) | ( ( bytes [ 1 ] & 0xff ) << 16 ) | ( ( bytes [ 2 ] & 0xff ) << 8 ) | ( ( bytes [ 3 ] & 0xff ) ) ) ; byte [ ] bibytes = Arrays . copyOfRange ( bytes , 4 , bytes . length ) ; BigInteger bi = new BigInteger ( bibytes ) ; return new BigDecimal ( bi , scale ) ; |
public class AbstractPageProvider { /** * Determine root resource to list its children . ( use resource for root page because root node does not have to be a
* page but can be e . g . a nt : folder node )
* @ param request Request
* @ return Root resource or null if invalid resource was referenced */
@ SuppressWarnings ( "null" ) protected final Resource getRootResource ( SlingHttpServletRequest request ) { } } | String path = RequestParam . get ( request , RP_PATH ) ; if ( StringUtils . isEmpty ( path ) && request . getResource ( ) != null ) { path = request . getResource ( ) . getPath ( ) ; } if ( StringUtils . isNotEmpty ( path ) ) { path = StringUtils . removeEnd ( path , "/" + JcrConstants . JCR_CONTENT ) ; return request . getResourceResolver ( ) . getResource ( path ) ; } return null ; |
public class TransparentReplicaGetHelper { /** * Asynchronously fetch the document from the primary and if that operations fails try
* all the replicas and return the first document that comes back from them ( with a custom
* timeout value applied to both primary and replica ) .
* @ param id the document ID to fetch .
* @ param bucket the bucket to use when fetching the doc .
* @ param timeout the timeout to use for both primary and replica fetches ( separately )
* @ return an { @ link Single } with either 0 or 1 { @ link JsonDocument } . */
@ InterfaceStability . Experimental @ InterfaceAudience . Public public Single < JsonDocument > getFirstPrimaryOrReplica ( final String id , final Bucket bucket , final long timeout ) { } } | return getFirstPrimaryOrReplica ( id , bucket , timeout , timeout ) ; |
public class TaskEventDispatcher { /** * Subscribes a listener to this dispatcher for events on a partition .
* @ param partitionId
* ID of the partition to subscribe for ( must be registered via { @ link
* # registerPartition ( ResultPartitionID ) } first ! )
* @ param eventListener
* the event listener to subscribe
* @ param eventType
* event type to subscribe to */
public void subscribeToEvent ( ResultPartitionID partitionId , EventListener < TaskEvent > eventListener , Class < ? extends TaskEvent > eventType ) { } } | checkNotNull ( partitionId ) ; checkNotNull ( eventListener ) ; checkNotNull ( eventType ) ; TaskEventHandler taskEventHandler ; synchronized ( registeredHandlers ) { taskEventHandler = registeredHandlers . get ( partitionId ) ; } if ( taskEventHandler == null ) { throw new IllegalStateException ( "Partition " + partitionId + " not registered at task event dispatcher." ) ; } taskEventHandler . subscribe ( eventListener , eventType ) ; |
public class EitherT { /** * Construct an MaybeWT from an AnyM that wraps a monad containing MaybeWs
* @ param monads AnyM that contains a monad wrapping an Maybe
* @ return MaybeWT */
public static < W extends WitnessType < W > , ST , A > EitherT < W , ST , A > of ( final AnyM < W , Either < ST , A > > monads ) { } } | return new EitherT < > ( monads ) ; |
public class InfinispanLofStateFactory { /** * { @ inheritDoc } */
@ SuppressWarnings ( "rawtypes" ) @ Override public State makeState ( Map conf , IMetricsContext metrics , int partitionIndex , int numPartitions ) { } } | InfinispanLofState resultState = new InfinispanLofState ( this . targetUri , this . tableName , partitionIndex , numPartitions ) ; if ( this . mergeInterval > 0 ) { resultState . setMergeInterval ( this . mergeInterval ) ; } if ( this . lifespan > 0 ) { resultState . setLifespan ( this . lifespan ) ; } if ( this . mergeConfig != null ) { resultState . setMergeConfig ( this . mergeConfig ) ; } resultState . initialize ( ) ; return resultState ; |
public class DnsHostMatcher { /** * Set the host .
* @ param host the host */
public final void setHost ( final String host ) throws UnknownHostException { } } | this . host = host ; final InetAddress [ ] inetAddresses = InetAddress . getAllByName ( host ) ; for ( InetAddress address : inetAddresses ) { final AddressHostMatcher matcher = new AddressHostMatcher ( ) ; matcher . setIp ( address . getHostAddress ( ) ) ; this . matchersForHost . add ( matcher ) ; } |
public class ViewVectorAsDoubleVector { /** * { @ inheritDoc } */
public void set ( int index , double value ) { } } | if ( isImmutable ) throw new UnsupportedOperationException ( "Cannot modify an immutable vector" ) ; vector . set ( getIndex ( index ) , value ) ; |
public class Grefenstette { /** * { @ inheritDoc } */
public void processDocument ( BufferedReader document ) throws IOException { } } | ArrayList < Pair < String > > wordsInPhrase = new ArrayList < Pair < String > > ( ) ; String nounPhrase = "" ; String lastNoun = "" ; String lastVerb = "" ; String secondPrevPhrase = "" ; String prevPhrase = "" ; nounPhrase = document . readLine ( ) ; for ( String tag = getNextTag ( nounPhrase ) ; tag != null ; tag = getNextTag ( nounPhrase ) ) { String word ; int startOfTag = nounPhrase . indexOf ( tag ) ; nounPhrase = nounPhrase . substring ( startOfTag ) ; wordsInPhrase . clear ( ) ; if ( tag . equals ( "NP" ) ) { while ( nounPhrase . charAt ( 0 ) != ')' ) { // extract tag of word in noun phrase
tag = getNextTag ( nounPhrase ) ; if ( isPhraseOrClause ( tag ) || isPreposition ( tag ) ) { nounPhrase = nounPhrase . substring ( nounPhrase . indexOf ( tag ) + tag . length ( ) ) ; // stop processing NP
break ; } else if ( inStartSet ( tag ) || inReceiveSet ( tag ) ) { // note to self : find out why this broke
try { word = nounPhrase . substring ( nounPhrase . indexOf ( " " , nounPhrase . indexOf ( tag ) ) + 1 , nounPhrase . indexOf ( ")" ) ) ; wordsInPhrase . add ( new Pair < String > ( tag , word ) ) ; nounPhrase = nounPhrase . substring ( nounPhrase . indexOf ( ")" , nounPhrase . indexOf ( word ) ) + 1 ) ; } catch ( StringIndexOutOfBoundsException e ) { nounPhrase = nounPhrase . substring ( nounPhrase . indexOf ( ")" ) ) ; } // else it ' s not a tag I care about
} else { nounPhrase = nounPhrase . substring ( nounPhrase . indexOf ( ")" ) + 1 ) ; } } // note to self : is this if statement represent the same thing
// as the next if statement ? ?
if ( ! wordsInPhrase . isEmpty ( ) ) { // set head noun to last word in noun phrase
String headNoun = wordsInPhrase . get ( wordsInPhrase . size ( ) - 1 ) . y ; // create the relations from pass two
if ( prevPhrase . equals ( "PP" ) && secondPrevPhrase . equals ( "NP" ) && lastNoun . length ( ) != 0 ) { wordRelationsWriter . println ( lastNoun + " " + headNoun ) ; addRelation ( lastNoun , headNoun ) ; } // create relations from pass four
if ( prevPhrase . equals ( "PP" ) && secondPrevPhrase . equals ( "VP" ) && lastVerb . length ( ) != 0 ) { wordRelationsWriter . println ( lastVerb + " " + headNoun ) ; addRelation ( lastVerb , headNoun ) ; } else if ( prevPhrase . equals ( "VP" ) ) { wordRelationsWriter . println ( lastVerb + " " + headNoun ) ; addRelation ( lastVerb , headNoun ) ; } lastNoun = headNoun ; } // reached end of noun phrase
if ( nounPhrase . charAt ( 0 ) == ')' ) { // create relations between words in noun phrase
// relations from pass one
processWordsInNP ( wordsInPhrase ) ; if ( ! "NP" . equals ( prevPhrase ) ) { secondPrevPhrase = prevPhrase ; prevPhrase = "NP" ; } } } // end processing NP
else if ( tag . equals ( "VP" ) ) { while ( tag != null && tag . startsWith ( "V" ) ) { // nonphrase verb
if ( tag . startsWith ( "VB" ) ) { word = nounPhrase . substring ( nounPhrase . indexOf ( " " , nounPhrase . indexOf ( tag ) ) + 1 , nounPhrase . indexOf ( ")" ) ) ; lastVerb = word ; } nounPhrase = nounPhrase . substring ( nounPhrase . indexOf ( tag ) + 1 ) ; tag = getNextTag ( nounPhrase ) ; } // relations from pass three
if ( prevPhrase . equals ( "NP" ) && lastNoun . length ( ) != 0 ) { wordRelationsWriter . println ( lastNoun + " " + lastVerb ) ; addRelation ( lastNoun , lastVerb ) ; } if ( ! prevPhrase . equals ( "VP" ) ) { secondPrevPhrase = prevPhrase ; prevPhrase = "VP" ; } } else if ( isPhraseOrClause ( tag ) || isPreposition ( tag ) ) { nounPhrase = nounPhrase . substring ( nounPhrase . indexOf ( tag ) + tag . length ( ) ) ; if ( ! tag . equals ( prevPhrase ) ) { secondPrevPhrase = prevPhrase ; prevPhrase = tag ; } } else { nounPhrase = nounPhrase . substring ( nounPhrase . indexOf ( tag ) + tag . length ( ) ) ; } } |
public class BeanProperty { /** * 获取属性值
* @ throws IllegalAccessException
* @ throws IllegalArgumentException
* @ throws InvocationTargetException
* @ throws BeanPropertyException */
public Object get ( Object obj , Object ... args ) throws IllegalArgumentException , IllegalAccessException , InvocationTargetException , BeanPropertyException , NoSuchMethodException { } } | if ( m_f != null ) return m_f . get ( obj ) ; if ( m_mGet != null ) if ( args == null || args . length == 0 ) return m_mGet . invoke ( obj ) ; else return m_mGet . invoke ( obj , args ) ; throw new BeanPropertyException ( "Try to read write-only property." ) ; |
public class LogEntry { /** * MBiManrX , synology . iig . uni - freiburg . de / Name / trunk */
private boolean modifyTime ( long milliseconds , TimeModification mod ) throws LockingException { } } | Validate . notNegative ( milliseconds ) ; Validate . notNull ( mod ) ; if ( milliseconds == 0 ) { return false ; } long diff = milliseconds ; if ( mod == TimeModification . SUB ) { diff = ( long ) Math . copySign ( diff , - 1 ) ; } Calendar cal = Calendar . getInstance ( ) ; cal . setTimeInMillis ( timestamp . getTime ( ) + diff ) ; return setTimestamp ( cal . getTime ( ) ) ; |
public class DirectedAcyclicGraph { /** * Gets the payloads for the given nodes parents .
* @ param payload the payload of the children node
* @ return the parents ' payloads , an empty list if the given payload doesn ' t exist in the DAG */
public List < T > getParents ( T payload ) { } } | List < T > parents = new ArrayList < > ( ) ; if ( ! mIndex . containsKey ( payload ) ) { return parents ; } DirectedAcyclicGraphNode < T > node = mIndex . get ( payload ) ; for ( DirectedAcyclicGraphNode < T > parent : node . getParents ( ) ) { parents . add ( parent . getPayload ( ) ) ; } return parents ; |
public class EmbeddedGobblin { /** * Specify job should run in MR mode . */
public EmbeddedGobblin mrMode ( ) throws IOException { } } | this . sysConfigOverrides . put ( ConfigurationKeys . JOB_LAUNCHER_TYPE_KEY , JobLauncherFactory . JobLauncherType . MAPREDUCE . name ( ) ) ; this . builtConfigMap . put ( ConfigurationKeys . FS_URI_KEY , FileSystem . get ( new Configuration ( ) ) . getUri ( ) . toString ( ) ) ; this . builtConfigMap . put ( ConfigurationKeys . MR_JOB_ROOT_DIR_KEY , "/tmp/EmbeddedGobblin_" + System . currentTimeMillis ( ) ) ; this . distributeJarsFunction = new Runnable ( ) { @ Override public void run ( ) { // Add jars needed at runtime to the sys config so MR job launcher will add them to distributed cache .
EmbeddedGobblin . this . sysConfigOverrides . put ( ConfigurationKeys . JOB_JAR_FILES_KEY , Joiner . on ( "," ) . join ( getPrioritizedDistributedJars ( ) ) ) ; } } ; return this ; |
public class OptionalFunction { /** * Creates a new OptionalFunction that will throw the exception supplied by the given
* supplier for null values .
* @ param exceptionSupplier the supplier to use when this function is called with a null value
* @ return a new OptionalFunction */
public OptionalFunction < T , R > orElseThrow ( Supplier < ? extends RuntimeException > exceptionSupplier ) { } } | return new OptionalFunction < > ( this . function , ( ) -> { throw exceptionSupplier . get ( ) ; } ) ; |
public class AbstractAlignmentJmol { /** * Create and set a new structure from a given atom array .
* @ param atoms */
public void setAtoms ( Atom [ ] atoms ) { } } | Structure s = new StructureImpl ( ) ; Chain c = new ChainImpl ( ) ; c . setId ( "A" ) ; for ( Atom a : atoms ) { c . addGroup ( a . getGroup ( ) ) ; } s . addChain ( c ) ; setStructure ( s ) ; |
public class Backend { /** * Opens a new transaction against all registered backend system wrapped in one { @ link BackendTransaction } .
* @ return
* @ throws BackendException */
public BackendTransaction beginTransaction ( TransactionConfiguration configuration , KeyInformation . Retriever indexKeyRetriever ) throws BackendException { } } | StoreTransaction tx = storeManagerLocking . beginTransaction ( configuration ) ; // Cache
CacheTransaction cacheTx = new CacheTransaction ( tx , storeManagerLocking , bufferSize , maxWriteTime , configuration . hasEnabledBatchLoading ( ) ) ; // Index transactions
Map < String , IndexTransaction > indexTx = new HashMap < String , IndexTransaction > ( indexes . size ( ) ) ; for ( Map . Entry < String , IndexProvider > entry : indexes . entrySet ( ) ) { indexTx . put ( entry . getKey ( ) , new IndexTransaction ( entry . getValue ( ) , indexKeyRetriever . get ( entry . getKey ( ) ) , configuration , maxWriteTime ) ) ; } return new BackendTransaction ( cacheTx , configuration , storeFeatures , edgeStore , indexStore , txLogStore , maxReadTime , indexTx , threadPool ) ; |
public class BorderLayoutRenderer { /** * Retrieves the name of the element that will contain components with the given constraint .
* @ param constraint the constraint to retrieve the tag for .
* @ return the tag for the given constraint . */
private String getTag ( final BorderLayoutConstraint constraint ) { } } | switch ( constraint ) { case EAST : return "ui:east" ; case NORTH : return "ui:north" ; case SOUTH : return "ui:south" ; case WEST : return "ui:west" ; case CENTER : default : return "ui:center" ; } |
public class system { /** * Navigate to an activity programmatically by providing the package +
* activity name
* @ param context Context where I am coming from
* @ param className Full path to the desired Activity ( e . g .
* " com . sample . MainActivity " ) */
public static void navigateToActivityByClassName ( Context context , String className ) throws ClassNotFoundException { } } | Class < ? > c = null ; if ( className != null ) { try { c = Class . forName ( className ) ; } catch ( ClassNotFoundException e ) { QuickUtils . log . d ( "ClassNotFound" , e ) ; } } navigateToActivity ( context , c ) ; |
public class ServiceMessage { /** * Sets headers for deserialization purpose .
* @ param headers headers to set */
void setHeaders ( Map < String , String > headers ) { } } | this . headers = Collections . unmodifiableMap ( new HashMap < > ( headers ) ) ; |
public class LdpConstraints { /** * Verify that the range of the property is an IRI ( if the property is in the above set ) */
private static boolean uriRangeFilter ( final Triple triple ) { } } | return invalidMembershipProperty ( triple ) || ( propertiesWithUriRange . contains ( triple . getPredicate ( ) ) && ! ( triple . getObject ( ) instanceof IRI ) ) || ( RDF . type . equals ( triple . getPredicate ( ) ) && ! ( triple . getObject ( ) instanceof IRI ) ) ; |
public class JKObjectUtil { /** * Gets the property value .
* @ param < T > the generic type
* @ param instance the instance
* @ param fieldName the field name
* @ return the property value */
public static < T > T getPropertyValue ( final Object instance , final String fieldName ) { } } | try { return ( T ) PropertyUtils . getProperty ( instance , fieldName ) ; } catch ( final Exception e ) { throw new RuntimeException ( e ) ; } |
public class BELUtilities { /** * Computes a SHA - 256 hash of data from the { @ link InputStream input } .
* @ param input the data { @ link InputStream input stream } , which cannot be
* { @ code null }
* @ return the { @ link String SHA - 256 hash }
* @ throws IOException Thrown if an IO error occurred reading from the
* { @ link InputStream input }
* @ throws InvalidArgument Thrown if { @ code input } is { @ code null } */
public static String computeHashSHA256 ( final InputStream input ) throws IOException { } } | if ( input == null ) { throw new InvalidArgument ( "input" , input ) ; } MessageDigest sha256 ; try { sha256 = MessageDigest . getInstance ( "SHA-256" ) ; } catch ( NoSuchAlgorithmException e ) { throw new MissingAlgorithmException ( SHA_256 , e ) ; } final DigestInputStream dis = new DigestInputStream ( input , sha256 ) ; while ( dis . read ( ) != - 1 ) { } byte [ ] mdbytes = sha256 . digest ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < mdbytes . length ; i ++ ) { sb . append ( Integer . toString ( ( mdbytes [ i ] & 0xff ) + 0x100 , 16 ) . substring ( 1 ) ) ; } return sb . toString ( ) ; |
public class DefaultGroovyMethods { /** * Used to determine if the given predicate closure is valid ( i . e . returns
* < code > true < / code > for all items in this Array ) .
* @ param self an Array
* @ param predicate the closure predicate used for matching
* @ return true if every element of the Array matches the closure predicate
* @ since 2.5.0 */
public static < T > boolean every ( T [ ] self , @ ClosureParams ( FirstParam . Component . class ) Closure predicate ) { } } | return every ( new ArrayIterator < T > ( self ) , predicate ) ; |
public class UpgradeStepItemMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpgradeStepItem upgradeStepItem , ProtocolMarshaller protocolMarshaller ) { } } | if ( upgradeStepItem == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( upgradeStepItem . getUpgradeStep ( ) , UPGRADESTEP_BINDING ) ; protocolMarshaller . marshall ( upgradeStepItem . getUpgradeStepStatus ( ) , UPGRADESTEPSTATUS_BINDING ) ; protocolMarshaller . marshall ( upgradeStepItem . getIssues ( ) , ISSUES_BINDING ) ; protocolMarshaller . marshall ( upgradeStepItem . getProgressPercent ( ) , PROGRESSPERCENT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class InternalXbaseWithAnnotationsParser { /** * InternalXbaseWithAnnotations . g : 3785:1 : ruleXForLoopExpression returns [ EObject current = null ] : ( ( ( ( ( ) ' for ' ' ( ' ( ( ruleJvmFormalParameter ) ) ' : ' ) ) = > ( ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : ' ) ) ( ( lv _ forExpression _ 5_0 = ruleXExpression ) ) otherlv _ 6 = ' ) ' ( ( lv _ eachExpression _ 7_0 = ruleXExpression ) ) ) ; */
public final EObject ruleXForLoopExpression ( ) throws RecognitionException { } } | EObject current = null ; Token otherlv_1 = null ; Token otherlv_2 = null ; Token otherlv_4 = null ; Token otherlv_6 = null ; EObject lv_declaredParam_3_0 = null ; EObject lv_forExpression_5_0 = null ; EObject lv_eachExpression_7_0 = null ; enterRule ( ) ; try { // InternalXbaseWithAnnotations . g : 3791:2 : ( ( ( ( ( ( ) ' for ' ' ( ' ( ( ruleJvmFormalParameter ) ) ' : ' ) ) = > ( ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : ' ) ) ( ( lv _ forExpression _ 5_0 = ruleXExpression ) ) otherlv _ 6 = ' ) ' ( ( lv _ eachExpression _ 7_0 = ruleXExpression ) ) ) )
// InternalXbaseWithAnnotations . g : 3792:2 : ( ( ( ( ( ) ' for ' ' ( ' ( ( ruleJvmFormalParameter ) ) ' : ' ) ) = > ( ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : ' ) ) ( ( lv _ forExpression _ 5_0 = ruleXExpression ) ) otherlv _ 6 = ' ) ' ( ( lv _ eachExpression _ 7_0 = ruleXExpression ) ) )
{ // InternalXbaseWithAnnotations . g : 3792:2 : ( ( ( ( ( ) ' for ' ' ( ' ( ( ruleJvmFormalParameter ) ) ' : ' ) ) = > ( ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : ' ) ) ( ( lv _ forExpression _ 5_0 = ruleXExpression ) ) otherlv _ 6 = ' ) ' ( ( lv _ eachExpression _ 7_0 = ruleXExpression ) ) )
// InternalXbaseWithAnnotations . g : 3793:3 : ( ( ( ( ) ' for ' ' ( ' ( ( ruleJvmFormalParameter ) ) ' : ' ) ) = > ( ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : ' ) ) ( ( lv _ forExpression _ 5_0 = ruleXExpression ) ) otherlv _ 6 = ' ) ' ( ( lv _ eachExpression _ 7_0 = ruleXExpression ) )
{ // InternalXbaseWithAnnotations . g : 3793:3 : ( ( ( ( ) ' for ' ' ( ' ( ( ruleJvmFormalParameter ) ) ' : ' ) ) = > ( ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : ' ) )
// InternalXbaseWithAnnotations . g : 3794:4 : ( ( ( ) ' for ' ' ( ' ( ( ruleJvmFormalParameter ) ) ' : ' ) ) = > ( ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : ' )
{ // InternalXbaseWithAnnotations . g : 3807:4 : ( ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : ' )
// InternalXbaseWithAnnotations . g : 3808:5 : ( ) otherlv _ 1 = ' for ' otherlv _ 2 = ' ( ' ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) ) otherlv _ 4 = ' : '
{ // InternalXbaseWithAnnotations . g : 3808:5 : ( )
// InternalXbaseWithAnnotations . g : 3809:6:
{ if ( state . backtracking == 0 ) { current = forceCreateModelElement ( grammarAccess . getXForLoopExpressionAccess ( ) . getXForLoopExpressionAction_0_0_0 ( ) , current ) ; } } otherlv_1 = ( Token ) match ( input , 65 , FOLLOW_48 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_1 , grammarAccess . getXForLoopExpressionAccess ( ) . getForKeyword_0_0_1 ( ) ) ; } otherlv_2 = ( Token ) match ( input , 14 , FOLLOW_22 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_2 , grammarAccess . getXForLoopExpressionAccess ( ) . getLeftParenthesisKeyword_0_0_2 ( ) ) ; } // InternalXbaseWithAnnotations . g : 3823:5 : ( ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter ) )
// InternalXbaseWithAnnotations . g : 3824:6 : ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter )
{ // InternalXbaseWithAnnotations . g : 3824:6 : ( lv _ declaredParam _ 3_0 = ruleJvmFormalParameter )
// InternalXbaseWithAnnotations . g : 3825:7 : lv _ declaredParam _ 3_0 = ruleJvmFormalParameter
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXForLoopExpressionAccess ( ) . getDeclaredParamJvmFormalParameterParserRuleCall_0_0_3_0 ( ) ) ; } pushFollow ( FOLLOW_51 ) ; lv_declaredParam_3_0 = ruleJvmFormalParameter ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXForLoopExpressionRule ( ) ) ; } set ( current , "declaredParam" , lv_declaredParam_3_0 , "org.eclipse.xtext.xbase.Xbase.JvmFormalParameter" ) ; afterParserOrEnumRuleCall ( ) ; } } } otherlv_4 = ( Token ) match ( input , 62 , FOLLOW_9 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_4 , grammarAccess . getXForLoopExpressionAccess ( ) . getColonKeyword_0_0_4 ( ) ) ; } } } // InternalXbaseWithAnnotations . g : 3848:3 : ( ( lv _ forExpression _ 5_0 = ruleXExpression ) )
// InternalXbaseWithAnnotations . g : 3849:4 : ( lv _ forExpression _ 5_0 = ruleXExpression )
{ // InternalXbaseWithAnnotations . g : 3849:4 : ( lv _ forExpression _ 5_0 = ruleXExpression )
// InternalXbaseWithAnnotations . g : 3850:5 : lv _ forExpression _ 5_0 = ruleXExpression
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXForLoopExpressionAccess ( ) . getForExpressionXExpressionParserRuleCall_1_0 ( ) ) ; } pushFollow ( FOLLOW_7 ) ; lv_forExpression_5_0 = ruleXExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXForLoopExpressionRule ( ) ) ; } set ( current , "forExpression" , lv_forExpression_5_0 , "org.eclipse.xtext.xbase.Xbase.XExpression" ) ; afterParserOrEnumRuleCall ( ) ; } } } otherlv_6 = ( Token ) match ( input , 16 , FOLLOW_9 ) ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { newLeafNode ( otherlv_6 , grammarAccess . getXForLoopExpressionAccess ( ) . getRightParenthesisKeyword_2 ( ) ) ; } // InternalXbaseWithAnnotations . g : 3871:3 : ( ( lv _ eachExpression _ 7_0 = ruleXExpression ) )
// InternalXbaseWithAnnotations . g : 3872:4 : ( lv _ eachExpression _ 7_0 = ruleXExpression )
{ // InternalXbaseWithAnnotations . g : 3872:4 : ( lv _ eachExpression _ 7_0 = ruleXExpression )
// InternalXbaseWithAnnotations . g : 3873:5 : lv _ eachExpression _ 7_0 = ruleXExpression
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXForLoopExpressionAccess ( ) . getEachExpressionXExpressionParserRuleCall_3_0 ( ) ) ; } pushFollow ( FOLLOW_2 ) ; lv_eachExpression_7_0 = ruleXExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { if ( current == null ) { current = createModelElementForParent ( grammarAccess . getXForLoopExpressionRule ( ) ) ; } set ( current , "eachExpression" , lv_eachExpression_7_0 , "org.eclipse.xtext.xbase.Xbase.XExpression" ) ; afterParserOrEnumRuleCall ( ) ; } } } } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class AbstractRouter { /** * Gets the url of the route handled by the specified action method . This implementation delegates to
* { @ link # getReverseRouteFor ( String , String , java . util . Map ) } .
* @ param clazz the controller class
* @ param method the controller method
* @ param params map of parameter name - value
* @ return the url , { @ literal null } if the action method is not found */
@ Override public String getReverseRouteFor ( Class < ? extends Controller > clazz , String method , Map < String , Object > params ) { } } | return getReverseRouteFor ( clazz . getName ( ) , method , params ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.