signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AxisAngle4d { /** * Set this { @ link AxisAngle4d } to the given values .
* @ param angle
* the angle in radians
* @ param v
* the rotation axis as a { @ link Vector3dc }
* @ return this */
public AxisAngle4d set ( double angle , Vector3dc v ) { } } | return set ( angle , v . x ( ) , v . y ( ) , v . z ( ) ) ; |
public class AlbumResource { /** * Parses an album response from a
* < a href = " https : / / developer . spotify . com / web - api / album - endpoints / " > Spotify API album query < / a > .
* @ param json The json response
* @ return A list of albums with artist information */
private ArrayList < Album > parseAlbumData ( String json ) { } } | ArrayList < Album > albums = new ArrayList < > ( ) ; try { JsonNode jsonNode = this . objectMapper . readTree ( json ) ; for ( JsonNode albumNode : jsonNode . get ( "albums" ) ) { JsonNode artistsNode = albumNode . get ( "artists" ) ; // Exclude albums with 0 artists
if ( artistsNode . size ( ) >= 1 ) { // Only keeping the first artist for simplicity
Artist artist = new Artist ( artistsNode . get ( 0 ) . get ( "name" ) . asText ( ) ) ; Album album = new Album ( albumNode . get ( "name" ) . asText ( ) , artist ) ; albums . add ( album ) ; } } } catch ( IOException e ) { throw new RuntimeException ( "Failed to parse JSON" , e ) ; } return albums ; |
public class route6 { /** * Use this API to delete route6 resources . */
public static base_responses delete ( nitro_service client , route6 resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { route6 deleteresources [ ] = new route6 [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { deleteresources [ i ] = new route6 ( ) ; deleteresources [ i ] . network = resources [ i ] . network ; deleteresources [ i ] . gateway = resources [ i ] . gateway ; deleteresources [ i ] . vlan = resources [ i ] . vlan ; deleteresources [ i ] . td = resources [ i ] . td ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ; |
public class NetworkElement { /** * This method only returns a copy of the list , if you modify the copy , the
* internal list of PossibleStates will be not modified . To interact with
* the real list , use " addPossibleStatus " and " removePossibleStatus " methods
* @ return a copy of possibleStates list */
public List < String > getPossibleStates ( ) { } } | List < String > copy = new ArrayList < String > ( ) ; for ( String possibleStatus : states . keySet ( ) ) { copy . add ( possibleStatus ) ; } return copy ; |
public class UppercaseTransliterator { /** * Implements { @ link Transliterator # handleTransliterate } . */
@ Override protected synchronized void handleTransliterate ( Replaceable text , Position offsets , boolean isIncremental ) { } } | if ( csp == null ) { return ; } if ( offsets . start >= offsets . limit ) { return ; } iter . setText ( text ) ; result . setLength ( 0 ) ; int c , delta ; // Walk through original string
// If there is a case change , modify corresponding position in replaceable
iter . setIndex ( offsets . start ) ; iter . setLimit ( offsets . limit ) ; iter . setContextLimits ( offsets . contextStart , offsets . contextLimit ) ; while ( ( c = iter . nextCaseMapCP ( ) ) >= 0 ) { c = csp . toFullUpper ( c , iter , result , caseLocale ) ; if ( iter . didReachLimit ( ) && isIncremental ) { // the case mapping function tried to look beyond the context limit
// wait for more input
offsets . start = iter . getCaseMapCPStart ( ) ; return ; } /* decode the result */
if ( c < 0 ) { /* c mapped to itself , no change */
continue ; } else if ( c <= UCaseProps . MAX_STRING_LENGTH ) { /* replace by the mapping string */
delta = iter . replace ( result . toString ( ) ) ; result . setLength ( 0 ) ; } else { /* replace by single - code point mapping */
delta = iter . replace ( UTF16 . valueOf ( c ) ) ; } if ( delta != 0 ) { offsets . limit += delta ; offsets . contextLimit += delta ; } } offsets . start = offsets . limit ; |
public class JavacState { /** * Propagate recompilation through the dependency chains .
* Avoid re - tainting packages that have already been compiled . */
public void taintPackagesDependingOnChangedPackages ( Set < String > pkgs , Set < String > recentlyCompiled ) { } } | for ( Package pkg : prev . packages ( ) . values ( ) ) { for ( String dep : pkg . dependencies ( ) ) { if ( pkgs . contains ( dep ) && ! recentlyCompiled . contains ( pkg . name ( ) ) ) { taintPackage ( pkg . name ( ) , " its depending on " + dep ) ; } } } |
public class AppServiceCertificateOrdersInner { /** * Retrieve email history .
* Retrieve email history .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the certificate order .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws DefaultErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the List & lt ; CertificateEmailInner & gt ; object if successful . */
public List < CertificateEmailInner > retrieveCertificateEmailHistory ( String resourceGroupName , String name ) { } } | return retrieveCertificateEmailHistoryWithServiceResponseAsync ( resourceGroupName , name ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class PluginDefaultGroovyMethods { /** * Accumulates the elements of stream into a new Set .
* @ param stream the Stream
* @ param < T > the type of element
* @ return a new { @ code java . util . Set } instance */
public static < T > Set < T > toSet ( Stream < T > stream ) { } } | return stream . collect ( Collectors . < T > toSet ( ) ) ; |
public class SetDataClass { /** * Called when a valid record is read from the table / query .
* @ param bDisplayOption If true , display any changes . */
public void doValidRecord ( boolean bDisplayOption ) { } } | String strClass = this . getOwner ( ) . getField ( FieldData . FIELD_CLASS ) . toString ( ) ; String strType = null ; if ( strClass . indexOf ( "Field" ) != - 1 ) { strType = strClass . substring ( 0 , strClass . indexOf ( "Field" ) ) ; if ( "Short Integer Double Float Currencys Percent Real Boolean String DateTime" . indexOf ( strType ) == - 1 ) strType = null ; if ( strType != null ) if ( ( strType . equals ( "DateTime" ) ) || ( strType . equals ( "Time" ) ) ) strType = "Date" ; if ( strType != null ) if ( ( strType . equals ( "Currencys" ) ) || ( strType . equals ( "Real" ) ) ) strType = "Double" ; if ( strType != null ) if ( strType . equals ( "Percent" ) ) strType = "Float" ; } if ( strType != null ) this . getOwner ( ) . getField ( FieldData . DATA_CLASS ) . setString ( strType ) ; super . doValidRecord ( bDisplayOption ) ; |
public class BeanMetaData { /** * Gets the index of the remote busines interface . This method will throw an
* IllegalStateException if a remte interface could not be matched . If it is
* known that a match must occur on a remote business interface , then this
* method should be used .
* @ param interfaceName the interface to find a match on
* @ return the index of the business interface found
* @ throws IllegalStateException if the requested business interface cannot be found . */
public int getRequiredRemoteBusinessInterfaceIndex ( String interfaceName ) throws IllegalStateException { } } | int interfaceIndex = getRemoteBusinessInterfaceIndex ( interfaceName ) ; if ( interfaceIndex == - 1 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getRequiredRemoteBusinessInterfaceIndex : IllegalStateException : " + "Requested business interface not found : " + interfaceName ) ; throw new IllegalStateException ( "Requested business interface not found : " + interfaceName ) ; } return interfaceIndex ; |
public class Options { /** * Sets the single yAxis . If you need to define more than one yAxis use
* { @ link # addyAxis ( Axis ) } . If there are multiple Axes defined when calling
* this method , only the specified axis will be defined afterwards .
* @ param yAxis the single yAxis of the chart
* @ return the { @ link Options } object for chaining */
public Options setyAxis ( final Axis yAxis ) { } } | this . yAxis = new ArrayList < Axis > ( ) ; this . yAxis . add ( yAxis ) ; return this ; |
public class AsteriskQueueImpl { /** * Shifts the position of the queue entries if needed
* ( and fire PCE on queue entries if appropriate ) . */
private void shift ( ) { } } | int currentPos = 1 ; // Asterisk starts at 1
synchronized ( entries ) { for ( AsteriskQueueEntryImpl qe : entries ) { // Only set ( and fire PCE on qe ) if necessary
if ( qe . getPosition ( ) != currentPos ) { qe . setPosition ( currentPos ) ; } currentPos ++ ; } } |
public class SearchRange { /** * Check if the given { @ link SearchKey } matches this range .
* @ param key
* the specified { @ link SearchKey }
* @ return if the given key matches */
public boolean match ( SearchKey key ) { } } | // It will not check if the key does not have the same length
if ( ranges . length != key . length ( ) ) return false ; // Check one by one
for ( int i = 0 ; i < ranges . length ; i ++ ) if ( ! ranges [ i ] . contains ( key . get ( i ) ) ) return false ; return true ; |
public class Manager { /** * Post an event to controllers or other managers on { @ link EventBusC } . The event will be posted
* on to the same thread as the caller .
* @ param event event to controllers */
protected void postEvent2C ( final Object event ) { } } | if ( eventBus2C != null ) { eventBus2C . post ( event ) ; } else { logger . warn ( "Trying to post event {} to EventBusC which is null" , event . getClass ( ) . getName ( ) ) ; } |
public class DoubleMatrix { /** * Solve linear equation Ax = b returning x
* @ param b
* @ return */
public DoubleMatrix solve ( DoubleMatrix b ) { } } | DoubleMatrix x = getInstance ( b . rows ( ) , b . columns ( ) ) ; solve ( b , x ) ; return x ; |
public class KunderaQuery { /** * Adds the update clause .
* @ param property
* the property
* @ param value
* the value */
public void addUpdateClause ( final String property , final String value ) { } } | UpdateClause updateClause = new UpdateClause ( property . trim ( ) , value . trim ( ) ) ; updateClauseQueue . add ( updateClause ) ; addTypedParameter ( value . trim ( ) . startsWith ( "?" ) ? Type . INDEXED : value . trim ( ) . startsWith ( ":" ) ? Type . NAMED : null , property , updateClause ) ; |
public class ReflectingConverter { /** * Add the self link to the entity .
* @ param builder assumed not < code > null < / code > .
* @ param resolvedUri the token resolved uri . Assumed not blank . */
private void handleSelfLink ( EntityBuilder builder , String resolvedUri ) { } } | if ( StringUtils . isBlank ( resolvedUri ) ) { return ; } Link link = LinkBuilder . newInstance ( ) . setRelationship ( Link . RELATIONSHIP_SELF ) . setHref ( resolvedUri ) . build ( ) ; builder . addLink ( link ) ; |
public class ReadCommEventCounterResponse { /** * getMessage - - format the message into a byte array .
* @ return Response as byte array */
public byte [ ] getMessage ( ) { } } | byte result [ ] = new byte [ 4 ] ; result [ 0 ] = ( byte ) ( status >> 8 ) ; result [ 1 ] = ( byte ) ( status & 0xFF ) ; result [ 2 ] = ( byte ) ( events >> 8 ) ; result [ 3 ] = ( byte ) ( events & 0xFF ) ; return result ; |
public class StreamsUtils { /** * < p > Generates a stream composed of the N greatest different values of the provided stream , compared using the
* natural order . This method calls the < code > filteringMaxKeys ( ) < / code > with the natural order comparator ,
* please refer to this javadoc for details . < / p >
* < p > A < code > NullPointerException < / code > will be thrown if the provided stream is null . < / p >
* < p > An < code > IllegalArgumentException < / code > is thrown if N is lesser than 1 . < / p >
* @ param stream the processed stream
* @ param numberOfMaxes the number of different max values that should be returned . Note that the total number of
* values returned may be larger if there are duplicates in the stream
* @ param < E > the type of the provided stream
* @ return the filtered stream */
public static < E extends Comparable < ? super E > > Stream < E > filteringMaxKeys ( Stream < E > stream , int numberOfMaxes ) { } } | return filteringMaxKeys ( stream , numberOfMaxes , Comparator . naturalOrder ( ) ) ; |
public class LinkedList { /** * This is a method used by the unit tests to determine the number of links in the list .
* It ' s too inefficient for any other purpose .
* @ return the number of links */
public int countLinks ( ) { } } | int count = 0 ; Link look = _dummyHead . getNextLogicalLink ( ) ; while ( look != null && _dummyTail != look ) { count ++ ; look = look . _getNextLink ( ) ; } return count ; |
public class HiveMetaStoreEventHelper { /** * Table Creation */
protected static void submitSuccessfulTableCreation ( EventSubmitter eventSubmitter , HiveTable table ) { } } | eventSubmitter . submit ( TABLE_CREATION + SUCCESS_POSTFIX , getAdditionalMetadata ( table , Optional . < HivePartition > absent ( ) , Optional . < Exception > absent ( ) ) ) ; |
public class CRFFeatureExporter { /** * Prefix features with U - ( for unigram ) features
* or B - ( for bigram ) features
* @ param feat String representing the feature
* @ return new prefixed feature string */
private String ubPrefixFeatureString ( String feat ) { } } | if ( feat . endsWith ( "|C" ) ) { return "U-" + feat ; } else if ( feat . endsWith ( "|CpC" ) ) { return "B-" + feat ; } else { return feat ; } |
public class XLog { /** * Log a message with level { @ link LogLevel # VERBOSE } .
* @ param format the format of the message to log
* @ param args the arguments of the message to log */
public static void v ( String format , Object ... args ) { } } | assertInitialization ( ) ; sLogger . v ( format , args ) ; |
public class XLog { /** * Initialize log system , should be called only once .
* @ param logLevel the log level , logs with a lower level than which would not be printed */
public static void init ( int logLevel ) { } } | init ( new LogConfiguration . Builder ( ) . logLevel ( logLevel ) . build ( ) , DefaultsFactory . createPrinter ( ) ) ; |
public class EnumEditor { /** * Format the Enum as translated String */
public String getAsText ( ) { } } | Enum < ? > value = ( Enum < ? > ) getValue ( ) ; if ( value == null ) { return "" ; } String text = getMessagesAccessor ( ) . getMessage ( messagesKeyPrefix + value . name ( ) , ( String ) null ) ; if ( text == null ) { return value . toString ( ) ; } else { return text ; } |
public class HashOrderIndependent { /** * ( non - Javadoc )
* @ see com . netflix . videometadata . serializer . blob . HashAlgorithm # write ( int [ ] ) */
@ Override public void write ( int [ ] b ) throws IOException { } } | write ( "int[]" ) ; long code = 0 ; for ( int i = 0 ; i < b . length ; i ++ ) { code = 31 * code + b [ i ] ; } write ( code ) ; |
public class CommercePriceListAccountRelLocalServiceBaseImpl { /** * Deletes the commerce price list account rel with the primary key from the database . Also notifies the appropriate model listeners .
* @ param commercePriceListAccountRelId the primary key of the commerce price list account rel
* @ return the commerce price list account rel that was removed
* @ throws PortalException if a commerce price list account rel with the primary key could not be found */
@ Indexable ( type = IndexableType . DELETE ) @ Override public CommercePriceListAccountRel deleteCommercePriceListAccountRel ( long commercePriceListAccountRelId ) throws PortalException { } } | return commercePriceListAccountRelPersistence . remove ( commercePriceListAccountRelId ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link DictionaryEntryType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link DictionaryEntryType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "definitionMember" , substitutionHeadNamespace = "http://www.opengis.net/gml" , substitutionHeadName = "dictionaryEntry" ) public JAXBElement < DictionaryEntryType > createDefinitionMember ( DictionaryEntryType value ) { } } | return new JAXBElement < DictionaryEntryType > ( _DefinitionMember_QNAME , DictionaryEntryType . class , null , value ) ; |
public class EntryFactory { /** * Returns an { @ link Entry } having the given { @ link Dn } . The attribute type of the Rdn is ' common name ' . */
public static Entry namedObject ( Dn dn ) { } } | Entry entry = new DefaultEntry ( dn ) ; try { entry . add ( SchemaConstants . OBJECT_CLASS_ATTRIBUTE , SchemaConstants . NAMED_OBJECT_OC ) ; entry . add ( SchemaConstants . CN_ATTRIBUTE , dn . getRdn ( ) . getName ( ) ) ; } catch ( LdapException e ) { throw new LdapRuntimeException ( e ) ; } return entry ; |
public class IdentityPatchContext { /** * Copy a patch element
* @ param entry the patch entry
* @ param patchId the patch id for the element
* @ param modifications the element modifications
* @ return the new patch element */
protected static PatchElement createPatchElement ( final PatchEntry entry , String patchId , final List < ContentModification > modifications ) { } } | final PatchElement patchElement = entry . element ; final PatchElementImpl element = new PatchElementImpl ( patchId ) ; element . setProvider ( patchElement . getProvider ( ) ) ; // Add all the rollback actions
element . getModifications ( ) . addAll ( modifications ) ; element . setDescription ( patchElement . getDescription ( ) ) ; return element ; |
public class Cache { /** * Deletes all resources that match the given resource name criteria .
* @ param regex
* the resource name pattern .
* @ return
* the cache itself , for method chaining . */
public Cache delete ( Regex regex ) { } } | logger . debug ( "deleting all files named according to /{}/" , regex ) ; storage . delete ( regex ) ; return this ; |
public class RecursableDiffEntity { /** * Returns true if some child entity matched .
* < p > Caches the result for future calls . */
final boolean isAnyChildMatched ( ) { } } | if ( isAnyChildMatched == null ) { isAnyChildMatched = false ; for ( RecursableDiffEntity entity : childEntities ( ) ) { if ( ( entity . isMatched ( ) && ! entity . isContentEmpty ( ) ) || entity . isAnyChildMatched ( ) ) { isAnyChildMatched = true ; break ; } } } return isAnyChildMatched ; |
public class Message { /** * A map of the attributes requested in < code > < a > ReceiveMessage < / a > < / code > to their respective values . Supported
* attributes :
* < ul >
* < li >
* < code > ApproximateReceiveCount < / code >
* < / li >
* < li >
* < code > ApproximateFirstReceiveTimestamp < / code >
* < / li >
* < li >
* < code > MessageDeduplicationId < / code >
* < / li >
* < li >
* < code > MessageGroupId < / code >
* < / li >
* < li >
* < code > SenderId < / code >
* < / li >
* < li >
* < code > SentTimestamp < / code >
* < / li >
* < li >
* < code > SequenceNumber < / code >
* < / li >
* < / ul >
* < code > ApproximateFirstReceiveTimestamp < / code > and < code > SentTimestamp < / code > are each returned as an integer
* representing the < a href = " http : / / en . wikipedia . org / wiki / Unix _ time " > epoch time < / a > in milliseconds .
* @ param attributes
* A map of the attributes requested in < code > < a > ReceiveMessage < / a > < / code > to their respective values .
* Supported attributes : < / p >
* < ul >
* < li >
* < code > ApproximateReceiveCount < / code >
* < / li >
* < li >
* < code > ApproximateFirstReceiveTimestamp < / code >
* < / li >
* < li >
* < code > MessageDeduplicationId < / code >
* < / li >
* < li >
* < code > MessageGroupId < / code >
* < / li >
* < li >
* < code > SenderId < / code >
* < / li >
* < li >
* < code > SentTimestamp < / code >
* < / li >
* < li >
* < code > SequenceNumber < / code >
* < / li >
* < / ul >
* < code > ApproximateFirstReceiveTimestamp < / code > and < code > SentTimestamp < / code > are each returned as an
* integer representing the < a href = " http : / / en . wikipedia . org / wiki / Unix _ time " > epoch time < / a > in milliseconds .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Message withAttributes ( java . util . Map < String , String > attributes ) { } } | setAttributes ( attributes ) ; return this ; |
public class AuthActivity { /** * Set static authentication parameters */
static void setAuthParams ( String appKey , String desiredUid , String [ ] alreadyAuthedUids , String sessionId , String webHost , String apiType ) { } } | sAppKey = appKey ; sDesiredUid = desiredUid ; sAlreadyAuthedUids = ( alreadyAuthedUids != null ) ? alreadyAuthedUids : new String [ 0 ] ; sSessionId = sessionId ; sWebHost = ( webHost != null ) ? webHost : DEFAULT_WEB_HOST ; sApiType = apiType ; |
public class BalanceSheetPdf { /** * < p > Simple delegator to print number . < / p >
* @ param pAddParam additional param
* @ param pVal value
* @ return String */
public final String prn ( final Map < String , Object > pAddParam , final BigDecimal pVal ) { } } | return this . srvNumberToString . print ( pVal . toString ( ) , ( String ) pAddParam . get ( "decSepv" ) , ( String ) pAddParam . get ( "decGrSepv" ) , ( Integer ) pAddParam . get ( "reportDp" ) , ( Integer ) pAddParam . get ( "digInGr" ) ) ; |
public class LoggingTool { /** * Shows FATAL output for the Object . It uses the toString ( ) method .
* @ param object Object to apply toString ( ) too and output */
@ Override public void fatal ( Object object ) { } } | if ( toSTDOUT ) { printToStderr ( "FATAL" , object . toString ( ) ) ; } else { log4jLogger . fatal ( "" + object . toString ( ) ) ; } |
public class Atomix { /** * Returns a new Atomix configuration .
* The configuration will be loaded from the given file and will fall back to { @ code atomix . conf } , { @ code
* atomix . json } , or { @ code atomix . properties } if located on the classpath .
* @ param configFiles the Atomix configuration files
* @ return a new Atomix configuration */
public static AtomixConfig config ( File ... configFiles ) { } } | return config ( Thread . currentThread ( ) . getContextClassLoader ( ) , Arrays . asList ( configFiles ) , AtomixRegistry . registry ( ) ) ; |
public class SeaGlassLookAndFeel { /** * Paint a region .
* @ param state the SynthContext describing the current component , region ,
* and state .
* @ param g the Graphics context used to paint the subregion .
* @ param bounds the bounds to paint in . */
private static void paintRegion ( SynthContext state , Graphics g , Rectangle bounds ) { } } | JComponent c = state . getComponent ( ) ; SynthStyle style = state . getStyle ( ) ; int x ; int y ; int width ; int height ; if ( bounds == null ) { x = 0 ; y = 0 ; width = c . getWidth ( ) ; height = c . getHeight ( ) ; } else { x = bounds . x ; y = bounds . y ; width = bounds . width ; height = bounds . height ; } // Fill in the background , if necessary .
boolean subregion = state . getRegion ( ) . isSubregion ( ) ; if ( ( subregion && style . isOpaque ( state ) ) || ( ! subregion && c . isOpaque ( ) ) ) { g . setColor ( style . getColor ( state , ColorType . BACKGROUND ) ) ; g . fillRect ( x , y , width , height ) ; } |
public class AmazonRoute53Client { /** * Retrieve a list of the health checks that are associated with the current AWS account .
* @ param listHealthChecksRequest
* A request to retrieve a list of the health checks that are associated with the current AWS account .
* @ return Result of the ListHealthChecks operation returned by the service .
* @ throws InvalidInputException
* The input is not valid .
* @ throws IncompatibleVersionException
* The resource you ' re trying to access is unsupported on this Amazon Route 53 endpoint .
* @ sample AmazonRoute53 . ListHealthChecks
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / route53-2013-04-01 / ListHealthChecks " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListHealthChecksResult listHealthChecks ( ListHealthChecksRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListHealthChecks ( request ) ; |
public class CSSFactory { /** * Parses file into StyleSheet . Internally transforms file to URL
* @ param fileName Name of file
* @ param encoding Encoding used to parse input
* @ return Parsed style sheet
* @ throws CSSException In case that parsing error occurs
* @ throws IOException If file is not found or not readable */
public static final StyleSheet parse ( String fileName , String encoding ) throws CSSException , IOException { } } | try { File f = new File ( fileName ) ; URL url = f . toURI ( ) . toURL ( ) ; return parse ( url , encoding ) ; } catch ( MalformedURLException e ) { String message = "Unable to construct URL from fileName: " + fileName ; log . error ( message ) ; throw new FileNotFoundException ( message ) ; } |
public class DateTimeStaticExtensions { /** * Parse text into a { @ link java . time . YearMonth } using the provided pattern .
* @ param type placeholder variable used by Groovy categories ; ignored for default static methods
* @ param text String to be parsed to create the date instance
* @ param pattern pattern used to parse the text
* @ return a YearMonth representing the parsed text
* @ throws java . lang . IllegalArgumentException if the pattern is invalid
* @ throws java . time . format . DateTimeParseException if the text cannot be parsed
* @ see java . time . format . DateTimeFormatter
* @ see java . time . YearMonth # parse ( java . lang . CharSequence , java . time . format . DateTimeFormatter )
* @ since 2.5.0 */
public static YearMonth parse ( final YearMonth type , CharSequence text , String pattern ) { } } | return YearMonth . parse ( text , DateTimeFormatter . ofPattern ( pattern ) ) ; |
public class AcceptableUsagePolicySubmitAction { /** * Record the fact that the policy is accepted .
* @ param context the context
* @ param credential the credential
* @ param messageContext the message context
* @ return success if policy acceptance is recorded successfully . */
private Event submit ( final RequestContext context , final Credential credential , final MessageContext messageContext ) { } } | if ( repository . submit ( context , credential ) ) { return new EventFactorySupport ( ) . event ( this , CasWebflowConstants . TRANSITION_ID_AUP_ACCEPTED ) ; } return error ( ) ; |
public class CharacterCLA { /** * { @ inheritDoc } */
@ Override public Character convert ( final String valueStr , final boolean _caseSensitive , final Object target ) throws ParseException { } } | if ( valueStr . length ( ) == 1 ) { if ( _caseSensitive ) return new Character ( valueStr . charAt ( 0 ) ) ; return new Character ( valueStr . toLowerCase ( ) . charAt ( 0 ) ) ; } throw new ParseException ( "invalid value for character argument: " + valueStr , 0 ) ; |
public class S6aServerSessionImpl { /** * ( non - Javadoc )
* @ see org . jdiameter . api . app . StateMachine # getState ( java . lang . Class ) */
@ Override @ SuppressWarnings ( "unchecked" ) public < E > E getState ( Class < E > stateType ) { } } | return stateType == S6aSessionState . class ? ( E ) this . sessionData . getS6aSessionState ( ) : null ; |
public class ContainerConfigurationController { /** * private static final Pattern jmxPattern = Pattern . compile ( " ( ? i : . * jmx . * ) " ) ; */
public void remapContainer ( @ Observes BeforeSetup event , CubeRegistry cubeRegistry , ContainerRegistry containerRegistry ) throws InstantiationException , IllegalAccessException { } } | Container container = ContainerUtil . getContainerByDeployableContainer ( containerRegistry , event . getDeployableContainer ( ) ) ; if ( container == null ) { return ; } Cube < ? > cube = cubeRegistry . getCube ( ContainerUtil . getCubeIDForContainer ( container ) ) ; if ( cube == null ) { return ; // No Cube found matching Container name , not managed by Cube
} HasPortBindings bindings = cube . getMetadata ( HasPortBindings . class ) ; if ( bindings == null ) { return ; } ContainerDef containerConfiguration = container . getContainerConfiguration ( ) ; // Get the port property
List < String > portPropertiesFromArquillianConfigurationFile = filterArquillianConfigurationPropertiesByPortAttribute ( containerConfiguration ) ; // Get the AddressProperty property
List < String > addressPropertiesFromArquillianConfigurationFile = filterArquillianConfigurationPropertiesByAddressAttribute ( containerConfiguration ) ; Class < ? > configurationClass = container . getDeployableContainer ( ) . getConfigurationClass ( ) ; // Get the port property
List < PropertyDescriptor > configurationClassPortFields = filterConfigurationClassPropertiesByPortAttribute ( configurationClass ) ; // Get the Address property
List < PropertyDescriptor > configurationClassAddressFields = filterConfigurationClassPropertiesByAddressAttribute ( configurationClass ) ; Object newConfigurationInstance = configurationClass . newInstance ( ) ; for ( PropertyDescriptor configurationClassPortField : configurationClassPortFields ) { int containerPort = getDefaultPortFromConfigurationInstance ( newConfigurationInstance , configurationClass , configurationClassPortField ) ; mappingForPort = bindings . getMappedAddress ( containerPort ) ; if ( ! portPropertiesFromArquillianConfigurationFile . contains ( configurationClassPortField . getName ( ) ) && ( configurationClassPortField . getPropertyType ( ) . equals ( Integer . class ) || configurationClassPortField . getPropertyType ( ) . equals ( int . class ) ) ) { // This means that port has not configured in arquillian . xml and it will use default value .
// In this case is when remapping should be activated to adequate the situation according to
// Arquillian Cube exposed ports .
if ( mappingForPort != null ) { containerConfiguration . overrideProperty ( configurationClassPortField . getName ( ) , Integer . toString ( mappingForPort . getPort ( ) ) ) ; } } } for ( PropertyDescriptor configurationClassAddressField : configurationClassAddressFields ) { if ( ! addressPropertiesFromArquillianConfigurationFile . contains ( configurationClassAddressField . getName ( ) ) && ( configurationClassAddressField . getPropertyType ( ) . equals ( String . class ) || configurationClassAddressField . getPropertyType ( ) . equals ( String . class ) ) ) { // If a property called portForwardBindAddress on openshift qualifier on arquillian . xml exists it will overrides the
// arquillian default | defined managementAddress with the IP address given on this property .
if ( mappingForPort != null ) { containerConfiguration . overrideProperty ( configurationClassAddressField . getName ( ) , mappingForPort . getIP ( ) ) ; } } } |
public class ApiOvhTelephony { /** * Alter this object properties
* REST : PUT / telephony / { billingAccount } / miniPabx / { serviceName } / hunting / agent / { agentNumber }
* @ param body [ required ] New object properties
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ]
* @ param agentNumber [ required ] The phone number of the agent */
public void billingAccount_miniPabx_serviceName_hunting_agent_agentNumber_PUT ( String billingAccount , String serviceName , String agentNumber , OvhEasyMiniPabxHuntingAgent body ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/miniPabx/{serviceName}/hunting/agent/{agentNumber}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , agentNumber ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ; |
public class SqlRunConfigurationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SqlRunConfiguration sqlRunConfiguration , ProtocolMarshaller protocolMarshaller ) { } } | if ( sqlRunConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( sqlRunConfiguration . getInputId ( ) , INPUTID_BINDING ) ; protocolMarshaller . marshall ( sqlRunConfiguration . getInputStartingPositionConfiguration ( ) , INPUTSTARTINGPOSITIONCONFIGURATION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class IOUtil { /** * Deletes a file or directory .
* When deleting a directory files and subdirectories in it are also
* deleted .
* @ param fileOrDir */
public static void emptyAndDelete ( File fileOrDir ) { } } | if ( fileOrDir . isDirectory ( ) ) { File [ ] files = fileOrDir . listFiles ( ) ; for ( File file : files ) { emptyAndDelete ( file ) ; } } fileOrDir . delete ( ) ; |
public class WebSocketClient { /** * Blocks until both threads exit . The actual close must be triggered separately . This is just a convenience
* method to make sure everything shuts down , if desired .
* @ throws InterruptedException */
public void blockClose ( ) throws InterruptedException { } } | // If the thread is new , it will never run , since we closed the connection before we actually connected
if ( writer . getInnerThread ( ) . getState ( ) != Thread . State . NEW ) { writer . getInnerThread ( ) . join ( ) ; } getInnerThread ( ) . join ( ) ; |
public class WCApplicationHelper { /** * Helper method to create a war and placed it to the specified directory which is relative from / publish / servers / directory . */
public static void createWar ( LibertyServer server , String dir , String warName , boolean addWarResources , String jarName , boolean addJarResources , String ... packageNames ) throws Exception { } } | addEarToServer ( server , dir , null , false , warName , addWarResources , jarName , addJarResources , packageNames ) ; |
public class ThreadPool { /** * Will close down all the threads in the pool as they become
* available . If all the threads cannot become available within the
* specified timeout , any active threads not yet returned to the
* thread pool are interrupted .
* @ param timeout Milliseconds to wait before unavailable threads
* are interrupted . If zero , don ' t wait at all . If negative , wait forever . */
public void close ( long timeout ) throws InterruptedException { } } | synchronized ( mPool ) { mClosed = true ; mPool . notifyAll ( ) ; if ( timeout != 0 ) { if ( timeout < 0 ) { while ( mActive > 0 ) { // Infinite wait for notification .
mPool . wait ( 0 ) ; } } else { long expireTime = System . currentTimeMillis ( ) + timeout ; while ( mActive > 0 ) { mPool . wait ( timeout ) ; if ( System . currentTimeMillis ( ) > expireTime ) { break ; } } } } } interrupt ( ) ; |
public class VirtualMachineImagesInner { /** * Gets a list of all virtual machine image versions for the specified location , publisher , offer , and SKU .
* @ param location The name of a supported Azure region .
* @ param publisherName A valid image publisher .
* @ param offer A valid image publisher offer .
* @ param skus A valid image SKU .
* @ param filter The filter to apply on the operation .
* @ param top the Integer value
* @ param orderby the String value
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < VirtualMachineImageResourceInner > > listAsync ( String location , String publisherName , String offer , String skus , String filter , Integer top , String orderby , final ServiceCallback < List < VirtualMachineImageResourceInner > > serviceCallback ) { } } | return ServiceFuture . fromResponse ( listWithServiceResponseAsync ( location , publisherName , offer , skus , filter , top , orderby ) , serviceCallback ) ; |
public class DTMDefaultBase { /** * Given a node handle , advance to its next sibling .
* If not yet resolved , waits for more nodes to be added to the document and
* tries again .
* @ param nodeHandle int Handle of the node .
* @ return int Node - number of next sibling ,
* or DTM . NULL to indicate none exists . */
public int getNextSibling ( int nodeHandle ) { } } | if ( nodeHandle == DTM . NULL ) return DTM . NULL ; return makeNodeHandle ( _nextsib ( makeNodeIdentity ( nodeHandle ) ) ) ; |
public class SoccomClient { /** * Get the response from the server , after sending a request .
* @ param timeout timeout value in seconds
* @ return The response message .
* @ exception SoccomException Thrown when an IOException is encountered . */
public String getresp ( int timeout ) throws SoccomException { } } | int size , n ; String sizestr ; try { byte [ ] _header = new byte [ SoccomMessage . HEADER_SIZE ] ; _socket . setSoTimeout ( timeout * 1000 ) ; n = _in . read ( _header , 0 , SoccomMessage . HEADER_SIZE ) ; if ( n != SoccomMessage . HEADER_SIZE ) throw new SoccomException ( SoccomException . RECV_HEADER ) ; logline ( "RECV HDR: " + new String ( _header ) ) ; check_msgid ( _msgid , _header ) ; sizestr = new String ( _header , SoccomMessage . MSGSIZE_OFFSET , 8 ) ; if ( sizestr . startsWith ( "ENDM" ) ) size = - 1 ; else size = Integer . parseInt ( sizestr ) ; } catch ( InterruptedIOException e ) { throw new SoccomException ( SoccomException . POLL_TIMEOUT ) ; } catch ( IOException e ) { throw new SoccomException ( SoccomException . RECV_HEADER ) ; } try { String msg ; if ( size == - 1 ) { String endm = sizestr . substring ( 4 , 8 ) ; String line ; StringBuffer sb = new StringBuffer ( ) ; byte [ ] buffer = new byte [ 1024 ] ; int k ; boolean done = false ; while ( ! done ) { k = readLine ( _in , buffer , 0 , 1024 ) ; line = new String ( buffer , 0 , k ) ; if ( k == 5 && line . startsWith ( endm ) ) done = true ; else sb . append ( line ) ; } msg = sb . toString ( ) ; } else { byte [ ] buffer = new byte [ size + SoccomMessage . HEADER_SIZE ] ; int got = 0 ; while ( got < size ) { n = _in . read ( buffer , got , size - got ) ; if ( n > 0 ) got += n ; else if ( n == - 1 ) throw new SoccomException ( SoccomException . SOCKET_CLOSED ) ; else throw new SoccomException ( SoccomException . RECV_ERROR ) ; } msg = new String ( buffer , 0 , size ) ; } logline ( "RECV MSG: " + msg ) ; return msg ; } catch ( InterruptedIOException e ) { throw new SoccomException ( SoccomException . RECV_ERROR ) ; } catch ( IOException e ) { throw new SoccomException ( SoccomException . RECV_ERROR ) ; } |
public class LocalityStats { /** * Peform the computation statistics based on a locality record .
* @ param record The locality information . */
private void computeStatistics ( Record record ) { } } | computeStatistics ( record . tip , record . host , record . inputBytes ) ; |
public class NumberFormat { /** * < strong > [ icu ] < / strong > Set a particular DisplayContext value in the formatter ,
* such as CAPITALIZATION _ FOR _ STANDALONE .
* @ param context The DisplayContext value to set . */
public void setContext ( DisplayContext context ) { } } | if ( context . type ( ) == DisplayContext . Type . CAPITALIZATION ) { capitalizationSetting = context ; } |
public class HeapCompactUnorderedSketch { /** * Constructs this sketch from correct , valid arguments .
* @ param cache in compact form
* @ param empty The correct < a href = " { @ docRoot } / resources / dictionary . html # empty " > Empty < / a > .
* @ param seedHash The correct
* < a href = " { @ docRoot } / resources / dictionary . html # seedHash " > Seed Hash < / a > .
* @ param curCount correct value
* @ param thetaLong The correct
* < a href = " { @ docRoot } / resources / dictionary . html # thetaLong " > thetaLong < / a > .
* @ return a CompactSketch */
static CompactSketch compact ( final long [ ] cache , final boolean empty , final short seedHash , final int curCount , final long thetaLong ) { } } | if ( ( curCount == 1 ) && ( thetaLong == Long . MAX_VALUE ) ) { return new SingleItemSketch ( cache [ 0 ] , seedHash ) ; } return new HeapCompactUnorderedSketch ( cache , empty , seedHash , curCount , thetaLong ) ; |
public class WorkflowServiceImpl { /** * Start a new workflow with StartWorkflowRequest , which allows task to be executed in a domain .
* @ param name Name of the workflow you want to start .
* @ param version Version of the workflow you want to start .
* @ param correlationId CorrelationID of the workflow you want to start .
* @ param input Input to the workflow you want to start .
* @ param externalInputPayloadStoragePath
* @ param taskToDomain
* @ param workflowDef - workflow definition
* @ return the id of the workflow instance that can be use for tracking . */
@ Service public String startWorkflow ( String name , Integer version , String correlationId , Map < String , Object > input , String externalInputPayloadStoragePath , Map < String , String > taskToDomain , WorkflowDef workflowDef ) { } } | if ( workflowDef == null ) { workflowDef = metadataService . getWorkflowDef ( name , version ) ; if ( workflowDef == null ) { throw new ApplicationException ( ApplicationException . Code . NOT_FOUND , String . format ( "No such workflow found by name: %s, version: %d" , name , version ) ) ; } return workflowExecutor . startWorkflow ( name , version , correlationId , input , externalInputPayloadStoragePath , null , taskToDomain ) ; } else { return workflowExecutor . startWorkflow ( workflowDef , input , externalInputPayloadStoragePath , correlationId , null , taskToDomain ) ; } |
public class Admin { /** * @ throws PageException */
private void doGetDefaultSecurityManager ( ) throws PageException { } } | ConfigServer cs = ConfigImpl . getConfigServer ( config , password ) ; SecurityManager dsm = cs . getDefaultSecurityManager ( ) ; _fillSecData ( dsm ) ; |
public class ResourceList { /** * Get the URLs of all resources in this list , by calling { @ link Resource # getURL ( ) } for each item in the list .
* @ return The URLs of all resources in this list . */
public List < URL > getURLs ( ) { } } | final List < URL > resourceURLs = new ArrayList < > ( this . size ( ) ) ; for ( final Resource resource : this ) { resourceURLs . add ( resource . getURL ( ) ) ; } return resourceURLs ; |
public class DefaultContextInteractionsSkill { /** * { @ inheritDoc } .
* @ deprecated see { @ link # willReceive ( UUID , Event ) } */
@ Deprecated @ Override public void receive ( UUID receiverID , Event event ) { } } | willReceive ( receiverID , event ) ; |
public class ObjectBindTransform { /** * / * ( non - Javadoc )
* @ see com . abubusoft . kripton . processor . bind . transform . BindTransform # generateSerializeOnXml ( com . abubusoft . kripton . processor . bind . BindTypeContext , com . squareup . javapoet . MethodSpec . Builder , java . lang . String , com . squareup . javapoet . TypeName , java . lang . String , com . abubusoft . kripton . processor . bind . model . BindProperty ) */
@ Override public void generateSerializeOnXml ( BindTypeContext context , MethodSpec . Builder methodBuilder , String serializerName , TypeName beanClass , String beanName , BindProperty property ) { } } | // TODO QUA
// TypeName typeName = resolveTypeName ( property . getParent ( ) ,
// property . getPropertyType ( ) . getTypeName ( ) ) ;
TypeName typeName = property . getPropertyType ( ) . getTypeName ( ) ; String bindName = context . getBindMapperName ( context , typeName ) ; // @ formatter : off
if ( property . isNullable ( ) && ! property . isInCollection ( ) ) { methodBuilder . beginControlFlow ( "if ($L!=null) " , getter ( beanName , beanClass , property ) ) ; } methodBuilder . addStatement ( "$L.writeStartElement($S)" , serializerName , BindProperty . xmlName ( property ) ) ; methodBuilder . addStatement ( "$L.serializeOnXml($L, xmlSerializer, $L)" , bindName , getter ( beanName , beanClass , property ) , XmlPullParser . START_TAG ) ; methodBuilder . addStatement ( "$L.writeEndElement()" , serializerName ) ; if ( property . isNullable ( ) && ! property . isInCollection ( ) ) { methodBuilder . endControlFlow ( ) ; } // @ formatter : on |
public class GroundyCodeGen { /** * Copy all callbacks implementations from - > to the specified set . It makes sure
* to copy the callbacks that don ' t exist already on the destination set .
* @ param from key for the set of callbacks to copy from
* @ param to key for the set of callbacks to copy to */
private void appendNonExistentCallbacks ( HandlerAndTask from , HandlerAndTask to ) { } } | final Set < ProxyImplContent > proxyImplContentsTo = implMap . get ( to ) ; if ( proxyImplContentsTo == null ) { return ; } final Set < ProxyImplContent > proxyImplContentsFrom = implMap . get ( from ) ; if ( proxyImplContentsFrom == null ) { return ; } for ( ProxyImplContent proxyImplContentFrom : proxyImplContentsFrom ) { boolean exists = false ; for ( ProxyImplContent proxyImplContentTo : proxyImplContentsTo ) { if ( proxyImplContentTo . annotation . equals ( proxyImplContentFrom . annotation ) ) { exists = true ; break ; } } if ( ! exists ) { proxyImplContentsTo . add ( proxyImplContentFrom ) ; } } |
public class ApiOvhDomain { /** * Delete a name server
* REST : DELETE / domain / { serviceName } / nameServer / { id }
* @ param serviceName [ required ] The internal name of your domain
* @ param id [ required ] Id of the object */
public net . minidev . ovh . api . domain . OvhTask serviceName_nameServer_id_DELETE ( String serviceName , Long id ) throws IOException { } } | String qPath = "/domain/{serviceName}/nameServer/{id}" ; StringBuilder sb = path ( qPath , serviceName , id ) ; String resp = exec ( qPath , "DELETE" , sb . toString ( ) , null ) ; return convertTo ( resp , net . minidev . ovh . api . domain . OvhTask . class ) ; |
public class Option { /** * 标题和副标题
* @ param text
* @ param subtext
* @ return */
public Option title ( String text , String subtext ) { } } | this . title ( ) . text ( text ) . subtext ( subtext ) ; return this ; |
public class TrajectoryEnvelope { /** * Returns a { @ link Geometry } representing the footprint of the robot in a given pose .
* @ param x The x coordinate of the pose used to create the footprint .
* @ param y The y coordinate of the pose used to create the footprint .
* @ param theta The orientation of the pose used to create the footprint .
* @ return A { @ link Geometry } representing the footprint of the robot in a given pose . */
public Geometry makeFootprint ( double x , double y , double theta ) { } } | AffineTransformation at = new AffineTransformation ( ) ; at . rotate ( theta ) ; at . translate ( x , y ) ; Geometry rect = at . transform ( footprint ) ; return rect ; |
public class DwrClientSideHandlerGeneratorImpl { /** * / * ( non - Javadoc )
* @ see net . jawr . web . resource . bundle . handler . ClientSideHandlerGeneratorImpl # getHeaderSection ( javax . servlet . http . HttpServletRequest ) */
protected StringBuffer getHeaderSection ( HttpServletRequest request ) { } } | StringBuffer sb = super . getHeaderSection ( request ) ; if ( null != this . config . getDwrMapping ( ) ) { sb . append ( DWRParamWriter . buildDWRJSParams ( request . getContextPath ( ) , PathNormalizer . joinPaths ( request . getContextPath ( ) , this . config . getDwrMapping ( ) ) ) ) ; sb . append ( "if(!window.DWR)window.DWR={};\nDWR.loader = JAWR.loader;\n" ) ; } return sb ; |
import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public class ReverseSubarray { /** * Function to reverse a portion of a list up to a particular position .
* > > > reverseSubarray ( [ 1 , 2 , 3 , 4 , 5 , 6 ] , 4)
* [ 4 , 3 , 2 , 1 , 5 , 6]
* > > > reverseSubarray ( [ 4 , 5 , 6 , 7 ] , 2)
* [ 5 , 4 , 6 , 7]
* > > > reverseSubarray ( [ 9 , 8 , 7 , 6 , 5 ] , 3)
* [ 7 , 8 , 9 , 6 , 5]
* Args :
* arr : List to be modified .
* until : Position up to which the list should be reversed .
* Returns :
* A list with its elements reversed up to the specified position . */
public static List < Integer > reverseSubarray ( List < Integer > arr , int until ) { } } | List < Integer > front = arr . subList ( 0 , until ) ; Collections . reverse ( front ) ; List < Integer > back = arr . subList ( until , arr . size ( ) ) ; front . addAll ( back ) ; return front ; |
public class APIAccessService { /** * Process the json API request
* @ param request
* @ param requestType POST or GET
* @ return the { @ link JSONObject } representation of the http response
* @ throws CertificateException
* @ throws IOException
* @ throws JSONException */
public String processHTTPAPIRequest ( String urlString , JSONObject request , GenericUser authenticationUser , String requestType , String [ ] requestParameters , String ... requestHedaers ) throws CertificateException , IOException , JSONException { } } | log . debug ( "API request: " + request . toString ( 4 ) ) ; String jsonRequest = request . toString ( ) ; HttpURLConnection ucon = null ; if ( "POST" . equals ( requestType ) ) { URL url = new URL ( urlString ) ; log . debug ( "API request: " + url ) ; ucon = ( HttpURLConnection ) url . openConnection ( ) ; ucon . setRequestMethod ( "POST" ) ; ucon . setRequestProperty ( "Content-Type" , "application/x-www-form-urlencoded" ) ; setRequestHeaders ( ucon , authenticationUser , requestHedaers ) ; for ( int i = 0 ; i < requestParameters . length ; i = i + 2 ) { ucon . setRequestProperty ( getReferenceService ( ) . namespaceString ( requestParameters [ i ] ) , getReferenceService ( ) . namespaceString ( requestParameters [ i + 1 ] ) ) ; } ucon . setUseCaches ( false ) ; ucon . setDoInput ( true ) ; ucon . setDoOutput ( true ) ; // Send request
String encodedPostRequest = "json=" + URLEncoder . encode ( jsonRequest , "UTF-8" ) ; ucon . setRequestProperty ( "Content-Length" , Integer . toString ( encodedPostRequest . getBytes ( ) . length ) ) ; DataOutputStream wr = new DataOutputStream ( ucon . getOutputStream ( ) ) ; wr . writeBytes ( encodedPostRequest ) ; wr . flush ( ) ; wr . close ( ) ; } else if ( "GET" . equals ( requestType ) ) { log . debug ( "API request: " + request . toString ( ) ) ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( urlString + "?json=" + URLEncoder . encode ( request . toString ( ) , "UTF-8" ) . replaceAll ( "\"" , "%22" ) ) ; for ( int i = 0 ; i < requestParameters . length ; i = i + 2 ) { builder . append ( "&" + getReferenceService ( ) . namespaceString ( requestParameters [ i ] ) + "=" + getReferenceService ( ) . namespaceString ( requestParameters [ i + 1 ] ) ) ; } URL url = new URL ( builder . toString ( ) ) ; log . debug ( "API request: " + url ) ; ucon = ( HttpURLConnection ) url . openConnection ( ) ; setRequestHeaders ( ucon , authenticationUser , requestHedaers ) ; ucon . setConnectTimeout ( 5000 ) ; ucon . setFollowRedirects ( true ) ; ucon . setDoOutput ( true ) ; } else { throw new IllegalArgumentException ( "Only POST and GET API requests are supported at this stage" ) ; } // Obtain the response
StringBuilder responseBuilder = new StringBuilder ( ) ; try { InputStream inputStream = ucon . getInputStream ( ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; String pre = null ; while ( ( pre = in . readLine ( ) ) != null ) { responseBuilder . append ( pre ) ; responseBuilder . append ( "\n" ) ; } in . close ( ) ; } catch ( IOException e ) { // on error codes we should not fail but just capture the response code
log . debug ( "Genarating the API call response caused: " , e ) ; } String response = responseBuilder . toString ( ) ; log . debug ( "The generated API call response: " + response ) ; getScenarioGlobals ( ) . setAttribute ( LAST_SCENARIO_HTTP_RESPONSE_CODE_KEY , ucon . getResponseCode ( ) ) ; return response ; |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getMappingOptionMapValue ( ) { } } | if ( mappingOptionMapValueEEnum == null ) { mappingOptionMapValueEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 91 ) ; } return mappingOptionMapValueEEnum ; |
public class ByteBufUtil { /** * Copies the all content of { @ code src } to a { @ link ByteBuf } using { @ link ByteBuf # writeBytes ( byte [ ] , int , int ) } .
* @ param src the source string to copy
* @ param dst the destination buffer */
public static void copy ( AsciiString src , ByteBuf dst ) { } } | copy ( src , 0 , dst , src . length ( ) ) ; |
public class OWLObjectComplementOfImpl_CustomFieldSerializer { /** * Serializes the content of the object into the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } .
* @ param streamWriter the { @ link com . google . gwt . user . client . rpc . SerializationStreamWriter } to write the
* object ' s content to
* @ param instance the object instance to serialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the serialization operation is not
* successful */
@ Override public void serializeInstance ( SerializationStreamWriter streamWriter , OWLObjectComplementOfImpl instance ) throws SerializationException { } } | serialize ( streamWriter , instance ) ; |
public class DefaultRaftMember { /** * Demotes the server to the given type . */
private CompletableFuture < Void > configure ( RaftMember . Type type ) { } } | if ( type == this . type ) { return CompletableFuture . completedFuture ( null ) ; } CompletableFuture < Void > future = new CompletableFuture < > ( ) ; cluster . getContext ( ) . getThreadContext ( ) . execute ( ( ) -> configure ( type , future ) ) ; return future ; |
public class SSLConfigManager { /** * Helper method to build the SSLConfig properties from the SecureSocketLayer
* model object ( s ) .
* @ param map
* @ param reinitialize
* @ return SSLConfig
* @ throws Exception */
private SSLConfig parseSecureSocketLayer ( Map < String , Object > map , boolean reinitialize ) throws Exception { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "parseSecureSocketLayer" ) ; SSLConfig sslprops = new SSLConfig ( ) ; // READ KEYSTORE OBJECT ( S )
WSKeyStore wsks_key = null ; String keyStoreName = ( String ) map . get ( LibertyConstants . KEY_KEYSTORE_REF ) ; if ( null != keyStoreName ) { wsks_key = KeyStoreManager . getInstance ( ) . getKeyStore ( keyStoreName ) ; } if ( wsks_key != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Adding keystore properties from KeyStore object." ) ; sslprops . setProperty ( Constants . SSLPROP_KEY_STORE_NAME , keyStoreName ) ; addSSLPropertiesFromKeyStore ( wsks_key , sslprops ) ; } String trustStoreName = ( String ) map . get ( LibertyConstants . KEY_TRUSTSTORE_REF ) ; WSKeyStore wsks_trust = null ; if ( null != trustStoreName ) { wsks_trust = KeyStoreManager . getInstance ( ) . getKeyStore ( trustStoreName ) ; } else { trustStoreName = ( String ) map . get ( LibertyConstants . KEY_KEYSTORE_REF ) ; wsks_trust = wsks_key ; } if ( wsks_trust != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Adding truststore properties from KeyStore object." ) ; sslprops . setProperty ( Constants . SSLPROP_TRUST_STORE_NAME , trustStoreName ) ; addSSLPropertiesFromTrustStore ( wsks_trust , sslprops ) ; } // KEY MANAGER
String defaultkeyManager = JSSEProviderFactory . getKeyManagerFactoryAlgorithm ( ) ; if ( defaultkeyManager != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Setting default KeyManager: " + defaultkeyManager ) ; sslprops . setProperty ( Constants . SSLPROP_KEY_MANAGER , defaultkeyManager ) ; } // TRUST MANAGERS
String defaultTrustManager = JSSEProviderFactory . getTrustManagerFactoryAlgorithm ( ) ; if ( defaultTrustManager != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Setting default TrustManager: " + defaultTrustManager ) ; sslprops . setProperty ( Constants . SSLPROP_TRUST_MANAGER , defaultTrustManager ) ; } // MISCELLANEOUS ATTRIBUTES
String sslProtocol = ( String ) map . get ( "sslProtocol" ) ; if ( sslProtocol != null && ! sslProtocol . isEmpty ( ) ) sslprops . setProperty ( Constants . SSLPROP_PROTOCOL , sslProtocol ) ; String contextProvider = ( String ) map . get ( "jsseProvider" ) ; if ( contextProvider != null && ! contextProvider . isEmpty ( ) ) { // setting IBMJSSE2 since IBMJSSE and IBMJSSEFIPS is not supported any
// longer
if ( contextProvider . equalsIgnoreCase ( Constants . IBMJSSE_NAME ) || contextProvider . equalsIgnoreCase ( Constants . IBMJSSEFIPS_NAME ) ) { contextProvider = Constants . IBMJSSE2_NAME ; } sslprops . setProperty ( Constants . SSLPROP_CONTEXT_PROVIDER , contextProvider ) ; } Boolean clientAuth = ( Boolean ) map . get ( "clientAuthentication" ) ; if ( null != clientAuth ) { sslprops . setProperty ( Constants . SSLPROP_CLIENT_AUTHENTICATION , clientAuth . toString ( ) ) ; } Boolean clientAuthSup = ( Boolean ) map . get ( "clientAuthenticationSupported" ) ; if ( null != clientAuthSup ) { sslprops . setProperty ( Constants . SSLPROP_CLIENT_AUTHENTICATION_SUPPORTED , clientAuthSup . toString ( ) ) ; } String prop = ( String ) map . get ( "securityLevel" ) ; if ( null != prop && ! prop . isEmpty ( ) ) { sslprops . setProperty ( Constants . SSLPROP_SECURITY_LEVEL , prop ) ; } prop = ( String ) map . get ( "clientKeyAlias" ) ; if ( null != prop && ! prop . isEmpty ( ) ) { sslprops . setProperty ( Constants . SSLPROP_KEY_STORE_CLIENT_ALIAS , prop ) ; } prop = ( String ) map . get ( "serverKeyAlias" ) ; if ( null != prop && ! prop . isEmpty ( ) ) { sslprops . setProperty ( Constants . SSLPROP_KEY_STORE_SERVER_ALIAS , prop ) ; } prop = ( String ) map . get ( "enabledCiphers" ) ; if ( null != prop && ! prop . isEmpty ( ) ) { sslprops . setProperty ( Constants . SSLPROP_ENABLED_CIPHERS , prop ) ; } prop = ( String ) map . get ( "id" ) ; if ( null != prop && ! prop . isEmpty ( ) ) { sslprops . setProperty ( Constants . SSLPROP_ALIAS , prop ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Saving SSLConfig: " + sslprops ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "parseSecureSocketLayer" ) ; return sslprops ; |
public class BitSet { /** * Sets a bit and returns the previous value . The index should be less than the BitSet
* size .
* @ param index the index to set
* @ return previous state of the index */
public boolean getAndSet ( int index ) { } } | int wordNum = index >> 6 ; // div 64
int bit = index & 0x3f ; // mod 64
long bitmask = 1L << bit ; boolean val = ( bits [ wordNum ] & bitmask ) != 0 ; bits [ wordNum ] |= bitmask ; return val ; |
public class AmazonConfigClient { /** * Accepts a resource type and returns a list of resource identifiers that are aggregated for a specific resource
* type across accounts and regions . A resource identifier includes the resource type , ID , ( if available ) the custom
* resource name , source account , and source region . You can narrow the results to include only resources that have
* specific resource IDs , or a resource name , or source account ID , or source region .
* For example , if the input consists of accountID 12345678910 and the region is us - east - 1 for resource type
* < code > AWS : : EC2 : : Instance < / code > then the API returns all the EC2 instance identifiers of accountID 12345678910
* and region us - east - 1.
* @ param listAggregateDiscoveredResourcesRequest
* @ return Result of the ListAggregateDiscoveredResources operation returned by the service .
* @ throws ValidationException
* The requested action is not valid .
* @ throws InvalidLimitException
* The specified limit is outside the allowable range .
* @ throws InvalidNextTokenException
* The specified next token is invalid . Specify the < code > nextToken < / code > string that was returned in the
* previous response to get the next page of results .
* @ throws NoSuchConfigurationAggregatorException
* You have specified a configuration aggregator that does not exist .
* @ sample AmazonConfig . ListAggregateDiscoveredResources
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / config - 2014-11-12 / ListAggregateDiscoveredResources "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListAggregateDiscoveredResourcesResult listAggregateDiscoveredResources ( ListAggregateDiscoveredResourcesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListAggregateDiscoveredResources ( request ) ; |
public class SimpleFormValidator { /** * Validates if given button ( usually checkbox ) is checked . Use VisCheckBox to additionally support error border around it . */
public void checked ( Button button , String errorMsg ) { } } | buttons . add ( new CheckedButtonWrapper ( button , true , errorMsg ) ) ; button . addListener ( changeListener ) ; validate ( ) ; |
public class NodeUtil { /** * Copy any annotations that follow a named value .
* @ param source
* @ param destination */
static void copyNameAnnotations ( Node source , Node destination ) { } } | if ( source . getBooleanProp ( Node . IS_CONSTANT_NAME ) ) { destination . putBooleanProp ( Node . IS_CONSTANT_NAME , true ) ; } |
public class V1InstanceCreator { /** * Create a new member entity with a name , short name , and default role .
* @ param name The full name of the user .
* @ param shortName An alias or nickname used throughout the VersionOne user
* interface .
* @ param defaultRole The new user ' s default role on projects .
* @ param attributes additional attributes for the Member .
* @ return A newly minted Member that exists in the VersionOne system . */
public Member member ( String name , String shortName , Role defaultRole , Map < String , Object > attributes ) { } } | Member member = new Member ( instance ) ; member . setName ( name ) ; member . setShortName ( shortName ) ; member . setDefaultRole ( defaultRole ) ; addAttributes ( member , attributes ) ; member . save ( ) ; return member ; |
public class Decoration { /** * Basic construction . Only the data is required */
public static < T > Decoration < T > of ( Decorator < T > decorator , T data ) { } } | Validate . notNull ( decorator , "The decorator is required" ) ; Validate . notNull ( data , "The decoration data is required" ) ; return new Decoration < > ( decorator , data , null ) ; |
public class AWSGlueClient { /** * Retrieves metadata for all runs of a given job definition .
* @ param getJobRunsRequest
* @ return Result of the GetJobRuns operation returned by the service .
* @ throws InvalidInputException
* The input provided was not valid .
* @ throws EntityNotFoundException
* A specified entity does not exist
* @ throws InternalServiceException
* An internal service error occurred .
* @ throws OperationTimeoutException
* The operation timed out .
* @ sample AWSGlue . GetJobRuns
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / glue - 2017-03-31 / GetJobRuns " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public GetJobRunsResult getJobRuns ( GetJobRunsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetJobRuns ( request ) ; |
public class SpiceServiceListenerNotifier { /** * Notify interested observers of request completion .
* @ param request the request that has completed .
* @ param requestListeners the listeners to notify . */
public void notifyObserversOfRequestProcessed ( CachedSpiceRequest < ? > request , Set < RequestListener < ? > > requestListeners ) { } } | RequestProcessingContext requestProcessingContext = new RequestProcessingContext ( ) ; requestProcessingContext . setExecutionThread ( Thread . currentThread ( ) ) ; requestProcessingContext . setRequestListeners ( requestListeners ) ; post ( new RequestProcessedNotifier ( request , spiceServiceListenerList , requestProcessingContext ) ) ; |
public class BootstrapContextImpl { /** * Configure a managed connection factory , admin object , or activation spec .
* Resource adapter config properties are also configured on the instance
* if they are valid for the type of object and haven ' t already been configured .
* @ param instance managed connection factory , admin object , or activation spec instance .
* @ param id name identifying the resource .
* @ param configProps config properties .
* @ param activationProps activation config properties from the container . Null if not configuring an activation spec .
* @ param adminObjSvc from the MEF may be passed when activation spec is to be configured , otherwise null .
* @ param destinationRef reference to the AdminObjectService for the destination that is configured on the activation spec . Otherwise null .
* @ throws Exception if an error occurs . */
@ FFDCIgnore ( value = { } } | NumberFormatException . class , Throwable . class } ) public void configure ( Object instance , String id , Map < String , ? > configProps , @ Sensitive Map < String , Object > activationProps , AdminObjectService adminObjSvc , AtomicServiceReference < AdminObjectService > destinationRef ) throws Exception { final String methodName = "configure" ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , methodName , instance , id , configProps , activationProps , adminObjSvc , destinationRef ) ; if ( instance instanceof ResourceAdapterAssociation && resourceAdapter != null ) ( ( ResourceAdapterAssociation ) instance ) . setResourceAdapter ( resourceAdapter ) ; // Assume all configured properties are invalid until we find them
Set < String > invalidPropNames = new HashSet < String > ( configProps . keySet ( ) ) ; if ( activationProps != null ) invalidPropNames . addAll ( activationProps . keySet ( ) ) ; Class < ? > objectClass = instance . getClass ( ) ; for ( PropertyDescriptor descriptor : Introspector . getBeanInfo ( objectClass ) . getPropertyDescriptors ( ) ) { Method writeMethod = descriptor . getWriteMethod ( ) ; Class < ? > type = descriptor . getPropertyType ( ) ; String name = MetatypeGenerator . toCamelCase ( descriptor . getName ( ) ) ; Object value = null ; if ( activationProps != null ) { // be tolerant of activation config properties using either form
value = activationProps . get ( name ) ; if ( value == null ) value = activationProps . get ( descriptor . getName ( ) ) ; } try { if ( value == null ) { value = configProps . get ( name ) ; if ( value == null && writeMethod != null ) { PropertyDescriptor raPropDescriptor = propertyDescriptors . get ( name ) ; Method getter = raPropDescriptor == null ? null : raPropDescriptor . getReadMethod ( ) ; value = getter == null ? properties . get ( name ) : getter . invoke ( resourceAdapter ) ; } } if ( value != null ) invalidPropNames . remove ( name ) ; // Special case : destination on activationSpec or activation config properties
if ( EndpointActivationService . DESTINATION . equals ( name ) ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "name, value before getDestination" , name , value ) ; value = getDestination ( value , type , ( String ) configProps . get ( "destinationType" ) , destinationRef , // From server activationSpec
activationProps , adminObjSvc ) ; // from MDB runtime
if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "value after getDestination" , value ) ; } if ( value != null ) { boolean isProtectedString = value instanceof SerializableProtectedString ; if ( isProtectedString ) value = new String ( ( ( SerializableProtectedString ) value ) . getChars ( ) ) ; if ( value instanceof String && name . toUpperCase ( ) . indexOf ( "PASSWORD" ) >= 0 ) { value = PasswordUtil . getCryptoAlgorithm ( ( String ) value ) == null ? value : PasswordUtil . decode ( ( String ) value ) ; isProtectedString = true ; // Recommend using authentication alias instead if password is configured on a connection factory or activation spec
if ( name . length ( ) == 8 && ( instance instanceof ManagedConnectionFactory || activationProps != null && ! activationProps . containsKey ( EndpointActivationService . PASSWORD ) ) ) ConnectorService . logMessage ( Level . INFO , "RECOMMEND_AUTH_ALIAS_J2CA8050" , id ) ; } if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "set " + name + '=' + ( isProtectedString ? "***" : value ) ) ; // Some ra . xml files specify everything as String even when that ' s not true . If so , try to convert it :
if ( value instanceof String ) { if ( ! type . isAssignableFrom ( value . getClass ( ) ) ) if ( SSLSocketFactory . class . equals ( type ) ) { BundleContext bundleContext = Utils . priv . getBundleContext ( componentContext ) ; ServiceReference < SSLHelper > sslHelperRef = Utils . priv . getServiceReference ( bundleContext , SSLHelper . class ) ; SSLHelper sslHelper = Utils . priv . getService ( bundleContext , SSLHelper . class ) ; try { value = sslHelper . getSSLSocketFactory ( ( String ) value ) ; } finally { bundleContext . ungetService ( sslHelperRef ) ; } } else try { value = Utils . convert ( ( String ) value , type ) ; } catch ( NumberFormatException numFormatX ) { // If the property type can ' t be converted to what the bean info wants ,
// then go looking for a matching method of the proper type ( that isn ' t on the bean info ) .
try { writeMethod = objectClass . getMethod ( writeMethod . getName ( ) , String . class ) ; } catch ( NoSuchMethodException x ) { throw numFormatX ; } } } // Allow the metatype to use primitive types instead of String , in which case we can easily convert to String :
else if ( String . class . equals ( type ) ) value = value . toString ( ) ; // When ibm : type = " duration " is used , we always get Long . If necessary , convert to another numeric type :
else if ( value instanceof Number && ! type . isAssignableFrom ( value . getClass ( ) ) ) value = Utils . convert ( ( Number ) value , type ) ; writeMethod . invoke ( instance , value ) ; } } catch ( Throwable x ) { x = x instanceof InvocationTargetException ? x . getCause ( ) : x ; x = Utils . ignoreWarnOrFail ( tc , x , x . getClass ( ) , "J2CA8500.config.prop.error" , name , id , objectClass . getName ( ) , x ) ; if ( x != null ) { InvalidPropertyException propX = x instanceof InvalidPropertyException ? ( InvalidPropertyException ) x : new InvalidPropertyException ( name , x ) ; propX . setInvalidPropertyDescriptors ( new PropertyDescriptor [ ] { descriptor } ) ; FFDCFilter . processException ( propX , getClass ( ) . getName ( ) , "134" ) ; throw propX ; } } } // Invalid properties
for ( String name : invalidPropNames ) { InvalidPropertyException x = Utils . ignoreWarnOrFail ( tc , null , InvalidPropertyException . class , "J2CA8501.config.prop.unknown" , name , id , objectClass . getName ( ) ) ; if ( x != null ) { FFDCFilter . processException ( x , Utils . class . getName ( ) , "146" ) ; throw x ; } } if ( bvalHelper != null ) { ComponentMetaData cmd = ComponentMetaDataAccessorImpl . getComponentMetaDataAccessor ( ) . getComponentMetaData ( ) ; if ( cmd != null ) { bvalHelper . validateInstance ( cmd . getModuleMetaData ( ) , resourceAdapterSvc . getClassLoader ( ) , instance ) ; } } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , methodName ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcDefinedSymbolSelect ( ) { } } | if ( ifcDefinedSymbolSelectEClass == null ) { ifcDefinedSymbolSelectEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 950 ) ; } return ifcDefinedSymbolSelectEClass ; |
public class DescribeAddressesResult { /** * Information about the Elastic IP addresses .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setAddresses ( java . util . Collection ) } or { @ link # withAddresses ( java . util . Collection ) } if you want to
* override the existing values .
* @ param addresses
* Information about the Elastic IP addresses .
* @ return Returns a reference to this object so that method calls can be chained together . */
public DescribeAddressesResult withAddresses ( Address ... addresses ) { } } | if ( this . addresses == null ) { setAddresses ( new com . amazonaws . internal . SdkInternalList < Address > ( addresses . length ) ) ; } for ( Address ele : addresses ) { this . addresses . add ( ele ) ; } return this ; |
public class SparseMatrix { /** * Put item to the matrix in row , column position .
* @ param row item row position
* @ param column item column position
* @ param item Object */
void put ( int row , int column , @ NonNull TObj item ) { } } | SparseArrayCompat < TObj > array = mData . get ( row ) ; if ( array == null ) { array = new SparseArrayCompat < > ( ) ; array . put ( column , item ) ; mData . put ( row , array ) ; } else { array . put ( column , item ) ; } |
public class SCMS { /** * Parses { @ link SCM } configuration from the submitted form .
* @ param target
* The project for which this SCM is configured to . */
@ SuppressWarnings ( "deprecation" ) public static SCM parseSCM ( StaplerRequest req , AbstractProject target ) throws FormException , ServletException { } } | SCM scm = SCM . all ( ) . newInstanceFromRadioList ( req . getSubmittedForm ( ) . getJSONObject ( "scm" ) ) ; if ( scm == null ) { scm = new NullSCM ( ) ; // JENKINS - 36043 workaround for AbstractMultiBranchProject . submit
} scm . getDescriptor ( ) . generation ++ ; return scm ; |
public class GeneralFeatureDetector { /** * Computes point features from image gradients .
* @ param image Original image .
* @ param derivX image derivative in along the x - axis . Only needed if { @ link # getRequiresGradient ( ) } is true .
* @ param derivY image derivative in along the y - axis . Only needed if { @ link # getRequiresGradient ( ) } is true .
* @ param derivXX Second derivative . Only needed if { @ link # getRequiresHessian ( ) } ( ) } is true .
* @ param derivXY Second derivative . Only needed if { @ link # getRequiresHessian ( ) } ( ) } is true .
* @ param derivYY Second derivative . Only needed if { @ link # getRequiresHessian ( ) } ( ) } is true . */
public void process ( I image , D derivX , D derivY , D derivXX , D derivYY , D derivXY ) { } } | intensity . process ( image , derivX , derivY , derivXX , derivYY , derivXY ) ; GrayF32 intensityImage = intensity . getIntensity ( ) ; int numSelectMin = - 1 ; int numSelectMax = - 1 ; if ( maxFeatures > 0 ) { if ( intensity . localMinimums ( ) ) numSelectMin = excludeMinimum == null ? maxFeatures : maxFeatures - excludeMinimum . size ; if ( intensity . localMaximums ( ) ) numSelectMax = excludeMaximum == null ? maxFeatures : maxFeatures - excludeMaximum . size ; // return without processing if there is no room to detect any more features
if ( numSelectMin <= 0 && numSelectMax <= 0 ) return ; } // mark pixels that should be excluded
if ( excludeMinimum != null ) { for ( int i = 0 ; i < excludeMinimum . size ; i ++ ) { Point2D_I16 p = excludeMinimum . get ( i ) ; intensityImage . set ( p . x , p . y , - Float . MAX_VALUE ) ; } } if ( excludeMaximum != null ) { for ( int i = 0 ; i < excludeMaximum . size ; i ++ ) { Point2D_I16 p = excludeMaximum . get ( i ) ; intensityImage . set ( p . x , p . y , Float . MAX_VALUE ) ; } } foundMinimum . reset ( ) ; foundMaximum . reset ( ) ; if ( intensity . hasCandidates ( ) ) { extractor . process ( intensityImage , intensity . getCandidatesMin ( ) , intensity . getCandidatesMax ( ) , foundMinimum , foundMaximum ) ; } else { extractor . process ( intensityImage , null , null , foundMinimum , foundMaximum ) ; } // optionally select the most intense features only
selectBest ( intensityImage , foundMinimum , numSelectMin , false ) ; selectBest ( intensityImage , foundMaximum , numSelectMax , true ) ; |
public class SparseSquareMatrix { /** * return C = A + B
* @ param B
* @ return */
public SparseSquareMatrix plus ( SparseSquareMatrix B ) { } } | SparseSquareMatrix A = this ; if ( A . N != B . N ) throw new IllegalArgumentException ( "Dimensions disagree. " + A . N + " != " + B . N ) ; SparseSquareMatrix C = new SparseSquareMatrix ( N ) ; for ( int i = 0 ; i < N ; i ++ ) C . rows [ i ] = A . rows [ i ] . plus ( B . rows [ i ] ) ; return C ; |
public class ResourceUtils { /** * Finds the resource directory for an instance .
* The resource directory may be the one of another component .
* This is the case when a component extends another component .
* An extending component can override the resource directory .
* @ param applicationFilesDirectory the application ' s directory
* @ param component a component ( may be null )
* @ return a non - null file ( that may not exist ) */
public static File findInstanceResourcesDirectory ( File applicationFilesDirectory , Component component ) { } } | File root = new File ( applicationFilesDirectory , Constants . PROJECT_DIR_GRAPH ) ; File result = new File ( "No recipe directory." ) ; Set < Component > alreadyChecked = new HashSet < > ( ) ; for ( Component c = component ; c != null ; c = c . getExtendedComponent ( ) ) { // Prevent infinite loops for exotic cases
if ( alreadyChecked . contains ( c ) ) break ; alreadyChecked . add ( c ) ; if ( ( result = new File ( root , c . getName ( ) ) ) . exists ( ) ) break ; } return result ; |
public class CloseableIterators { /** * Combines multiple iterators into a single closeable iterator . The returned
* closeable iterator iterates across the elements of each iterator in { @ code inputs } .
* The input iterators are not polled until necessary . */
public static < T > CloseableIterator < T > concat ( final CloseableIterator < ? extends Iterator < ? extends T > > iterators ) { } } | return wrap ( Iterators . concat ( iterators ) , iterators ) ; |
public class EJBMDOrchestrator { /** * Process any role links that have been established . We
* will create a HashMap linking these role - links ( if any ) to
* their corresponding roles . This information is needed during
* isCallerInRole processing .
* @ param bmd BeanMetaData for the specific Enterprise Bean */
private void processSecurityRoleLink ( BeanMetaData bmd ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "processSecurityRoleLink" ) ; } EnterpriseBean ejbBean = bmd . wccm . enterpriseBean ; if ( ejbBean != null ) { // get security - role - ref if any
// The role name in thesecurity - role - ref is not really a role name ,
// it is a seudo name that is to be linked to the " real "
// role name that is in the role - link stanza / / 429623
for ( SecurityRoleRef roleRef : ejbBean . getSecurityRoleRefs ( ) ) { String link = roleRef . getLink ( ) ; if ( link != null ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "role-ref = " + roleRef . getName ( ) + " role-link = " + link ) ; // create a new HashMap only when needed .
if ( bmd . ivRoleLinkMap == null ) { bmd . ivRoleLinkMap = new HashMap < String , String > ( ) ; } bmd . ivRoleLinkMap . put ( roleRef . getName ( ) , link ) ; } } } // if ( ejbBean ! = null )
if ( isTraceOn && tc . isEntryEnabled ( ) ) { if ( bmd . ivRoleLinkMap == null ) { Tr . exit ( tc , "processSecurityRoleLink: no role-link elements found." ) ; } else { Tr . exit ( tc , "processSecurityRoleLink: " + bmd . ivRoleLinkMap . toString ( ) ) ; } } |
public class NettyConnection { /** * Reads an error from the given buffer . */
private Throwable readError ( ByteBuf buffer ) { } } | return context . serializer ( ) . readObject ( INPUT . get ( ) . setByteBuf ( buffer ) ) ; |
public class AWSLambdaClient { /** * Modify the version - specific settings of a Lambda function .
* These settings can vary between versions of a function and are locked when you publish a version . You can ' t
* modify the configuration of a published version , only the unpublished version .
* To configure function concurrency , use < a > PutFunctionConcurrency < / a > . To grant invoke permissions to an account
* or AWS service , use < a > AddPermission < / a > .
* @ param updateFunctionConfigurationRequest
* @ return Result of the UpdateFunctionConfiguration operation returned by the service .
* @ throws ServiceException
* The AWS Lambda service encountered an internal error .
* @ throws ResourceNotFoundException
* The resource ( for example , a Lambda function or access policy statement ) specified in the request does
* not exist .
* @ throws InvalidParameterValueException
* One of the parameters in the request is invalid . For example , if you provided an IAM role for AWS Lambda
* to assume in the < code > CreateFunction < / code > or the < code > UpdateFunctionConfiguration < / code > API , that
* AWS Lambda is unable to assume you will get this exception .
* @ throws TooManyRequestsException
* Request throughput limit exceeded .
* @ throws ResourceConflictException
* The resource already exists .
* @ throws PreconditionFailedException
* The RevisionId provided does not match the latest RevisionId for the Lambda function or alias . Call the
* < code > GetFunction < / code > or the < code > GetAlias < / code > API to retrieve the latest RevisionId for your
* resource .
* @ sample AWSLambda . UpdateFunctionConfiguration
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lambda - 2015-03-31 / UpdateFunctionConfiguration "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateFunctionConfigurationResult updateFunctionConfiguration ( UpdateFunctionConfigurationRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateFunctionConfiguration ( request ) ; |
public class GrailsDomainBinder { /** * Binds a joined sub - class mapping using table - per - subclass
* @ param sub The Grails sub class
* @ param joinedSubclass The Hibernate Subclass object
* @ param mappings The mappings Object
* @ param gormMapping The GORM mapping object
* @ param sessionFactoryBeanName the session factory bean name */
protected void bindJoinedSubClass ( HibernatePersistentEntity sub , JoinedSubclass joinedSubclass , InFlightMetadataCollector mappings , Mapping gormMapping , String sessionFactoryBeanName ) { } } | bindClass ( sub , joinedSubclass , mappings ) ; String schemaName = getSchemaName ( mappings ) ; String catalogName = getCatalogName ( mappings ) ; Table mytable = mappings . addTable ( schemaName , catalogName , getJoinedSubClassTableName ( sub , joinedSubclass , null , mappings , sessionFactoryBeanName ) , null , false ) ; joinedSubclass . setTable ( mytable ) ; LOG . info ( "Mapping joined-subclass: " + joinedSubclass . getEntityName ( ) + " -> " + joinedSubclass . getTable ( ) . getName ( ) ) ; SimpleValue key = new DependantValue ( metadataBuildingContext , mytable , joinedSubclass . getIdentifier ( ) ) ; joinedSubclass . setKey ( key ) ; final PersistentProperty identifier = sub . getIdentity ( ) ; String columnName = getColumnNameForPropertyAndPath ( identifier , EMPTY_PATH , null , sessionFactoryBeanName ) ; bindSimpleValue ( identifier . getType ( ) . getName ( ) , key , false , columnName , mappings ) ; joinedSubclass . createPrimaryKey ( ) ; // properties
createClassProperties ( sub , joinedSubclass , mappings , sessionFactoryBeanName ) ; |
public class FastAggregation { /** * Minimizes memory usage while computing the xor aggregate on a moderate number of bitmaps .
* This function runs in linearithmic ( O ( n log n ) ) time with respect to the number of bitmaps .
* @ param bitmaps input bitmaps
* @ return aggregated bitmap
* @ see # xor ( RoaringBitmap . . . ) */
public static RoaringBitmap horizontal_xor ( RoaringBitmap ... bitmaps ) { } } | RoaringBitmap answer = new RoaringBitmap ( ) ; if ( bitmaps . length == 0 ) { return answer ; } PriorityQueue < ContainerPointer > pq = new PriorityQueue < > ( bitmaps . length ) ; for ( int k = 0 ; k < bitmaps . length ; ++ k ) { ContainerPointer x = bitmaps [ k ] . highLowContainer . getContainerPointer ( ) ; if ( x . getContainer ( ) != null ) { pq . add ( x ) ; } } while ( ! pq . isEmpty ( ) ) { ContainerPointer x1 = pq . poll ( ) ; if ( pq . isEmpty ( ) || ( pq . peek ( ) . key ( ) != x1 . key ( ) ) ) { answer . highLowContainer . append ( x1 . key ( ) , x1 . getContainer ( ) . clone ( ) ) ; x1 . advance ( ) ; if ( x1 . getContainer ( ) != null ) { pq . add ( x1 ) ; } continue ; } ContainerPointer x2 = pq . poll ( ) ; Container newc = x1 . getContainer ( ) . xor ( x2 . getContainer ( ) ) ; while ( ! pq . isEmpty ( ) && ( pq . peek ( ) . key ( ) == x1 . key ( ) ) ) { ContainerPointer x = pq . poll ( ) ; newc = newc . ixor ( x . getContainer ( ) ) ; x . advance ( ) ; if ( x . getContainer ( ) != null ) { pq . add ( x ) ; } else if ( pq . isEmpty ( ) ) { break ; } } answer . highLowContainer . append ( x1 . key ( ) , newc ) ; x1 . advance ( ) ; if ( x1 . getContainer ( ) != null ) { pq . add ( x1 ) ; } x2 . advance ( ) ; if ( x2 . getContainer ( ) != null ) { pq . add ( x2 ) ; } } return answer ; |
public class FakeTable { /** * Init this table .
* Add this table to the database and hook this table to the record .
* @ param database The database to add this table to .
* @ param record The record to connect to this table . */
public void init ( BaseDatabase database , Record record ) { } } | super . init ( database , record ) ; m_databaseFake = m_database ; m_database = this . getSharedTable ( ) . getDatabase ( ) ; // Return the correct database |
public class SimpleDataArrayCompactor { /** * Frees segments that were compacted successfully . */
private void freeCompactedSegments ( ) { } } | SegmentManager segManager = _dataArray . getSegmentManager ( ) ; if ( segManager == null ) return ; while ( ! _freeQueue . isEmpty ( ) ) { Segment seg = _freeQueue . remove ( ) ; try { segManager . freeSegment ( seg ) ; } catch ( Exception e ) { _log . error ( "failed to free Segment " + seg . getSegmentId ( ) + ": " + seg . getStatus ( ) , e ) ; } } |
public class SDVariable { /** * Max norm ( infinity norm ) reduction operation : The output contains the max norm for each tensor / subset along the
* specified dimensions : < br >
* { @ code out = max ( abs ( x [ i ] ) ) } < br >
* Note that if keepDims = true , the output variable has the same rank as the input variable ,
* with the reduced dimensions having size 1 . This can be useful for later broadcast operations ( such as subtracting
* the mean along a dimension ) . < br >
* Example : if input has shape [ a , b , c ] and dimensions = [ 1 ] then output has shape :
* keepDims = true : [ a , 1 , c ] < br >
* keepDims = false : [ a , c ]
* @ param name Output variable name
* @ param keepDims If true : keep the dimensions that are reduced on ( as size 1 ) . False : remove the reduction dimensions
* @ param dimensions dimensions to reduce over
* @ return Output variable */
public SDVariable normmax ( String name , boolean keepDims , int ... dimensions ) { } } | return sameDiff . normmax ( name , this , keepDims , dimensions ) ; |
public class JsonObject { /** * Appends a new member to the end of this object , with the specified name and the specified JSON value .
* This method < strong > does not prevent duplicate names < / strong > . Calling this method with a name that already exists
* in the object will append another member with the same name . In order to replace existing members , use the method
* < code > set ( name , value ) < / code > instead . However , < strong > < em > add < / em > is much faster than < em > set < / em > < / strong >
* ( because it does not need to search for existing members ) . Therefore < em > add < / em > should be preferred when
* constructing new objects .
* @ param name
* the name of the member to add
* @ param value
* the value of the member to add , must not be < code > null < / code >
* @ return the object itself , to enable method chaining */
public JsonObject add ( String name , JsonValue value ) { } } | if ( name == null ) { throw new NullPointerException ( NAME_IS_NULL ) ; } if ( value == null ) { throw new NullPointerException ( VALUE_IS_NULL ) ; } table . add ( name , names . size ( ) ) ; names . add ( name ) ; values . add ( value ) ; return this ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.