signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AVQuery { /** * Create a AVQuery with special sub - class . * @ param clazz The AVObject subclass * @ return The AVQuery */ public static < T extends AVObject > AVQuery < T > getQuery ( Class < T > clazz ) { } }
return new AVQuery < T > ( Transformer . getSubClassName ( clazz ) , clazz ) ;
public class LinkHelper { /** * Get the default URL to stream the passed URL . It is assumed that the * servlet is located under the path " / stream " . Because of the logic of the * stream servlet , no parameter are assumed . * @ param aRequestScope * The request web scope to be used . Required for cookie - less handling . * May not be < code > null < / code > . * @ param sURL * The URL to be streamed . If it does not start with a slash ( " / " ) one * is prepended automatically . If the URL already has a protocol , it is * returned unchanged . May neither be < code > null < / code > nor empty . * @ return The URL incl . the context to be stream . E . g . * < code > / < i > webapp - context < / i > / stream / < i > URL < / i > < / code > . */ @ Nonnull public static SimpleURL getStreamURL ( @ Nonnull final IRequestWebScopeWithoutResponse aRequestScope , @ Nonnull @ Nonempty final String sURL ) { } }
ValueEnforcer . notNull ( aRequestScope , "RequestScope" ) ; ValueEnforcer . notEmpty ( sURL , "URL" ) ; // If the URL is absolute , use it if ( hasKnownProtocol ( sURL ) ) return new SimpleURL ( sURL ) ; final StringBuilder aPrefix = new StringBuilder ( getStreamServletPath ( ) ) ; if ( ! StringHelper . startsWith ( sURL , '/' ) ) aPrefix . append ( '/' ) ; return getURLWithContext ( aRequestScope , aPrefix . append ( sURL ) . toString ( ) ) ;
public class SQLParser { /** * to the extent that comments are supported they have already been stripped out . */ private static List < String > parseExecParameters ( String paramText ) { } }
final String SafeParamStringValuePattern = "#(SQL_PARSER_SAFE_PARAMSTRING)" ; // Find all quoted strings . // Mask out strings that contain whitespace or commas // that must not be confused with parameter separators . // " Safe " strings that don ' t contain these characters don ' t need to be masked // but they DO need to be found and explicitly skipped so that their closing // quotes don ' t trigger a false positive for the START of an unsafe string . // Skipping is accomplished by resetting paramText to an offset substring // after copying the skipped ( or substituted ) text to a string builder . ArrayList < String > originalString = new ArrayList < > ( ) ; Matcher stringMatcher = SingleQuotedString . matcher ( paramText ) ; StringBuilder safeText = new StringBuilder ( ) ; while ( stringMatcher . find ( ) ) { // Save anything before the found string . safeText . append ( paramText . substring ( 0 , stringMatcher . start ( ) ) ) ; String asMatched = stringMatcher . group ( ) ; if ( SingleQuotedStringContainingParameterSeparators . matcher ( asMatched ) . matches ( ) ) { // The matched string is unsafe , provide cover for it in safeText . originalString . add ( asMatched ) ; safeText . append ( SafeParamStringValuePattern ) ; } else { // The matched string is safe . Add it to safeText . safeText . append ( asMatched ) ; } paramText = paramText . substring ( stringMatcher . end ( ) ) ; stringMatcher = SingleQuotedString . matcher ( paramText ) ; } // Save anything after the last found string . safeText . append ( paramText ) ; ArrayList < String > params = new ArrayList < > ( ) ; int subCount = 0 ; int neededSubs = originalString . size ( ) ; // Split the params at the separators String [ ] split = safeText . toString ( ) . split ( "[\\s,]+" ) ; for ( String fragment : split ) { if ( fragment . isEmpty ( ) ) { continue ; // ignore effects of leading or trailing separators } // Replace each substitution in order exactly once . if ( subCount < neededSubs ) { // Substituted strings will normally take up an entire parameter , // but some cases like parameters containing escaped single quotes // may require multiple serial substitutions . while ( fragment . indexOf ( SafeParamStringValuePattern ) > - 1 ) { fragment = fragment . replace ( SafeParamStringValuePattern , originalString . get ( subCount ) ) ; ++ subCount ; } } params . add ( fragment ) ; } assert ( subCount == neededSubs ) ; return params ;
public class VarDefBuilder { /** * Adds variable values . */ public VarDefBuilder values ( Stream < VarValueDef > values ) { } }
values . forEach ( value -> varDef_ . addValue ( value ) ) ; return this ;
public class Image { /** * Calls { @ link # createImage ( com . itextpdf . text . pdf . PdfContentByte , java . lang . Object , float ) } , { @ link # applySettings ( com . itextpdf . text . Image ) } , * { @ link com . itextpdf . text . Image # setAbsolutePosition ( float , float ) } and * { @ link # addToCanvas ( float [ ] , com . itextpdf . text . Image , com . itextpdf . text . pdf . PdfContentByte ) * @ param canvas * @ param x * @ param y * @ param width * @ param height * @ param genericTag the value of genericTag * @ throws VectorPrintException */ @ Override protected final void draw ( PdfContentByte canvas , float x , float y , float width , float height , String genericTag ) throws VectorPrintException { } }
com . itextpdf . text . Image img ; try { img = createImage ( canvas , getData ( ) , getValue ( ( isDrawShadow ( ) ) ? SHADOWOPACITY : OPACITY , Float . class ) ) ; applySettings ( img ) ; } catch ( BadElementException ex ) { throw new VectorPrintException ( ex ) ; } img . setAbsolutePosition ( x , y ) ; try { addToCanvas ( getValue ( TRANSFORM , float [ ] . class ) , img , canvas ) ; } catch ( DocumentException ex ) { throw new VectorPrintRuntimeException ( ex ) ; }
public class Bar { /** * Set a gradient color from point 1 with color 1 to point2 with color 2. * @ param color1 The first color . * @ param color2 The last color . */ public void setColorGradient ( ColorRgba color1 , ColorRgba color2 ) { } }
setColorGradient ( x , y , color1 , x + maxWidth , y + maxHeight , color2 ) ;
public class ApiOvhEmaildomain { /** * Alter this object properties * REST : PUT / email / domain / delegatedAccount / { email } * @ param body [ required ] New object properties * @ param email [ required ] Email */ public void delegatedAccount_email_PUT ( String email , OvhAccountDelegated body ) throws IOException { } }
String qPath = "/email/domain/delegatedAccount/{email}" ; StringBuilder sb = path ( qPath , email ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ;
public class Closeables { /** * Create a single Closeable which closes all of the specified closeables * @ param throwIOException if true , throw any IOException encountered * @ param closeables collection of closeables * @ return closeable */ public static Closeable single ( boolean throwIOException , final Collection < Closeable > closeables ) { } }
return single ( throwIOException , closeables . toArray ( new Closeable [ closeables . size ( ) ] ) ) ;
public class GitlabAPI { /** * Returns a List of GitlabRunners . * @ param scope Can be null . Defines type of Runner to retrieve . * @ return List of GitLabRunners * @ throws IOException on Gitlab API call error */ public List < GitlabRunner > getRunners ( GitlabRunner . RunnerScope scope ) throws IOException { } }
return getRunnersWithPagination ( scope , null ) ;
public class CCEncoder { /** * Returns the current configuration of this encoder . If the encoder was constructed with a given configuration , this * configuration will always be used . Otherwise the current configuration of the formula factory is used or - if not * present - the default configuration . * @ return the current configuration of */ public CCConfig config ( ) { } }
if ( this . config != null ) return this . config ; Configuration ccConfig = this . f . configurationFor ( ConfigurationType . CC_ENCODER ) ; return ccConfig != null ? ( CCConfig ) ccConfig : this . defaultConfig ;
public class HeaderAndFooterGridView { /** * Returns the index of the item , which corresponds to a specific flattened position . * @ param position * The flattened position of the item , whose index should be returned , as an { @ link * Integer } value * @ return The index of the item , which corresponds to the given flattened position , as an * { @ link Integer } value */ private int getItemPosition ( final int position ) { } }
int numColumns = getNumColumnsCompatible ( ) ; int headerItemCount = getHeaderViewsCount ( ) * numColumns ; int adapterCount = adapter . getEncapsulatedAdapter ( ) . getCount ( ) ; if ( position < headerItemCount ) { return position / numColumns ; } else if ( position < headerItemCount + adapterCount + getNumberOfPlaceholderViews ( ) ) { return position - headerItemCount + getHeaderViewsCount ( ) ; } else { return getHeaderViewsCount ( ) + adapterCount + ( position - headerItemCount - adapterCount - getNumberOfPlaceholderViews ( ) ) / numColumns ; }
public class CollectionHelper { /** * Returns the first element from a collection that matches the given predicate or null if no matching element is * found . * @ param items source items * @ param predicate predicate function * @ param < T > type of elements in the source collection * @ return the first element that matches the given predicate or null if no matching element is found */ public static < T > T firstOrNull ( Collection < T > items , Predicate < T > predicate ) { } }
if ( ! isEmpty ( items ) ) { for ( T item : items ) { if ( predicate . apply ( item ) ) { return item ; } } } return null ;
public class AbstractResources { /** * Create a multipart upload request . * @ param url the url * @ param t the object to create * @ param partName the name of the part * @ param inputstream the file inputstream * @ param contentType the type of the file to be attached * @ return the http request * @ throws UnsupportedEncodingException the unsupported encoding exception */ public < T > Attachment attachFile ( String url , T t , String partName , InputStream inputstream , String contentType , String attachmentName ) throws SmartsheetException { } }
Util . throwIfNull ( inputstream , contentType ) ; Attachment attachment = null ; final String boundary = "----" + System . currentTimeMillis ( ) ; CloseableHttpClient httpClient = HttpClients . createDefault ( ) ; HttpPost uploadFile = createHttpPost ( this . getSmartsheet ( ) . getBaseURI ( ) . resolve ( url ) ) ; try { uploadFile . setHeader ( "Content-Type" , "multipart/form-data; boundary=" + boundary ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } MultipartEntityBuilder builder = MultipartEntityBuilder . create ( ) ; builder . setBoundary ( boundary ) ; builder . addTextBody ( partName , this . getSmartsheet ( ) . getJsonSerializer ( ) . serialize ( t ) , ContentType . APPLICATION_JSON ) ; builder . addBinaryBody ( "file" , inputstream , ContentType . create ( contentType ) , attachmentName ) ; org . apache . http . HttpEntity multipart = builder . build ( ) ; uploadFile . setEntity ( multipart ) ; try { CloseableHttpResponse response = httpClient . execute ( uploadFile ) ; org . apache . http . HttpEntity responseEntity = response . getEntity ( ) ; attachment = this . getSmartsheet ( ) . getJsonSerializer ( ) . deserializeResult ( Attachment . class , responseEntity . getContent ( ) ) . getResult ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return attachment ;
public class EvolutionResult { /** * Return a collector which collects the best < em > result < / em > ( in the native * problem space ) . * < pre > { @ code * final Problem < ISeq < Point > , EnumGene < Point > , Double > tsm = . . . ; * final ISeq < Point > route = Engine . builder ( tsm ) * . optimize ( Optimize . MINIMUM ) . build ( ) * . stream ( ) * . limit ( 100) * . collect ( EvolutionResult . toBestResult ( tsm . codec ( ) . decoder ( ) ) ) ; * } < / pre > * If the collected { @ link EvolutionStream } is empty , the collector returns * < b > { @ code null } < / b > . * @ since 3.6 * @ param decoder the decoder which converts the { @ code Genotype } into the * result of the problem space . * @ param < T > the < em > native < / em > problem result type * @ param < G > the gene type * @ param < C > the fitness result type * @ return a collector which collects the best result of an evolution stream * @ throws NullPointerException if the given { @ code decoder } is { @ code null } */ public static < G extends Gene < ? , G > , C extends Comparable < ? super C > , T > Collector < EvolutionResult < G , C > , ? , T > toBestResult ( final Function < Genotype < G > , T > decoder ) { } }
requireNonNull ( decoder ) ; return Collector . of ( MinMax :: < EvolutionResult < G , C > > of , MinMax :: accept , MinMax :: combine , mm -> mm . getMax ( ) != null ? mm . getMax ( ) . getBestPhenotype ( ) != null ? decoder . apply ( mm . getMax ( ) . getBestPhenotype ( ) . getGenotype ( ) ) : null : null ) ;
public class StrictMath { /** * Returns the first floating - point argument with the sign of the * second floating - point argument . For this method , a NaN * { @ code sign } argument is always treated as if it were * positive . * @ param magnitude the parameter providing the magnitude of the result * @ param sign the parameter providing the sign of the result * @ return a value with the magnitude of { @ code magnitude } * and the sign of { @ code sign } . * @ since 1.6 */ public static double copySign ( double magnitude , double sign ) { } }
return Math . copySign ( magnitude , ( Double . isNaN ( sign ) ? 1.0d : sign ) ) ;
public class JdkZoneProviderSPI { /** * The real implementation using a wrapper around { @ code ZoneRules } derived from given { @ code ZoneId } . * @ param zoneId threeten - zone - identifier * @ return timezone history * @ throws IllegalArgumentException if given id is wrong * @ since 5.0 */ public static TransitionHistory load ( ZoneId zoneId ) { } }
try { ZoneRules zoneRules = zoneId . getRules ( ) ; ZonalOffset initialOffset = ZonalOffset . ofTotalSeconds ( zoneRules . getOffset ( Instant . MIN ) . getTotalSeconds ( ) ) ; List < ZonalTransition > transitions = new ArrayList < > ( ) ; List < DaylightSavingRule > rules = new ArrayList < > ( ) ; for ( ZoneOffsetTransition zot : zoneRules . getTransitions ( ) ) { Instant instant = zot . getInstant ( ) ; long posixTime = instant . getEpochSecond ( ) ; int previousOffset = zot . getOffsetBefore ( ) . getTotalSeconds ( ) ; int totalOffset = zot . getOffsetAfter ( ) . getTotalSeconds ( ) ; int dst = Math . toIntExact ( zoneRules . getDaylightSavings ( instant ) . getSeconds ( ) ) ; transitions . add ( new ZonalTransition ( posixTime , previousOffset , totalOffset , dst ) ) ; } for ( ZoneOffsetTransitionRule zotr : zoneRules . getTransitionRules ( ) ) { DaylightSavingRule rule ; int dom = zotr . getDayOfMonthIndicator ( ) ; // -28 bis + 31 ( ohne 0) DayOfWeek dayOfWeek = zotr . getDayOfWeek ( ) ; Month month = Month . valueOf ( zotr . getMonth ( ) . getValue ( ) ) ; PlainTime timeOfDay = ( zotr . isMidnightEndOfDay ( ) ? PlainTime . midnightAtEndOfDay ( ) : TemporalType . LOCAL_TIME . translate ( zotr . getLocalTime ( ) ) ) ; OffsetIndicator indicator ; switch ( zotr . getTimeDefinition ( ) ) { case STANDARD : indicator = OffsetIndicator . STANDARD_TIME ; break ; case UTC : indicator = OffsetIndicator . UTC_TIME ; break ; case WALL : indicator = OffsetIndicator . WALL_TIME ; break ; default : throw new UnsupportedOperationException ( zotr . getTimeDefinition ( ) . name ( ) ) ; } int dst = ( zotr . getOffsetAfter ( ) . getTotalSeconds ( ) - zotr . getStandardOffset ( ) . getTotalSeconds ( ) ) ; if ( dayOfWeek == null ) { rule = GregorianTimezoneRule . ofFixedDay ( month , dom , timeOfDay , indicator , dst ) ; } else { Weekday wd = Weekday . valueOf ( dayOfWeek . getValue ( ) ) ; if ( dom == - 1 ) { rule = GregorianTimezoneRule . ofLastWeekday ( month , wd , timeOfDay , indicator , dst ) ; } else if ( dom < 0 ) { rule = new NegativeDayOfMonthPattern ( month , dom , wd , timeOfDay , indicator , dst ) ; } else { rule = GregorianTimezoneRule . ofWeekdayAfterDate ( month , dom , wd , timeOfDay , indicator , dst ) ; } } rules . add ( rule ) ; } return TransitionModel . of ( initialOffset , transitions , rules ) ; } catch ( DateTimeException ex ) { throw new IllegalArgumentException ( ex ) ; }
public class Utils { /** * Returns the node where defined group is stored . */ Node getGroupNode ( Session session , Group group ) throws PathNotFoundException , RepositoryException { } }
return getGroupNode ( session , group == null ? "" : group . getId ( ) ) ;
public class CPInstancePersistenceImpl { /** * Returns all the cp instances where CPDefinitionId = & # 63 ; . * @ param CPDefinitionId the cp definition ID * @ return the matching cp instances */ @ Override public List < CPInstance > findByCPDefinitionId ( long CPDefinitionId ) { } }
return findByCPDefinitionId ( CPDefinitionId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ;
public class PrimaveraPMFileReader { /** * { @ inheritDoc } */ @ Override public ProjectFile read ( InputStream stream ) throws MPXJException { } }
try { m_projectFile = new ProjectFile ( ) ; m_eventManager = m_projectFile . getEventManager ( ) ; ProjectConfig config = m_projectFile . getProjectConfig ( ) ; config . setAutoTaskUniqueID ( false ) ; config . setAutoResourceUniqueID ( false ) ; config . setAutoCalendarUniqueID ( false ) ; config . setAutoAssignmentUniqueID ( false ) ; config . setAutoWBS ( false ) ; m_projectFile . getProjectProperties ( ) . setFileApplication ( "Primavera" ) ; m_projectFile . getProjectProperties ( ) . setFileType ( "PMXML" ) ; CustomFieldContainer fields = m_projectFile . getCustomFields ( ) ; fields . getCustomField ( TaskField . TEXT1 ) . setAlias ( "Code" ) ; fields . getCustomField ( TaskField . TEXT2 ) . setAlias ( "Activity Type" ) ; fields . getCustomField ( TaskField . TEXT3 ) . setAlias ( "Status" ) ; fields . getCustomField ( TaskField . NUMBER1 ) . setAlias ( "Primary Resource Unique ID" ) ; m_eventManager . addProjectListeners ( m_projectListeners ) ; SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; factory . setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; factory . setNamespaceAware ( true ) ; SAXParser saxParser = factory . newSAXParser ( ) ; XMLReader xmlReader = saxParser . getXMLReader ( ) ; if ( CONTEXT == null ) { throw CONTEXT_EXCEPTION ; } Unmarshaller unmarshaller = CONTEXT . createUnmarshaller ( ) ; XMLFilter filter = new NamespaceFilter ( ) ; filter . setParent ( xmlReader ) ; UnmarshallerHandler unmarshallerHandler = unmarshaller . getUnmarshallerHandler ( ) ; filter . setContentHandler ( unmarshallerHandler ) ; filter . parse ( new InputSource ( stream ) ) ; APIBusinessObjects apibo = ( APIBusinessObjects ) unmarshallerHandler . getResult ( ) ; List < ProjectType > projects = apibo . getProject ( ) ; ProjectType project = null ; for ( ProjectType currentProject : projects ) { if ( ! BooleanHelper . getBoolean ( currentProject . isExternal ( ) ) ) { project = currentProject ; break ; } } if ( project == null ) { throw new MPXJException ( "Unable to locate any non-external projects in a list of " + projects . size ( ) + " projects" ) ; } processProjectUDFs ( apibo ) ; processProjectProperties ( apibo , project ) ; processActivityCodes ( apibo , project ) ; processCalendars ( apibo ) ; processResources ( apibo ) ; processTasks ( project ) ; processPredecessors ( project ) ; processAssignments ( project ) ; // Ensure that the unique ID counters are correct config . updateUniqueCounters ( ) ; return ( m_projectFile ) ; } catch ( ParserConfigurationException ex ) { throw new MPXJException ( "Failed to parse file" , ex ) ; } catch ( JAXBException ex ) { throw new MPXJException ( "Failed to parse file" , ex ) ; } catch ( SAXException ex ) { throw new MPXJException ( "Failed to parse file" , ex ) ; } catch ( IOException ex ) { throw new MPXJException ( "Failed to parse file" , ex ) ; } finally { m_projectFile = null ; m_clashMap . clear ( ) ; m_calMap . clear ( ) ; m_activityCodeMap . clear ( ) ; }
public class Stream { /** * This aggregator operation computes the maximum of tuples in a stream by using the given { @ code comparator } with * { @ code TridentTuple } s . * @ param comparator comparator used in for finding maximum of two tuple values . * @ return the new stream with this operation . */ public Stream max ( Comparator < TridentTuple > comparator ) { } }
Aggregator < ComparisonAggregator . State > max = new MaxWithComparator < > ( comparator ) ; return comparableAggregateStream ( null , max ) ;
public class BaseMessageFilter { /** * Update this object ' s filter with this new tree information . * @ param propTree Changes to the current property tree . */ public final void updateFilterTree ( Map < String , Object > propTree ) { } }
Object [ ] [ ] mxProperties = this . cloneMatrix ( this . getNameValueTree ( ) ) ; mxProperties = this . createNameValueTree ( mxProperties , propTree ) ; // Update these properties this . setFilterTree ( mxProperties ) ; // Update any remote copy of this .
public class IO { /** * { @ inheritDoc } */ @ Override public final < B > IO < B > flatMap ( Function < ? super A , ? extends Monad < B , IO < ? > > > f ) { } }
@ SuppressWarnings ( "unchecked" ) IO < Object > source = ( IO < Object > ) this ; @ SuppressWarnings ( { "unchecked" , "RedundantCast" } ) Function < Object , IO < Object > > flatMap = ( Function < Object , IO < Object > > ) ( Object ) f ; return new Compose < > ( source , Choice2 . b ( flatMap ) ) ;
public class CacheObjectUtil { /** * execute the specified script . * @ param cacheConfigBean the data source of the cache * @ param scripts the lua script . * @ param keyCount the key count . * @ param params the parameters . * @ return the object result . */ public static Single < Object > luaScript ( CacheConfigBean cacheConfigBean , String scripts , int keyCount , List < String > params ) { } }
return SingleRxXian . call ( CacheService . CACHE_SERVICE , "cacheLua" , new JSONObject ( ) { { put ( "cacheConfig" , cacheConfigBean ) ; put ( "scripts" , scripts ) ; put ( "keyCount" , keyCount ) ; put ( "params" , params ) ; } } ) . map ( unitResponseObject -> { unitResponseObject . throwExceptionIfNotSuccess ( ) ; if ( unitResponseObject . getData ( ) == null ) return null ; return unitResponseObject . getData ( ) ; } ) ;
public class GeocodeResultBuilder { /** * Create a GeoServiceGeometry from a Geometry . * @ param geometry the Geometry * @ return the GeoServiceGeometry */ public FeatureCollection toGeoServiceGeometry ( final Geometry geometry ) { } }
if ( geometry == null ) { return GeoServiceGeometry . createFeatureCollection ( toLocationFeature ( new LatLng ( Double . NaN , Double . NaN ) , LocationType . UNKNOWN ) , null , null ) ; } return GeoServiceGeometry . createFeatureCollection ( toLocationFeature ( geometry . location , geometry . locationType ) , toBox ( "bounds" , geometry . bounds ) , toBox ( "viewport" , geometry . viewport ) ) ;
public class ConfigFileCreator { /** * Returns the all config file found under a directory * @ param dir * @ return A list of files found . Length = 0 if not found files . */ private List < File > getConfigFiles ( File dir ) { } }
String [ ] extensions = { "xml" } ; List < File > configFiles = new ArrayList < File > ( ) ; Collection < File > files = FileUtils . listFiles ( dir , extensions , true ) ; for ( Iterator < File > iterator = files . iterator ( ) ; iterator . hasNext ( ) ; ) { File file = ( File ) iterator . next ( ) ; if ( file . getName ( ) . equals ( "config.xml" ) ) { configFiles . add ( file ) ; } } return configFiles ;
public class IsEmptyBuilder { /** * String型の値を追加する 。 * @ param value nullまたは空文字の場合 、 空と判断する 。 * @ param trim 引数valueをトリムした後空文字と判定するかどうか 。 * @ return this . */ public IsEmptyBuilder append ( final String value , final boolean trim ) { } }
if ( isNotEmpty ( ) ) { return this ; } if ( trim ) { if ( value != null && ! value . trim ( ) . isEmpty ( ) ) { setNotEmpty ( ) ; } } else { if ( value != null && ! value . isEmpty ( ) ) { setNotEmpty ( ) ; } } return this ;
public class IOUtil { /** * 递归遍历获取目录下的所有文件 * @ param path 根目录 * @ return 文件列表 */ public static List < File > fileList ( String path ) { } }
List < File > fileList = new LinkedList < File > ( ) ; File folder = new File ( path ) ; if ( folder . isDirectory ( ) ) enumerate ( folder , fileList ) ; else fileList . add ( folder ) ; // 兼容路径为文件的情况 return fileList ;
public class ViterbiAlgorithm { /** * Returns the most likely sequence of states for all time steps . This includes the initial * states / initial observation time step . If an HMM break occurred in the last time step t , * then the most likely sequence up to t - 1 is returned . See also { @ link # isBroken ( ) } . * < p > Formally , the most likely sequence is argmax p ( [ s _ 0 , ] s _ 1 , . . . , s _ T | o _ 1 , . . . , o _ T ) * with respect to s _ 1 , . . . , s _ T , where s _ t is a state candidate at time step t , * o _ t is the observation at time step t and T is the number of time steps . */ public List < SequenceState < S , O , D > > computeMostLikelySequence ( ) { } }
if ( message == null ) { // Return empty most likely sequence if there are no time steps or if initial // observations caused an HMM break . return new ArrayList < > ( ) ; } else { return retrieveMostLikelySequence ( ) ; }
public class TypedVector { /** * Replaces the element at the specified position in this Vector with the * specified element . * @ param index * the index at which the element will be placed ; it can be a positive * number , or a negative number that is smaller than the size of the vector ; * see { @ link # getRealIndex ( int ) } . * @ param element * the new value to store at the specified index . * @ return * the previous element at the specified index . * @ see java . util . Vector # set ( int , java . lang . Object ) */ @ Override public E set ( int index , E element ) { } }
int idx = getRealIndex ( index ) ; return super . set ( idx , element ) ;
public class RadialMenu { /** * Sets the menu model . * @ param menu Structure of { @ link MenuItem } s to display . */ public void setMenu ( Menu menu ) { } }
this . menu = menu ; RadialMenuItem . setupMenuButton ( this , radialMenuParams , ( menu != null ) ? menu . getGraphic ( ) : null , ( menu != null ) ? menu . getText ( ) : null , true ) ;
public class JavascriptRuntime { /** * Gets an array parameter constructor as a String , which then can be * passed to the execute ( ) method . * @ param javascriptObjectType type The type of JavaScript object array to create * @ param ary The array elements * @ return A string which can be passed to the JavaScript environment to * create a new array . */ @ Override public String getArrayConstructor ( String javascriptObjectType , Object [ ] ary ) { } }
String fn = getArrayFunction ( "new " + javascriptObjectType , ary ) ; return fn ;
public class Scheduler { public static LocalDate toLocalDate ( Date time ) { } }
return time . toInstant ( ) . atZone ( ZoneId . systemDefault ( ) ) . toLocalDate ( ) ;
public class CmsSearchManager { /** * Sets the maximal wait time for offline index updates after edit operations . < p > * @ param maxIndexWaitTime the maximal wait time to set in milliseconds */ public void setMaxIndexWaitTime ( String maxIndexWaitTime ) { } }
try { setMaxIndexWaitTime ( Long . parseLong ( maxIndexWaitTime ) ) ; } catch ( Exception e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_PARSE_MAX_INDEX_WAITTIME_FAILED_2 , maxIndexWaitTime , new Long ( DEFAULT_MAX_INDEX_WAITTIME ) ) , e ) ; setMaxIndexWaitTime ( DEFAULT_MAX_INDEX_WAITTIME ) ; }
public class Scenario3DPortrayal { /** * To draw a link * @ param link */ public void drawLink ( Link link ) { } }
List < Device > linkedDevices = link . getLinkedDevices ( ) ; for ( int i = 0 ; i < linkedDevices . size ( ) ; i ++ ) { Device from = linkedDevices . get ( i ) ; for ( int j = i + 1 ; j < linkedDevices . size ( ) ; j ++ ) { Device to = linkedDevices . get ( j ) ; Edge e = new Edge ( from , to , link ) ; links . addEdge ( e ) ; } }
public class AuthenticateApi { /** * For formLogout , this is a new request and there is no subject on the thread . A previous * request handled on this thread may not be from this same client . We have to authenticate using * the token and push the subject on thread so webcontainer can use the subject credential to invalidate * the session . * @ param req * @ param res */ private void createSubjectAndPushItOnThreadAsNeeded ( HttpServletRequest req , HttpServletResponse res ) { } }
// We got a new instance of FormLogoutExtensionProcess every request . logoutSubject = null ; Subject subject = subjectManager . getCallerSubject ( ) ; if ( subject == null || subjectHelper . isUnauthenticated ( subject ) ) { if ( authService == null && securityServiceRef != null ) { authService = securityServiceRef . getService ( ) . getAuthenticationService ( ) ; } SSOAuthenticator ssoAuthenticator = new SSOAuthenticator ( authService , null , null , ssoCookieHelper ) ; // TODO : We can not call ssoAuthenticator . authenticate because it can not handle multiple tokens . // In the next release , authenticate need to handle multiple authentication data . See story AuthenticationResult authResult = ssoAuthenticator . handleSSO ( req , res ) ; if ( authResult != null && authResult . getStatus ( ) == AuthResult . SUCCESS ) { subjectManager . setCallerSubject ( authResult . getSubject ( ) ) ; logoutSubject = authResult . getSubject ( ) ; } }
public class ChunkedOutputStream { /** * Writes the cache out onto the underlying stream * @ throws IOException * @ since 3.0 */ protected void flushCache ( ) throws IOException { } }
if ( cachePosition > 0 ) { byte [ ] chunkHeader = ( Integer . toHexString ( cachePosition ) + "\r\n" ) . getBytes ( StandardCharsets . US_ASCII ) ; stream . write ( chunkHeader , 0 , chunkHeader . length ) ; stream . write ( cache , 0 , cachePosition ) ; stream . write ( ENDCHUNK , 0 , ENDCHUNK . length ) ; cachePosition = 0 ; }
public class ExtensionPassiveScan { /** * Sets the value of { @ code alertThreshold } of the plug - in passive scanner with the given { @ code pluginId } . * If the { @ code alertThreshold } is { @ code OFF } the scanner is also disabled . The call to this method has no effect if no * scanner with the given { @ code pluginId } exist . * @ param pluginId the ID of the plug - in passive scanner * @ param alertThreshold the alert threshold that will be set * @ see org . parosproxy . paros . core . scanner . Plugin . AlertThreshold */ void setPluginPassiveScannerAlertThreshold ( int pluginId , Plugin . AlertThreshold alertThreshold ) { } }
PluginPassiveScanner scanner = getPluginPassiveScanner ( pluginId ) ; if ( scanner != null ) { scanner . setAlertThreshold ( alertThreshold ) ; scanner . setEnabled ( ! Plugin . AlertThreshold . OFF . equals ( alertThreshold ) ) ; scanner . save ( ) ; }
public class HTTPUtil { /** * Escape special characters . */ public static String encodeString ( String uri ) { } }
CharBuffer cb = CharBuffer . allocate ( ) ; for ( int i = 0 ; i < uri . length ( ) ; i ++ ) { char ch = uri . charAt ( i ) ; switch ( ch ) { case '<' : cb . append ( "&lt;" ) ; break ; case '>' : cb . append ( "&gt;" ) ; break ; case '&' : cb . append ( "&amp;" ) ; break ; default : cb . append ( ch ) ; } } return cb . close ( ) ;
public class GroovydocManager { /** * Attach Groovydoc annotation to the target element */ private void attachGroovydocAnnotation ( ASTNode node , String docCommentNodeText ) { } }
if ( ! runtimeGroovydocEnabled ) { return ; } if ( ! ( node instanceof AnnotatedNode ) ) { return ; } if ( ! docCommentNodeText . startsWith ( RUNTIME_GROOVYDOC_PREFIX ) ) { return ; } AnnotatedNode annotatedNode = ( AnnotatedNode ) node ; AnnotationNode annotationNode = new AnnotationNode ( ClassHelper . make ( Groovydoc . class ) ) ; annotationNode . addMember ( VALUE , new ConstantExpression ( docCommentNodeText ) ) ; annotatedNode . addAnnotation ( annotationNode ) ;
public class Post { /** * An immutable list of terms associated with this post from a specified taxonomy . * @ param taxonomy The taxonomy . * @ return The list of terms . */ public final ImmutableList < TaxonomyTerm > terms ( final String taxonomy ) { } }
ImmutableList < TaxonomyTerm > terms = taxonomyTerms . get ( taxonomy ) ; return terms != null ? terms : ImmutableList . of ( ) ;
public class SerializerSwitcher { /** * Get the value of a property , without using the default properties . This * can be used to test if a property has been explicitly set by the stylesheet * or user . * @ param name The property name , which is a fully - qualified URI . * @ return The value of the property , or null if not found . * @ throws IllegalArgumentException If the property is not supported , * and is not namespaced . */ private static String getOutputPropertyNoDefault ( String qnameString , Properties props ) throws IllegalArgumentException { } }
String value = ( String ) props . get ( qnameString ) ; return value ;
public class CircleManager { /** * Set the CircleTranslate property * The geometry ' s offset . Values are [ x , y ] where negatives indicate left and up , respectively . * @ param value property wrapper value around Float [ ] */ public void setCircleTranslate ( Float [ ] value ) { } }
PropertyValue propertyValue = circleTranslate ( value ) ; constantPropertyUsageMap . put ( PROPERTY_CIRCLE_TRANSLATE , propertyValue ) ; layer . setProperties ( propertyValue ) ;
public class WeeklyOpeningHours { /** * Determines if this instance if " open " at the given day and time ranges . It is only allowed to call this method if the parameter * ' dayOpeningHours ' represents only one day . This means a value like ' Fri 18:00-03:00 ' will lead to an error . To avoid this , call the * { @ link DayOpeningHours # normalize ( ) } function before this one and pass the result per day as an argument to this method . * @ param dayOpeningHours * Day and times to verify . * @ return { @ literal true } if open else { @ literal false } if not open . */ public final boolean openAt ( @ NotNull final DayOpeningHours dayOpeningHours ) { } }
Contract . requireArgNotNull ( "dayOpeningHours" , dayOpeningHours ) ; if ( ! dayOpeningHours . isNormalized ( ) ) { throw new ConstraintViolationException ( "The argument 'dayOpeningHours' is expected to have only hours of a single day, but was: " + dayOpeningHours ) ; } final int idx = weeklyOpeningHours . indexOf ( dayOpeningHours ) ; if ( idx < 0 ) { return false ; } final DayOpeningHours found = weeklyOpeningHours . get ( idx ) ; final List < DayOpeningHours > normalized = found . normalize ( ) ; final DayOpeningHours day = normalized . get ( 0 ) ; return day . openAt ( dayOpeningHours ) ;
public class Captions { /** * Source files for the input sidecar captions used during the transcoding process . To omit all sidecar captions , * leave < code > CaptionSources < / code > blank . * @ param captionSources * Source files for the input sidecar captions used during the transcoding process . To omit all sidecar * captions , leave < code > CaptionSources < / code > blank . */ @ Deprecated public void setCaptionSources ( java . util . Collection < CaptionSource > captionSources ) { } }
if ( captionSources == null ) { this . captionSources = null ; return ; } this . captionSources = new com . amazonaws . internal . SdkInternalList < CaptionSource > ( captionSources ) ;
public class MisoScenePanel { /** * documentation inherited from interface */ public void mousePressed ( MouseEvent e ) { } }
// ignore mouse presses if we ' re not responsive if ( ! isResponsive ( ) ) { return ; } if ( e . getButton ( ) == MouseEvent . BUTTON1 ) { if ( _hobject instanceof Sprite ) { handleSpritePressed ( ( Sprite ) _hobject , e . getX ( ) , e . getY ( ) ) ; return ; } else if ( _hobject instanceof SceneObject ) { handleObjectPressed ( ( SceneObject ) _hobject , e . getX ( ) , e . getY ( ) ) ; return ; } } // if not button1 , or _ hobject not Sprite or SceneObject . . . handleMousePressed ( _hobject , e ) ;
public class UpdateSMBFileShareRequest { /** * A list of users or groups in the Active Directory that are allowed to access the file share . A group must be * prefixed with the @ character . For example < code > @ group1 < / code > . Can only be set if Authentication is set to * < code > ActiveDirectory < / code > . * @ return A list of users or groups in the Active Directory that are allowed to access the file share . A group must * be prefixed with the @ character . For example < code > @ group1 < / code > . Can only be set if Authentication is * set to < code > ActiveDirectory < / code > . */ public java . util . List < String > getValidUserList ( ) { } }
if ( validUserList == null ) { validUserList = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return validUserList ;
public class AbstractBoostingBagging { /** * { @ inheritDoc } */ @ Override protected void _fit ( Dataframe trainingData ) { } }
Configuration configuration = knowledgeBase . getConfiguration ( ) ; TP trainingParameters = knowledgeBase . getTrainingParameters ( ) ; MP modelParameters = knowledgeBase . getModelParameters ( ) ; // reset previous entries on the bundle resetBundle ( ) ; // first we need to find all the classes int n = trainingData . size ( ) ; Set < Object > classesSet = modelParameters . getClasses ( ) ; for ( Record r : trainingData ) { Object theClass = r . getY ( ) ; classesSet . add ( theClass ) ; } AssociativeArray observationWeights = new AssociativeArray ( ) ; // calculate the training parameters of bagging for ( Integer rId : trainingData . index ( ) ) { observationWeights . put ( rId , 1.0 / n ) ; // initialize observation weights } AbstractClassifier . AbstractTrainingParameters weakClassifierTrainingParameters = trainingParameters . getWeakClassifierTrainingParameters ( ) ; int totalWeakClassifiers = trainingParameters . getMaxWeakClassifiers ( ) ; // training the weak classifiers int i = 0 ; int retryCounter = 0 ; while ( i < totalWeakClassifiers ) { logger . debug ( "Training Weak learner {}" , i ) ; // We sample a list of Ids based on their weights FlatDataList sampledIDs = SimpleRandomSampling . weightedSampling ( observationWeights , n , true ) . toFlatDataList ( ) ; // We construct a new Dataframe from the sampledIDs Dataframe sampledTrainingDataset = trainingData . getSubset ( sampledIDs ) ; AbstractClassifier mlclassifier = MLBuilder . create ( weakClassifierTrainingParameters , configuration ) ; mlclassifier . fit ( sampledTrainingDataset ) ; sampledTrainingDataset . close ( ) ; mlclassifier . predict ( trainingData ) ; Status status = updateObservationAndClassifierWeights ( trainingData , observationWeights ) ; if ( status == Status . IGNORE ) { mlclassifier . close ( ) ; } else { bundle . put ( STORAGE_INDICATOR + i , mlclassifier ) ; } if ( status == Status . STOP ) { logger . debug ( "Skipping further training due to low error" ) ; break ; } else if ( status == Status . IGNORE ) { if ( retryCounter < MAX_NUM_OF_RETRIES ) { logger . debug ( "Ignoring last weak learner due to high error" ) ; ++ retryCounter ; continue ; } else { logger . debug ( "Too many retries, skipping further training" ) ; break ; } } else if ( status == Status . NEXT ) { retryCounter = 0 ; // reset the retry counter } i ++ ; }
public class ELSupport { /** * but I couldn ' t find it */ @ SuppressWarnings ( "unchecked" ) public static final Enum < ? > coerceToEnum ( final ELContext ctx , final Object obj , @ SuppressWarnings ( "rawtypes" ) Class type ) { } }
if ( ctx != null ) { boolean originalIsPropertyResolved = ctx . isPropertyResolved ( ) ; try { Object result = ctx . getELResolver ( ) . convertToType ( ctx , obj , type ) ; if ( ctx . isPropertyResolved ( ) ) { return ( Enum < ? > ) result ; } } finally { ctx . setPropertyResolved ( originalIsPropertyResolved ) ; } } if ( obj == null || "" . equals ( obj ) ) { return null ; } if ( type . isAssignableFrom ( obj . getClass ( ) ) ) { return ( Enum < ? > ) obj ; } if ( ! ( obj instanceof String ) ) { throw new ELException ( MessageFactory . get ( "error.convert" , obj , obj . getClass ( ) , type ) ) ; } Enum < ? > result ; try { result = Enum . valueOf ( type , ( String ) obj ) ; } catch ( IllegalArgumentException iae ) { throw new ELException ( MessageFactory . get ( "error.convert" , obj , obj . getClass ( ) , type ) ) ; } return result ;
public class CommandHelper { /** * Convert the value according the type of DeviceData . * @ param deviceDataArgout * the DeviceData attribute to read * @ return String , the result in String format * @ throws DevFailed */ public static String extractToString ( final DeviceData deviceDataArgout ) throws DevFailed { } }
final Object [ ] values = CommandHelper . extractArray ( deviceDataArgout ) ; Object value = null ; String argout = "" ; if ( values . length == 1 ) { value = values [ 0 ] ; if ( value instanceof DevState ) { argout = StateUtilities . getNameForState ( ( DevState ) value ) ; } else if ( value instanceof DevVarLongStringArray ) { final int [ ] intValues = ( ( DevVarLongStringArray ) value ) . lvalue ; final String [ ] stringValues = ( ( DevVarLongStringArray ) value ) . svalue ; for ( int i = 0 ; i < stringValues . length ; i ++ ) { argout = argout + "DevVarLongStringArray[" + i + "]=(" + intValues [ i ] + "," + stringValues [ i ] + ")\n" ; } } else if ( value instanceof DevVarDoubleStringArray ) { final double [ ] doubleValues = ( ( DevVarDoubleStringArray ) value ) . dvalue ; final String [ ] stringValues = ( ( DevVarDoubleStringArray ) value ) . svalue ; for ( int i = 0 ; i < stringValues . length ; i ++ ) { argout = argout + "DevVarDoubleStringArray[" + i + "]=(" + doubleValues [ i ] + "," + stringValues [ i ] + ")\n" ; } } else { argout = value . toString ( ) ; } } else if ( values . length > 1 ) { for ( int i = 0 ; i < values . length ; i ++ ) { if ( values [ i ] instanceof DevState ) { argout = argout + values [ i ] . getClass ( ) . getSimpleName ( ) + "[" + i + "]=" + StateUtilities . getNameForState ( ( DevState ) values [ i ] ) + "\n" ; } else { argout = argout + values [ i ] . getClass ( ) . getSimpleName ( ) + "[" + i + "]=" + values [ i ] . toString ( ) + "\n" ; } } } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "CommandHelper.extractToString(Object value,deviceDataArgin)" ) ; } return argout ;
public class JNDIMBeanRuntime { /** * Used to Register an MBean * @ param on : The ObjectName registration for the MBean * @ param type : The class type of the MBean being register * @ param o : The MBean * @ return : A service registration that provides access to manage the MBean */ private < T > ServiceRegistration < T > registerMBean ( ObjectName on , Class < T > type , T o ) { } }
Dictionary < String , Object > props = new Hashtable < String , Object > ( ) ; props . put ( "jmx.objectname" , on . toString ( ) ) ; return context . registerService ( type , o , props ) ;
public class ServerGroupReplicationConfigurationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ServerGroupReplicationConfiguration serverGroupReplicationConfiguration , ProtocolMarshaller protocolMarshaller ) { } }
if ( serverGroupReplicationConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( serverGroupReplicationConfiguration . getServerGroupId ( ) , SERVERGROUPID_BINDING ) ; protocolMarshaller . marshall ( serverGroupReplicationConfiguration . getServerReplicationConfigurations ( ) , SERVERREPLICATIONCONFIGURATIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class HttpAuthServiceBuilder { /** * Adds an { @ link Authorizer } . */ public HttpAuthServiceBuilder add ( Authorizer < HttpRequest > authorizer ) { } }
requireNonNull ( authorizer , "authorizer" ) ; if ( this . authorizer == null ) { this . authorizer = authorizer ; } else { this . authorizer = this . authorizer . orElse ( authorizer ) ; } return this ;
public class DiffFactory { /** * Do a full diff . * @ param paramBuilder * { @ link Builder } reference * @ throws TTException */ public static synchronized void invokeFullDiff ( final Builder paramBuilder ) throws TTException { } }
checkParams ( paramBuilder ) ; DiffKind . FULL . invoke ( paramBuilder ) ;
public class BaseParserScreen { /** * Display this screen in html input format . * @ return true if default params were found for this form . * @ param out The http output stream . * @ exception DBException File exception . */ public boolean printData ( PrintWriter out , int iPrintOptions ) { } }
if ( this . getProperty ( DBParams . XML ) != null ) return this . getScreenFieldView ( ) . printData ( out , iPrintOptions ) ; else return super . printData ( out , iPrintOptions ) ;
public class Type { /** * Returns this type converted such that it cannot reference null . */ public Type toNonNull ( ) { } }
if ( isNonNull ( ) ) { return this ; } else { return new Type ( this ) { private static final long serialVersionUID = 1L ; public boolean isNonNull ( ) { return true ; } public boolean isNullable ( ) { return false ; } public Type toNullable ( ) { return Type . this ; } } ; }
public class EditShape { /** * Returns envelope of all coordinates . */ Envelope2D getEnvelope2D ( ) { } }
Envelope2D env = new Envelope2D ( ) ; env . setEmpty ( ) ; VertexIterator vert_iter = queryVertexIterator ( ) ; Point2D pt = new Point2D ( ) ; boolean b_first = true ; for ( int ivertex = vert_iter . next ( ) ; ivertex != - 1 ; ivertex = vert_iter . next ( ) ) { getXY ( ivertex , pt ) ; if ( b_first ) env . merge ( pt . x , pt . y ) ; else env . mergeNE ( pt . x , pt . y ) ; b_first = false ; } return env ;
public class Request { /** * Issues a GET to the server . * @ return The { @ link Response } from the server * @ throws IOException */ public Response getResource ( ) throws IOException { } }
buildQueryString ( ) ; buildHeaders ( ) ; connection . setDoOutput ( true ) ; connection . setRequestMethod ( "GET" ) ; return readResponse ( ) ;
public class CmsDriverManager { /** * Sets a new parent group for an already existing group . < p > * @ param dbc the current database context * @ param groupName the name of the group that should be written * @ param parentGroupName the name of the parent group to set , * or < code > null < / code > if the parent * group should be deleted . * @ throws CmsException if operation was not successful * @ throws CmsDataAccessException if the group with < code > groupName < / code > could not be read from VFS */ public void setParentGroup ( CmsDbContext dbc , String groupName , String parentGroupName ) throws CmsException , CmsDataAccessException { } }
CmsGroup group = readGroup ( dbc , groupName ) ; CmsUUID parentGroupId = CmsUUID . getNullUUID ( ) ; // if the group exists , use its id , else set to unknown . if ( parentGroupName != null ) { parentGroupId = readGroup ( dbc , parentGroupName ) . getId ( ) ; } group . setParentId ( parentGroupId ) ; // write the changes to the cms writeGroup ( dbc , group ) ;
public class PtrCLog { /** * Send a DEBUG log message * @ param tag * @ param msg * @ param throwable */ public static void d ( String tag , String msg , Throwable throwable ) { } }
if ( sLevel > LEVEL_DEBUG ) { return ; } Log . d ( tag , msg , throwable ) ;
public class TypeSignature { /** * Returns the type signature of a method according to JVM specs */ public String getTypeSignature ( String javasignature , TypeMirror returnType ) throws SignatureException { } }
String signature = null ; // Java type signature . String typeSignature = null ; // Internal type signature . List < String > params = new ArrayList < > ( ) ; // List of parameters . String paramsig = null ; // Java parameter signature . String paramJVMSig = null ; // Internal parameter signature . String returnSig = null ; // Java return type signature . String returnJVMType = null ; // Internal return type signature . int dimensions = 0 ; // Array dimension . int startIndex = - 1 ; int endIndex = - 1 ; StringTokenizer st = null ; int i = 0 ; // Gets the actual java signature without parentheses . if ( javasignature != null ) { startIndex = javasignature . indexOf ( "(" ) ; endIndex = javasignature . indexOf ( ")" ) ; } if ( ( ( startIndex != - 1 ) && ( endIndex != - 1 ) ) && ( startIndex + 1 < javasignature . length ( ) ) && ( endIndex < javasignature . length ( ) ) ) { signature = javasignature . substring ( startIndex + 1 , endIndex ) ; } // Separates parameters . if ( signature != null ) { if ( signature . contains ( "," ) ) { st = new StringTokenizer ( signature , "," ) ; if ( st != null ) { while ( st . hasMoreTokens ( ) ) { params . add ( st . nextToken ( ) ) ; } } } else { params . add ( signature ) ; } } /* JVM type signature . */ typeSignature = "(" ; // Gets indivisual internal parameter signature . while ( params . isEmpty ( ) != true ) { paramsig = params . remove ( i ) . trim ( ) ; paramJVMSig = getParamJVMSignature ( paramsig ) ; if ( paramJVMSig != null ) { typeSignature += paramJVMSig ; } } typeSignature += ")" ; // Get internal return type signature . returnJVMType = "" ; if ( returnType != null ) { dimensions = dimensions ( returnType ) ; } // Gets array dimension of return type . while ( dimensions -- > 0 ) { returnJVMType += "[" ; } if ( returnType != null ) { returnSig = qualifiedTypeName ( returnType ) ; returnJVMType += getComponentType ( returnSig ) ; } else { System . out . println ( "Invalid return type." ) ; } typeSignature += returnJVMType ; return typeSignature ;
public class CommerceOrderNoteUtil { /** * Returns the last commerce order note in the ordered set where commerceOrderId = & # 63 ; and restricted = & # 63 ; . * @ param commerceOrderId the commerce order ID * @ param restricted the restricted * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce order note , or < code > null < / code > if a matching commerce order note could not be found */ public static CommerceOrderNote fetchByC_R_Last ( long commerceOrderId , boolean restricted , OrderByComparator < CommerceOrderNote > orderByComparator ) { } }
return getPersistence ( ) . fetchByC_R_Last ( commerceOrderId , restricted , orderByComparator ) ;
public class IntSets { /** * Validate the specified arguments . */ protected static void checkNotNull ( Object [ ] array ) { } }
checkNotNull ( ( Object ) array ) ; for ( Object o : array ) { checkNotNull ( o ) ; }
public class AbstractSitemapGenerator { /** * Save sitemap to output file * @ param file * Output file * @ param sitemap * Sitemap as array of Strings ( created by constructSitemap ( ) * method ) * @ throws IOException * when error * @ deprecated Use { @ link # toFile ( Path ) } instead */ @ Deprecated public void saveSitemap ( File file , String [ ] sitemap ) throws IOException { } }
try ( BufferedWriter writer = new BufferedWriter ( new FileWriter ( file ) ) ) { for ( String string : sitemap ) { writer . write ( string ) ; } }
public class AbstractMaterialDialog { /** * Attaches all registered decorators to the dialog . * @ param window * The window , the dialog belongs to , as an instance of the class { @ link Window } . The * window may not be null * @ param rootView * The root view of the dialog as an instance of the class { @ link DialogRootView } . The * root view may not be null * @ param view * The view of the dialog as an instance of the class { @ link View } . The view may not be * null * @ return A map , which contains the views , which have been inflated by the decorators , mapped * to their view types , as an instance of the type { @ link Map } or null , if the decorator has not * inflated any views */ private Map < ViewType , View > attachDecorators ( @ NonNull final Window window , @ NonNull final DialogRootView rootView , @ NonNull final View view ) { } }
Map < ViewType , View > result = new HashMap < > ( ) ; for ( AbstractDecorator < ? , ? > decorator : decorators ) { result . putAll ( decorator . attach ( window , view , result , null ) ) ; decorator . addAreaListener ( rootView ) ; } return result ;
public class ComponentExposedTypeGenerator { /** * Create the " created " hook method . This method will be called on each Component when it ' s * created . It will inject dependencies if any . * @ param dependenciesBuilder Builder for our component dependencies , needed here to inject the * dependencies in the instance */ private void createCreatedHook ( ComponentInjectedDependenciesBuilder dependenciesBuilder ) { } }
String hasRunCreatedFlagName = "vg$hrc_" + getSuperComponentCount ( component ) ; componentExposedTypeBuilder . addField ( FieldSpec . builder ( boolean . class , hasRunCreatedFlagName , Modifier . PUBLIC ) . addAnnotation ( JsProperty . class ) . build ( ) ) ; MethodSpec . Builder createdMethodBuilder = MethodSpec . methodBuilder ( "vg$created" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( JsMethod . class ) ; // Avoid infinite recursion in case calling the Java constructor calls Vue . js constructor // This can happen when extending an existing JS component createdMethodBuilder . addStatement ( "if ($L) return" , hasRunCreatedFlagName ) . addStatement ( "$L = true" , hasRunCreatedFlagName ) ; createdMethodBuilder . addStatement ( "vue().$L().proxyFields(this)" , "$options" ) ; injectDependencies ( component , dependenciesBuilder , createdMethodBuilder ) ; initFieldsValues ( component , createdMethodBuilder ) ; processWatchers ( createdMethodBuilder ) ; if ( hasInterface ( processingEnv , component . asType ( ) , HasCreated . class ) ) { createdMethodBuilder . addStatement ( "super.created()" ) ; } componentExposedTypeBuilder . addMethod ( createdMethodBuilder . build ( ) ) ; // Register the hook addMethodToProto ( "vg$created" ) ; optionsBuilder . addStatement ( "options.addHookMethod($S, p.$L)" , "created" , "vg$created" ) ;
public class ValidatorHelper { /** * This method must be synchronized as it is possible for two threads to * enter concurrently while schema = = null and both will try to load and * parse the schema , which may cause a parsing exception : * org . xml . sax . SAXException : FWK005 parse may not be called while parsing . */ public static synchronized Schema getXJCLSchema ( ) { } }
if ( schema == null ) { final URL url = ValidatorHelper . class . getResource ( SCHEMA_LOCATION ) ; try { schema = AccessController . doPrivileged ( new PrivilegedExceptionAction < Schema > ( ) { @ Override public Schema run ( ) throws SAXException { return sf . newSchema ( url ) ; } } ) ; } catch ( PrivilegedActionException e ) { throw new RuntimeException ( e . getCause ( ) ) ; } } return schema ;
public class Swagger2MarkupConfigBuilder { /** * Enable use of inter - document cross - references when needed . * @ param prefix Prefix to document in all inter - document cross - references . * @ return this builder */ public Swagger2MarkupConfigBuilder withInterDocumentCrossReferences ( String prefix ) { } }
Validate . notNull ( prefix , "%s must not be null" , "prefix" ) ; config . interDocumentCrossReferencesEnabled = true ; config . interDocumentCrossReferencesPrefix = prefix ; return this ;
public class Model { /** * TODO : override in KMeansModel once that ' s rewritten on water . Model */ public ModelCategory getModelCategory ( ) { } }
return ( isClassifier ( ) ? ( nclasses ( ) > 2 ? ModelCategory . Multinomial : ModelCategory . Binomial ) : ModelCategory . Regression ) ;
public class ModelMetrics { /** * Fetch all ModelMetrics from the KV store . */ protected static List < water . ModelMetrics > fetchAll ( ) { } }
return new ArrayList < water . ModelMetrics > ( H2O . KeySnapshot . globalSnapshot ( ) . fetchAll ( water . ModelMetrics . class ) . values ( ) ) ;
public class ClassUtility { /** * Find and Build the generic type according to assignable and excluded classes . * @ param mainClass The main class used ( that contains at least one generic type ) * @ param assignableClasses if the array contains only one class it define the type of the generic to build , otherwise it defines the types to skip to find the obejct to build * @ param excludedClass the class that shouldn ' t be retrieved ( ie : NullXX class ) * @ param parameters used by the constructor of the generic type * @ return the first generic type of a class that is compatible with provided assignable class . * @ throws CoreException if the class cannot be found and is not an excluded class */ public static Object findAndBuildGenericType ( final Class < ? > mainClass , final Class < ? > assignableClass , final Class < ? > excludedClass , final Object ... parameters ) throws CoreException { } }
Object object = null ; final Class < ? > objectClass = ClassUtility . findGenericClass ( mainClass , assignableClass ) ; if ( objectClass != null && ( excludedClass == null || ! excludedClass . equals ( objectClass ) ) ) { object = buildGenericType ( mainClass , new Class < ? > [ ] { assignableClass } , parameters ) ; } return object ;
public class Copiers { /** * 基于 Cglib 实现的拷贝 , 不支持 Converter * @ param sourceClass 源对象类型 * @ param targetClass 目标对象类型 * @ return copier */ public static < F , T > Copier < F , T > createCglib ( Class < F > sourceClass , Class < T > targetClass ) { } }
return CopierFactory . getOrCreateCglibCopier ( sourceClass , targetClass ) ;
public class AbstractModbusMaster { /** * Writes a given number of coil states to the slave . * Note that the number of coils to be written is given * implicitly , through { @ link BitVector # size ( ) } . * @ param unitId the slave unit id . * @ param ref the offset of the coil to start writing to . * @ param coils a < tt > BitVector < / tt > which holds the coil states to be written . * @ throws ModbusException if an I / O error , a slave exception or * a transaction error occurs . */ public void writeMultipleCoils ( int unitId , int ref , BitVector coils ) throws ModbusException { } }
checkTransaction ( ) ; if ( writeMultipleCoilsRequest == null ) { writeMultipleCoilsRequest = new WriteMultipleCoilsRequest ( ) ; } writeMultipleCoilsRequest . setUnitID ( unitId ) ; writeMultipleCoilsRequest . setReference ( ref ) ; writeMultipleCoilsRequest . setCoils ( coils ) ; transaction . setRequest ( writeMultipleCoilsRequest ) ; transaction . execute ( ) ;
public class ModuleRegistry { /** * Returns a { @ link ResourceLookup } instance that combines all instances * registered by modules . * @ return resource lookup */ public ResourceLookup getResourceLookup ( ) { } }
checkState ( InitializedState . INITIALIZING , InitializedState . INITIALIZED ) ; return new MultiResourceLookup ( aggregatedModule . getResourceLookups ( ) ) ;
public class ConcurrentLinkedHashMap { /** * Returns a value which the specified key is mapped . * At the same time , this method will call the callback interface , the getting entry event will be triggered . * @ param key the key whose associated value is to be returned * @ return the value which the specified key is mapped , or * { @ code null } if this map contains no mapping for the key */ @ SuppressWarnings ( "unchecked" ) @ Override public V get ( Object key ) { } }
LinkedHashMapSegment < K , V > seg = segmentFor ( key . hashCode ( ) ) ; try { seg . lock . lock ( ) ; return mapEventListener . onGetEntry ( ( K ) key , seg . get ( key ) ) ; } finally { seg . lock . unlock ( ) ; }
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcRelContainedInSpatialStructure ( ) { } }
if ( ifcRelContainedInSpatialStructureEClass == null ) { ifcRelContainedInSpatialStructureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 542 ) ; } return ifcRelContainedInSpatialStructureEClass ;
public class Validator { /** * Reverses a set of properties mapped using the specified property mapping , or the same input * if the description has no mapping * @ param input input map * @ param mapping key value mapping * @ param skip if true , ignore input entries when the key is not present in the mapping * @ return mapped values */ public static Map < String , String > demapProperties ( final Map < String , String > input , final Map < String , String > mapping , final boolean skip ) { } }
if ( null == mapping ) { return input ; } final Map < String , String > rev = new HashMap < String , String > ( ) ; for ( final Map . Entry < String , String > entry : mapping . entrySet ( ) ) { rev . put ( entry . getValue ( ) , entry . getKey ( ) ) ; } return performMapping ( input , rev , skip ) ;
public class CassandraDefs { /** * Create a SlicePredicate that starts at the given column name , selecting up to * { @ link # MAX _ COLS _ BATCH _ SIZE } columns . * @ param startColName Starting column name as a byte [ ] . * @ param endColNameEnding column name as a byte [ ] * @ return SlicePredicate that starts at the given starting column name , * ends at the given ending column name , selecting up to * { @ link # MAX _ COLS _ BATCH _ SIZE } columns . */ static SlicePredicate slicePredicateStartEndCol ( byte [ ] startColName , byte [ ] endColName , boolean reversed ) { } }
if ( startColName == null ) startColName = EMPTY_BYTES ; if ( endColName == null ) endColName = EMPTY_BYTES ; SliceRange sliceRange = new SliceRange ( ByteBuffer . wrap ( startColName ) , ByteBuffer . wrap ( endColName ) , reversed , CassandraDefs . MAX_COLS_BATCH_SIZE ) ; SlicePredicate slicePred = new SlicePredicate ( ) ; slicePred . setSlice_range ( sliceRange ) ; return slicePred ;
public class MaxAbsScaler { /** * Scales each feature by its maximum absolute value . * @ param x a vector to be scaled . The vector will be modified on output . * @ return the input vector . */ @ Override public double [ ] transform ( double [ ] x ) { } }
if ( x . length != scale . length ) { throw new IllegalArgumentException ( String . format ( "Invalid vector size %d, expected %d" , x . length , scale . length ) ) ; } double [ ] y = copy ? new double [ x . length ] : x ; for ( int i = 0 ; i < x . length ; i ++ ) { y [ i ] = x [ i ] / scale [ i ] ; } return y ;
public class Utils { /** * It casts an array of objets to an array of GraphRelationship * @ param o the array of objects * @ return */ public static GraphRelationship [ ] toGRArray ( Object [ ] o ) { } }
GraphRelationship [ ] result = new GraphRelationship [ o . length ] ; System . arraycopy ( o , 0 , result , 0 , o . length ) ; return result ;
public class AsyncDataStream { /** * Add an AsyncWaitOperator . * @ param in The { @ link DataStream } where the { @ link AsyncWaitOperator } will be added . * @ param func { @ link AsyncFunction } wrapped inside { @ link AsyncWaitOperator } . * @ param timeout for the asynchronous operation to complete * @ param bufSize The max number of inputs the { @ link AsyncWaitOperator } can hold inside . * @ param mode Processing mode for { @ link AsyncWaitOperator } . * @ param < IN > Input type . * @ param < OUT > Output type . * @ return A new { @ link SingleOutputStreamOperator } */ private static < IN , OUT > SingleOutputStreamOperator < OUT > addOperator ( DataStream < IN > in , AsyncFunction < IN , OUT > func , long timeout , int bufSize , OutputMode mode ) { } }
TypeInformation < OUT > outTypeInfo = TypeExtractor . getUnaryOperatorReturnType ( func , AsyncFunction . class , 0 , 1 , new int [ ] { 1 , 0 } , in . getType ( ) , Utils . getCallLocationName ( ) , true ) ; // create transform AsyncWaitOperator < IN , OUT > operator = new AsyncWaitOperator < > ( in . getExecutionEnvironment ( ) . clean ( func ) , timeout , bufSize , mode ) ; return in . transform ( "async wait operator" , outTypeInfo , operator ) ;
public class CmsSitemapTreeNode { /** * Opens / closes the list of children . < p < * @ param isOpen true if the children should be opened , false if they should be closed */ public void setOpen ( boolean isOpen ) { } }
m_opener . setStyleOpen ( isOpen ) ; m_children . setVisible ( isOpen ) ; m_isOpen = isOpen ;
public class ConfigElement { /** * Sets an attribute on this element that does not have an explicit setter . * @ param name the name * @ param value the value */ public void setExtraAttribute ( String name , String value ) { } }
if ( extraAttributes == null ) { extraAttributes = new HashMap < QName , Object > ( ) ; } if ( value == null ) { extraAttributes . remove ( new QName ( null , name ) ) ; } else { extraAttributes . put ( new QName ( null , name ) , value ) ; }
public class CollectionUtil { /** * map转换 * @ param map 要转换的map * @ param function 转换函数 * @ param < K > KEY类型 * @ param < NEW > 转换后的value类型 * @ param < OLD > 转换前的value类型 * @ return 转换后的map */ public static < K , NEW , OLD > Map < K , NEW > convert ( Map < K , OLD > map , Function < OLD , NEW > function ) { } }
Map < K , NEW > newMap = new HashMap < > ( ) ; map . forEach ( ( k , v ) -> newMap . put ( k , function . apply ( v ) ) ) ; return newMap ;
public class GeneratedCodeRepository { /** * Update the repository class from the given classloader . If the given repository class cannot be instantiated * then this method will throw a TransfuseRuntimeException . * @ throws TransfuseRuntimeException * @ param classLoader */ public final void loadRepository ( ClassLoader classLoader , String repositoryPackage , String repositoryName ) { } }
try { Class repositoryClass = classLoader . loadClass ( repositoryPackage + "." + repositoryName ) ; Repository < T > instance = ( Repository < T > ) repositoryClass . newInstance ( ) ; generatedMap . putAll ( instance . get ( ) ) ; } catch ( ClassNotFoundException e ) { // nothing } catch ( InstantiationException e ) { throw new TransfuseRuntimeException ( "Unable to instantiate generated Repository" , e ) ; } catch ( IllegalAccessException e ) { throw new TransfuseRuntimeException ( "Unable to access generated Repository" , e ) ; }
public class Matth { /** * Returns { @ code b } to the { @ code k } th power . Even if the result overflows , it will be equal to * { @ code BigInteger . valueOf ( b ) . pow ( k ) . longValue ( ) } . This implementation runs in { @ code O ( log k ) } * time . * @ throws IllegalArgumentException if { @ code k < 0} */ public static long pow ( long b , int k ) { } }
checkNonNegative ( "exponent" , k ) ; if ( - 2 <= b && b <= 2 ) { switch ( ( int ) b ) { case 0 : return ( k == 0 ) ? 1 : 0 ; case 1 : return 1 ; case ( - 1 ) : return ( ( k & 1 ) == 0 ) ? 1 : - 1 ; case 2 : return ( k < Long . SIZE ) ? 1L << k : 0 ; case ( - 2 ) : if ( k < Long . SIZE ) { return ( ( k & 1 ) == 0 ) ? 1L << k : - ( 1L << k ) ; } else { return 0 ; } default : throw new AssertionError ( ) ; } } for ( long accum = 1 ; ; k >>= 1 ) { switch ( k ) { case 0 : return accum ; case 1 : return accum * b ; default : accum *= ( ( k & 1 ) == 0 ) ? 1 : b ; b *= b ; } }
public class GobblinApplicationMaster { /** * Build the { @ link YarnService } for the Application Master . */ private YarnService buildYarnService ( Config config , String applicationName , String applicationId , YarnConfiguration yarnConfiguration , FileSystem fs ) throws Exception { } }
return new YarnService ( config , applicationName , applicationId , yarnConfiguration , fs , this . eventBus ) ;
public class UpdateUtils { /** * Get the source URL and store it to a destination file path * @ param sourceUrl url * @ param destinationFilePath destination * @ param username username * @ param password password * @ param factory updater factory * @ throws UpdateException on error */ public static void updateFileFromUrl ( final String sourceUrl , final String destinationFilePath , final String username , final String password , final URLFileUpdaterFactory factory ) throws UpdateException { } }
String tusername = username ; String tpassword = password ; URL url ; try { url = new URL ( sourceUrl ) ; if ( null == username && null == password && null != url . getUserInfo ( ) ) { // try to extract userinfo from URL final String userInfo = url . getUserInfo ( ) ; final String [ ] split = userInfo . split ( ":" , 2 ) ; if ( 2 == split . length ) { tusername = split [ 0 ] ; tpassword = split [ 1 ] ; url = new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , url . getFile ( ) ) ; } } } catch ( MalformedURLException e ) { throw new UpdateException ( e ) ; } final File destinationFile = new File ( destinationFilePath ) ; final long mtime = destinationFile . exists ( ) ? destinationFile . lastModified ( ) : 0 ; update ( factory . fileUpdaterFromURL ( url , tusername , tpassword ) , destinationFile ) ; if ( destinationFile . lastModified ( ) > mtime ) { logger . info ( "updated file: " + destinationFile . getAbsolutePath ( ) ) ; } else { logger . info ( "file already up to date: " + destinationFile . getAbsolutePath ( ) ) ; }
public class FlowPreparer { /** * Download project zip and unzip it if not exists locally . * @ param proj project to download * @ return the temp dir where the new project is downloaded to , null if no project is downloaded . * @ throws IOException if downloading or unzipping fails . */ @ VisibleForTesting File downloadProjectIfNotExists ( final ProjectDirectoryMetadata proj , final int execId ) throws IOException { } }
final String projectDir = generateProjectDirName ( proj ) ; if ( proj . getInstalledDir ( ) == null ) { proj . setInstalledDir ( new File ( this . projectCacheDir , projectDir ) ) ; } // If directory exists , assume it ' s prepared and skip . if ( proj . getInstalledDir ( ) . exists ( ) ) { log . info ( "Project {} already cached. Skipping download. ExecId: {}" , proj , execId ) ; // Hit the local cache . this . projectCacheHitRatio . markHit ( ) ; // Update last modified time of the file keeping project dir size when the project is // accessed . This last modified time will be used to determined least recently used // projects when performing project directory clean - up . updateLastModifiedTime ( Paths . get ( proj . getInstalledDir ( ) . getPath ( ) , PROJECT_DIR_SIZE_FILE_NAME ) ) ; return null ; } this . projectCacheHitRatio . markMiss ( ) ; final long start = System . currentTimeMillis ( ) ; // Download project to a temp dir if not exists in local cache . final File tempDir = createTempDir ( proj ) ; downloadAndUnzipProject ( proj , tempDir ) ; log . info ( "Downloading zip file for project {} when preparing execution [execid {}] " + "completed in {} second(s)" , proj , execId , ( System . currentTimeMillis ( ) - start ) / 1000 ) ; return tempDir ;
public class BaseExceptionHandler { /** * { @ inheritDoc } */ public MjdbcSQLException convert ( Connection conn , SQLException cause , String sql , Object ... params ) { } }
String causeMessage = cause . getMessage ( ) ; if ( causeMessage == null ) { causeMessage = "" ; } StringBuffer msg = new StringBuffer ( causeMessage ) ; msg . append ( " Query: " ) ; msg . append ( sql ) ; msg . append ( " Parameters: " ) ; if ( params == null ) { msg . append ( "[]" ) ; } else { msg . append ( Arrays . deepToString ( params ) ) ; } MjdbcSQLException ex = new MjdbcSQLException ( msg . toString ( ) , cause . getSQLState ( ) , cause . getErrorCode ( ) ) ; ex . setStackTrace ( cause . getStackTrace ( ) ) ; return ex ;
public class CollectionFuncSup { /** * a chain to simplify ' add ' process * < pre > * $ ( collection ) . add ( e1 ) . add ( e2 ) . add ( e3) * < / pre > * @ param t * the element to add * @ return < code > this < / code > */ @ SuppressWarnings ( "unchecked" ) public < Coll extends CollectionFuncSup < T > > Coll add ( T t ) { } }
Collection < T > coll = ( Collection < T > ) iterable ; coll . add ( t ) ; return ( Coll ) this ;
public class DataUtil { /** * big - endian or motorola format . */ public static int readIntegerBigEndian ( InputStream io ) throws IOException { } }
int value = io . read ( ) ; if ( value < 0 ) throw new EOFException ( ) ; value <<= 24 ; int i = io . read ( ) ; if ( i < 0 ) throw new EOFException ( ) ; value |= i << 16 ; i = io . read ( ) ; if ( i < 0 ) throw new EOFException ( ) ; value |= i << 8 ; i = io . read ( ) ; if ( i < 0 ) throw new EOFException ( ) ; value |= i ; return value ;
public class LocalDate { /** * Returns a copy of this date plus the specified number of days . * This LocalDate instance is immutable and unaffected by this method call . * The following three lines are identical in effect : * < pre > * LocalDate added = dt . plusDays ( 6 ) ; * LocalDate added = dt . plus ( Period . days ( 6 ) ) ; * LocalDate added = dt . withFieldAdded ( DurationFieldType . days ( ) , 6 ) ; * < / pre > * @ param days the amount of days to add , may be negative * @ return the new LocalDate plus the increased days */ public LocalDate plusDays ( int days ) { } }
if ( days == 0 ) { return this ; } long instant = getChronology ( ) . days ( ) . add ( getLocalMillis ( ) , days ) ; return withLocalMillis ( instant ) ;
public class CasVersion { /** * Gets last modified date / time for the module . * @ return the date / time */ @ SneakyThrows public static ZonedDateTime getDateTime ( ) { } }
val clazz = CasVersion . class ; val resource = clazz . getResource ( clazz . getSimpleName ( ) + ".class" ) ; if ( "file" . equals ( resource . getProtocol ( ) ) ) { return DateTimeUtils . zonedDateTimeOf ( new File ( resource . toURI ( ) ) . lastModified ( ) ) ; } if ( "jar" . equals ( resource . getProtocol ( ) ) ) { val path = resource . getPath ( ) ; val file = new File ( path . substring ( JAR_PROTOCOL_STARTING_INDEX , path . indexOf ( '!' ) ) ) ; return DateTimeUtils . zonedDateTimeOf ( file . lastModified ( ) ) ; } if ( "vfs" . equals ( resource . getProtocol ( ) ) ) { val file = new VfsResource ( resource . openConnection ( ) . getContent ( ) ) . getFile ( ) ; return DateTimeUtils . zonedDateTimeOf ( file . lastModified ( ) ) ; } LOGGER . warn ( "Unhandled url protocol: [{}] resource: [{}]" , resource . getProtocol ( ) , resource ) ; return ZonedDateTime . now ( ZoneOffset . UTC ) ;
public class DeleteElasticsearchServiceRoleRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteElasticsearchServiceRoleRequest deleteElasticsearchServiceRoleRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteElasticsearchServiceRoleRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ConfigurationUtils { /** * Loads the path level configuration from the get configuration response . * Only client scope properties will be loaded . * @ param response the get configuration RPC response * @ param clusterConf cluster level configuration * @ return the loaded path level configuration */ private static PathConfiguration loadPathConfiguration ( GetConfigurationPResponse response , AlluxioConfiguration clusterConf ) { } }
String clientVersion = clusterConf . get ( PropertyKey . VERSION ) ; LOG . info ( "Alluxio client (version {}) is trying to load path level configurations" , clientVersion ) ; Map < String , AlluxioConfiguration > pathConfs = new HashMap < > ( ) ; response . getPathConfigsMap ( ) . forEach ( ( path , conf ) -> { Properties props = loadClientProperties ( conf . getPropertiesList ( ) , ( key , value ) -> String . format ( "Loading property: %s (%s) -> %s for path %s" , key , key . getScope ( ) , value , path ) ) ; AlluxioProperties properties = new AlluxioProperties ( ) ; properties . merge ( props , Source . PATH_DEFAULT ) ; pathConfs . put ( path , new InstancedConfiguration ( properties , true ) ) ; } ) ; LOG . info ( "Alluxio client has loaded path level configurations" ) ; return PathConfiguration . create ( pathConfs ) ;
public class MenuTree { /** * Replace the menu item that has a given parent with the one provided * @ param subMenu the parent * @ param toReplace the menu item to replace by ID */ public void replaceMenuById ( SubMenuItem subMenu , MenuItem toReplace ) { } }
synchronized ( subMenuItems ) { ArrayList < MenuItem > list = subMenuItems . get ( subMenu ) ; int idx = - 1 ; for ( int i = 0 ; i < list . size ( ) ; ++ i ) { if ( list . get ( i ) . getId ( ) == toReplace . getId ( ) ) { idx = i ; } } if ( idx != - 1 ) { MenuItem oldItem = list . set ( idx , toReplace ) ; if ( toReplace . hasChildren ( ) ) { ArrayList < MenuItem > items = subMenuItems . remove ( oldItem ) ; subMenuItems . put ( toReplace , items ) ; } } }
public class DerivativeTransform { /** * ~ Methods * * * * * */ @ Override public List < Metric > transform ( QueryContext context , List < Metric > metrics ) { } }
SystemAssert . requireArgument ( metrics != null , "Cannot transform null metric/metrics" ) ; return computeDerivedValues ( metrics , - 1L ) ;
public class DukeController { /** * - - - Create link database */ private LinkDatabase makeLinkDatabase ( Properties props ) { } }
String dbtype = get ( props , "duke.linkdbtype" ) ; if ( dbtype . equals ( "jdbc" ) ) return makeJDBCLinkDatabase ( props ) ; else if ( dbtype . equals ( "jndi" ) ) return makeJNDILinkDatabase ( props ) ; else throw new DukeConfigException ( "Unknown link database type '" + dbtype + "'" ) ;
public class ScrollBarButtonIsIncreaseButtonState { /** * { @ inheritDoc } */ public boolean isInState ( JComponent c ) { } }
if ( c != null && c . getParent ( ) != null ) { SeaGlassScrollBarUI ui = ( SeaGlassScrollBarUI ) ( ( JScrollBar ) c . getParent ( ) ) . getUI ( ) ; if ( ui . getIncreaseButton ( ) == c ) { return true ; } } return false ;
public class ServerCommandListener { /** * Start listening for incoming commands . * read ( ) ( accept ( ) / read ( ) ) are blocking , not waiting , operations . * Locks are not suspended while waiting for input */ public void startListening ( ) { } }
if ( listenForCommands ) { listeningThread = new Thread ( "kernel-command-listener" ) { @ Override public void run ( ) { while ( listenForCommands && acceptAndExecuteCommand ( ) ) { // loop intentionally empty } } } ; listeningThread . start ( ) ; }