signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Component { /** * 构建配置参数 * @ param params 参数 */ protected void buildConfigParams ( final Map < String , String > params ) { } }
params . put ( WepayField . APP_ID , wepay . getAppId ( ) ) ; params . put ( WepayField . MCH_ID , wepay . getMchId ( ) ) ;
public class ValueBox { /** * Creates a ValueBox widget that wraps an existing & lt ; input type = ' text ' & gt ; element . * This element must already be attached to the document . If the element is removed from the * document , you must call { @ link RootPanel # detachNow ( Widget ) } . * @ param < T > the value type * @ param element the element to be wrapped * @ param renderer rendering routine * @ param parser parsing routine * @ return value box */ public static < T > ValueBox < T > wrap ( final Element element , final Renderer < T > renderer , final Parser < T > parser ) { } }
// Assert that the element is attached . assert Document . get ( ) . getBody ( ) . isOrHasChild ( element ) ; final ValueBox < T > valueBox = new ValueBox < > ( element , renderer , parser ) ; // Mark it attached and remember it for cleanup . valueBox . onAttach ( ) ; RootPanel . detachOnWindowClose ( valueBox ) ; return valueBox ;
public class DefaultEventStudio { /** * Adds a { @ link Listener } ( with the given priority and strength ) to the hidden station listening for the given event class , hiding the station abstraction . * @ see EventStudio # add ( Listener , String , int , ReferenceStrength ) * @ see DefaultEventStudio # HIDDEN _ STATION */ public < T > void add ( Class < T > eventClass , Listener < T > listener , int priority , ReferenceStrength strength ) { } }
add ( eventClass , listener , HIDDEN_STATION , priority , strength ) ;
public class AsyncLibrary { /** * @ see com . ibm . io . async . IAsyncProvider # dispose ( long ) */ @ Override public long dispose ( long channelIdentifier ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "dispose" , Long . valueOf ( channelIdentifier ) ) ; } long rc = 0L ; synchronized ( oneAtATime ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "have lock" ) ; } if ( aioInitialized == AIO_INITIALIZED ) { try { rc = aio_dispose ( channelIdentifier ) ; } catch ( AsyncException ae ) { // just log any errors if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error disposing channel: " + channelIdentifier + ", error: " + ae . getMessage ( ) ) ; } } catch ( Throwable t ) { if ( aioInitialized != AIO_SHUTDOWN ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "caught throwable:" + t ) ; } throw new RuntimeException ( "Throwable caught from aio dll: aio_dispose: " + t . getMessage ( ) ) ; } } } } // end - sync if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "dispose" ) ; } return rc ;
public class Cache2kBuilder { /** * Enables write through operation and sets a writer customization that gets * called synchronously upon cache mutations . By default write through is not enabled . */ public final Cache2kBuilder < K , V > writer ( CacheWriter < K , V > w ) { } }
config ( ) . setWriter ( wrapCustomizationInstance ( w ) ) ; return this ;
public class Property { /** * Writes one property of the given object to { @ link DataWriter } . * @ param pruner * Determines how to prune the object graph tree . */ @ SuppressWarnings ( "unchecked" ) public void writeTo ( Object object , TreePruner pruner , DataWriter writer ) throws IOException { } }
TreePruner child = pruner . accept ( object , this ) ; if ( child == null ) return ; Object d = writer . getExportConfig ( ) . getExportInterceptor ( ) . getValue ( this , object , writer . getExportConfig ( ) ) ; if ( ( d == null && skipNull ) || d == ExportInterceptor . SKIP ) { // don ' t write anything return ; } if ( merge ) { // merged property will get all its properties written here if ( d != null ) { Class < ? > objectType = d . getClass ( ) ; Model model = owner . getOrNull ( objectType , parent . type , name ) ; if ( model == null && ! writer . getExportConfig ( ) . isSkipIfFail ( ) ) { throw new NotExportableException ( objectType ) ; } else if ( model != null ) { model . writeNestedObjectTo ( d , new FilteringTreePruner ( parent . HAS_PROPERTY_NAME_IN_ANCESTRY , child ) , writer ) ; } } } else { writer . name ( name ) ; writeValue ( type , d , child , writer ) ; }
public class PortableFinderEnumeration { /** * object . */ private void readObject ( java . io . ObjectInputStream in ) throws IOException , ClassNotFoundException { } }
in . defaultReadObject ( ) ; // read in the eyecatcher for this object ( WSFE in ascii ) byte [ ] ec = new byte [ Constants . EYE_CATCHER_LENGTH ] ; // d164415 start int bytesRead = 0 ; for ( int offset = 0 ; offset < Constants . EYE_CATCHER_LENGTH ; offset += bytesRead ) { bytesRead = in . read ( ec , offset , Constants . EYE_CATCHER_LENGTH - offset ) ; if ( bytesRead == - 1 ) { throw new IOException ( "end of input stream while reading eye catcher" ) ; } } // d164415 end // validate that the eyecatcher matches for ( int i = 0 ; i < eyecatcher . length ; i ++ ) { if ( eyecatcher [ i ] != ec [ i ] ) { throw new IOException ( ) ; } } in . readShort ( ) ; // platform in . readShort ( ) ; // version finderEnumerator = ( PortableFinderEnumerator ) in . readObject ( ) ;
public class SecureHash { /** * Get the hash of the supplied content , using the digest identified by the supplied name . Note that this method never closes * the supplied stream . * @ param digestName the name of the hashing function ( or { @ link MessageDigest message digest } ) that should be used * @ param stream the stream containing the content to be hashed ; may not be null * @ return the hash of the contents as a byte array * @ throws NoSuchAlgorithmException if the supplied algorithm could not be found * @ throws IOException if there is an error reading the stream */ public static byte [ ] getHash ( String digestName , InputStream stream ) throws NoSuchAlgorithmException , IOException { } }
CheckArg . isNotNull ( stream , "stream" ) ; MessageDigest digest = MessageDigest . getInstance ( digestName ) ; assert digest != null ; int bufSize = 1024 ; byte [ ] buffer = new byte [ bufSize ] ; int n = stream . read ( buffer , 0 , bufSize ) ; while ( n != - 1 ) { digest . update ( buffer , 0 , n ) ; n = stream . read ( buffer , 0 , bufSize ) ; } return digest . digest ( ) ;
public class LocalQPConsumerKey { /** * Method notifyReceiveAllowed * < p > Notify the consumerKeys consumerPoint about change of Receive Allowed state * @ param isAllowed - New state of Receive Allowed for localization */ public void notifyReceiveAllowed ( boolean isAllowed , DestinationHandler destinationBeingModified ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "notifyReceiveAllowed" , Boolean . valueOf ( isAllowed ) ) ; if ( consumerPoint . destinationMatches ( destinationBeingModified , consumerDispatcher ) ) { consumerPoint . notifyReceiveAllowed ( isAllowed ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "notifyReceiveAllowed" ) ;
public class JwtTokenCipherSigningPublicKeyEndpoint { /** * Fetch public key . * @ param service the service * @ return the string * @ throws Exception the exception */ @ ReadOperation ( produces = MediaType . TEXT_PLAIN_VALUE ) public String fetchPublicKey ( @ Nullable final String service ) throws Exception { } }
val factory = KeyFactory . getInstance ( "RSA" ) ; var signingKey = tokenCipherExecutor . getSigningKey ( ) ; if ( StringUtils . isNotBlank ( service ) ) { val registeredService = this . servicesManager . findServiceBy ( service ) ; RegisteredServiceAccessStrategyUtils . ensureServiceAccessIsAllowed ( registeredService ) ; val serviceCipher = new RegisteredServiceJwtTicketCipherExecutor ( ) ; if ( serviceCipher . supports ( registeredService ) ) { val cipher = serviceCipher . getTokenTicketCipherExecutorForService ( registeredService ) ; if ( cipher . isEnabled ( ) ) { signingKey = cipher . getSigningKey ( ) ; } } } if ( signingKey instanceof RSAPrivateCrtKey ) { val rsaSigningKey = ( RSAPrivateCrtKey ) signingKey ; val publicKey = factory . generatePublic ( new RSAPublicKeySpec ( rsaSigningKey . getModulus ( ) , rsaSigningKey . getPublicExponent ( ) ) ) ; return EncodingUtils . encodeBase64 ( publicKey . getEncoded ( ) ) ; } return null ;
public class CodecCollector { /** * Collect intersection prefixes . * @ param fi * the fi * @ return the sets the * @ throws IOException * Signals that an I / O exception has occurred . */ private static Set < String > collectIntersectionPrefixes ( FieldInfo fi ) throws IOException { } }
if ( fi != null ) { Set < String > result = new HashSet < > ( ) ; String intersectingPrefixes = fi . getAttribute ( MtasCodecPostingsFormat . MTAS_FIELDINFO_ATTRIBUTE_PREFIX_INTERSECTION ) ; if ( intersectingPrefixes != null ) { String [ ] prefixes = intersectingPrefixes . split ( Pattern . quote ( MtasToken . DELIMITER ) ) ; for ( int i = 0 ; i < prefixes . length ; i ++ ) { String item = prefixes [ i ] . trim ( ) ; if ( ! item . equals ( "" ) ) { result . add ( item ) ; } } } return result ; } else { return Collections . emptySet ( ) ; }
public class TableForm { /** * Add a File Entry Field . * @ param tag The form name of the element * @ param label The label for the element in the table . */ public Input addFileField ( String tag , String label ) { } }
Input i = new Input ( Input . File , tag ) ; addField ( label , i ) ; return i ;
public class Stripe { /** * Create a { @ link Source } using an { @ link AsyncTask } on the default { @ link Executor } with a * publishable api key that has already been set on this { @ link Stripe } instance . * @ param sourceParams the { @ link SourceParams } to be used * @ param callback a { @ link SourceCallback } to receive a result or an error message */ public void createSource ( @ NonNull SourceParams sourceParams , @ NonNull SourceCallback callback ) { } }
createSource ( sourceParams , callback , null , null ) ;
public class UiLifecycleHelper { /** * Retrieves an instance of AppEventsLogger that can be used for the current Session , if any . Different * instances may be returned if the current Session changes , so this value should not be cached for long * periods of time - - always call getAppEventsLogger to get the right logger for the current Session . If * no Session is currently available , this method will return null . * To ensure delivery of app events across Activity lifecycle events , calling Activities should be sure to * call the onStop method . * @ return an AppEventsLogger to use for logging app events */ public AppEventsLogger getAppEventsLogger ( ) { } }
Session session = Session . getActiveSession ( ) ; if ( session == null ) { return null ; } if ( appEventsLogger == null || ! appEventsLogger . isValidForSession ( session ) ) { if ( appEventsLogger != null ) { // Pretend we got stopped so the old logger will persist its results now , in case we get stopped // before events get flushed . AppEventsLogger . onContextStop ( ) ; } appEventsLogger = AppEventsLogger . newLogger ( activity , session ) ; } return appEventsLogger ;
public class SipApplicationDispatcherImpl { /** * set the outbound interfaces on all servlet context of applications deployed */ private void resetOutboundInterfaces ( ) { } }
List < SipURI > outboundInterfaces = sipNetworkInterfaceManager . getOutboundInterfaces ( ) ; for ( SipContext sipContext : applicationDeployed . values ( ) ) { sipContext . getServletContext ( ) . setAttribute ( javax . servlet . sip . SipServlet . OUTBOUND_INTERFACES , outboundInterfaces ) ; }
public class ElementService { /** * The referenced view should not show the element identified by elementName * @ param viewName * @ param elementName * @ throws IllegalAccessException * @ throws InterruptedException */ public void viewShouldNotShowElement ( String viewName , String elementName ) throws IllegalAccessException , InterruptedException { } }
boolean pass = false ; long startOfLookup = System . currentTimeMillis ( ) ; int timeoutInMillies = getSeleniumManager ( ) . getTimeout ( ) * 1000 ; while ( ! pass ) { WebElement found = getElementFromReferencedView ( viewName , elementName ) ; try { pass = ! found . isDisplayed ( ) ; } catch ( NoSuchElementException e ) { pass = true ; } if ( ! pass ) { Thread . sleep ( 100 ) ; } if ( System . currentTimeMillis ( ) - startOfLookup > timeoutInMillies ) { String foundLocator = getElementLocatorFromReferencedView ( viewName , elementName ) ; fail ( "The element \"" + foundLocator + "\" referenced by \"" + elementName + "\" on view/page \"" + viewName + "\" is still found where it is not expected after " + getSeleniumManager ( ) . getTimeout ( ) + " seconds." ) ; break ; } }
public class DeltaFIFO { /** * List keys list . * @ return the list */ @ Override public List < String > listKeys ( ) { } }
lock . readLock ( ) . lock ( ) ; try { List < String > keyList = new ArrayList < > ( items . size ( ) ) ; for ( Map . Entry < String , Deque < MutablePair < DeltaType , Object > > > entry : items . entrySet ( ) ) { keyList . add ( entry . getKey ( ) ) ; } return keyList ; } finally { lock . readLock ( ) . unlock ( ) ; }
public class Endpoint { /** * Convenience factory method for Endpoint , returns a created Endpoint object from a name * @ param domainId the domain id . * @ param name the endpoint name . * @ param password the endpoint password * @ param enabled indicates if the endpoint is active or not * @ return the created endpoint . * @ throws AppPlatformException API Exception * @ throws ParseException Error parsing data * @ throws Exception error */ public static Endpoint create ( final String domainId , final String name , final String password , final boolean enabled ) throws AppPlatformException , ParseException , Exception { } }
return create ( domainId , name , password , null , enabled ) ;
public class GregorianTimezoneRule { /** * / * [ deutsch ] * < p > Konstruiert ein Muster f & uuml ; r einen festen Tag im angegebenen * Monat . < / p > * @ param month calendar month * @ param dayOfMonth day of month ( 1 - 31) * @ param timeOfDay clock time when time switch happens * @ param indicator offset indicator * @ param savings fixed DST - offset in seconds * @ return new daylight saving rule * @ throws IllegalArgumentException if the last argument is out of range or * if the day of month is not valid in context of given month * @ since 2.2 */ public static GregorianTimezoneRule ofFixedDay ( Month month , int dayOfMonth , PlainTime timeOfDay , OffsetIndicator indicator , int savings ) { } }
return ofFixedDay ( month , dayOfMonth , timeOfDay . getInt ( PlainTime . SECOND_OF_DAY ) , indicator , savings ) ;
public class AddHeadersProcessor { /** * Create a MfClientHttpRequestFactory for adding the specified headers . * @ param requestFactory the basic request factory . It should be unmodified and just wrapped with * a proxy class . * @ param matchers The matchers . * @ param headers The headers . * @ return */ public static MfClientHttpRequestFactory createFactoryWrapper ( final MfClientHttpRequestFactory requestFactory , final UriMatchers matchers , final Map < String , List < String > > headers ) { } }
return new AbstractMfClientHttpRequestFactoryWrapper ( requestFactory , matchers , false ) { @ Override protected ClientHttpRequest createRequest ( final URI uri , final HttpMethod httpMethod , final MfClientHttpRequestFactory requestFactory ) throws IOException { final ClientHttpRequest request = requestFactory . createRequest ( uri , httpMethod ) ; request . getHeaders ( ) . putAll ( headers ) ; return request ; } } ;
public class ProtocolConnectionUtils { /** * Connect . * @ param configuration the connection configuration * @ return the future connection * @ throws IOException */ public static IoFuture < Connection > connect ( final ProtocolConnectionConfiguration configuration ) throws IOException { } }
return connect ( configuration . getCallbackHandler ( ) , configuration ) ;
public class Elements { /** * Returns an iterator over the children of the given parent node . The iterator supports the { @ link * Iterator # remove ( ) } operation which removes the current node from its parent . */ public static Iterator < Node > iterator ( Node parent ) { } }
return parent != null ? new JsArrayNodeIterator ( parent ) : emptyIterator ( ) ;
public class BaseMessagingEngineImpl { /** * ( non - Javadoc ) * @ see com . ibm . ws . sib . admin . JsMessagingEngine # getMQLinkEngineComponent ( java . lang . String ) */ public JsEngineComponent getMQLinkEngineComponent ( String name ) { } }
String thisMethodName = "getMQLinkEngineComponent" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , name ) ; } // MQ link no longer an engine component JsEngineComponent rc = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName , rc ) ; } return rc ;
public class AWSDynamoDAO { @ Override public < P extends ParaObject > String create ( String appid , P so ) { } }
if ( so == null ) { return null ; } if ( StringUtils . isBlank ( so . getId ( ) ) ) { so . setId ( Utils . getNewId ( ) ) ; } if ( so . getTimestamp ( ) == null ) { so . setTimestamp ( Utils . timestamp ( ) ) ; } so . setAppid ( appid ) ; createRow ( so . getId ( ) , appid , toRow ( so , null ) ) ; logger . debug ( "DAO.create() {}->{}" , appid , so . getId ( ) ) ; return so . getId ( ) ;
public class DockerExecuteAction { /** * Validate command results . * @ param command * @ param context */ private void validateCommandResult ( DockerCommand command , TestContext context ) { } }
if ( log . isDebugEnabled ( ) ) { log . debug ( "Starting Docker command result validation" ) ; } if ( StringUtils . hasText ( expectedCommandResult ) ) { if ( command . getCommandResult ( ) == null ) { throw new ValidationException ( "Missing Docker command result" ) ; } try { String commandResultJson = jsonMapper . writeValueAsString ( command . getCommandResult ( ) ) ; JsonMessageValidationContext validationContext = new JsonMessageValidationContext ( ) ; jsonTextMessageValidator . validateMessage ( new DefaultMessage ( commandResultJson ) , new DefaultMessage ( expectedCommandResult ) , context , validationContext ) ; log . info ( "Docker command result validation successful - all values OK!" ) ; } catch ( JsonProcessingException e ) { throw new CitrusRuntimeException ( e ) ; } } if ( command . getResultCallback ( ) != null ) { command . getResultCallback ( ) . doWithCommandResult ( command . getCommandResult ( ) , context ) ; }
public class ServiceLoaderUtil { /** * Finds the first implementation of the given service type using the given predicate to filter * out found service types and creates its instance . * @ param clazz service type * @ param predicate service type predicate * @ return the first implementation of the given service type */ public static < T > Optional < T > findFirst ( Class < T > clazz , Predicate < ? super T > predicate ) { } }
ServiceLoader < T > load = ServiceLoader . load ( clazz ) ; Stream < T > stream = StreamSupport . stream ( load . spliterator ( ) , false ) ; return stream . filter ( predicate ) . findFirst ( ) ;
public class ListSkillsStoreSkillsByCategoryResult { /** * The skill store skills . * @ param skillsStoreSkills * The skill store skills . */ public void setSkillsStoreSkills ( java . util . Collection < SkillsStoreSkill > skillsStoreSkills ) { } }
if ( skillsStoreSkills == null ) { this . skillsStoreSkills = null ; return ; } this . skillsStoreSkills = new java . util . ArrayList < SkillsStoreSkill > ( skillsStoreSkills ) ;
public class BuffReaderFixedParser { /** * Reads in the next record on the file and return a row * @ param ds * @ return Row */ @ Override public Row buildRow ( final DefaultDataSet ds ) { } }
String line = null ; try { while ( ( line = br . readLine ( ) ) != null ) { lineCount ++ ; // empty line skip past it if ( line . trim ( ) . length ( ) == 0 ) { continue ; } final String mdkey = FixedWidthParserUtils . getCMDKey ( getPzMetaData ( ) , line ) ; final Row row = new Row ( ) ; row . setRowNumber ( lineCount ) ; row . setMdkey ( mdkey . equals ( FPConstants . DETAIL_ID ) ? null : mdkey ) ; final List < ColumnMetaData > cmds = ParserUtils . getColumnMetaData ( mdkey , getPzMetaData ( ) ) ; final int recordLength = ( ( Integer ) recordLengths . get ( mdkey ) ) . intValue ( ) ; if ( line . length ( ) > recordLength ) { // Incorrect record length on line log the error . Line will not // be included in the // dataset if ( isIgnoreExtraColumns ( ) ) { addError ( ds , "TRUNCATED LINE TO CORRECT LENGTH" , lineCount , 1 ) ; // user has chosen to ignore the fact that we have too many bytes in the fixed // width file . Truncate the line to the correct length row . addColumn ( FixedWidthParserUtils . splitFixedText ( cmds , line . substring ( 0 , recordLength ) , isPreserveLeadingWhitespace ( ) , isPreserveTrailingWhitespace ( ) ) ) ; } else { addError ( ds , "LINE TOO LONG. LINE IS " + line . length ( ) + " LONG. SHOULD BE " + recordLength , lineCount , 2 , isStoreRawDataToDataError ( ) ? line : null ) ; continue ; } } else if ( line . length ( ) < recordLength ) { if ( isHandlingShortLines ( ) ) { // log a warning addError ( ds , "PADDED LINE TO CORRECT RECORD LENGTH" , lineCount , 1 ) ; // We can pad this line out row . addColumn ( FixedWidthParserUtils . splitFixedText ( cmds , line + ParserUtils . padding ( recordLength - line . length ( ) , ' ' ) , isPreserveLeadingWhitespace ( ) , isPreserveTrailingWhitespace ( ) ) ) ; } else { addError ( ds , "LINE TOO SHORT. LINE IS " + line . length ( ) + " LONG. SHOULD BE " + recordLength , lineCount , 2 , isStoreRawDataToDataError ( ) ? line : null ) ; continue ; } } else { row . addColumn ( FixedWidthParserUtils . splitFixedText ( cmds , line , isPreserveLeadingWhitespace ( ) , isPreserveTrailingWhitespace ( ) ) ) ; } if ( isFlagEmptyRows ( ) ) { // user has elected to have the parser flag rows that are empty row . setEmpty ( ParserUtils . isListElementsEmpty ( row . getCols ( ) ) ) ; } if ( isStoreRawDataToDataSet ( ) ) { // user told the parser to keep a copy of the raw data in the row // WARNING potential for high memory usage here row . setRawData ( line ) ; } return row ; } } catch ( final IOException e ) { throw new FPException ( "Error Fetching Record From File..." , e ) ; } return null ;
public class DriverLauncher { /** * Kills the running job . */ @ Override public void close ( ) { } }
synchronized ( this ) { LOG . log ( Level . FINER , "Close launcher: job {0} with status {1}" , new Object [ ] { this . theJob , this . status } ) ; if ( this . status . isRunning ( ) ) { this . status = LauncherStatus . FORCE_CLOSED ; } if ( null != this . theJob ) { this . theJob . close ( ) ; } this . notify ( ) ; } LOG . log ( Level . FINEST , "Close launcher: shutdown REEF" ) ; this . reef . close ( ) ; LOG . log ( Level . FINEST , "Close launcher: done" ) ;
public class AbstractUndoableCommand { /** * Stores cursor coordinates . */ @ Override public final void execute ( ) { } }
beforeLine = editor . getLine ( ) ; beforeColumn = editor . getColumn ( ) ; doExecute ( ) ; afterLine = editor . getLine ( ) ; afterColumn = editor . getColumn ( ) ;
public class DecimalFormat { /** * Does the real work of applying a pattern . */ private void applyPattern ( String pattern , boolean localized ) { } }
char zeroDigit = PATTERN_ZERO_DIGIT ; char groupingSeparator = PATTERN_GROUPING_SEPARATOR ; char decimalSeparator = PATTERN_DECIMAL_SEPARATOR ; char percent = PATTERN_PERCENT ; char perMill = PATTERN_PER_MILLE ; char digit = PATTERN_DIGIT ; char separator = PATTERN_SEPARATOR ; String exponent = PATTERN_EXPONENT ; char minus = PATTERN_MINUS ; if ( localized ) { zeroDigit = symbols . getZeroDigit ( ) ; groupingSeparator = symbols . getGroupingSeparator ( ) ; decimalSeparator = symbols . getDecimalSeparator ( ) ; percent = symbols . getPercent ( ) ; perMill = symbols . getPerMill ( ) ; digit = symbols . getDigit ( ) ; separator = symbols . getPatternSeparator ( ) ; exponent = symbols . getExponentSeparator ( ) ; minus = symbols . getMinusSign ( ) ; } boolean gotNegative = false ; decimalSeparatorAlwaysShown = false ; isCurrencyFormat = false ; useExponentialNotation = false ; // Two variables are used to record the subrange of the pattern // occupied by phase 1 . This is used during the processing of the // second pattern ( the one representing negative numbers ) to ensure // that no deviation exists in phase 1 between the two patterns . int phaseOneStart = 0 ; int phaseOneLength = 0 ; int start = 0 ; for ( int j = 1 ; j >= 0 && start < pattern . length ( ) ; -- j ) { boolean inQuote = false ; StringBuffer prefix = new StringBuffer ( ) ; StringBuffer suffix = new StringBuffer ( ) ; int decimalPos = - 1 ; int multiplier = 1 ; int digitLeftCount = 0 , zeroDigitCount = 0 , digitRightCount = 0 ; byte groupingCount = - 1 ; byte secondaryGroupingCount = - 1 ; // The phase ranges from 0 to 2 . Phase 0 is the prefix . Phase 1 is // the section of the pattern with digits , decimal separator , // grouping characters . Phase 2 is the suffix . In phases 0 and 2, // percent , per mille , and currency symbols are recognized and // translated . The separation of the characters into phases is // strictly enforced ; if phase 1 characters are to appear in the // suffix , for example , they must be quoted . int phase = 0 ; // The affix is either the prefix or the suffix . StringBuffer affix = prefix ; for ( int pos = start ; pos < pattern . length ( ) ; ++ pos ) { char ch = pattern . charAt ( pos ) ; switch ( phase ) { case 0 : case 2 : // Process the prefix / suffix characters if ( inQuote ) { // A quote within quotes indicates either the closing // quote or two quotes , which is a quote literal . That // is , we have the second quote in ' do ' or ' don ' ' t ' . if ( ch == QUOTE ) { if ( ( pos + 1 ) < pattern . length ( ) && pattern . charAt ( pos + 1 ) == QUOTE ) { ++ pos ; affix . append ( "''" ) ; // ' don ' ' t ' } else { inQuote = false ; // ' do ' } continue ; } } else { // Process unquoted characters seen in prefix or suffix // phase . if ( ch == digit || ch == zeroDigit || ch == groupingSeparator || ch == decimalSeparator ) { phase = 1 ; if ( j == 1 ) { phaseOneStart = pos ; } -- pos ; // Reprocess this character continue ; } else if ( ch == CURRENCY_SIGN ) { // Use lookahead to determine if the currency sign // is doubled or not . boolean doubled = ( pos + 1 ) < pattern . length ( ) && pattern . charAt ( pos + 1 ) == CURRENCY_SIGN ; if ( doubled ) { // Skip over the doubled character ++ pos ; } isCurrencyFormat = true ; affix . append ( doubled ? "'\u00A4\u00A4" : "'\u00A4" ) ; continue ; } else if ( ch == QUOTE ) { // A quote outside quotes indicates either the // opening quote or two quotes , which is a quote // literal . That is , we have the first quote in ' do ' // or o ' ' clock . if ( ch == QUOTE ) { if ( ( pos + 1 ) < pattern . length ( ) && pattern . charAt ( pos + 1 ) == QUOTE ) { ++ pos ; affix . append ( "''" ) ; // o ' ' clock } else { inQuote = true ; // ' do ' } continue ; } } else if ( ch == separator ) { // Don ' t allow separators before we see digit // characters of phase 1 , and don ' t allow separators // in the second pattern ( j = = 0 ) . if ( phase == 0 || j == 0 ) { throw new IllegalArgumentException ( "Unquoted special character '" + ch + "' in pattern \"" + pattern + '"' ) ; } start = pos + 1 ; pos = pattern . length ( ) ; continue ; } // Next handle characters which are appended directly . else if ( ch == percent ) { if ( multiplier != 1 ) { throw new IllegalArgumentException ( "Too many percent/per mille characters in pattern \"" + pattern + '"' ) ; } multiplier = 100 ; affix . append ( "'%" ) ; continue ; } else if ( ch == perMill ) { if ( multiplier != 1 ) { throw new IllegalArgumentException ( "Too many percent/per mille characters in pattern \"" + pattern + '"' ) ; } multiplier = 1000 ; affix . append ( "'\u2030" ) ; continue ; } else if ( ch == minus ) { affix . append ( "'-" ) ; continue ; } } // Note that if we are within quotes , or if this is an // unquoted , non - special character , then we usually fall // through to here . affix . append ( ch ) ; break ; case 1 : // Phase one must be identical in the two sub - patterns . We // enforce this by doing a direct comparison . While // processing the first sub - pattern , we just record its // length . While processing the second , we compare // characters . if ( j == 1 ) { ++ phaseOneLength ; } else { if ( -- phaseOneLength == 0 ) { phase = 2 ; affix = suffix ; } continue ; } // Process the digits , decimal , and grouping characters . We // record five pieces of information . We expect the digits // to occur in the pattern # # # # 0000 . # # # # , and we record the // number of left digits , zero ( central ) digits , and right // digits . The position of the last grouping character is // recorded ( should be somewhere within the first two blocks // of characters ) , as is the position of the decimal point , // if any ( should be in the zero digits ) . If there is no // decimal point , then there should be no right digits . if ( ch == digit ) { if ( zeroDigitCount > 0 ) { ++ digitRightCount ; } else { ++ digitLeftCount ; } if ( groupingCount >= 0 && decimalPos < 0 ) { ++ groupingCount ; } } else if ( ch == zeroDigit ) { if ( digitRightCount > 0 ) { throw new IllegalArgumentException ( "Unexpected '0' in pattern \"" + pattern + '"' ) ; } ++ zeroDigitCount ; if ( groupingCount >= 0 && decimalPos < 0 ) { ++ groupingCount ; } } else if ( ch == groupingSeparator ) { if ( groupingCount > 0 ) { secondaryGroupingCount = groupingCount ; } groupingCount = 0 ; } else if ( ch == decimalSeparator ) { if ( decimalPos >= 0 ) { throw new IllegalArgumentException ( "Multiple decimal separators in pattern \"" + pattern + '"' ) ; } decimalPos = digitLeftCount + zeroDigitCount + digitRightCount ; } else if ( pattern . regionMatches ( pos , exponent , 0 , exponent . length ( ) ) ) { if ( useExponentialNotation ) { throw new IllegalArgumentException ( "Multiple exponential " + "symbols in pattern \"" + pattern + '"' ) ; } useExponentialNotation = true ; minExponentDigits = 0 ; // Use lookahead to parse out the exponential part // of the pattern , then jump into phase 2. pos = pos + exponent . length ( ) ; while ( pos < pattern . length ( ) && pattern . charAt ( pos ) == zeroDigit ) { ++ minExponentDigits ; ++ phaseOneLength ; ++ pos ; } if ( ( digitLeftCount + zeroDigitCount ) < 1 || minExponentDigits < 1 ) { throw new IllegalArgumentException ( "Malformed exponential " + "pattern \"" + pattern + '"' ) ; } // Transition to phase 2 phase = 2 ; affix = suffix ; -- pos ; continue ; } else { phase = 2 ; affix = suffix ; -- pos ; -- phaseOneLength ; continue ; } break ; } } // Handle patterns with no ' 0 ' pattern character . These patterns // are legal , but must be interpreted . " # # . # # # " - > " # 0 . # # # " . /* We allow patterns of the form " # # # # " to produce a zeroDigitCount * of zero ( got that ? ) ; although this seems like it might make it * possible for format ( ) to produce empty strings , format ( ) checks * for this condition and outputs a zero digit in this situation . * Having a zeroDigitCount of zero yields a minimum integer digits * of zero , which allows proper round - trip patterns . That is , we * don ' t want " # " to become " # 0 " when toPattern ( ) is called ( even * though that ' s what it really is , semantically ) . */ if ( zeroDigitCount == 0 && digitLeftCount > 0 && decimalPos >= 0 ) { // Handle " # # # . # # # " and " # # # . " and " . # # # " int n = decimalPos ; if ( n == 0 ) { // Handle " . # # # " ++ n ; } digitRightCount = digitLeftCount - n ; digitLeftCount = n - 1 ; zeroDigitCount = 1 ; } // Do syntax checking on the digits . if ( ( decimalPos < 0 && digitRightCount > 0 ) || ( decimalPos >= 0 && ( decimalPos < digitLeftCount || decimalPos > ( digitLeftCount + zeroDigitCount ) ) ) || groupingCount == 0 || secondaryGroupingCount == 0 || inQuote ) { throw new IllegalArgumentException ( "Malformed pattern \"" + pattern + '"' ) ; } if ( j == 1 ) { posPrefixPattern = prefix . toString ( ) ; posSuffixPattern = suffix . toString ( ) ; negPrefixPattern = posPrefixPattern ; // assume these for now negSuffixPattern = posSuffixPattern ; int digitTotalCount = digitLeftCount + zeroDigitCount + digitRightCount ; /* The effectiveDecimalPos is the position the decimal is at or * would be at if there is no decimal . Note that if decimalPos < 0, * then digitTotalCount = = digitLeftCount + zeroDigitCount . */ int effectiveDecimalPos = decimalPos >= 0 ? decimalPos : digitTotalCount ; setMinimumIntegerDigits ( effectiveDecimalPos - digitLeftCount ) ; setMaximumIntegerDigits ( useExponentialNotation ? digitLeftCount + getMinimumIntegerDigits ( ) : MAXIMUM_INTEGER_DIGITS ) ; setMaximumFractionDigits ( decimalPos >= 0 ? ( digitTotalCount - decimalPos ) : 0 ) ; setMinimumFractionDigits ( decimalPos >= 0 ? ( digitLeftCount + zeroDigitCount - decimalPos ) : 0 ) ; setGroupingUsed ( groupingCount > 0 ) ; this . groupingSize = ( groupingCount > 0 ) ? groupingCount : 0 ; this . secondaryGroupingSize = ( secondaryGroupingCount > 0 && secondaryGroupingCount != groupingCount ) ? secondaryGroupingCount : 0 ; this . multiplier = multiplier ; setDecimalSeparatorAlwaysShown ( decimalPos == 0 || decimalPos == digitTotalCount ) ; } else { negPrefixPattern = prefix . toString ( ) ; negSuffixPattern = suffix . toString ( ) ; gotNegative = true ; } } if ( pattern . length ( ) == 0 ) { posPrefixPattern = posSuffixPattern = "" ; setMinimumIntegerDigits ( 0 ) ; setMaximumIntegerDigits ( MAXIMUM_INTEGER_DIGITS ) ; setMinimumFractionDigits ( 0 ) ; setMaximumFractionDigits ( MAXIMUM_FRACTION_DIGITS ) ; } // If there was no negative pattern , or if the negative pattern is // identical to the positive pattern , then prepend the minus sign to // the positive pattern to form the negative pattern . if ( ! gotNegative || ( negPrefixPattern . equals ( posPrefixPattern ) && negSuffixPattern . equals ( posSuffixPattern ) ) ) { negSuffixPattern = posSuffixPattern ; negPrefixPattern = "'-" + posPrefixPattern ; } expandAffixes ( ) ;
public class ParserUtils { /** * Converts a String to the given timezone . * @ param date Date to format * @ param zoneId Zone id to convert from sherdog ' s time * @ return the converted zonedatetime */ static ZonedDateTime getDateFromStringToZoneId ( String date , ZoneId zoneId ) throws DateTimeParseException { } }
ZonedDateTime usDate = ZonedDateTime . parse ( date ) . withZoneSameInstant ( ZoneId . of ( Constants . SHERDOG_TIME_ZONE ) ) ; return usDate . withZoneSameInstant ( zoneId ) ;
public class ReisadviesRequest { /** * { @ inheritDoc } * @ see nl . pvanassen . ns . ApiRequest # getRequestString ( ) */ @ Override String getRequestString ( ) { } }
StringBuilder requestString = new StringBuilder ( ) ; requestString . append ( "fromStation=" ) . append ( fromStation ) . append ( '&' ) ; requestString . append ( "toStation=" ) . append ( toStation ) . append ( '&' ) ; if ( viaStation != null && viaStation . trim ( ) . length ( ) != 0 ) { requestString . append ( "viaStation=" ) . append ( viaStation ) . append ( '&' ) ; } if ( previousAdvices != null ) { requestString . append ( "previousAdvices=" ) . append ( previousAdvices ) . append ( '&' ) ; } if ( nextAdvices != null ) { requestString . append ( "nextAdvices=" ) . append ( nextAdvices ) . append ( '&' ) ; } if ( dateTime != null ) { requestString . append ( "dateTime=" ) . append ( new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ss" ) . format ( dateTime ) ) . append ( '&' ) ; } if ( departure != null ) { requestString . append ( "departure=" ) . append ( departure ) . append ( '&' ) ; } if ( hslAllowed != null ) { requestString . append ( "hslAllowed=" ) . append ( hslAllowed ) . append ( '&' ) ; } if ( yearCard != null ) { requestString . append ( "yearCard=" ) . append ( yearCard ) . append ( '&' ) ; } return requestString . toString ( ) ;
public class ConfigElementList { /** * Returns the first element in this list with a matching identifier * @ param id the identifier to search for * @ return the first element in this list with a matching identifier , or null of no such element is found */ public E getById ( String id ) { } }
if ( id == null ) { for ( E element : this ) { if ( element != null && element . getId ( ) == null ) { return element ; } } } else { for ( E element : this ) { if ( element != null && id . equals ( element . getId ( ) ) ) { return element ; } } } return null ;
public class ExtraFieldUtils { /** * Split the array into ExtraFields and populate them with the * given data as local file data , throwing an exception if the * data cannot be parsed . * @ param data an array of bytes as it appears in local file data * @ return an array of ExtraFields * @ throws ZipException on error */ public static List < ZipExtraField > parse ( byte [ ] data ) throws ZipException { } }
List < ZipExtraField > v = new ArrayList < ZipExtraField > ( ) ; if ( data == null ) { return v ; } int start = 0 ; while ( start <= data . length - WORD ) { ZipShort headerId = new ZipShort ( data , start ) ; int length = ( new ZipShort ( data , start + 2 ) ) . getValue ( ) ; if ( start + WORD + length > data . length ) { throw new ZipException ( "bad extra field starting at " + start + ". Block length of " + length + " bytes exceeds remaining" + " data of " + ( data . length - start - WORD ) + " bytes." ) ; } try { ZipExtraField ze = createExtraField ( headerId ) ; ze . parseFromLocalFileData ( data , start + WORD , length ) ; v . add ( ze ) ; } catch ( InstantiationException ie ) { throw new ZipException ( ie . getMessage ( ) ) ; } catch ( IllegalAccessException iae ) { throw new ZipException ( iae . getMessage ( ) ) ; } start += ( length + WORD ) ; } return v ;
public class Instant { /** * Adjusts the specified temporal object to have this instant . * This returns a temporal object of the same observable type as the input * with the instant changed to be the same as this . * The adjustment is equivalent to using { @ link Temporal # with ( TemporalField , long ) } * twice , passing { @ link ChronoField # INSTANT _ SECONDS } and * { @ link ChronoField # NANO _ OF _ SECOND } as the fields . * In most cases , it is clearer to reverse the calling pattern by using * { @ link Temporal # with ( TemporalAdjuster ) } : * < pre > * / / these two lines are equivalent , but the second approach is recommended * temporal = thisInstant . adjustInto ( temporal ) ; * temporal = temporal . with ( thisInstant ) ; * < / pre > * This instance is immutable and unaffected by this method call . * @ param temporal the target object to be adjusted , not null * @ return the adjusted object , not null * @ throws DateTimeException if unable to make the adjustment * @ throws ArithmeticException if numeric overflow occurs */ @ Override public Temporal adjustInto ( Temporal temporal ) { } }
return temporal . with ( INSTANT_SECONDS , seconds ) . with ( NANO_OF_SECOND , nanos ) ;
public class LogGroupFieldMarshaller { /** * Marshall the given parameter object . */ public void marshall ( LogGroupField logGroupField , ProtocolMarshaller protocolMarshaller ) { } }
if ( logGroupField == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( logGroupField . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( logGroupField . getPercent ( ) , PERCENT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AWSDeviceFarmClient { /** * Specifies and starts a remote access session . * @ param createRemoteAccessSessionRequest * Creates and submits a request to start a remote access session . * @ return Result of the CreateRemoteAccessSession operation returned by the service . * @ throws ArgumentException * An invalid argument was specified . * @ throws NotFoundException * The specified entity was not found . * @ throws LimitExceededException * A limit was exceeded . * @ throws ServiceAccountException * There was a problem with the service account . * @ sample AWSDeviceFarm . CreateRemoteAccessSession * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / devicefarm - 2015-06-23 / CreateRemoteAccessSession " * target = " _ top " > AWS API Documentation < / a > */ @ Override public CreateRemoteAccessSessionResult createRemoteAccessSession ( CreateRemoteAccessSessionRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeCreateRemoteAccessSession ( request ) ;
public class RequestParam { /** * Returns a request parameter as boolean . * @ param request Request . * @ param param Parameter name . * @ return Parameter value or < code > false < / code > if it does not exist or cannot be interpreted as boolean . */ public static boolean getBoolean ( @ NotNull ServletRequest request , @ NotNull String param ) { } }
return getBoolean ( request , param , false ) ;
public class MOEADSTM { /** * Calculate the perpendicular distance between the solution and reference line */ public double calculateDistance ( DoubleSolution individual , double [ ] lambda ) { } }
double scale ; double distance ; double [ ] vecInd = new double [ problem . getNumberOfObjectives ( ) ] ; double [ ] vecProj = new double [ problem . getNumberOfObjectives ( ) ] ; // vecInd has been normalized to the range [ 0,1] for ( int i = 0 ; i < problem . getNumberOfObjectives ( ) ; i ++ ) { vecInd [ i ] = ( individual . getObjective ( i ) - idealPoint . getValue ( i ) ) / ( nadirPoint . getValue ( i ) - idealPoint . getValue ( i ) ) ; } scale = innerproduct ( vecInd , lambda ) / innerproduct ( lambda , lambda ) ; for ( int i = 0 ; i < problem . getNumberOfObjectives ( ) ; i ++ ) { vecProj [ i ] = vecInd [ i ] - scale * lambda [ i ] ; } distance = norm_vector ( vecProj ) ; return distance ;
public class ClientService { /** * Set a friendly name for a client * @ param profileId profileId of the client * @ param clientUUID UUID of the client * @ param friendlyName friendly name of the client * @ return return Client object or null * @ throws Exception exception */ public Client setFriendlyName ( int profileId , String clientUUID , String friendlyName ) throws Exception { } }
// first see if this friendlyName is already in use Client client = this . findClientFromFriendlyName ( profileId , friendlyName ) ; if ( client != null && ! client . getUUID ( ) . equals ( clientUUID ) ) { throw new Exception ( "Friendly name already in use" ) ; } PreparedStatement statement = null ; int rowsAffected = 0 ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_CLIENT + " SET " + Constants . CLIENT_FRIENDLY_NAME + " = ?" + " WHERE " + Constants . CLIENT_CLIENT_UUID + " = ?" + " AND " + Constants . GENERIC_PROFILE_ID + " = ?" ) ; statement . setString ( 1 , friendlyName ) ; statement . setString ( 2 , clientUUID ) ; statement . setInt ( 3 , profileId ) ; rowsAffected = statement . executeUpdate ( ) ; } catch ( Exception e ) { } finally { try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } if ( rowsAffected == 0 ) { return null ; } return this . findClient ( clientUUID , profileId ) ;
public class Bean { /** * Report a { @ code boolean } bound indexed property update to any registered listeners . < p > * No event is fired if old and new values are equal and non - null . < p > * This is merely a convenience wrapper around the more general fireIndexedPropertyChange method * which takes Object values . * @ param propertyName The programmatic name of the property that was changed . * @ param index index of the property element that was changed . * @ param oldValue The old value of the property . * @ param newValue The new value of the property . * @ since 2.0 */ protected final void fireIndexedPropertyChange ( String propertyName , int index , boolean oldValue , boolean newValue ) { } }
if ( oldValue == newValue ) { return ; } fireIndexedPropertyChange ( propertyName , index , Boolean . valueOf ( oldValue ) , Boolean . valueOf ( newValue ) ) ;
public class ObjectInputStream { /** * Read a new array from the receiver . It is assumed the array has not been * read yet ( not a cyclic reference ) . Return the array read . * @ param unshared * read the object unshared * @ return the array read * @ throws IOException * If an IO exception happened when reading the array . * @ throws ClassNotFoundException * If a class for one of the objects could not be found * @ throws OptionalDataException * If optional data could not be found when reading the array . */ private Object readNewArray ( boolean unshared ) throws OptionalDataException , ClassNotFoundException , IOException { } }
ObjectStreamClass classDesc = readClassDesc ( ) ; if ( classDesc == null ) { throw missingClassDescriptor ( ) ; } int newHandle = nextHandle ( ) ; // Array size int size = input . readInt ( ) ; Class < ? > arrayClass = classDesc . forClass ( ) ; Class < ? > componentType = arrayClass . getComponentType ( ) ; Object result = Array . newInstance ( componentType , size ) ; registerObjectRead ( result , newHandle , unshared ) ; // Now we have code duplication just because Java is typed . We have to // read N elements and assign to array positions , but we must typecast // the array first , and also call different methods depending on the // elements . if ( componentType . isPrimitive ( ) ) { if ( componentType == int . class ) { int [ ] intArray = ( int [ ] ) result ; for ( int i = 0 ; i < size ; i ++ ) { intArray [ i ] = input . readInt ( ) ; } } else if ( componentType == byte . class ) { byte [ ] byteArray = ( byte [ ] ) result ; input . readFully ( byteArray , 0 , size ) ; } else if ( componentType == char . class ) { char [ ] charArray = ( char [ ] ) result ; for ( int i = 0 ; i < size ; i ++ ) { charArray [ i ] = input . readChar ( ) ; } } else if ( componentType == short . class ) { short [ ] shortArray = ( short [ ] ) result ; for ( int i = 0 ; i < size ; i ++ ) { shortArray [ i ] = input . readShort ( ) ; } } else if ( componentType == boolean . class ) { boolean [ ] booleanArray = ( boolean [ ] ) result ; for ( int i = 0 ; i < size ; i ++ ) { booleanArray [ i ] = input . readBoolean ( ) ; } } else if ( componentType == long . class ) { long [ ] longArray = ( long [ ] ) result ; for ( int i = 0 ; i < size ; i ++ ) { longArray [ i ] = input . readLong ( ) ; } } else if ( componentType == float . class ) { float [ ] floatArray = ( float [ ] ) result ; for ( int i = 0 ; i < size ; i ++ ) { floatArray [ i ] = input . readFloat ( ) ; } } else if ( componentType == double . class ) { double [ ] doubleArray = ( double [ ] ) result ; for ( int i = 0 ; i < size ; i ++ ) { doubleArray [ i ] = input . readDouble ( ) ; } } else { throw new ClassNotFoundException ( "Wrong base type in " + classDesc . getName ( ) ) ; } } else { // Array of Objects Object [ ] objectArray = ( Object [ ] ) result ; for ( int i = 0 ; i < size ; i ++ ) { // TODO : This place is the opportunity for enhancement // We can implement writing elements through fast - path , // without setting up the context ( see readObject ( ) ) for // each element with public API objectArray [ i ] = readObject ( ) ; } } if ( enableResolve ) { result = resolveObject ( result ) ; registerObjectRead ( result , newHandle , false ) ; } return result ;
public class Artifact { /** * More lax version of { @ link # equals ( Object ) } that matches SNAPSHOTs with their corresponding timestamped versions . * @ param artifact the artifact to compare with . * @ return < code > true < / code > if this artifact is the same as the specified artifact ( where timestamps are ignored * for SNAPSHOT versions ) . * @ since 1.0 */ public boolean equalSnapshots ( Artifact artifact ) { } }
if ( this == artifact ) { return true ; } if ( ! groupId . equals ( artifact . groupId ) ) { return false ; } if ( ! artifactId . equals ( artifact . artifactId ) ) { return false ; } if ( ! version . equals ( artifact . version ) ) { return false ; } if ( ! type . equals ( artifact . type ) ) { return false ; } if ( classifier != null ? ! classifier . equals ( artifact . classifier ) : artifact . classifier != null ) { return false ; } return true ;
public class ReflectionUtil { /** * Extract the full template type information from the given type ' s template parameter at the * given position . * @ param type type to extract the full template parameter information from * @ param templatePosition describing at which position the template type parameter is * @ return Full type information describing the template parameter ' s type */ public static FullTypeInfo getFullTemplateType ( Type type , int templatePosition ) { } }
if ( type instanceof ParameterizedType ) { return getFullTemplateType ( ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) [ templatePosition ] ) ; } else { throw new IllegalArgumentException ( ) ; }
public class Transition { /** * Sets the algorithm used to calculate two - dimensional interpolation . * Transitions such as { @ link ChangeBounds } move Views , typically * in a straight path between the start and end positions . Applications that desire to * have these motions move in a curve can change how Views interpolate in two dimensions * by extending PathMotion and implementing * { @ link PathMotion # getPath ( float , float , float , float ) } . * When describing in XML , use a nested XML tag for the path motion . It can be one of * the built - in tags < code > arcMotion < / code > or < code > patternPathMotion < / code > or it can * be a custom PathMotion using < code > pathMotion < / code > with the < code > class < / code > * attributed with the fully - described class name . For example : < / p > * < pre > * { @ code * & lt ; changeBounds > * & lt ; pathMotion class = " my . app . transition . MyPathMotion " / > * & lt ; / changeBounds > * < / pre > * < p > or < / p > * < pre > * { @ code * & lt ; changeBounds > * & lt ; arcMotion android : minimumHorizontalAngle = " 15" * android : minimumVerticalAngle = " 0 " android : maximumAngle = " 90 " / > * & lt ; / changeBounds > * < / pre > * @ param pathMotion Algorithm object to use for determining how to interpolate in two * dimensions . If null , a straight - path algorithm will be used . * @ return This transition object . * @ see ArcMotion * @ see PatternPathMotion * @ see PathMotion */ @ NonNull public Transition setPathMotion ( @ Nullable PathMotion pathMotion ) { } }
if ( pathMotion == null ) { mPathMotion = PathMotion . STRAIGHT_PATH_MOTION ; } else { mPathMotion = pathMotion ; } return this ;
public class Conversion { /** * Converts UUID into an array of byte using the default ( little endian , Lsb0 ) byte and bit * ordering . * @ param src the UUID to convert * @ param dst the destination array * @ param dstPos the position in { @ code dst } where to copy the result * @ param nBytes the number of bytes to copy to { @ code dst } , must be smaller or equal to the * width of the input ( from srcPos to msb ) * @ return { @ code dst } * @ throws NullPointerException if { @ code dst } is { @ code null } * @ throws IllegalArgumentException if { @ code nBytes > 16} * @ throws ArrayIndexOutOfBoundsException if { @ code dstPos + nBytes > dst . length } */ @ GwtIncompatible ( "incompatible method" ) public static byte [ ] uuidToByteArray ( final UUID src , final byte [ ] dst , final int dstPos , final int nBytes ) { } }
if ( 0 == nBytes ) { return dst ; } if ( nBytes > 16 ) { throw new IllegalArgumentException ( "nBytes is greater than 16" ) ; } longToByteArray ( src . getMostSignificantBits ( ) , 0 , dst , dstPos , nBytes > 8 ? 8 : nBytes ) ; if ( nBytes >= 8 ) { longToByteArray ( src . getLeastSignificantBits ( ) , 0 , dst , dstPos + 8 , nBytes - 8 ) ; } return dst ;
public class JdbcWriter { /** * Extracts the URL to database or data source from configuration . * @ param properties * Configuration for writer * @ return Connection URL * @ throws IllegalArgumentException * URL is not defined in configuration */ private static String getUrl ( final Map < String , String > properties ) { } }
String url = properties . get ( "url" ) ; if ( url == null ) { throw new IllegalArgumentException ( "URL is missing for JDBC writer" ) ; } else { return url ; }
public class SystemUtil { /** * Load system properties from a given filename or url . * File is first searched for in resources using the system { @ link ClassLoader } , * then file system , then URL . All are loaded if multiples found . * @ param filenameOrUrl that holds properties */ public static void loadPropertiesFile ( final String filenameOrUrl ) { } }
final Properties properties = new Properties ( System . getProperties ( ) ) ; System . getProperties ( ) . forEach ( properties :: put ) ; final URL resource = ClassLoader . getSystemClassLoader ( ) . getResource ( filenameOrUrl ) ; if ( null != resource ) { try ( InputStream in = resource . openStream ( ) ) { properties . load ( in ) ; } catch ( final Exception ignore ) { } } final File file = new File ( filenameOrUrl ) ; if ( file . exists ( ) ) { try ( FileInputStream in = new FileInputStream ( file ) ) { properties . load ( in ) ; } catch ( final Exception ignore ) { } } try ( InputStream in = new URL ( filenameOrUrl ) . openStream ( ) ) { properties . load ( in ) ; } catch ( final Exception ignore ) { } System . setProperties ( properties ) ;
public class Pack { /** * Pack the images provided * @ param files The list of file objects pointing at the images to be packed * @ param width The width of the sheet to be generated * @ param height The height of the sheet to be generated * @ param border The border between sprites * @ param out The file to write out to * @ return The generated sprite sheet * @ throws IOException Indicates a failure to write out files */ public Sheet pack ( ArrayList files , int width , int height , int border , File out ) throws IOException { } }
ArrayList images = new ArrayList ( ) ; try { for ( int i = 0 ; i < files . size ( ) ; i ++ ) { File file = ( File ) files . get ( i ) ; Sprite sprite = new Sprite ( file . getName ( ) , ImageIO . read ( file ) ) ; images . add ( sprite ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } return packImages ( images , width , height , border , out ) ;
public class HtmlInjectorServletResponseWrapper { /** * { @ inheritDoc } */ @ Override public ServletOutputStream createOutputStream ( ) throws IOException { } }
if ( ! isContentTypeHtml ( ) ) { return getHttpServletResponse ( ) . getOutputStream ( ) ; } return new HtmlInjectorResponseStream ( getHttpServletResponse ( ) , htmlToInject ) ;
public class Configuration { /** * @ return current environment as specified by environment variable < code > ACTIVE _ ENV < / code > * of < code > active _ env < / code > system property . System property value overrides environment variable . * Defaults to " development " if no environment variable provided . */ public String getEnvironment ( ) { } }
String env = "development" ; if ( ! blank ( System . getenv ( "ACTIVE_ENV" ) ) ) { env = System . getenv ( "ACTIVE_ENV" ) ; } if ( ! blank ( System . getProperty ( "active_env" ) ) ) { env = System . getProperty ( "active_env" ) ; } return env ;
public class PaxParser { /** * { @ inheritDoc } * @ throws PrivilegedActionException * @ throws IOException * @ throws ProductInfoParseException */ @ Override protected AssetInformation extractInformationFromAsset ( File archive , final ArtifactMetadata metadata ) throws PrivilegedActionException , ProductInfoParseException , IOException { } }
// Create the asset information AssetInformation assetInformtion = new AssetInformation ( ) ; ZipFile zipFile = null ; try { zipFile = AccessController . doPrivileged ( new PrivilegedExceptionAction < ZipFile > ( ) { @ Override public ZipFile run ( ) throws IOException { return new ZipFile ( metadata . getArchive ( ) ) ; } } ) ; assetInformtion . addProductInfos ( zipFile , "wlp/" , archive ) ; assetInformtion . type = ResourceType . INSTALL ; assetInformtion . provideFeature = metadata . getProperty ( "provideFeature" ) ; assetInformtion . laLocation = "wlp/lafiles_text/LA" ; assetInformtion . liLocation = "wlp/lafiles_text/LI" ; assetInformtion . fileWithLicensesIn = metadata . getArchive ( ) ; } finally { if ( zipFile != null ) { zipFile . close ( ) ; } } return assetInformtion ;
public class Configuration { /** * Get the comma delimited values of the < code > name < / code > property as * a collection of < code > String < / code > s , trimmed of the leading and trailing whitespace . * If no such property is specified then empty < code > Collection < / code > is returned . * @ param name property name . * @ return property value as a collection of < code > String < / code > s , or empty < code > Collection < / code > */ public Collection < String > getTrimmedStringCollection ( String name ) { } }
String valueString = get ( name ) ; if ( null == valueString ) { Collection < String > empty = new ArrayList < String > ( ) ; return empty ; } return StringUtils . getTrimmedStringCollection ( valueString ) ;
public class XmlEmit { /** * Create the sequence < br > * < tag > val < / tag > where val is represented by a Reader * @ param tag * @ param val * @ throws IOException */ public void property ( final QName tag , final Reader val ) throws IOException { } }
blanks ( ) ; openTagSameLine ( tag ) ; writeContent ( val , wtr ) ; closeTagSameLine ( tag ) ; newline ( ) ;
public class SimpleStatsResult { /** * ( non - Javadoc ) * @ see org . springframework . data . solr . core . query . result . StatsResult # getMinAsDouble ( ) */ @ Nullable @ Override public Double getMinAsDouble ( ) { } }
if ( min instanceof Number ) { return ( ( Number ) min ) . doubleValue ( ) ; } return null ;
public class Monitor { /** * Wait until the cluster has fully started ( ie . all nodes have joined ) . * @ param clusterName the ES cluster name * @ param nodesCount the number of nodes in the cluster * @ param timeout how many seconds to wait */ public void waitToStartCluster ( final String clusterName , int nodesCount , int timeout ) { } }
log . debug ( String . format ( "Waiting up to %ds for the Elasticsearch cluster to start ..." , timeout ) ) ; Awaitility . await ( ) . atMost ( timeout , TimeUnit . SECONDS ) . pollDelay ( 1 , TimeUnit . SECONDS ) . pollInterval ( 1 , TimeUnit . SECONDS ) . until ( new Callable < Boolean > ( ) { @ Override public Boolean call ( ) throws Exception { return isClusterRunning ( clusterName , nodesCount , client ) ; } } ) ; log . info ( "The Elasticsearch cluster has started" ) ;
public class MonthlyCalendar { /** * Redefine a certain day of the month to be excluded ( true ) or included * ( false ) . * @ param day * The day of the month ( from 1 to 31 ) to set . */ public void setDayExcluded ( final int day , final boolean exclude ) { } }
if ( ( day < 1 ) || ( day > MAX_DAYS_IN_MONTH ) ) { throw new IllegalArgumentException ( "The day parameter must be in the range of 1 to " + MAX_DAYS_IN_MONTH ) ; } m_aExcludeDays [ day - 1 ] = exclude ; m_aExcludeAll = areAllDaysExcluded ( ) ;
public class MatrixFactory { /** * Creates a new column vector with all elements initialized to 0. * @ param dimension the dimension of the vector . * @ return the new vector * @ throws IllegalArgumentException if the argument is not positive */ public static Vector createVector ( int dimension ) { } }
if ( dimension <= 0 ) throw new IllegalArgumentException ( ) ; switch ( dimension ) { case 2 : return createVector2 ( ) ; case 3 : return createVector3 ( ) ; case 4 : return createVector4 ( ) ; default : return new VectorImpl ( dimension ) ; }
public class ClusterNode { /** * Used to write the state of the ClusterNode instance to disk , when we are * persisting the state of the NodeManager * @ param jsonGenerator The JsonGenerator instance being used to write JSON * to disk * @ throws IOException */ public void write ( JsonGenerator jsonGenerator ) throws IOException { } }
jsonGenerator . writeStartObject ( ) ; // clusterNodeInfo begins jsonGenerator . writeFieldName ( "clusterNodeInfo" ) ; jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeStringField ( "name" , clusterNodeInfo . name ) ; jsonGenerator . writeObjectField ( "address" , clusterNodeInfo . address ) ; jsonGenerator . writeObjectField ( "total" , clusterNodeInfo . total ) ; jsonGenerator . writeObjectField ( "free" , clusterNodeInfo . free ) ; jsonGenerator . writeObjectField ( "resourceInfos" , clusterNodeInfo . resourceInfos ) ; jsonGenerator . writeEndObject ( ) ; // clusterNodeInfo ends // grants begins jsonGenerator . writeFieldName ( "grants" ) ; jsonGenerator . writeStartObject ( ) ; for ( Map . Entry < GrantId , ResourceRequestInfo > entry : grants . entrySet ( ) ) { jsonGenerator . writeFieldName ( entry . getKey ( ) . unique ) ; jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeFieldName ( "grantId" ) ; entry . getKey ( ) . write ( jsonGenerator ) ; jsonGenerator . writeFieldName ( "grant" ) ; entry . getValue ( ) . write ( jsonGenerator ) ; jsonGenerator . writeEndObject ( ) ; } jsonGenerator . writeEndObject ( ) ; // grants ends jsonGenerator . writeEndObject ( ) ; // We skip the hostNode and lastHeartbeatTime as they need not be persisted . // resourceTypeToMaxCpu and resourceTypeToStatsMap can be rebuilt using the // conf and the grants respectively .
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcClassificationNotation ( ) { } }
if ( ifcClassificationNotationEClass == null ) { ifcClassificationNotationEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 82 ) ; } return ifcClassificationNotationEClass ;
public class CustomerSession { /** * Calls the Stripe API ( or a test proxy ) to fetch a customer . If the provided key is expired , * this method < b > does not < / b > update the key . * Use { @ link # updateCustomer ( CustomerEphemeralKey , String ) } to validate the key * before refreshing the customer . * @ param key the { @ link CustomerEphemeralKey } used for this access * @ return a { @ link Customer } if one can be found with this key , or { @ code null } if one cannot . */ @ Nullable private Customer retrieveCustomerWithKey ( @ NonNull CustomerEphemeralKey key ) throws StripeException { } }
return mApiHandler . retrieveCustomer ( key . getCustomerId ( ) , key . getSecret ( ) ) ;
public class SectionLoader { /** * Returns the file offset for the given RVA . * A warning is issued if the file offset is outside the file , but the file * offset will be returned nevertheless . * @ param rva * the relative virtual address that shall be converted to a * plain file offset * @ return file offset */ public long getFileOffset ( long rva ) { } }
// standard value if rva doesn ' t point into a section long fileOffset = rva ; Optional < Long > maybeOffset = maybeGetFileOffset ( rva ) ; // file offset is not within file - - > warning if ( ! maybeOffset . isPresent ( ) ) { logger . warn ( "invalid file offset: 0x" + Long . toHexString ( fileOffset ) + " for file: " + file . getName ( ) + " with length 0x" + Long . toHexString ( file . length ( ) ) ) ; } else { fileOffset = maybeOffset . get ( ) ; } return fileOffset ;
public class CmsTemplateFinder { /** * Returns the available templates . < p > * @ return the available templates * @ throws CmsException if something goes wrong */ public Map < String , CmsClientTemplateBean > getTemplates ( ) throws CmsException { } }
Map < String , CmsClientTemplateBean > result = new HashMap < String , CmsClientTemplateBean > ( ) ; CmsObject cms = getCmsObject ( ) ; // find current site templates int templateId = OpenCms . getResourceManager ( ) . getResourceType ( CmsResourceTypeJsp . getContainerPageTemplateTypeName ( ) ) . getTypeId ( ) ; List < CmsResource > templates = cms . readResources ( "/" , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED . addRequireType ( templateId ) , true ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( cms . getRequestContext ( ) . getSiteRoot ( ) ) ) { // if not in the root site , also add template under / system / templates . addAll ( cms . readResources ( CmsWorkplace . VFS_PATH_SYSTEM , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED . addRequireType ( templateId ) , true ) ) ; } // convert resources to template beans for ( CmsResource template : templates ) { CmsClientTemplateBean templateBean = getTemplateBean ( cms , template ) ; result . put ( templateBean . getSitePath ( ) , templateBean ) ; } return result ;
public class TableRowEditingAjaxExample { /** * Setup the action buttons and ajax controls in the action column . */ private void setUpActionButtons ( ) { } }
// Buttons Panel WPanel buttonPanel = new WPanel ( ) ; actionContainer . add ( buttonPanel ) ; // Edit Button final WButton editButton = new WButton ( "Edit" ) { @ Override public boolean isVisible ( ) { Object key = TableUtil . getCurrentRowKey ( ) ; return ! isEditRow ( key ) ; } } ; editButton . setImage ( "/image/pencil.png" ) ; editButton . setRenderAsLink ( true ) ; editButton . setToolTip ( "Edit" ) ; editButton . setAction ( new Action ( ) { @ Override public void execute ( final ActionEvent event ) { Object key = TableUtil . getCurrentRowKey ( ) ; addEditRow ( key ) ; } } ) ; // Cancel Button final WButton cancelButton = new WButton ( "Cancel" ) { @ Override public boolean isVisible ( ) { Object key = TableUtil . getCurrentRowKey ( ) ; return isEditRow ( key ) ; } } ; cancelButton . setImage ( "/image/cancel.png" ) ; cancelButton . setRenderAsLink ( true ) ; cancelButton . setToolTip ( "Cancel" ) ; cancelButton . setAction ( new Action ( ) { @ Override public void execute ( final ActionEvent event ) { Object key = TableUtil . getCurrentRowKey ( ) ; removeEditRow ( key ) ; firstNameField . reset ( ) ; lastNameField . reset ( ) ; dobField . reset ( ) ; } } ) ; // Delete Button WConfirmationButton deleteButton = new WConfirmationButton ( "Delete" ) { @ Override public boolean isVisible ( ) { Object key = TableUtil . getCurrentRowKey ( ) ; return ! isEditRow ( key ) ; } } ; deleteButton . setMessage ( "Do you want to delete row?" ) ; deleteButton . setImage ( "/image/remove.png" ) ; deleteButton . setRenderAsLink ( true ) ; deleteButton . setToolTip ( "Delete" ) ; deleteButton . setAction ( new Action ( ) { @ Override public void execute ( final ActionEvent event ) { Object key = TableUtil . getCurrentRowKey ( ) ; removeEditRow ( key ) ; PersonBean bean = ( PersonBean ) actionContainer . getBean ( ) ; List < PersonBean > beans = ( List < PersonBean > ) table . getBean ( ) ; beans . remove ( bean ) ; table . handleDataChanged ( ) ; messages . success ( bean . getFirstName ( ) + " " + bean . getLastName ( ) + " removed." ) ; } } ) ; buttonPanel . add ( editButton ) ; buttonPanel . add ( cancelButton ) ; buttonPanel . add ( deleteButton ) ; // Ajax - edit button WAjaxControl editAjax = new WAjaxControl ( editButton , new AjaxTarget [ ] { firstNameField , lastNameField , dobField , buttonPanel } ) { @ Override public boolean isVisible ( ) { return editButton . isVisible ( ) ; } } ; buttonPanel . add ( editAjax ) ; // Ajax - cancel button WAjaxControl cancelAjax = new WAjaxControl ( cancelButton , new AjaxTarget [ ] { firstNameField , lastNameField , dobField , buttonPanel } ) { @ Override public boolean isVisible ( ) { return cancelButton . isVisible ( ) ; } } ; buttonPanel . add ( cancelAjax ) ; buttonPanel . setIdName ( "buttons" ) ; editAjax . setIdName ( "ajax_edit" ) ; cancelAjax . setIdName ( "ajax_can" ) ; editButton . setIdName ( "edit_btn" ) ; cancelButton . setIdName ( "cancel_btn" ) ; deleteButton . setIdName ( "delete_btn" ) ;
public class DateUtils { /** * 在日期上加指定的年数 * @ param * @ param * @ return */ public static Date addYear ( Date date1 , int addYear ) { } }
Date resultDate = null ; Calendar c = Calendar . getInstance ( ) ; c . setTime ( date1 ) ; // 设置当前日期 c . add ( Calendar . YEAR , addYear ) ; // 日期加1 resultDate = c . getTime ( ) ; // 结果 return resultDate ;
public class NoxView { /** * Configures the nox item default size used in NoxConfig , Shape and NoxItemCatalog to draw nox * item instances during the onDraw execution . */ private void initializeNoxItemSize ( TypedArray attributes ) { } }
float noxItemSizeDefaultValue = getResources ( ) . getDimension ( R . dimen . default_nox_item_size ) ; float noxItemSize = attributes . getDimension ( R . styleable . nox_item_size , noxItemSizeDefaultValue ) ; noxConfig . setNoxItemSize ( noxItemSize ) ;
public class MyScpClient { /** * Copy a local file to a remote directory , uses mode 0600 when creating * the file on the remote side . * @ param localFile Path and name of local file . * @ param remoteTargetDirectory Remote target directory . * @ throws IOException */ public void put ( String localFile , String remoteTargetDirectory ) throws IOException { } }
put ( new String [ ] { localFile } , remoteTargetDirectory , "0600" ) ;
public class ns_vm_template { /** * < pre > * Converts API response of bulk operation into object and returns the object array in case of get request . * < / pre > */ protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } }
ns_vm_template_responses result = ( ns_vm_template_responses ) service . get_payload_formatter ( ) . string_to_resource ( ns_vm_template_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . ns_vm_template_response_array ) ; } ns_vm_template [ ] result_ns_vm_template = new ns_vm_template [ result . ns_vm_template_response_array . length ] ; for ( int i = 0 ; i < result . ns_vm_template_response_array . length ; i ++ ) { result_ns_vm_template [ i ] = result . ns_vm_template_response_array [ i ] . ns_vm_template [ 0 ] ; } return result_ns_vm_template ;
public class AbstractMockEc2Instance { /** * Stop this ec2 instance . * @ return true for successfully turned into ' stopping ' and false for nothing changed */ public final boolean stop ( ) { } }
if ( booting || running ) { stopping = true ; booting = false ; onStopping ( ) ; return true ; } else { return false ; }
public class AbstractEndpointComponent { /** * Removes non config parameters from list of endpoint parameters according to given endpoint configuration type . All * parameters that do not reside to a endpoint configuration setting are removed so the result is a qualified list * of endpoint configuration parameters . * @ param parameters * @ param endpointConfigurationType * @ return */ protected Map < String , String > getEndpointConfigurationParameters ( Map < String , String > parameters , Class < ? extends EndpointConfiguration > endpointConfigurationType ) { } }
Map < String , String > params = new HashMap < String , String > ( ) ; for ( Map . Entry < String , String > parameterEntry : parameters . entrySet ( ) ) { Field field = ReflectionUtils . findField ( endpointConfigurationType , parameterEntry . getKey ( ) ) ; if ( field != null ) { params . put ( parameterEntry . getKey ( ) , parameterEntry . getValue ( ) ) ; } } return params ;
public class ParallelIterate { /** * Same effect as { @ link Iterate # collectIf ( Iterable , Predicate , Function ) } , * but executed in parallel batches , and writing output into the specified collection . * @ param target Where to write the output . * @ param allowReorderedResult If the result can be in a different order . * Allowing reordering may yield faster execution . * @ return The ' target ' collection , with the collected elements added . */ public static < T , V , R extends Collection < V > > R collectIf ( Iterable < T > iterable , Predicate < ? super T > predicate , Function < ? super T , V > function , R target , boolean allowReorderedResult ) { } }
return ParallelIterate . collectIf ( iterable , predicate , function , target , ParallelIterate . DEFAULT_MIN_FORK_SIZE , ParallelIterate . EXECUTOR_SERVICE , allowReorderedResult ) ;
public class ClientService { /** * Returns a client model from a ResultSet * @ param result resultset containing client information * @ return Client or null * @ throws Exception exception */ private Client getClientFromResultSet ( ResultSet result ) throws Exception { } }
Client client = new Client ( ) ; client . setId ( result . getInt ( Constants . GENERIC_ID ) ) ; client . setUUID ( result . getString ( Constants . CLIENT_CLIENT_UUID ) ) ; client . setFriendlyName ( result . getString ( Constants . CLIENT_FRIENDLY_NAME ) ) ; client . setProfile ( ProfileService . getInstance ( ) . findProfile ( result . getInt ( Constants . GENERIC_PROFILE_ID ) ) ) ; client . setIsActive ( result . getBoolean ( Constants . CLIENT_IS_ACTIVE ) ) ; client . setActiveServerGroup ( result . getInt ( Constants . CLIENT_ACTIVESERVERGROUP ) ) ; return client ;
public class LineSegment { /** * Calculate which point on the LineSegment is nearest to the given coordinate . Will be perpendicular or one of the * end - points . * @ param c * The coordinate to check . * @ return The point on the LineSegment nearest to the given coordinate . */ public Coordinate nearest ( Coordinate c ) { } }
double len = this . getLength ( ) ; double u = ( c . getX ( ) - this . c1 . getX ( ) ) * ( this . c2 . getX ( ) - this . c1 . getX ( ) ) + ( c . getY ( ) - this . c1 . getY ( ) ) * ( this . c2 . getY ( ) - this . c1 . getY ( ) ) ; u = u / ( len * len ) ; if ( u < 0.00001 || u > 1 ) { // Shortest point not within LineSegment , so take closest end - point . LineSegment ls1 = new LineSegment ( c , this . c1 ) ; LineSegment ls2 = new LineSegment ( c , this . c2 ) ; double len1 = ls1 . getLength ( ) ; double len2 = ls2 . getLength ( ) ; if ( len1 < len2 ) { return this . c1 ; } return this . c2 ; } else { // Intersecting point is on the line , use the formula : P = P1 + u ( P2 - P1) double x1 = this . c1 . getX ( ) + u * ( this . c2 . getX ( ) - this . c1 . getX ( ) ) ; double y1 = this . c1 . getY ( ) + u * ( this . c2 . getY ( ) - this . c1 . getY ( ) ) ; return new Coordinate ( x1 , y1 ) ; }
public class JournalRecovery { public static AbstractJournalOperation readJournalOperation ( DataInputStream in ) { } }
try { int operationType = in . read ( ) ; if ( operationType == - 1 ) return null ; // EOF switch ( operationType ) { case 0 : // Padding return null ; case AbstractJournalOperation . TYPE_META_DATA_WRITE : return readMetaDataWriteOperation ( in ) ; case AbstractJournalOperation . TYPE_META_DATA_BLOCK_WRITE : return readMetaDataBlockWriteOperation ( in ) ; case AbstractJournalOperation . TYPE_DATA_BLOCK_WRITE : return readDataBlockWriteOperation ( in ) ; case AbstractJournalOperation . TYPE_STORE_EXTEND : return readStoreExtendOperation ( in ) ; case AbstractJournalOperation . TYPE_COMMIT : return readCommitOperation ( in ) ; default : throw new IllegalArgumentException ( "Invalid operation type : " + operationType ) ; } } catch ( Exception e ) { log . error ( "Corrupted or truncated journal operation, skipping." , e ) ; return null ; }
public class OkRequest { /** * Write part of a multipart request to the request body * @ param name * @ param filename * @ param contentType value of the Content - Type part header * @ param part * @ return this request */ public OkRequest < T > part ( final String name , final String filename , final String contentType , final String part ) throws IOException { } }
startPart ( ) ; writePartHeader ( name , filename , contentType ) ; mOutput . write ( part ) ; return this ;
public class vpnvserver_vpnurl_binding { /** * Use this API to fetch vpnvserver _ vpnurl _ binding resources of given name . */ public static vpnvserver_vpnurl_binding [ ] get ( nitro_service service , String name ) throws Exception { } }
vpnvserver_vpnurl_binding obj = new vpnvserver_vpnurl_binding ( ) ; obj . set_name ( name ) ; vpnvserver_vpnurl_binding response [ ] = ( vpnvserver_vpnurl_binding [ ] ) obj . get_resources ( service ) ; return response ;
public class FlinkKinesisConsumer { /** * Set the assigner that will extract the timestamp from { @ link T } and calculate the * watermark . * @ param periodicWatermarkAssigner periodic watermark assigner */ public void setPeriodicWatermarkAssigner ( AssignerWithPeriodicWatermarks < T > periodicWatermarkAssigner ) { } }
this . periodicWatermarkAssigner = periodicWatermarkAssigner ; ClosureCleaner . clean ( this . periodicWatermarkAssigner , true ) ;
public class NS { /** * Returns an < code > AddAction < / code > for building expression that would * append the specified values to this number set ; or if the attribute does * not already exist , adding the new attribute and the value ( s ) to the item . * In general , DynamoDB recommends using SET rather than ADD . */ public < T extends Number > AddAction append ( Set < T > values ) { } }
return new AddAction ( this , new LiteralOperand ( values ) ) ;
public class Security { /** * If using { @ link Security # doAs ( Subject , PrivilegedAction ) } or * { @ link Security # doAs ( Subject , PrivilegedExceptionAction ) } , returns the { @ link Subject } associated with the current thread * otherwise it returns the { @ link Subject } associated with the current { @ link AccessControlContext } */ public static Subject getSubject ( ) { } }
if ( SUBJECT . get ( ) != null ) { return SUBJECT . get ( ) . peek ( ) ; } else { AccessControlContext acc = AccessController . getContext ( ) ; if ( System . getSecurityManager ( ) == null ) { return Subject . getSubject ( acc ) ; } else { return AccessController . doPrivileged ( ( PrivilegedAction < Subject > ) ( ) -> Subject . getSubject ( acc ) ) ; } }
public class RunReflectiveCall { /** * Interceptor for the { @ link org . junit . internal . runners . model . ReflectiveCallable # runReflectiveCall * runReflectiveCall } method . * @ param callable { @ code ReflectiveCallable } object being intercepted * @ param proxy callable proxy for the intercepted method * @ return { @ code anything } - value returned by the intercepted method * @ throws Exception { @ code anything } ( exception thrown by the intercepted method ) */ @ RuntimeType public static Object intercept ( @ This final Object callable , @ SuperCall final Callable < ? > proxy ) throws Exception { } }
Object runner = null ; Object target = null ; FrameworkMethod method = null ; Object [ ] params = null ; try { Object owner = getFieldValue ( callable , "this$0" ) ; if ( owner instanceof FrameworkMethod ) { method = ( FrameworkMethod ) owner ; target = getFieldValue ( callable , "val$target" ) ; params = getFieldValue ( callable , "val$params" ) ; if ( isParticleMethod ( method ) ) { if ( target != null ) { runner = CreateTest . getRunnerForTarget ( target ) ; } else { runner = Run . getThreadRunner ( ) ; } } } else { runner = owner ; } } catch ( IllegalAccessException | NoSuchFieldException | SecurityException | IllegalArgumentException e ) { // handled below } if ( method == null ) { return LifecycleHooks . callProxy ( proxy ) ; } Object result = null ; Throwable thrown = null ; try { fireBeforeInvocation ( runner , target , method , params ) ; result = LifecycleHooks . callProxy ( proxy ) ; } catch ( Throwable t ) { thrown = t ; } finally { fireAfterInvocation ( runner , target , method , thrown ) ; } if ( thrown != null ) { throw UncheckedThrow . throwUnchecked ( thrown ) ; } return result ;
public class TangramEngine { /** * { @ inheritDoc } */ @ Override public void unbindView ( ) { } }
RecyclerView contentView = getContentView ( ) ; if ( contentView != null && mSwipeItemTouchListener != null ) { contentView . removeOnItemTouchListener ( mSwipeItemTouchListener ) ; mSwipeItemTouchListener = null ; contentView . removeCallbacks ( updateRunnable ) ; } super . unbindView ( ) ;
public class BootLogger { public void info ( String msg ) { } }
if ( logger != null ) { logger . info ( msg ) ; } else { if ( loggingFile == null ) { // no logger settings println ( msg ) ; // as default } // no output before logger ready }
public class Authorization { /** * Checks if the User passed has access to the Topic to perform an action * < ul > * < li > When Messaging Security is disabled , it always returns true < / li > * < li > When Messaging Security is enabled , it calls * MessagingAuthorizationService to check for access < / li > * < / ul > * @ param authenticatedSubject * Subject got after authenticating the user * @ param topicSpace * TopicSpace in which the Topic is defined * @ param topicName * TopicName for which the permission should be checked * @ param operationType * Type of operation ( SEND , RECEIVE , BROWSE , CREATE ) * @ return true : If the User is authorized * false : If the User is not authorized */ public boolean checkTopicAccess ( Subject authenticatedSubject , String topicSpace , String topicName , String operationType ) throws MessagingAuthorizationException { } }
SibTr . entry ( tc , CLASS_NAME + "checkTopicAccess" , new Object [ ] { authenticatedSubject , topicSpace , topicName , operationType } ) ; boolean result = false ; if ( ! runtimeSecurityService . isMessagingSecure ( ) ) { result = true ; } else { if ( messagingAuthorizationService != null ) { result = messagingAuthorizationService . checkTopicAccess ( authenticatedSubject , topicSpace , topicName , operationType ) ; } } SibTr . exit ( tc , CLASS_NAME + "checkDestinationAccess" , result ) ; return result ;
public class RequestHttp2 { /** * Returns a char buffer containing the host . */ @ Override protected CharBuffer getHost ( ) { } }
if ( _host . length ( ) > 0 ) { return _host ; } _host . append ( _serverName ) ; _host . toLowerCase ( ) ; return _host ;
public class AbstractSerializer { /** * public T fromByteBuffer ( ByteBuffer byteBuffer ) { return * fromBytes ( byteBuffer . array ( ) ) ; } * public T fromByteBuffer ( ByteBuffer byteBuffer , int offset , int length ) { * return fromBytes ( Arrays . copyOfRange ( byteBuffer . array ( ) , offset , length ) ) ; } */ @ Override public Set < ByteBuffer > toBytesSet ( List < T > list ) { } }
Set < ByteBuffer > bytesList = new HashSet < ByteBuffer > ( computeInitialHashSize ( list . size ( ) ) ) ; for ( T s : list ) { bytesList . add ( toByteBuffer ( s ) ) ; } return bytesList ;
public class PriorityScheduler { /** * Adds the { @ code schedulable } to the list using the given { @ code frequency } and { @ code phase } with priority 1. * @ param schedulable the task to schedule * @ param frequency the frequency * @ param phase the phase */ @ Override public void add ( Schedulable schedulable , int frequency , int phase ) { } }
add ( schedulable , frequency , phase , 1f ) ;
public class ServerSICoreConnectionListener { /** * This method will remove the SICoreConnection from our table that maps * the connection to conversations . This is not essentially needed but the * smaller the table , the faster it is to search . * This would typically be called when the connection is closing . * @ param conn */ public void removeSICoreConnection ( SICoreConnection conn ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeSICoreConnection" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "Params: connection" , conn ) ; } conversationTable . remove ( conn ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeSICoreConnection" ) ;
public class TargetStreamManager { /** * Determine if there are any unflushed target streams to the destination * @ return boolean */ public boolean isEmpty ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "isEmpty" ) ; SibTr . exit ( tc , "isEmpty" , new Object [ ] { Boolean . valueOf ( streamSets . isEmpty ( ) ) , Boolean . valueOf ( flushedStreamSets . isEmpty ( ) ) , streamSets , this } ) ; } // Don ' t report empty until any pending flushes have completed . // Otherwise we may run into a race with an async delete thread // for the destination . return ( streamSets . isEmpty ( ) && flushedStreamSets . isEmpty ( ) ) ;
public class SerializerIntrinsics { /** * ! @ note One of dst or src must be st ( 0 ) . */ public final void fsub ( X87Register dst , X87Register src ) { } }
assert ( dst . index ( ) == 0 || src . index ( ) == 0 ) ; emitX86 ( INST_FSUB , dst , src ) ;
public class FTPServerFacade { /** * Use this as an interface to the local manager thread . * This submits the task to the thread queue . * The thread will perform it when it ' s ready with other * waiting tasks . */ private synchronized void runTask ( Task task ) { } }
if ( taskThread == null ) { taskThread = new TaskThread ( ) ; } taskThread . runTask ( task ) ;
public class AVIMConversation { /** * 在聊天对话中间增加新的参与者 * @ param memberIds * @ param callback * @ since 3.0 */ public void addMembers ( final List < String > memberIds , final AVIMConversationCallback callback ) { } }
if ( null == memberIds || memberIds . size ( ) < 1 ) { if ( null != callback ) { callback . done ( new AVIMException ( new IllegalArgumentException ( "memberIds is null" ) ) ) ; } return ; } Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( Conversation . PARAM_CONVERSATION_MEMBER , memberIds ) ; boolean ret = InternalConfiguration . getOperationTube ( ) . processMembers ( this . client . getClientId ( ) , this . conversationId , getType ( ) , JSON . toJSONString ( params ) , Conversation . AVIMOperation . CONVERSATION_ADD_MEMBER , callback ) ; if ( ! ret && null != callback ) { callback . internalDone ( null , new AVException ( AVException . OPERATION_FORBIDDEN , "couldn't start service in background." ) ) ; }
public class MemorySession { /** * To invalidate the session internally by sessionmanager */ public void internalInvalidate ( boolean timeoutOccurred ) { } }
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . entering ( methodClassName , methodNames [ INTERNAL_INVALIDATE ] , appNameAndIdString ) ; } // if it ' s not valid , just return if ( _isValid ) { // sets the Thread ' s context ( classLoader ) so that we can handle app specific listeners try { _store . setThreadContext ( ) ; // PM11279 : Call callInvalidateFromInternalInvalidate , which is overridden in MTMSesion callInvalidateFromInternalInvalidate ( ) ; if ( timeoutOccurred ) { _storeCallback . sessionInvalidatedByTimeout ( this ) ; } } finally { _store . unsetThreadContext ( ) ; } } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_CORE . exiting ( methodClassName , methodNames [ INTERNAL_INVALIDATE ] ) ; }
public class IBEA { /** * Calculate the fitness for the individual at position pos */ public void fitness ( List < S > solutionSet , int pos ) { } }
double fitness = 0.0 ; double kappa = 0.05 ; for ( int i = 0 ; i < solutionSet . size ( ) ; i ++ ) { if ( i != pos ) { fitness += Math . exp ( ( - 1 * indicatorValues . get ( i ) . get ( pos ) / maxIndicatorValue ) / kappa ) ; } } solutionFitness . setAttribute ( solutionSet . get ( pos ) , fitness ) ;
public class Functions { /** * Fluent transform operation using primitive types * e . g . * < pre > * { @ code * import static cyclops . ReactiveSeq . mapInts ; * ReactiveSeq . ofInts ( 1,2,3) * . to ( mapInts ( i - > i * 2 ) ) ; * / / [ 2,4,6] * < / pre > */ public static Function < ? super ReactiveSeq < Integer > , ? extends ReactiveSeq < Integer > > mapInts ( IntUnaryOperator b ) { } }
return a -> a . ints ( i -> i , s -> s . map ( b ) ) ;
public class CoordinatorConfig { /** * Sets the bootstrap URLs used by the different Fat clients inside the * Coordinator * @ param bootstrapUrls list of bootstrap URLs defining which cluster to * connect to * @ return modified CoordinatorConfig */ public CoordinatorConfig setBootstrapURLs ( List < String > bootstrapUrls ) { } }
this . bootstrapURLs = Utils . notNull ( bootstrapUrls ) ; if ( this . bootstrapURLs . size ( ) <= 0 ) throw new IllegalArgumentException ( "Must provide at least one bootstrap URL." ) ; return this ;
public class FieldBuilder { /** * Construct a new FieldBuilder . * @ param context the build context . * @ param classDoc the class whoses members are being documented . * @ param writer the doclet specific writer . */ public static FieldBuilder getInstance ( Context context , ClassDoc classDoc , FieldWriter writer ) { } }
return new FieldBuilder ( context , classDoc , writer ) ;
public class ActivityResponseMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ActivityResponse activityResponse , ProtocolMarshaller protocolMarshaller ) { } }
if ( activityResponse == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( activityResponse . getApplicationId ( ) , APPLICATIONID_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getCampaignId ( ) , CAMPAIGNID_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getEnd ( ) , END_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getResult ( ) , RESULT_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getScheduledStart ( ) , SCHEDULEDSTART_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getStart ( ) , START_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getState ( ) , STATE_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getSuccessfulEndpointCount ( ) , SUCCESSFULENDPOINTCOUNT_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getTimezonesCompletedCount ( ) , TIMEZONESCOMPLETEDCOUNT_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getTimezonesTotalCount ( ) , TIMEZONESTOTALCOUNT_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getTotalEndpointCount ( ) , TOTALENDPOINTCOUNT_BINDING ) ; protocolMarshaller . marshall ( activityResponse . getTreatmentId ( ) , TREATMENTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class IfcCurveStyleFontImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcCurveStyleFontPattern > getPatternList ( ) { } }
return ( EList < IfcCurveStyleFontPattern > ) eGet ( Ifc4Package . Literals . IFC_CURVE_STYLE_FONT__PATTERN_LIST , true ) ;
public class KlusterConf { /** * replace $ variables by mapping function result */ private String resolve ( String cdr , Function < String , String > map ) { } }
StringBuilder res = new StringBuilder ( cdr . length ( ) * 2 ) ; int state = 0 ; String var = "" ; for ( int i = 0 ; i < cdr . length ( ) ; i ++ ) { char c = cdr . charAt ( i ) ; if ( c == '$' ) { state = 1 ; } else { switch ( state ) { case 0 : res . append ( c ) ; break ; case 1 : { if ( Character . isLetterOrDigit ( c ) ) { var += c ; } else { String apply = map . apply ( var ) ; if ( apply != null ) res . append ( apply ) ; else res . append ( "$" + var ) ; state = 0 ; i -- ; var = "" ; } break ; } } } } String expanded = res . toString ( ) ; if ( ! expanded . equals ( cdr ) ) return resolve ( expanded , map ) ; return expanded ;