signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class XMLConverter { /** * serialize a Query
* @ param query Query to serialize
* @ param done
* @ return serialized query
* @ throws ConverterException */
private String _serializeQuery ( Query query , Map < Object , String > done , String id ) throws ConverterException { } } | /* * < QUERY ID = " 1 " > < COLUMNNAMES > < COLUMN NAME = " a " > < / COLUMN > < COLUMN NAME = " b " > < / COLUMN > < / COLUMNNAMES >
* < ROWS > < ROW > < COLUMN TYPE = " STRING " > a1 < / COLUMN > < COLUMN TYPE = " STRING " > b1 < / COLUMN > < / ROW > < ROW >
* < COLUMN TYPE = " STRING " > a2 < / COLUMN > < COLUMN TYPE = " STRING " > b2 < / COLUMN > < / ROW > < / ROWS > < / QUERY > */
Collection . Key [ ] keys = CollectionUtil . keys ( query ) ; StringBuilder sb = new StringBuilder ( goIn ( ) + "<QUERY ID=\"" + id + "\">" ) ; // columns
sb . append ( goIn ( ) + "<COLUMNNAMES>" ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { sb . append ( goIn ( ) + "<COLUMN NAME=\"" + keys [ i ] . getString ( ) + "\"></COLUMN>" ) ; } sb . append ( goIn ( ) + "</COLUMNNAMES>" ) ; String value ; deep ++ ; sb . append ( goIn ( ) + "<ROWS>" ) ; int len = query . getRecordcount ( ) ; for ( int row = 1 ; row <= len ; row ++ ) { sb . append ( goIn ( ) + "<ROW>" ) ; for ( int col = 0 ; col < keys . length ; col ++ ) { try { value = _serialize ( query . getAt ( keys [ col ] , row ) , done ) ; } catch ( PageException e ) { value = _serialize ( e . getMessage ( ) , done ) ; } sb . append ( "<COLUMN TYPE=\"" + type + "\">" + value + "</COLUMN>" ) ; } sb . append ( goIn ( ) + "</ROW>" ) ; } sb . append ( goIn ( ) + "</ROWS>" ) ; deep -- ; sb . append ( goIn ( ) + "</QUERY>" ) ; type = "QUERY" ; return sb . toString ( ) ; |
public class ServiceManagerSparql { /** * Given the URI of a type ( i . e . , a modelReference ) , this method figures out all the operations
* that have this as part of their inputs .
* @ param modelReference the type of output sought for
* @ return a Set of URIs of operations that generate this output type . */
@ Override public Set < URI > listOperationsWithOutputType ( URI modelReference ) { } } | return this . listEntitiesByDataModel ( MSM . Operation , MSM . hasOutput , modelReference ) ; |
public class AbstractPlanNode { /** * Collect read tables read and index names used in the current node subquery expressions .
* @ param tablesRead Set of table aliases read potentially added to at each recursive level .
* @ param indexes Set of index names used in the plan tree
* Only the current node is of interest . */
protected void getTablesAndIndexesFromSubqueries ( Map < String , StmtTargetTableScan > tablesRead , Collection < String > indexes ) { } } | for ( AbstractExpression expr : findAllSubquerySubexpressions ( ) ) { assert ( expr instanceof AbstractSubqueryExpression ) ; AbstractSubqueryExpression subquery = ( AbstractSubqueryExpression ) expr ; AbstractPlanNode subqueryNode = subquery . getSubqueryNode ( ) ; assert ( subqueryNode != null ) ; subqueryNode . getTablesAndIndexes ( tablesRead , indexes ) ; } |
public class ResourceBundleHelper { /** * Clear the complete resource bundle cache using the specified class loader !
* @ param aClassLoader
* The class loader to be used . May not be < code > null < / code > . */
public static void clearCache ( @ Nonnull final ClassLoader aClassLoader ) { } } | ResourceBundle . clearCache ( aClassLoader ) ; if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "Cache was cleared: " + ResourceBundle . class . getName ( ) + "; classloader=" + aClassLoader ) ; |
public class Processor { /** * Set output directory .
* @ param output absolute output directory
* @ return this Process object */
public Processor setOutputDir ( final File output ) { } } | if ( ! output . isAbsolute ( ) ) { throw new IllegalArgumentException ( "Output directory path must be absolute: " + output ) ; } if ( output . exists ( ) && ! output . isDirectory ( ) ) { throw new IllegalArgumentException ( "Output directory exists and is not a directory: " + output ) ; } args . put ( "output.dir" , output . getAbsolutePath ( ) ) ; return this ; |
public class CreateOTAUpdateRequest { /** * The files to be streamed by the OTA update .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setFiles ( java . util . Collection ) } or { @ link # withFiles ( java . util . Collection ) } if you want to override the
* existing values .
* @ param files
* The files to be streamed by the OTA update .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CreateOTAUpdateRequest withFiles ( OTAUpdateFile ... files ) { } } | if ( this . files == null ) { setFiles ( new java . util . ArrayList < OTAUpdateFile > ( files . length ) ) ; } for ( OTAUpdateFile ele : files ) { this . files . add ( ele ) ; } return this ; |
public class Request { /** * / * - - - - - [ Bean ] - - - - - */
@ Override @ SuppressWarnings ( "StringEquality" ) public Object getField ( String name ) throws UnresolvedException { } } | if ( name == "method" ) return method == null ? null : method . toString ( ) ; else if ( name == "uri" ) return uri ; else if ( name == "line" ) return method + " " + uri + ' ' + version ; else if ( name == "query_string" ) { if ( uri == null ) return null ; int question = uri . indexOf ( '?' ) ; return question == - 1 ? "" : uri . substring ( question + 1 ) ; } else if ( name == "cookies" ) return getCookies ( ) ; else return super . getField ( name ) ; |
public class Tree { /** * Inserts the specified byte array at the specified position in this List .
* @ param index
* index at which the specified element is to be inserted
* @ param value
* array value to be inserted
* @ param asBase64String
* store byte array as BASE64 String
* @ return this node
* @ throws IndexOutOfBoundsException
* if the index is out of range */
public Tree insert ( int index , byte [ ] value , boolean asBase64String ) { } } | if ( asBase64String ) { return insertObjectInternal ( index , BASE64 . encode ( value ) ) ; } return insertObjectInternal ( index , value ) ; |
public class KafkaClient { /** * Sets an { @ link ExecutorService } to be used for async task .
* @ param executorService
* @ return */
public KafkaClient setExecutorService ( ExecutorService executorService ) { } } | if ( this . executorService != null ) { this . executorService . shutdown ( ) ; } this . executorService = executorService ; myOwnExecutorService = false ; return this ; |
public class SqlInfoPrinter { /** * 打印SqlInfo的日志信息 .
* @ param nameSpace XML命名空间
* @ param zealotId XML中的zealotId
* @ param sqlInfo 要打印的SqlInfo对象
* @ param hasXml 是否包含xml的打印信息 */
public void printZealotSqlInfo ( SqlInfo sqlInfo , boolean hasXml , String nameSpace , String zealotId ) { } } | // 如果可以配置的打印SQL信息 , 且日志级别是info级别 , 则打印SQL信息 .
if ( NormalConfig . getInstance ( ) . isPrintSqlInfo ( ) ) { StringBuilder sb = new StringBuilder ( LINE_BREAK ) ; sb . append ( PRINT_START ) . append ( LINE_BREAK ) ; // 如果是xml版本的SQL , 则打印xml的相关信息 .
if ( hasXml ) { sb . append ( "--zealot xml: " ) . append ( XmlContext . INSTANCE . getXmlPathMap ( ) . get ( nameSpace ) ) . append ( " -> " ) . append ( zealotId ) . append ( LINE_BREAK ) ; } sb . append ( "-------- SQL: " ) . append ( sqlInfo . getSql ( ) ) . append ( LINE_BREAK ) . append ( "----- Params: " ) . append ( Arrays . toString ( sqlInfo . getParamsArr ( ) ) ) . append ( LINE_BREAK ) ; sb . append ( PRINT_END ) . append ( LINE_BREAK ) ; log . info ( sb . toString ( ) ) ; } |
public class CreateSubnetGroupRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CreateSubnetGroupRequest createSubnetGroupRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( createSubnetGroupRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createSubnetGroupRequest . getSubnetGroupName ( ) , SUBNETGROUPNAME_BINDING ) ; protocolMarshaller . marshall ( createSubnetGroupRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( createSubnetGroupRequest . getSubnetIds ( ) , SUBNETIDS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RaftSessionConnection { /** * Resends a request due to a request failure , resetting the connection if necessary . */
@ SuppressWarnings ( "unchecked" ) protected < T extends RaftRequest > void retryRequest ( Throwable cause , T request , BiFunction sender , int count , int selectionId , CompletableFuture future ) { } } | // If the connection has not changed , reset it and connect to the next server .
if ( this . selectionId == selectionId ) { log . trace ( "Resetting connection. Reason: {}" , cause . getMessage ( ) ) ; this . currentNode = null ; } // Attempt to send the request again .
sendRequest ( request , sender , count , future ) ; |
public class UntagResourceRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UntagResourceRequest untagResourceRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( untagResourceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( untagResourceRequest . getResourceName ( ) , RESOURCENAME_BINDING ) ; protocolMarshaller . marshall ( untagResourceRequest . getTagKeys ( ) , TAGKEYS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CmsPropertyPanel { /** * Preprocesses the fields to find out which fields need to displayed at the top / bottom later . < p >
* @ param fields the fields
* @ return the set of property names of the preprocessed fields */
private Set < String > preprocessFields ( Collection < I_CmsFormField > fields ) { } } | Set < String > displaySet = Sets . newHashSet ( ) ; for ( I_CmsFormField field : fields ) { boolean hasValue = ! CmsStringUtil . isEmpty ( field . getWidget ( ) . getApparentValue ( ) ) ; if ( hasValue || Boolean . TRUE . toString ( ) . equals ( field . getLayoutData ( ) . get ( LD_DISPLAY_VALUE ) ) ) { String propName = field . getLayoutData ( ) . get ( LD_PROPERTY ) ; displaySet . add ( propName ) ; } } return displaySet ; |
public class TermEquivalencer { /** * { @ inheritDoc } */
@ Override public int equivalence ( ) { } } | int eqct = 0 ; final List < String > nodes = pnt . getProtoNodes ( ) ; final Map < Integer , Integer > nodeTerms = pnt . getNodeTermIndex ( ) ; final int termct = nodeTerms . size ( ) ; final Map < EquivalentTerm , Integer > nodeCache = sizedHashMap ( termct ) ; final Map < Integer , Integer > eqn = pnt . getEquivalences ( ) ; // clear out equivalences , since we ' re rebuilding them
eqn . clear ( ) ; // Iterate each node
int eq = 0 ; for ( int i = 0 , n = nodes . size ( ) ; i < n ; i ++ ) { final Integer termidx = nodeTerms . get ( i ) ; final Term term = tt . getIndexedTerms ( ) . get ( termidx ) ; // Convert to an equivalent term
EquivalentTerm equiv = eqCvtr . convert ( term ) ; Integer eqId = nodeCache . get ( equiv ) ; if ( eqId != null ) { // We ' ve seen an equivalent term before , use that .
eqn . put ( i , eqId ) ; eqct ++ ; continue ; } nodeCache . put ( equiv , eq ) ; eqn . put ( i , eq ) ; eq ++ ; } return eqct ; |
public class RolloverLogBase { /** * Sets the archive name format */
public void setArchiveFormat ( String format ) { } } | if ( format . endsWith ( ".gz" ) ) { _archiveFormat = format . substring ( 0 , format . length ( ) - ".gz" . length ( ) ) ; _archiveSuffix = ".gz" ; } else if ( format . endsWith ( ".zip" ) ) { _archiveFormat = format . substring ( 0 , format . length ( ) - ".zip" . length ( ) ) ; _archiveSuffix = ".zip" ; } else { _archiveFormat = format ; _archiveSuffix = "" ; } |
public class HlsEncryptionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( HlsEncryption hlsEncryption , ProtocolMarshaller protocolMarshaller ) { } } | if ( hlsEncryption == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( hlsEncryption . getConstantInitializationVector ( ) , CONSTANTINITIALIZATIONVECTOR_BINDING ) ; protocolMarshaller . marshall ( hlsEncryption . getEncryptionMethod ( ) , ENCRYPTIONMETHOD_BINDING ) ; protocolMarshaller . marshall ( hlsEncryption . getKeyRotationIntervalSeconds ( ) , KEYROTATIONINTERVALSECONDS_BINDING ) ; protocolMarshaller . marshall ( hlsEncryption . getRepeatExtXKey ( ) , REPEATEXTXKEY_BINDING ) ; protocolMarshaller . marshall ( hlsEncryption . getSpekeKeyProvider ( ) , SPEKEKEYPROVIDER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class EnumConstantWriterImpl { /** * { @ inheritDoc } */
public Content getEnumConstantsDetailsTreeHeader ( ClassDoc classDoc , Content memberDetailsTree ) { } } | memberDetailsTree . addContent ( HtmlConstants . START_OF_ENUM_CONSTANT_DETAILS ) ; Content enumConstantsDetailsTree = writer . getMemberTreeHeader ( ) ; enumConstantsDetailsTree . addContent ( writer . getMarkerAnchor ( SectionName . ENUM_CONSTANT_DETAIL ) ) ; Content heading = HtmlTree . HEADING ( HtmlConstants . DETAILS_HEADING , writer . enumConstantsDetailsLabel ) ; enumConstantsDetailsTree . addContent ( heading ) ; return enumConstantsDetailsTree ; |
public class BytecodeUtils { /** * Returns an { @ link Expression } that can load the given double constant . */
public static Expression constant ( final double value ) { } } | return new Expression ( Type . DOUBLE_TYPE , Feature . CHEAP ) { @ Override protected void doGen ( CodeBuilder mv ) { mv . pushDouble ( value ) ; } } ; |
public class CmsSolrFieldConfiguration { /** * Retrieves the locales for an content , that is whether an XML content nor an XML page . < p >
* Uses following strategy :
* < ul >
* < li > first by file name < / li >
* < li > then by detection and < / li >
* < li > otherwise take the first configured default locale for this resource < / li >
* < / ul >
* @ param cms the current CmsObject
* @ param resource the resource to get the content locales for
* @ param extraction the extraction result
* @ return the determined locales for the given resource */
protected List < Locale > getContentLocales ( CmsObject cms , CmsResource resource , I_CmsExtractionResult extraction ) { } } | // try to detect locale by filename
Locale detectedLocale = CmsStringUtil . getLocaleForName ( resource . getRootPath ( ) ) ; if ( ! OpenCms . getLocaleManager ( ) . getAvailableLocales ( cms , resource ) . contains ( detectedLocale ) ) { detectedLocale = null ; } // try to detect locale by language detector
if ( getIndex ( ) . isLanguageDetection ( ) && ( detectedLocale == null ) && ( extraction != null ) && ( extraction . getContent ( ) != null ) ) { detectedLocale = CmsStringUtil . getLocaleForText ( extraction . getContent ( ) ) ; } // take the detected locale or use the first configured default locale for this resource
List < Locale > result = new ArrayList < Locale > ( ) ; if ( detectedLocale != null ) { // take the found locale
result . add ( detectedLocale ) ; } else { // take all locales set via locale - available or the configured default locales as fall - back for this resource
result . addAll ( OpenCms . getLocaleManager ( ) . getAvailableLocales ( cms , resource ) ) ; LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_LANGUAGE_DETECTION_FAILED_1 , resource ) ) ; } return result ; |
public class AbstractComponentDecoration { /** * Calculates and updates the clipped bounds of the decoration painter in layered pane coordinates .
* @ param layeredPane Layered pane containing the decoration painter .
* @ param relativeLocationToOwner Location of the decoration painter relatively to the decorated component . */
private void updateDecorationPainterClippedBounds ( JLayeredPane layeredPane , Point relativeLocationToOwner ) { } } | if ( layeredPane == null ) { decorationPainter . setClipBounds ( null ) ; } else { JComponent clippingComponent = getEffectiveClippingAncestor ( ) ; if ( clippingComponent == null ) { LOGGER . error ( "No decoration clipping component can be found for decorated component: " + decoratedComponent ) ; decorationPainter . setClipBounds ( null ) ; } else if ( clippingComponent . isShowing ( ) ) { Rectangle ownerBoundsInParent = decoratedComponent . getBounds ( ) ; Rectangle decorationBoundsInParent = new Rectangle ( ownerBoundsInParent . x + relativeLocationToOwner . x , ownerBoundsInParent . y + relativeLocationToOwner . y , getWidth ( ) , getHeight ( ) ) ; Rectangle decorationBoundsInAncestor = SwingUtilities . convertRectangle ( decoratedComponent . getParent ( ) , decorationBoundsInParent , clippingComponent ) ; Rectangle decorationVisibleBoundsInAncestor ; Rectangle ancestorVisibleRect = clippingComponent . getVisibleRect ( ) ; decorationVisibleBoundsInAncestor = ancestorVisibleRect . intersection ( decorationBoundsInAncestor ) ; if ( ( decorationVisibleBoundsInAncestor . width == 0 ) || ( decorationVisibleBoundsInAncestor . height == 0 ) ) { // No bounds , no painting
decorationPainter . setClipBounds ( null ) ; } else { Rectangle decorationVisibleBoundsInLayeredPane = SwingUtilities . convertRectangle ( clippingComponent , decorationVisibleBoundsInAncestor , layeredPane ) ; // Clip graphics context
Rectangle clipBounds = SwingUtilities . convertRectangle ( decorationPainter . getParent ( ) , decorationVisibleBoundsInLayeredPane , decorationPainter ) ; decorationPainter . setClipBounds ( clipBounds ) ; } } else { // This could happen for example when a dialog is closed , so no need to log anything
decorationPainter . setClipBounds ( null ) ; } } |
public class AWSGlueClient { /** * Changes the schedule state of the specified crawler to < code > SCHEDULED < / code > , unless the crawler is already
* running or the schedule state is already < code > SCHEDULED < / code > .
* @ param startCrawlerScheduleRequest
* @ return Result of the StartCrawlerSchedule operation returned by the service .
* @ throws EntityNotFoundException
* A specified entity does not exist
* @ throws SchedulerRunningException
* The specified scheduler is already running .
* @ throws SchedulerTransitioningException
* The specified scheduler is transitioning .
* @ throws NoScheduleException
* There is no applicable schedule .
* @ throws OperationTimeoutException
* The operation timed out .
* @ sample AWSGlue . StartCrawlerSchedule
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / glue - 2017-03-31 / StartCrawlerSchedule " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public StartCrawlerScheduleResult startCrawlerSchedule ( StartCrawlerScheduleRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeStartCrawlerSchedule ( request ) ; |
public class JvmFieldImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setTransient ( boolean newTransient ) { } } | boolean oldTransient = transient_ ; transient_ = newTransient ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , TypesPackage . JVM_FIELD__TRANSIENT , oldTransient , transient_ ) ) ; |
public class FaceSearchSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( FaceSearchSettings faceSearchSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( faceSearchSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( faceSearchSettings . getCollectionId ( ) , COLLECTIONID_BINDING ) ; protocolMarshaller . marshall ( faceSearchSettings . getFaceMatchThreshold ( ) , FACEMATCHTHRESHOLD_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ValueStatistics { /** * Returns a { @ link ValueStatistic } that caches the value of a statistic for at least a specific amount of time .
* This method does not block .
* When the delay expires , if several threads are coming at the same time to read the expired value , then only one will
* do the update and set a new expiring delay and read the new value .
* The other threads can continue to read the current expired value for their next call until it gets updated .
* If the caching delay is smaller than the time it takes for a statistic value to be computed , then it is possible that
* a new thread starts asking for a new value before the previous update is completed . In this case , there is no guarantee
* that the cached value will be updated in order because it depends on the time took to get the new value .
* @ param delay The delay
* @ param unit The unit of time
* @ param valueStatistic The delegate statistic that will provide the value
* @ param < T > The statistic type
* @ return the memoizing statistic */
public static < T extends Serializable > ValueStatistic < T > memoize ( long delay , TimeUnit unit , ValueStatistic < T > valueStatistic ) { } } | return new MemoizingValueStatistic < > ( delay , unit , valueStatistic ) ; |
public class ConvexHull { /** * Determine the winding of three points . The winding is the sign of the space - the parity .
* @ param a first point
* @ param b second point
* @ param c third point
* @ return winding , - 1 = cw , 0 = straight , + 1 = ccw */
private static int winding ( Point2D a , Point2D b , Point2D c ) { } } | return ( int ) Math . signum ( ( b . getX ( ) - a . getX ( ) ) * ( c . getY ( ) - a . getY ( ) ) - ( b . getY ( ) - a . getY ( ) ) * ( c . getX ( ) - a . getX ( ) ) ) ; |
public class InfoWindow { /** * close all InfoWindows currently opened on this MapView
* @ param mapView */
public static void closeAllInfoWindowsOn ( MapView mapView ) { } } | ArrayList < InfoWindow > opened = getOpenedInfoWindowsOn ( mapView ) ; for ( InfoWindow infoWindow : opened ) { infoWindow . close ( ) ; } |
public class CommunicationChannelRepository { /** * endregion */
@ Programmatic public SortedSet < CommunicationChannel > findByOwner ( final Object owner ) { } } | final List < CommunicationChannelOwnerLink > links = linkRepository . findByOwner ( owner ) ; return Sets . newTreeSet ( Iterables . transform ( links , CommunicationChannelOwnerLink . Functions . communicationChannel ( ) ) ) ; |
public class HourRanges { /** * If the hour ranges represent two different days , this method returns two hour ranges , one for each day . Example :
* ' 09:00-14:00 + 18:00-03:00 ' will be splitted into ' 09:00-14:00 + 18:00-24:00 ' and ' 00:00-03:00 ' .
* @ return This range or range for today and tomorrow . */
public final List < HourRanges > normalize ( ) { } } | final List < HourRange > today = new ArrayList < > ( ) ; final List < HourRange > tommorrow = new ArrayList < > ( ) ; for ( final HourRange range : ranges ) { final List < HourRange > nr = range . normalize ( ) ; if ( nr . size ( ) == 1 ) { today . add ( nr . get ( 0 ) ) ; } else if ( nr . size ( ) == 2 ) { today . add ( nr . get ( 0 ) ) ; tommorrow . add ( nr . get ( 1 ) ) ; } else { throw new IllegalStateException ( "Normalized hour range returned an unexpected number of elements: " + nr ) ; } } final List < HourRanges > list = new ArrayList < > ( ) ; list . add ( new HourRanges ( today . toArray ( new HourRange [ today . size ( ) ] ) ) ) ; if ( tommorrow . size ( ) > 0 ) { list . add ( new HourRanges ( tommorrow . toArray ( new HourRange [ tommorrow . size ( ) ] ) ) ) ; } return list ; |
public class Collectors { /** * Note : Generally it ' s much slower than other { @ code Collectors } .
* @ param supplier
* @ param streamingCollector
* @ param maxWaitIntervalInMillis
* @ return
* @ see Stream # observe ( BlockingQueue , Predicate , long )
* @ see Stream # asyncCall ( Try . Function ) */
@ SuppressWarnings ( "rawtypes" ) public static < T , R > Collector < T , ? , R > streaming ( final Supplier < ? extends BlockingQueue < T > > queueSupplier , final Function < ? super Stream < T > , ContinuableFuture < R > > streamingCollector , final long maxWaitIntervalInMillis ) { } } | final T NULL = ( T ) NONE ; final Supplier < Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > > supplier = new Supplier < Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > > ( ) { @ Override public Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > get ( ) { return Tuple . of ( ( BlockingQueue < T > ) queueSupplier . get ( ) , MutableBoolean . of ( true ) , MutableBoolean . of ( false ) , new Holder < ContinuableFuture < R > > ( ) ) ; // _1 = queue , _ 2 = hasMore , _ 3 = isComplete , _ 4 = future .
} } ; final BiConsumer < Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > , T > accumulator = new BiConsumer < Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > , T > ( ) { @ Override public void accept ( Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > xxx , T t ) { if ( xxx . _4 . value ( ) == null ) { initStream ( xxx , streamingCollector , maxWaitIntervalInMillis , NULL ) ; } t = t == null ? NULL : t ; if ( xxx . _3 . isFalse ( ) && xxx . _1 . offer ( t ) == false ) { try { while ( xxx . _3 . isFalse ( ) && xxx . _1 . offer ( t , maxWaitIntervalInMillis , TimeUnit . MILLISECONDS ) == false ) { } } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } } } } ; final BinaryOperator < Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > > combiner = new BinaryOperator < Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > > ( ) { @ Override public Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > apply ( Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > t , Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > u ) { throw new UnsupportedOperationException ( "Should not happen" ) ; } } ; final Function < Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > , R > finisher = new Function < Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > , R > ( ) { @ Override public R apply ( Tuple4 < BlockingQueue < T > , MutableBoolean , MutableBoolean , Holder < ContinuableFuture < R > > > xxx ) { if ( xxx . _4 . value ( ) == null ) { initStream ( xxx , streamingCollector , maxWaitIntervalInMillis , NULL ) ; } xxx . _2 . setFalse ( ) ; try { return xxx . _4 . value ( ) . get ( ) ; } catch ( InterruptedException | ExecutionException e ) { throw new RuntimeException ( e ) ; } } } ; return new CollectorImpl ( supplier , accumulator , combiner , finisher , CH_CONCURRENT_NOID ) ; |
public class WikipediaCleaner { /** * Removes any tokens not allowed by the { @ link
* edu . ucla . sspace . text . TokenFilter } in the article . */
private String filterTokens ( String article ) { } } | Iterator < String > filteredTokens = IteratorFactory . tokenize ( article ) ; StringBuilder sb = new StringBuilder ( article . length ( ) ) ; while ( filteredTokens . hasNext ( ) ) { sb . append ( filteredTokens . next ( ) ) ; if ( filteredTokens . hasNext ( ) ) sb . append ( " " ) ; } return sb . toString ( ) ; |
public class CustomLogProperties { /** * Returns the Resource Factory associated with this log
* implementation
* @ return ResourceFactory associated with this log
* implementation */
public ResourceFactory resourceFactory ( ) { } } | if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "resourceFactory" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "resourceFactory" , _resourceFactory ) ; return _resourceFactory ; |
public class AdditionalNamespaceResolver { /** * { @ inheritDoc } */
public String getURI ( String prefix ) throws NamespaceException { } } | String uri = prefixToURI . getProperty ( prefix ) ; if ( uri != null ) { return uri ; } else { throw new NamespaceException ( "Unknown namespace prefix " + prefix + "." ) ; } |
public class Distribution { /** * Contribution to numerator for GBM ' s leaf node prediction
* @ param w weight
* @ param y response
* @ param z residual
* @ param f predicted value ( including offset )
* @ return weighted contribution to numerator */
public double gammaNum ( double w , double y , double z , double f ) { } } | switch ( distribution ) { case gaussian : case bernoulli : case quasibinomial : case multinomial : return w * z ; case poisson : return w * y ; case gamma : return w * ( z + 1 ) ; // z + 1 = = y * exp ( - f )
case tweedie : return w * y * exp ( f * ( 1 - tweediePower ) ) ; case modified_huber : double yf = ( 2 * y - 1 ) * f ; if ( yf < - 1 ) return w * 4 * ( 2 * y - 1 ) ; else if ( yf > 1 ) return 0 ; else return w * 2 * ( 2 * y - 1 ) * ( 1 - yf ) ; default : throw H2O . unimpl ( ) ; } |
public class CommerceShippingFixedOptionRelLocalServiceBaseImpl { /** * Deletes the commerce shipping fixed option rel with the primary key from the database . Also notifies the appropriate model listeners .
* @ param commerceShippingFixedOptionRelId the primary key of the commerce shipping fixed option rel
* @ return the commerce shipping fixed option rel that was removed
* @ throws PortalException if a commerce shipping fixed option rel with the primary key could not be found */
@ Indexable ( type = IndexableType . DELETE ) @ Override public CommerceShippingFixedOptionRel deleteCommerceShippingFixedOptionRel ( long commerceShippingFixedOptionRelId ) throws PortalException { } } | return commerceShippingFixedOptionRelPersistence . remove ( commerceShippingFixedOptionRelId ) ; |
public class Transforms { /** * Element - wise tan function . Copies the array
* @ param ndArray Input array */
public static INDArray tan ( INDArray ndArray , boolean dup ) { } } | return exec ( dup ? new Tan ( ndArray , ndArray . ulike ( ) ) : new Tan ( ndArray ) ) ; |
public class ListEntitlementsResult { /** * A list of entitlements that have been granted to you from other AWS accounts .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setEntitlements ( java . util . Collection ) } or { @ link # withEntitlements ( java . util . Collection ) } if you want to
* override the existing values .
* @ param entitlements
* A list of entitlements that have been granted to you from other AWS accounts .
* @ return Returns a reference to this object so that method calls can be chained together . */
public ListEntitlementsResult withEntitlements ( ListedEntitlement ... entitlements ) { } } | if ( this . entitlements == null ) { setEntitlements ( new java . util . ArrayList < ListedEntitlement > ( entitlements . length ) ) ; } for ( ListedEntitlement ele : entitlements ) { this . entitlements . add ( ele ) ; } return this ; |
public class DefaultEntityHandler { /** * IFコメントでSQLをラップする
* @ param original SQL
* @ param addParts IFコメントの中に含まれるSQLパーツ
* @ param col カラム情報
* @ return SQL */
private StringBuilder wrapIfComment ( final StringBuilder original , final StringBuilder addParts , final TableMetadata . Column col ) { } } | String camelColName = col . getCamelColumnName ( ) ; // フィールドがセットされていない場合はカラム自体を削る
if ( isStringType ( col . getDataType ( ) ) ) { if ( emptyStringEqualsNull ) { original . append ( "/*IF SF.isNotEmpty(" ) . append ( camelColName ) . append ( ") */" ) . append ( System . lineSeparator ( ) ) ; } else { original . append ( "/*IF " ) . append ( camelColName ) . append ( " != null */" ) . append ( System . lineSeparator ( ) ) ; } } else { original . append ( "/*IF " ) . append ( camelColName ) . append ( " != null */" ) . append ( System . lineSeparator ( ) ) ; } original . append ( addParts ) ; original . append ( "/*END*/" ) . append ( System . lineSeparator ( ) ) ; return original ; |
public class AbstractPool { /** * Returns a value for the given key , which is lazily created and
* pooled . If multiple threads are requesting upon the same key
* concurrently , at most one thread attempts to lazily create the
* value . The others wait for it to become available . */
public V get ( K key ) throws E { } } | // Quick check without locking .
V value = mValues . get ( key ) ; if ( value != null ) { return value ; } // Check again with key lock held .
Lock lock = mLockPool . get ( key ) ; lock . lock ( ) ; try { value = mValues . get ( key ) ; if ( value == null ) { try { value = create ( key ) ; mValues . put ( key , value ) ; } catch ( Exception e ) { // Workaround compiler bug .
org . cojen . util . ThrowUnchecked . fire ( e ) ; } } } finally { lock . unlock ( ) ; } return value ; |
public class UrlUtil { /** * Switch zip protocol ( used by Weblogic ) to jar protocol ( supported by DropWizard ) .
* @ param resourceUrl the URL to switch protocol eventually
* @ return the URL with eventually switched protocol */
public static URL switchFromZipToJarProtocolIfNeeded ( URL resourceUrl ) throws MalformedURLException { } } | final String protocol = resourceUrl . getProtocol ( ) ; // If zip protocol switch to jar protocol
if ( "zip" . equals ( protocol ) && resourceUrl . getPath ( ) . contains ( ".jar" + JAR_URL_SEPARATOR ) ) { String filePath = resourceUrl . getFile ( ) ; if ( ! filePath . startsWith ( "/" ) ) { filePath = "/" + filePath ; } return new URL ( "jar:file:" + filePath ) ; } return resourceUrl ; |
public class CoreStitchAuth { /** * Performs a request against Stitch using the provided { @ link StitchAuthRequest } object , and
* decodes the JSON body of the response into a T value as specified by the provided class type .
* The type will be decoded using the codec found for T in the codec registry given .
* If the provided type is not supported by the codec registry to be used , the method will throw
* a { @ link org . bson . codecs . configuration . CodecConfigurationException } .
* @ param stitchReq the request to perform .
* @ param resultClass the class that the JSON response should be decoded as .
* @ param codecRegistry the codec registry used for de / serialization .
* @ param < T > the type into which the JSON response will be decoded into .
* @ return the decoded value . */
public < T > T doAuthenticatedRequest ( final StitchAuthRequest stitchReq , final Class < T > resultClass , final CodecRegistry codecRegistry ) { } } | final Response response = doAuthenticatedRequest ( stitchReq ) ; try { final String bodyStr = IoUtils . readAllToString ( response . getBody ( ) ) ; final JsonReader bsonReader = new JsonReader ( bodyStr ) ; // We must check this condition because the decoder will throw trying to decode null
if ( bsonReader . readBsonType ( ) == BsonType . NULL ) { return null ; } final CodecRegistry newReg = CodecRegistries . fromRegistries ( BsonUtils . DEFAULT_CODEC_REGISTRY , codecRegistry ) ; return newReg . get ( resultClass ) . decode ( bsonReader , DecoderContext . builder ( ) . build ( ) ) ; } catch ( final Exception e ) { throw new StitchRequestException ( e , StitchRequestErrorCode . DECODING_ERROR ) ; } |
public class Config { /** * Retrieves a configuration value with the given key
* @ param key The key of the configuration value ( e . g . application . name )
* @ param defaultValue The default value to return of no key is found
* @ return The configured value as int or the passed defautlValue if the key is not configured */
public int getInt ( String key , int defaultValue ) { } } | final String value = this . props . getValue ( key ) ; if ( StringUtils . isBlank ( value ) ) { return defaultValue ; } return Integer . parseInt ( value ) ; |
public class PhotosGeoApi { /** * Get permissions for who may view geo data for a photo .
* < br >
* This method requires authentication with ' read ' permission .
* @ param photoId ( Required ) The id of the photo to get permissions for .
* @ return object with the geo permissions for the specified photo .
* @ throws JinxException if required parameters are missing , or if there are any errors .
* @ see < a href = " https : / / www . flickr . com / services / api / flickr . photos . geo . getPerms . html " > flickr . photos . geo . getPerms < / a > */
public GeoPerms getGeoPerms ( String photoId ) throws JinxException { } } | JinxUtils . validateParams ( photoId ) ; Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.photos.geo.getPerms" ) ; params . put ( "photo_id" , photoId ) ; return jinx . flickrGet ( params , GeoPerms . class ) ; |
public class StateAnimator { /** * Called by View */
public void setState ( int [ ] state ) { } } | Tuple match = null ; final int count = mTuples . size ( ) ; for ( int i = 0 ; i < count ; i ++ ) { final Tuple tuple = mTuples . get ( i ) ; if ( StateSet . stateSetMatches ( tuple . mSpecs , state ) ) { match = tuple ; break ; } } if ( match == lastMatch ) { return ; } if ( lastMatch != null ) { cancel ( ) ; } lastMatch = match ; View view = ( View ) viewRef . get ( ) ; if ( match != null && view != null && view . getVisibility ( ) == View . VISIBLE ) { start ( match ) ; } |
public class FileAuthStore { /** * ( non - Javadoc )
* @ see com . flickr4java . flickr . util . AuthStore # store ( com . flickr4java . flickr . auth . Auth ) */
public void store ( Auth token ) throws IOException { } } | this . auths . put ( token . getUser ( ) . getId ( ) , token ) ; this . authsByUser . put ( token . getUser ( ) . getUsername ( ) , token ) ; String filename = token . getUser ( ) . getId ( ) + ".auth" ; File outFile = new File ( this . authStoreDir , filename ) ; outFile . createNewFile ( ) ; ObjectOutputStream authStream = new ObjectOutputStream ( new FileOutputStream ( outFile ) ) ; authStream . writeObject ( token ) ; authStream . flush ( ) ; authStream . close ( ) ; |
public class FullDTDReader { /** * Specialized method that handles potentially suppressable entity
* declaration . Specifically : at this point it is known that first
* letter is ' E ' , that we are outputting flattened DTD info ,
* and that parameter entity declarations are to be suppressed .
* Furthermore , flatten output is still being disabled , and needs
* to be enabled by the method at some point . */
private void handleSuppressedDeclaration ( ) throws XMLStreamException { } } | String keyw ; char c = dtdNextFromCurr ( ) ; if ( c == 'N' ) { keyw = checkDTDKeyword ( "TITY" ) ; if ( keyw == null ) { handleEntityDecl ( true ) ; return ; } keyw = "EN" + keyw ; mFlattenWriter . enableOutput ( mInputPtr ) ; // error condition . . .
} else { mFlattenWriter . enableOutput ( mInputPtr ) ; mFlattenWriter . output ( "<!E" ) ; mFlattenWriter . output ( c ) ; if ( c == 'L' ) { keyw = checkDTDKeyword ( "EMENT" ) ; if ( keyw == null ) { handleElementDecl ( ) ; return ; } keyw = "EL" + keyw ; } else { keyw = readDTDKeyword ( "E" ) ; } } _reportBadDirective ( keyw ) ; |
public class DeviceAttributeDAODefaultImpl { public AttributeValue_3 getAttributeValueObject_3 ( ) throws DevFailed { } } | // Build a DeviceAttribute _ 3 from this
final DeviceAttribute_3 att = new DeviceAttribute_3 ( ) ; att . setAttributeValue ( this ) ; // And return the AttributeValue _ 3 object
return att . getAttributeValueObject_3 ( ) ; |
public class nspbr_stats { /** * Use this API to fetch the statistics of all nspbr _ stats resources that are configured on netscaler . */
public static nspbr_stats [ ] get ( nitro_service service ) throws Exception { } } | nspbr_stats obj = new nspbr_stats ( ) ; nspbr_stats [ ] response = ( nspbr_stats [ ] ) obj . stat_resources ( service ) ; return response ; |
public class WebSocketHandler { /** * { @ inheritDoc } */
@ Override public void exceptionCaught ( IoSession session , Throwable cause ) throws Exception { } } | log . warn ( "Exception (session: {})" , session . getId ( ) , cause ) ; // get the existing reference to a ws connection
WebSocketConnection conn = ( WebSocketConnection ) session . getAttribute ( Constants . CONNECTION ) ; if ( conn != null ) { // close the socket
conn . close ( ) ; } |
public class CellRepeater { /** * Set the HTML style class that is rendered on each HTML table row that
* is opened by this tag . For example , if the row class is " rowClass " ,
* each opening table row tag is :
* < pre >
* & lt ; tr class = " rowClass " & gt ;
* < / pre >
* @ param rowClass the name of a style class in the CSS
* @ jsptagref . attributedescription
* Set the HTML style class that is rendered on each HTML table row that
* is opened by this tag . For example , if the row class is " rowClass " ,
* each opening table row tag is :
* < pre >
* & lt ; tr class = " rowClass " & gt ;
* < / pre >
* @ jsptagref . attributesyntaxvalue < i > string _ class < / i >
* @ netui : attribute required = " false " */
public void setRowClass ( String rowClass ) { } } | if ( "" . equals ( rowClass ) ) return ; _trState = new TrTag . State ( ) ; _trState . styleClass = rowClass ; |
public class OcelotServices { /** * Subscribe to topic
* @ param topic
* @ param session
* @ return
* @ throws IllegalAccessException */
@ JsTopic @ WsDataService public Integer subscribe ( @ JsTopicName ( prefix = Constants . Topic . SUBSCRIBERS ) String topic , Session session ) throws IllegalAccessException { } } | return topicManager . registerTopicSession ( topic , session ) ; |
public class StringConverter { /** * Hsqldb specific encoding used only for log files . The SQL statements that
* need to be written to the log file ( input ) are Java Unicode strings .
* input is converted into a 7bit escaped ASCII string ( output ) with the
* following transformations . All characters outside the 0x20-7f range are
* converted to a escape sequence and added to output . If a backslash
* character is immdediately followed by ' u ' , the backslash character is
* converted to escape sequence and added to output . All the remaining
* characters in input are added to output without conversion . The escape
* sequence is backslash , letter u , xxxx , where xxxx is the hex
* representation of the character code . ( fredt @ users ) < p >
* Method based on Hypersonic Code
* @ param b output stream to wite to
* @ param s Java string
* @ param doubleSingleQuotes boolean */
public static void stringToUnicodeBytes ( HsqlByteArrayOutputStream b , String s , boolean doubleSingleQuotes ) { } } | final int len = s . length ( ) ; char [ ] chars ; int extras = 0 ; if ( s == null || len == 0 ) { return ; } chars = s . toCharArray ( ) ; b . ensureRoom ( len * 2 + 5 ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = chars [ i ] ; if ( c == '\\' ) { if ( ( i < len - 1 ) && ( chars [ i + 1 ] == 'u' ) ) { b . writeNoCheck ( c ) ; // encode the \ as unicode , so ' u ' is ignored
b . writeNoCheck ( 'u' ) ; b . writeNoCheck ( '0' ) ; b . writeNoCheck ( '0' ) ; b . writeNoCheck ( '5' ) ; b . writeNoCheck ( 'c' ) ; extras += 5 ; } else { b . write ( c ) ; } } else if ( ( c >= 0x0020 ) && ( c <= 0x007f ) ) { b . writeNoCheck ( c ) ; // this is 99%
if ( c == '\'' && doubleSingleQuotes ) { b . writeNoCheck ( c ) ; extras ++ ; } } else { b . writeNoCheck ( '\\' ) ; b . writeNoCheck ( 'u' ) ; b . writeNoCheck ( HEXBYTES [ ( c >> 12 ) & 0xf ] ) ; b . writeNoCheck ( HEXBYTES [ ( c >> 8 ) & 0xf ] ) ; b . writeNoCheck ( HEXBYTES [ ( c >> 4 ) & 0xf ] ) ; b . writeNoCheck ( HEXBYTES [ c & 0xf ] ) ; extras += 5 ; } if ( extras > len ) { b . ensureRoom ( len + extras + 5 ) ; extras = 0 ; } } |
public class KeyVaultClientBaseImpl { /** * List the versions of a certificate .
* The GetCertificateVersions operation returns the versions of a certificate in the specified key vault . This operation requires the certificates / list permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param certificateName The name of the certificate .
* @ param maxresults Maximum number of results to return in a page . If not specified the service will return up to 25 results .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; CertificateItem & gt ; object */
public Observable < Page < CertificateItem > > getCertificateVersionsAsync ( final String vaultBaseUrl , final String certificateName , final Integer maxresults ) { } } | return getCertificateVersionsWithServiceResponseAsync ( vaultBaseUrl , certificateName , maxresults ) . map ( new Func1 < ServiceResponse < Page < CertificateItem > > , Page < CertificateItem > > ( ) { @ Override public Page < CertificateItem > call ( ServiceResponse < Page < CertificateItem > > response ) { return response . body ( ) ; } } ) ; |
public class ListFileFilter { /** * Check the record locally . */
public boolean doLocalCriteria ( StringBuffer strbFilter , boolean bIncludeFileName , Vector < BaseField > vParamList ) { } } | Object objTargetValue = m_fldTarget . getData ( ) ; if ( ( m_hsFilter != null ) && ( ! m_hsFilter . isEmpty ( ) ) && ( ! m_hsFilter . contains ( objTargetValue ) ) ) return false ; return super . doLocalCriteria ( strbFilter , bIncludeFileName , vParamList ) ; |
public class HashGeneratorMaker { /** * Generate different hash codes for stereoisomers . The currently supported
* geometries are :
* < ul >
* < li > Tetrahedral < / li >
* < li > Double Bond < / li >
* < li > Cumulative Double Bonds < / li >
* < / ul >
* @ return fluent API reference ( self ) */
public HashGeneratorMaker chiral ( ) { } } | this . stereoEncoders . add ( new GeometricTetrahedralEncoderFactory ( ) ) ; this . stereoEncoders . add ( new GeometricDoubleBondEncoderFactory ( ) ) ; this . stereoEncoders . add ( new GeometricCumulativeDoubleBondFactory ( ) ) ; this . stereoEncoders . add ( new TetrahedralElementEncoderFactory ( ) ) ; this . stereoEncoders . add ( new DoubleBondElementEncoderFactory ( ) ) ; return this ; |
public class base_resource { /** * This method , forms the http DELETE request , applies on the MPS .
* Reads the response from the MPS and converts it to base response .
* @ param service
* @ param req _ args
* @ return
* @ throws Exception */
private String _delete ( nitro_service service , String req_args ) throws Exception { } } | StringBuilder responseStr = new StringBuilder ( ) ; HttpURLConnection httpURLConnection = null ; try { String urlstr ; String ipaddress = service . get_ipaddress ( ) ; String version = service . get_version ( ) ; String sessionid = service . get_sessionid ( ) ; String objtype = get_object_type ( ) ; String protocol = service . get_protocol ( ) ; // build URL
urlstr = protocol + "://" + ipaddress + "/nitro/" + version + "/config/" + objtype ; String name = this . get_object_id ( ) ; if ( name != null && name . length ( ) > 0 ) { urlstr = urlstr + "/" + nitro_util . encode ( nitro_util . encode ( name ) ) ; } /* if ( req _ args ! = null & & req _ args . length ( ) > 0)
urlstr = urlstr + " ? args = " + req _ args ; */
URL url = new URL ( urlstr ) ; httpURLConnection = ( HttpURLConnection ) url . openConnection ( ) ; httpURLConnection . setRequestMethod ( "DELETE" ) ; if ( sessionid != null ) { httpURLConnection . setRequestProperty ( "Cookie" , "SESSID=" + nitro_util . encode ( sessionid ) ) ; httpURLConnection . setRequestProperty ( "Accept-Encoding" , "gzip, deflate" ) ; } if ( httpURLConnection instanceof HttpsURLConnection ) { SSLContext sslContext = SSLContext . getInstance ( "SSL" ) ; // we are using an empty trust manager , because MPS currently presents
// a test certificate not issued by any signing authority , so we need to bypass
// the credentials check
sslContext . init ( null , new TrustManager [ ] { new EmptyTrustManager ( ) } , null ) ; SocketFactory sslSocketFactory = sslContext . getSocketFactory ( ) ; HttpsURLConnection secured = ( HttpsURLConnection ) httpURLConnection ; secured . setSSLSocketFactory ( ( SSLSocketFactory ) sslSocketFactory ) ; secured . setHostnameVerifier ( new EmptyHostnameVerifier ( ) ) ; } InputStream input = httpURLConnection . getInputStream ( ) ; String contentEncoding = httpURLConnection . getContentEncoding ( ) ; // get correct input stream for compressed data :
if ( contentEncoding != null ) { if ( contentEncoding . equalsIgnoreCase ( "gzip" ) ) input = new GZIPInputStream ( input ) ; // reads 2 bytes to determine GZIP stream !
else if ( contentEncoding . equalsIgnoreCase ( "deflate" ) ) input = new InflaterInputStream ( input ) ; } int numOfTotalBytesRead ; byte [ ] buffer = new byte [ 1024 ] ; while ( ( numOfTotalBytesRead = input . read ( buffer , 0 , buffer . length ) ) != - 1 ) { responseStr . append ( new String ( buffer , 0 , numOfTotalBytesRead ) ) ; } httpURLConnection . disconnect ( ) ; input . close ( ) ; } catch ( MalformedURLException mue ) { System . err . println ( "Invalid URL" ) ; } catch ( IOException ioe ) { System . err . println ( "I/O Error - " + ioe ) ; } catch ( Exception e ) { System . err . println ( "Error - " + e ) ; } return responseStr . toString ( ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcTankType ( ) { } } | if ( ifcTankTypeEClass == null ) { ifcTankTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 595 ) ; } return ifcTankTypeEClass ; |
public class CharacterizingSets { /** * Computes a characterizing set for the given automaton .
* @ param automaton
* the automaton for which to determine the characterizing set .
* @ param inputs
* the input alphabets to consider
* @ param result
* the collection in which to store the characterizing words */
public static < S , I , T > void findCharacterizingSet ( UniversalDeterministicAutomaton < S , I , T , ? , ? > automaton , Collection < ? extends I > inputs , Collection < ? super Word < I > > result ) { } } | findIncrementalCharacterizingSet ( automaton , inputs , Collections . emptyList ( ) , result ) ; |
public class CircuitPresenter { /** * When this method is called it ' s guaranteed that the presenter is visible . */
protected void onError ( Action action , String reason ) { } } | Console . error ( Console . CONSTANTS . lastActionError ( ) , reason ) ; |
public class LinearSparseVector { /** * 计算x + y * w
* @ param sv
* @ param w */
public void plus ( LinearSparseVector sv , float w ) { } } | if ( sv == null ) return ; for ( int i = 0 ; i < sv . length ; i ++ ) { float val = ( float ) sv . data [ i ] * w ; add ( sv . index [ i ] , val ) ; } |
public class BaseXMLBuilder { /** * Add a named and namespaced XML element to the document as a child of
* this builder ' s node .
* @ param name
* the name of the XML element .
* @ param namespaceURI
* a namespace URI
* @ return
* @ throws IllegalStateException
* if you attempt to add a child element to an XML node that already
* contains a text node value . */
protected Element elementImpl ( String name , String namespaceURI ) { } } | assertElementContainsNoOrWhitespaceOnlyTextNodes ( this . xmlNode ) ; if ( namespaceURI == null ) { return getDocument ( ) . createElement ( name ) ; } else { return getDocument ( ) . createElementNS ( namespaceURI , name ) ; } |
public class RepositoryReaderImpl { /** * Returns log directory used by this reader .
* @ return absolute path to log directory . */
public String getLogLocation ( ) { } } | if ( logInstanceBrowser instanceof MainLogRepositoryBrowserImpl ) { return ( ( MainLogRepositoryBrowserImpl ) logInstanceBrowser ) . getLocation ( ) . getAbsolutePath ( ) ; } else { return ( ( OneInstanceBrowserImpl ) logInstanceBrowser ) . getLocation ( ) . getAbsolutePath ( ) ; } |
public class AllureThreadContext { /** * Adds new uuid . */
public void start ( final String uuid ) { } } | Objects . requireNonNull ( uuid , "step uuid" ) ; context . get ( ) . push ( uuid ) ; |
public class FlyWeightFlatXmlProducer { /** * IDataSetProducer interface */
@ Override public void setConsumer ( IDataSetConsumer consumer ) { } } | logger . debug ( "setConsumer(consumer) - start" ) ; if ( this . _columnSensing ) { _consumer = new BufferedConsumer ( consumer ) ; } else { _consumer = consumer ; } |
public class ServerLogReaderPreTransactional { /** * Called after we read a null operation from the transaction log .
* @ throws IOException when a fatal error occurred . */
private void handleNullRead ( ) throws IOException { } } | if ( curStreamFinished && readNullAfterStreamFinished ) { // If we read a null operation after the NameNode closed
// the stream , then we surely reached the end of the file .
curStreamConsumed = true ; } else { try { // This affects how much we wait after we reached the end of the
// current stream .
Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { throw new IOException ( e ) ; } } if ( curStreamFinished ) readNullAfterStreamFinished = true ; refreshStreamPosition ( ) ; |
public class SipSession { /** * This sendUnidirectionalRequest ( ) method sends out a request message with no response expected .
* A Request object is constructed from the string parameter passed in .
* Example : < code >
* StringBuffer invite = new StringBuffer ( " INVITE sip : becky @ "
* + PROXY _ HOST + ' : ' + PROXY _ PORT + " ; transport = "
* + PROXY _ PROTO + " SIP / 2.0 \ n " ) ;
* invite . append ( " Call - ID : 5ff235b07a7e4c19784d138fb26c1ec8 @ "
* + thisHostAddr + " \ n " ) ;
* invite . append ( " CSeq : 1 INVITE \ n " ) ;
* invite . append ( " From : & lt ; sip : amit @ nist . gov & gt ; ; tag = 1181356482 \ n " ) ;
* invite . append ( " To : & lt ; sip : becky @ nist . gov & gt ; \ n " ) ;
* invite . append ( " Contact : & lt ; sip : amit @ " + thisHostAddr + " : 5060 & gt ; \ n " ) ;
* invite . append ( " Max - Forwards : 5 \ n " ) ;
* invite . append ( " Via : SIP / 2.0 / " + PROXY _ PROTO + " " + thisHostAddr
* + " : 5060 ; branch = 322e3136382e312e3130303a3530363 \ n " ) ;
* invite . append ( " Event : presence \ n " ) ;
* invite . append ( " Content - Length : 5 \ n " ) ;
* invite . append ( " \ n " ) ;
* invite . append ( " 12345 " ) ;
* SipTransaction trans = ua . sendRequestWithTransaction ( invite
* . toString ( ) , true , null ) ;
* assertNotNull ( ua . format ( ) , trans ) ;
* < / code >
* @ param reqMessage A request message in the form of a String with everything from the request
* line and headers to the body . It must be in the proper format per RFC - 3261.
* @ param viaProxy If true , send the message to the proxy . In this case the request URI is
* modified by this method . Else send it to the user specified in the given request URI . In
* this case , for an INVITE request , a route header must be present for the request routing
* to complete . This method does NOT add a route header .
* @ return true if the message was successfully built and sent , false otherwise .
* @ throws ParseException if an error was encountered while parsing the string . */
public boolean sendUnidirectionalRequest ( String reqMessage , boolean viaProxy ) throws ParseException { } } | Request request = parent . getMessageFactory ( ) . createRequest ( reqMessage ) ; return sendUnidirectionalRequest ( request , viaProxy ) ; |
public class AutoConfigurationImportSelector { /** * Return the appropriate { @ link AnnotationAttributes } from the
* { @ link AnnotationMetadata } . By default this method will return attributes for
* { @ link # getAnnotationClass ( ) } .
* @ param metadata the annotation metadata
* @ return annotation attributes */
protected AnnotationAttributes getAttributes ( AnnotationMetadata metadata ) { } } | String name = getAnnotationClass ( ) . getName ( ) ; AnnotationAttributes attributes = AnnotationAttributes . fromMap ( metadata . getAnnotationAttributes ( name , true ) ) ; Assert . notNull ( attributes , ( ) -> "No auto-configuration attributes found. Is " + metadata . getClassName ( ) + " annotated with " + ClassUtils . getShortName ( name ) + "?" ) ; return attributes ; |
public class JavaUtils { /** * Get the corresponding primitive for a give wrapper type .
* Also handles arrays of which . */
public static Class < ? > getPrimitiveType ( Class < ? > javaType ) { } } | if ( javaType == Integer . class ) return int . class ; if ( javaType == Short . class ) return short . class ; if ( javaType == Boolean . class ) return boolean . class ; if ( javaType == Byte . class ) return byte . class ; if ( javaType == Long . class ) return long . class ; if ( javaType == Double . class ) return double . class ; if ( javaType == Float . class ) return float . class ; if ( javaType == Character . class ) return char . class ; if ( javaType == Integer [ ] . class ) return int [ ] . class ; if ( javaType == Short [ ] . class ) return short [ ] . class ; if ( javaType == Boolean [ ] . class ) return boolean [ ] . class ; if ( javaType == Byte [ ] . class ) return byte [ ] . class ; if ( javaType == Long [ ] . class ) return long [ ] . class ; if ( javaType == Double [ ] . class ) return double [ ] . class ; if ( javaType == Float [ ] . class ) return float [ ] . class ; if ( javaType == Character [ ] . class ) return char [ ] . class ; if ( javaType . isArray ( ) && javaType . getComponentType ( ) . isArray ( ) ) { Class < ? > compType = getPrimitiveType ( javaType . getComponentType ( ) ) ; return Array . newInstance ( compType , 0 ) . getClass ( ) ; } return javaType ; |
public class BaseJdbcDao { /** * { @ inheritDoc } */
@ Override public < T > List < T > executeSelect ( IRowMapper < T > rowMapper , String sql , Object ... bindValues ) { } } | return jdbcHelper . executeSelect ( rowMapper , sql , bindValues ) ; |
public class Range { /** * Returns a list of all allowed values within the range
* @ return a list of all allowed values within the range */
public List < Integer > listValues ( ) { } } | ArrayList < Integer > list = new ArrayList < Integer > ( getRange ( ) ) ; for ( int i = getMin ( ) ; i <= getMax ( ) ; i ++ ) { list . add ( i ) ; } return list ; |
public class JSONUtil { /** * JSON转换为List
* @ param json
* @ return */
public List < ? > formatJSON2List ( String json ) { } } | List < ? > list = null ; try { list = MAPPER . readValue ( json , List . class ) ; } catch ( Exception e ) { LOGGER . error ( "formatJSON2List error, json = " + json , e ) ; } return list ; |
public class CmsClientUserSettingConverter { /** * Loads the current user ' s preferences into a CmsUserSettingsBean . < p >
* @ return the bean representing the current user ' s preferences */
public CmsUserSettingsBean loadSettings ( ) { } } | CmsUserSettingsBean result = new CmsUserSettingsBean ( ) ; CmsDefaultUserSettings currentSettings = new CmsDefaultUserSettings ( ) ; currentSettings . init ( m_currentPreferences . getUser ( ) ) ; for ( I_CmsPreference pref : OpenCms . getWorkplaceManager ( ) . getDefaultUserSettings ( ) . getPreferences ( ) . values ( ) ) { String tab = pref . getTab ( ) ; if ( CmsGwtConstants . TAB_HIDDEN . equals ( tab ) || pref . isDisabled ( m_cms ) ) { continue ; } CmsXmlContentProperty prop2 = pref . getPropertyDefinition ( m_cms ) ; String value = pref . getValue ( currentSettings ) ; CmsXmlContentProperty resolvedProp = CmsXmlContentPropertyHelper . resolveMacrosInProperty ( prop2 . withDefaultWidget ( "string" ) , m_macroResolver ) ; result . addSetting ( value , resolvedProp , CmsGwtConstants . TAB_BASIC . equals ( tab ) ) ; } return result ; |
public class Contract { /** * syntactic sugar */
public AgentComponent addAgent ( ) { } } | AgentComponent t = new AgentComponent ( ) ; if ( this . agent == null ) this . agent = new ArrayList < AgentComponent > ( ) ; this . agent . add ( t ) ; return t ; |
public class ApplicationGatewaysInner { /** * Deletes the specified application gateway .
* @ param resourceGroupName The name of the resource group .
* @ param applicationGatewayName The name of the application gateway .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < ServiceResponse < Void > > deleteWithServiceResponseAsync ( String resourceGroupName , String applicationGatewayName ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( applicationGatewayName == null ) { throw new IllegalArgumentException ( "Parameter applicationGatewayName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } final String apiVersion = "2018-04-01" ; Observable < Response < ResponseBody > > observable = service . delete ( resourceGroupName , applicationGatewayName , this . client . subscriptionId ( ) , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) ; return client . getAzureClient ( ) . getPostOrDeleteResultAsync ( observable , new TypeToken < Void > ( ) { } . getType ( ) ) ; |
public class CheckClassAdapter { /** * Returns the signature car at the given index .
* @ param signature
* a signature .
* @ param pos
* an index in signature .
* @ return the character at the given index , or 0 if there is no such
* character . */
private static char getChar ( final String signature , int pos ) { } } | return pos < signature . length ( ) ? signature . charAt ( pos ) : ( char ) 0 ; |
public class Content { /** * Sets the cmsSources value for this Content .
* @ param cmsSources * Information about the content from the CMS it was ingested
* from .
* This attribute is read - only . */
public void setCmsSources ( com . google . api . ads . admanager . axis . v201811 . CmsContent [ ] cmsSources ) { } } | this . cmsSources = cmsSources ; |
public class Application { /** * Replaces application bindings for a given prefix .
* @ param externalExportPrefix an external export prefix ( not null )
* @ param applicationNames a non - null set of application names
* @ return true if bindings were modified , false otherwise */
public boolean replaceApplicationBindings ( String externalExportPrefix , Set < String > applicationNames ) { } } | // There is a change if the set do not have the same size or if they do not contain the same
// number of element . If no binding had been registered previously , then we only check whether
// the new set contains something .
boolean changed = false ; Set < String > oldApplicationNames = this . applicationBindings . remove ( externalExportPrefix ) ; if ( oldApplicationNames == null ) { changed = ! applicationNames . isEmpty ( ) ; } else if ( oldApplicationNames . size ( ) != applicationNames . size ( ) ) { changed = true ; } else { oldApplicationNames . removeAll ( applicationNames ) ; changed = ! oldApplicationNames . isEmpty ( ) ; } // Do not register keys when there is no binding
if ( ! applicationNames . isEmpty ( ) ) this . applicationBindings . put ( externalExportPrefix , applicationNames ) ; return changed ; |
public class Settings { /** * Get a property by name
* @ param key the property name */
public boolean getBooleanProperty ( String key , boolean defaultValue ) { } } | String value = SystemTools . replaceSystemProperties ( settings . getProperty ( key ) ) ; if ( value == null ) return defaultValue ; return Boolean . valueOf ( value . trim ( ) ) . booleanValue ( ) ; |
public class WordlistsProcessor { /** * Processes the word list .
* @ return true , if successful */
public boolean process ( ) { } } | boolean continueIterate = true ; boolean found = false ; String attempt = getCurrentAttempt ( ) ; while ( continueIterate ) { if ( attempt . equals ( toCheckAgainst ) ) { found = true ; break ; } attempt = getCurrentAttempt ( ) ; continueIterate = increment ( ) ; } return found ; |
public class LambdaIterable { /** * { @ inheritDoc } */
@ Override public < B > LambdaIterable < B > fmap ( Function < ? super A , ? extends B > fn ) { } } | return wrap ( map ( fn , as ) ) ; |
public class JaasAuthenticationHandler { /** * Gets login context .
* @ param credential the credential
* @ return the login context
* @ throws GeneralSecurityException the general security exception */
protected LoginContext getLoginContext ( final UsernamePasswordCredential credential ) throws GeneralSecurityException { } } | val callbackHandler = new UsernamePasswordCallbackHandler ( credential . getUsername ( ) , credential . getPassword ( ) ) ; if ( this . loginConfigurationFile != null && StringUtils . isNotBlank ( this . loginConfigType ) && this . loginConfigurationFile . exists ( ) && this . loginConfigurationFile . canRead ( ) ) { final Configuration . Parameters parameters = new URIParameter ( loginConfigurationFile . toURI ( ) ) ; val loginConfig = Configuration . getInstance ( this . loginConfigType , parameters ) ; return new LoginContext ( this . realm , null , callbackHandler , loginConfig ) ; } return new LoginContext ( this . realm , callbackHandler ) ; |
public class SelectWhereDSLCodeGen { /** * ClassSignatureInfo lastSignature ) ; */
public List < TypeSpec > buildWhereClasses ( GlobalParsingContext context , EntityMetaSignature signature ) { } } | SelectWhereDSLCodeGen selectWhereDSLCodeGen = context . selectWhereDSLCodeGen ( ) ; final List < FieldSignatureInfo > partitionKeys = getPartitionKeysSignatureInfo ( signature . fieldMetaSignatures ) ; final List < FieldSignatureInfo > clusteringCols = getClusteringColsSignatureInfo ( signature . fieldMetaSignatures ) ; final ClassSignatureParams classSignatureParams = ClassSignatureParams . of ( SELECT_DSL_SUFFIX , WHERE_DSL_SUFFIX , END_DSL_SUFFIX , ABSTRACT_SELECT_WHERE_PARTITION , ABSTRACT_SELECT_WHERE ) ; final ClassSignatureParams typedMapClassSignatureParams = ClassSignatureParams . of ( SELECT_DSL_SUFFIX , WHERE_TYPED_MAP_DSL_SUFFIX , END_TYPED_MAP_DSL_SUFFIX , ABSTRACT_SELECT_WHERE_PARTITION_TYPED_MAP , ABSTRACT_SELECT_WHERE_TYPED_MAP ) ; final List < TypeSpec > partitionKeysWhereClasses = buildWhereClassesInternal ( signature , selectWhereDSLCodeGen , partitionKeys , clusteringCols , classSignatureParams ) ; final List < TypeSpec > partitionKeysWhereTypedMapClasses = buildWhereClassesInternal ( signature , selectWhereDSLCodeGen , partitionKeys , clusteringCols , typedMapClassSignatureParams ) ; partitionKeysWhereClasses . addAll ( partitionKeysWhereTypedMapClasses ) ; partitionKeysWhereClasses . addAll ( generateExtraWhereClasses ( context , signature , partitionKeys , clusteringCols ) ) ; return partitionKeysWhereClasses ; |
public class CacheMapUtil { /** * batch remove the elements in the cached map
* @ param batchRemoves Map ( key , fields ) the sub map you want to remvoe */
@ SuppressWarnings ( "unused" ) public static Completable batchRemove ( Map < String , List < String > > batchRemoves ) { } } | return batchRemove ( CacheService . CACHE_CONFIG_BEAN , batchRemoves ) ; |
public class GridStory { /** * Here we specify the configuration , starting from default MostUsefulConfiguration , and changing only what is needed */
@ Override public Configuration configuration ( ) { } } | return new MostUsefulConfiguration ( ) // where to find the stories
. useStoryLoader ( new LoadFromClasspath ( this . getClass ( ) ) ) // CONSOLE and TXT reporting
. useStoryReporterBuilder ( new StoryReporterBuilder ( ) . withDefaultFormats ( ) . withFormats ( Format . CONSOLE , Format . TXT ) ) ; |
public class TransitionUtils { /** * Creates a View using the bitmap copy of < code > view < / code > . If < code > view < / code > is large ,
* the copy will use a scaled bitmap of the given view .
* @ param sceneRoot The ViewGroup in which the view copy will be displayed .
* @ param view The view to create a copy of .
* @ param parent The parent of view */
@ NonNull public static View copyViewImage ( @ NonNull ViewGroup sceneRoot , @ NonNull View view , @ NonNull View parent ) { } } | Matrix matrix = new Matrix ( ) ; matrix . setTranslate ( - parent . getScrollX ( ) , - parent . getScrollY ( ) ) ; ViewUtils . transformMatrixToGlobal ( view , matrix ) ; ViewUtils . transformMatrixToLocal ( sceneRoot , matrix ) ; RectF bounds = new RectF ( 0 , 0 , view . getWidth ( ) , view . getHeight ( ) ) ; matrix . mapRect ( bounds ) ; int left = Math . round ( bounds . left ) ; int top = Math . round ( bounds . top ) ; int right = Math . round ( bounds . right ) ; int bottom = Math . round ( bounds . bottom ) ; ImageView copy = new ImageView ( view . getContext ( ) ) ; copy . setScaleType ( ImageView . ScaleType . CENTER_CROP ) ; Bitmap bitmap = createViewBitmap ( view , matrix , bounds ) ; if ( bitmap != null ) { copy . setImageBitmap ( bitmap ) ; } int widthSpec = View . MeasureSpec . makeMeasureSpec ( right - left , View . MeasureSpec . EXACTLY ) ; int heightSpec = View . MeasureSpec . makeMeasureSpec ( bottom - top , View . MeasureSpec . EXACTLY ) ; copy . measure ( widthSpec , heightSpec ) ; copy . layout ( left , top , right , bottom ) ; return copy ; |
public class MessageStoreImpl { /** * JsMonitoredComponent Implementation / / */
@ Override public final JsHealthState getHealthState ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "getHealthState" ) ; SibTr . exit ( this , tc , "getHealthState" , "return=" + _healthState ) ; } return _healthState ; |
public class WithMavenStepExecution2 { /** * Reads the config file from Config File Provider , expands the credentials and stores it in a file on the temp
* folder to use it with the maven wrapper script
* @ param mavenSettingsConfigId config file id from Config File Provider
* @ param mavenSettingsFile path to write te content to
* @ param credentials
* @ return the { @ link FilePath } to the settings file
* @ throws AbortException in case of error */
private void settingsFromConfig ( String mavenSettingsConfigId , FilePath mavenSettingsFile , @ Nonnull Collection < Credentials > credentials ) throws AbortException { } } | Config c = ConfigFiles . getByIdOrNull ( build , mavenSettingsConfigId ) ; if ( c == null ) { throw new AbortException ( "Could not find the Maven settings.xml config file id:" + mavenSettingsConfigId + ". Make sure it exists on Managed Files" ) ; } if ( StringUtils . isBlank ( c . content ) ) { throw new AbortException ( "Could not create Maven settings.xml config file id:" + mavenSettingsConfigId + ". Content of the file is empty" ) ; } MavenSettingsConfig mavenSettingsConfig ; if ( c instanceof MavenSettingsConfig ) { mavenSettingsConfig = ( MavenSettingsConfig ) c ; } else { mavenSettingsConfig = new MavenSettingsConfig ( c . id , c . name , c . comment , c . content , MavenSettingsConfig . isReplaceAllDefault , null ) ; } try { final Map < String , StandardUsernameCredentials > resolvedCredentialsByMavenServerId = resolveCredentials ( mavenSettingsConfig . getServerCredentialMappings ( ) , "Maven settings" ) ; String mavenSettingsFileContent ; if ( resolvedCredentialsByMavenServerId . isEmpty ( ) ) { mavenSettingsFileContent = mavenSettingsConfig . content ; if ( LOGGER . isLoggable ( Level . FINE ) ) { console . println ( "[withMaven] using Maven settings.xml '" + mavenSettingsConfig . id + "' with NO Maven servers credentials provided by Jenkins" ) ; } } else { credentials . addAll ( resolvedCredentialsByMavenServerId . values ( ) ) ; List < String > tempFiles = new ArrayList < > ( ) ; mavenSettingsFileContent = CredentialsHelper . fillAuthentication ( mavenSettingsConfig . content , mavenSettingsConfig . isReplaceAll , resolvedCredentialsByMavenServerId , tempBinDir , tempFiles ) ; if ( LOGGER . isLoggable ( Level . FINE ) ) { console . println ( "[withMaven] using Maven settings.xml '" + mavenSettingsConfig . id + "' with Maven servers credentials provided by Jenkins " + "(replaceAll: " + mavenSettingsConfig . isReplaceAll + "): " + resolvedCredentialsByMavenServerId . entrySet ( ) . stream ( ) . map ( new MavenServerToCredentialsMappingToStringFunction ( ) ) . sorted ( ) . collect ( Collectors . joining ( ", " ) ) ) ; } } mavenSettingsFile . write ( mavenSettingsFileContent , getComputer ( ) . getDefaultCharset ( ) . name ( ) ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Exception injecting Maven settings.xml " + mavenSettingsConfig . id + " during the build: " + build + ": " + e . getMessage ( ) , e ) ; } |
public class StringExpression { /** * Create a { @ code this . startsWith ( str ) } expression
* < p > Return true if this starts with str < / p >
* @ param str string
* @ return this . startsWith ( str )
* @ see java . lang . String # startsWith ( String ) */
public BooleanExpression startsWith ( Expression < String > str ) { } } | return Expressions . booleanOperation ( Ops . STARTS_WITH , mixin , str ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcCenterLineProfileDef ( ) { } } | if ( ifcCenterLineProfileDefEClass == null ) { ifcCenterLineProfileDefEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 86 ) ; } return ifcCenterLineProfileDefEClass ; |
public class TransactionScope { /** * Registers the given cursor against the active transaction , allowing it
* to be closed on transaction exit or transaction manager close . If there
* is no active transaction in scope , the cursor is registered as not part
* of a transaction . Cursors should register when created . */
public < S extends Storable > void register ( Class < S > type , Cursor < S > cursor ) { } } | mLock . lock ( ) ; try { checkClosed ( ) ; if ( mCursors == null ) { mCursors = new IdentityHashMap < Class < ? > , CursorList < TransactionImpl < Txn > > > ( ) ; } CursorList < TransactionImpl < Txn > > cursorList = mCursors . get ( type ) ; if ( cursorList == null ) { cursorList = new CursorList < TransactionImpl < Txn > > ( ) ; mCursors . put ( type , cursorList ) ; } cursorList . register ( cursor , mActive ) ; if ( mActive != null ) { mActive . register ( cursor ) ; } } finally { mLock . unlock ( ) ; } |
public class DescribeFpgaImagesRequest { /** * Filters the AFI by owner . Specify an AWS account ID , < code > self < / code > ( owner is the sender of the request ) , or
* an AWS owner alias ( valid values are < code > amazon < / code > | < code > aws - marketplace < / code > ) .
* @ return Filters the AFI by owner . Specify an AWS account ID , < code > self < / code > ( owner is the sender of the
* request ) , or an AWS owner alias ( valid values are < code > amazon < / code > | < code > aws - marketplace < / code > ) . */
public java . util . List < String > getOwners ( ) { } } | if ( owners == null ) { owners = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return owners ; |
public class HttpRequest { /** * Parses a new HttpMessage using { @ link # parse ( InputStream ) } with out as
* null .
* @ param in The InputStream to parse
* @ return An HttpMessage object parsed from the InputStream
* @ throws java . io . IOException Any IO Exceptions will be thrown */
public static HttpRequest parseMessage ( InputStream in ) throws IOException { } } | HttpRequest m = new HttpRequest ( ) ; m . parse ( in ) ; return m ; |
public class DependencyQueryBuilder { /** * Creates a { @ link DependencyQueryBuilder } based on a { @ link DependencyQuery } */
public static DependencyQueryBuilder create ( DependencyQuery query ) { } } | DependencyQueryBuilder builder = new DependencyQueryBuilder ( ) ; builder . setCoordinate ( query . getCoordinate ( ) ) ; builder . setFilter ( query . getDependencyFilter ( ) ) ; builder . setRepositories ( query . getDependencyRepositories ( ) ) ; builder . setScopeType ( query . getScopeType ( ) ) ; return builder ; |
public class Grid { /** * Returns model for given combination of model parameters or null if the model does not exist .
* @ param params parameters of the model
* @ return A model run with these parameters , or null if the model does not exist . */
public Model getModel ( MP params ) { } } | Key < Model > mKey = getModelKey ( params ) ; return mKey != null ? mKey . get ( ) : null ; |
public class StringUtil { /** * Checks if a string contains only digits .
* @ return True if the string0 only contains digits , or false otherwise . */
static public boolean containsOnlyDigits ( String string0 ) { } } | // are they all digits ?
for ( int i = 0 ; i < string0 . length ( ) ; i ++ ) { if ( ! Character . isDigit ( string0 . charAt ( i ) ) ) { return false ; } } return true ; |
public class ReadCoilsResponse { /** * Convenience method that returns the state
* of the bit at the given index .
* @ param index the index of the coil for which
* the status should be returned .
* @ return true if set , false otherwise .
* @ throws IndexOutOfBoundsException if the
* index is out of bounds */
public boolean getCoilStatus ( int index ) throws IndexOutOfBoundsException { } } | if ( index < 0 ) { throw new IllegalArgumentException ( index + " < 0" ) ; } if ( index > coils . size ( ) ) { throw new IndexOutOfBoundsException ( index + " > " + coils . size ( ) ) ; } return coils . getBit ( index ) ; |
public class PropertiesConfigHelper { /** * Returns the map , where the key is the 2 group of the pattern and the
* value is the property value
* @ param keyPattern
* the pattern of the key
* @ return the map . */
private Map < String , String > getCustomMap ( Pattern keyPattern ) { } } | Map < String , String > map = new HashMap < > ( ) ; for ( Iterator < Object > it = props . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { String key = ( String ) it . next ( ) ; Matcher matcher = keyPattern . matcher ( key ) ; if ( matcher . matches ( ) ) { String id = matcher . group ( 2 ) ; String propertyValue = props . getProperty ( key ) ; map . put ( id , propertyValue ) ; } } return map ; |
public class WebSecurityPropagatorImpl { /** * Gets the security metadata from the web app config
* @ param webAppConfig the webAppConfig representing the deployed module
* @ return the security metadata */
private SecurityMetadata getSecurityMetadata ( WebAppConfig webAppConfig ) { } } | WebModuleMetaData wmmd = ( ( WebAppConfigExtended ) webAppConfig ) . getMetaData ( ) ; return ( SecurityMetadata ) wmmd . getSecurityMetaData ( ) ; |
public class HttpResponseMessageImpl { /** * Query whether or not a body is allowed to be present for this
* message . This is not whether a body is present , but rather only
* whether it is allowed to be present .
* @ return boolean ( true if allowed ) */
@ Override public boolean isBodyAllowed ( ) { } } | if ( super . isBodyAllowed ( ) ) { // sending a body with the response is not valid for a HEAD request
if ( getServiceContext ( ) . getRequestMethod ( ) . equals ( MethodValues . HEAD ) ) { return false ; } // if that worked , then check the status code flag
return this . myStatusCode . isBodyAllowed ( ) ; } // no body allowed on this message
return false ; |
public class ScalarValueMakerFactory { /** * produce a maker for given settable
* @ param settable
* settable
* @ return maker */
public Maker from ( Settable settable ) { } } | Optional < Maker < ? > > makerOptional = context . getPreferredValueMakers ( ) . getMaker ( settable ) ; if ( makerOptional . isPresent ( ) ) { return makerOptional . get ( ) ; } Type type = settable . getType ( ) ; Class < ? > rawType = ClassUtil . getRawType ( type ) ; if ( ClassUtil . isPrimitive ( type ) ) { return new PrimitiveMaker ( type ) ; } if ( type == String . class ) { return StringMaker . from ( settable ) ; } if ( type == Date . class ) { return new DateMaker ( ) ; } if ( Number . class . isAssignableFrom ( rawType ) ) { return NumberMaker . from ( settable ) ; } if ( ClassUtil . isArray ( type ) ) { log . trace ( "array type: {}" , rawType . getComponentType ( ) ) ; return new NullMaker ( ) ; } if ( ClassUtil . isEnum ( type ) ) { log . trace ( "enum type: {}" , type ) ; return new EnumMaker ( rawType . getEnumConstants ( ) ) ; } if ( ClassUtil . isCollection ( type ) ) { log . trace ( "collection: {}" , type ) ; return new NullMaker ( ) ; } if ( ClassUtil . isMap ( type ) ) { log . trace ( "map: {}" , type ) ; return new NullMaker < Object > ( ) ; } if ( ClassUtil . isEntity ( type ) ) { log . trace ( "{} is entity type" , type ) ; // we don ' t want to make unnecessary entities
// @ see EntityMakerBuilder
return new ReuseOrNullMaker ( context . getBeanValueHolder ( ) , rawType ) ; } log . debug ( "guessing this is a bean {}" , type ) ; return new BeanMaker ( rawType , context ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.