signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SchemaProperty { /** * - - - - - public static methods - - - - - */
public static List < GraphQLArgument > getGraphQLArgumentsForType ( final Type type ) { } } | final List < GraphQLArgument > arguments = new LinkedList < > ( ) ; switch ( type ) { case String : arguments . add ( GraphQLArgument . newArgument ( ) . name ( "_equals" ) . type ( Scalars . GraphQLString ) . build ( ) ) ; arguments . add ( GraphQLArgument . newArgument ( ) . name ( "_contains" ) . type ( Scalars . GraphQLString ) . build ( ) ) ; arguments . add ( GraphQLArgument . newArgument ( ) . name ( "_conj" ) . type ( Scalars . GraphQLString ) . build ( ) ) ; break ; case Integer : arguments . add ( GraphQLArgument . newArgument ( ) . name ( "_equals" ) . type ( Scalars . GraphQLInt ) . build ( ) ) ; arguments . add ( GraphQLArgument . newArgument ( ) . name ( "_conj" ) . type ( Scalars . GraphQLString ) . build ( ) ) ; break ; case Long : arguments . add ( GraphQLArgument . newArgument ( ) . name ( "_equals" ) . type ( Scalars . GraphQLLong ) . build ( ) ) ; arguments . add ( GraphQLArgument . newArgument ( ) . name ( "_conj" ) . type ( Scalars . GraphQLString ) . build ( ) ) ; break ; } return arguments ; |
public class SingularityExecutorShellCommandUpdater { /** * TODO thread ? */
public void sendUpdate ( UpdateType updateType , Optional < String > message , Optional < String > outputFilename ) { } } | SingularityTaskShellCommandUpdate update = new SingularityTaskShellCommandUpdate ( shellRequest . getId ( ) , System . currentTimeMillis ( ) , message , outputFilename , updateType ) ; try { byte [ ] data = objectMapper . writeValueAsBytes ( update ) ; task . getLog ( ) . info ( "Sending update {} ({}) for shell command {}" , updateType , message . or ( "" ) , shellRequest . getId ( ) ) ; task . getDriver ( ) . sendFrameworkMessage ( data ) ; } catch ( JsonProcessingException e ) { task . getLog ( ) . error ( "Unable to serialize update {}" , update , e ) ; } |
public class TVRageApi { /** * Get the episode information for all episodes for a show
* @ param showID
* @ return
* @ throws com . omertron . tvrageapi . TVRageException */
public EpisodeList getEpisodeList ( String showID ) throws TVRageException { } } | if ( ! isValidString ( showID ) ) { return new EpisodeList ( ) ; } String tvrageURL = buildURL ( API_EPISODE_LIST , showID ) . toString ( ) ; return TVRageParser . getEpisodeList ( tvrageURL ) ; |
public class AttachedRemoteSubscriberControl { /** * Return the remote engine uuid */
public String getRemoteEngineUuid ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getRemoteEngineUuid" ) ; String engineUUID = _anycastInputHandler . getLocalisationUuid ( ) . toString ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getRemoteEngineUuid" , engineUUID ) ; return engineUUID ; |
public class KamImpl { /** * { @ inheritDoc } */
@ Override public Set < KamNode > getAdjacentNodes ( KamNode kamNode , EdgeDirectionType edgeDirection ) { } } | return getAdjacentNodes ( kamNode , edgeDirection , null , null ) ; |
public class TableReader { /** * Read the table from the file and populate the supplied Table instance .
* @ param file database file
* @ param table Table instance */
public void read ( File file , Table table ) throws IOException { } } | // System . out . println ( " Reading " + file . getName ( ) ) ;
InputStream is = null ; try { is = new FileInputStream ( file ) ; read ( is , table ) ; } finally { StreamHelper . closeQuietly ( is ) ; } |
public class SparseHashIntegerVector { /** * { @ inheritDoc } */
public int add ( int index , int delta ) { } } | int val = map . get ( index ) ; int newVal = val + delta ; if ( newVal == 0 ) map . remove ( index ) ; else map . put ( index , newVal ) ; magnitude = - 1 ; return newVal ; |
public class SimpleJob { /** * Job { @ link Filter } class setting .
* @ param clazz { @ link Filter } class
* @ return this */
public SimpleJob setFilter ( Class < ? extends Mapper < Key , Value , Key , Value > > clazz ) { } } | super . setMapperClass ( clazz ) ; mapper = true ; return this ; |
public class PrintedContent { /** * When anonymization is enabled , we create an { @ link com . cloudbees . jenkins . support . filter . FilteredWriter } directly from
* the underlying { @ link FilteredOutputStream } that prevents us from encoding and
* then immediately decoding characters written to the returned { @ link java . io . PrintStream }
* when filtering . */
private PrintWriter getWriter ( OutputStream os ) throws IOException { } } | if ( os instanceof WrapperOutputStream ) { OutputStream out = ( ( WrapperOutputStream ) os ) . unwrapRecursively ( ) ; if ( out instanceof FilteredOutputStream ) { FilteredOutputStream filteredStream = ( FilteredOutputStream ) out ; return new PrintWriter ( new IgnoreCloseWriter ( filteredStream . asWriter ( ) ) ) ; } } return new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( os , StandardCharsets . UTF_8 ) ) ) ; |
public class FlowControlHandler { /** * Releases all messages and destroys the { @ link Queue } . */
private void destroy ( ) { } } | if ( queue != null ) { if ( ! queue . isEmpty ( ) ) { logger . trace ( "Non-empty queue: {}" , queue ) ; if ( releaseMessages ) { Object msg ; while ( ( msg = queue . poll ( ) ) != null ) { ReferenceCountUtil . safeRelease ( msg ) ; } } } queue . recycle ( ) ; queue = null ; } |
public class Sql { /** * Performs the given SQL query calling the given Closure with each row of the result set .
* The row will be a < code > GroovyResultSet < / code > which is a < code > ResultSet < / code >
* that supports accessing the fields using property style notation and ordinal index values .
* In addition , the < code > metaClosure < / code > will be called once passing in the
* < code > ResultSetMetaData < / code > as argument .
* The query may contain placeholder question marks which match the given list of parameters .
* Example usage :
* < pre >
* def printColNames = { meta { @ code - > }
* ( 1 . . meta . columnCount ) . each {
* print meta . getColumnLabel ( it ) . padRight ( 20)
* println ( )
* def printRow = { row { @ code - > }
* row . toRowResult ( ) . values ( ) . each { print it . toString ( ) . padRight ( 20 ) }
* println ( )
* sql . eachRow ( " select * from PERSON where lastname like ? " , [ ' % a % ' ] , printColNames , printRow )
* < / pre >
* This method supports named and named ordinal parameters .
* See the class Javadoc for more details .
* Resource handling is performed automatically where appropriate .
* @ param sql the sql statement
* @ param params a list of parameters
* @ param metaClosure called for meta data ( only once after sql execution )
* @ param rowClosure called for each row with a GroovyResultSet
* @ throws SQLException if a database access error occurs */
public void eachRow ( String sql , List < Object > params , @ ClosureParams ( value = SimpleType . class , options = "java.sql.ResultSetMetaData" ) Closure metaClosure , @ ClosureParams ( value = SimpleType . class , options = "groovy.sql.GroovyResultSet" ) Closure rowClosure ) throws SQLException { } } | eachRow ( sql , params , metaClosure , 0 , 0 , rowClosure ) ; |
public class ClassInfo { /** * Add method info .
* @ param methodInfoList
* the method info list
* @ param classNameToClassInfo
* the map from class name to class info */
void addMethodInfo ( final MethodInfoList methodInfoList , final Map < String , ClassInfo > classNameToClassInfo ) { } } | for ( final MethodInfo mi : methodInfoList ) { // Index method annotations
addFieldOrMethodAnnotationInfo ( mi . annotationInfo , /* isField = */
false , classNameToClassInfo ) ; // Index method parameter annotations
if ( mi . parameterAnnotationInfo != null ) { for ( int i = 0 ; i < mi . parameterAnnotationInfo . length ; i ++ ) { final AnnotationInfo [ ] paramAnnotationInfoArr = mi . parameterAnnotationInfo [ i ] ; if ( paramAnnotationInfoArr != null ) { for ( int j = 0 ; j < paramAnnotationInfoArr . length ; j ++ ) { final AnnotationInfo methodParamAnnotationInfo = paramAnnotationInfoArr [ j ] ; final ClassInfo annotationClassInfo = getOrCreateClassInfo ( methodParamAnnotationInfo . getName ( ) , ANNOTATION_CLASS_MODIFIER , classNameToClassInfo ) ; annotationClassInfo . addRelatedClass ( RelType . CLASSES_WITH_METHOD_PARAMETER_ANNOTATION , this ) ; this . addRelatedClass ( RelType . METHOD_PARAMETER_ANNOTATIONS , annotationClassInfo ) ; } } } } } if ( this . methodInfo == null ) { this . methodInfo = methodInfoList ; } else { this . methodInfo . addAll ( methodInfoList ) ; } |
public class AmazonSQSClient { /** * Returns the URL of an existing Amazon SQS queue .
* To access a queue that belongs to another AWS account , use the < code > QueueOwnerAWSAccountId < / code > parameter to
* specify the account ID of the queue ' s owner . The queue ' s owner must grant you permission to access the queue . For
* more information about shared queue access , see < code > < a > AddPermission < / a > < / code > or see < a href =
* " http : / / docs . aws . amazon . com / AWSSimpleQueueService / latest / SQSDeveloperGuide / sqs - writing - an - sqs - policy . html # write - messages - to - shared - queue "
* > Allow Developers to Write Messages to a Shared Queue < / a > in the < i > Amazon Simple Queue Service Developer
* Guide < / i > .
* @ param getQueueUrlRequest
* @ return Result of the GetQueueUrl operation returned by the service .
* @ throws QueueDoesNotExistException
* The specified queue doesn ' t exist .
* @ sample AmazonSQS . GetQueueUrl
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / sqs - 2012-11-05 / GetQueueUrl " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public GetQueueUrlResult getQueueUrl ( GetQueueUrlRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetQueueUrl ( request ) ; |
public class MessageAdapter { /** * Gets all child MessageOrBuilder descriptors for the type .
* @ author protobufel @ gmail . com David Tesler */
protected static List < FieldDescriptor > getChildFieldDescriptors ( final Descriptor type ) { } } | final List < FieldDescriptor > fields = new ArrayList < FieldDescriptor > ( ) ; for ( final FieldDescriptor field : type . getFields ( ) ) { if ( field . getJavaType ( ) == JavaType . MESSAGE ) { fields . add ( field ) ; } } for ( final FieldDescriptor field : type . getExtensions ( ) ) { if ( field . getJavaType ( ) == JavaType . MESSAGE ) { fields . add ( field ) ; } } return Collections . unmodifiableList ( fields ) ; |
public class RecvTensorRequest { /** * < pre >
* A key that identifies the tensor to be received .
* < / pre >
* < code > optional string rendezvous _ key = 2 ; < / code > */
public java . lang . String getRendezvousKey ( ) { } } | java . lang . Object ref = rendezvousKey_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; rendezvousKey_ = s ; return s ; } |
public class AmazonEC2Waiters { /** * Builds a CustomerGatewayAvailable waiter by using custom parameters waiterParameters and other parameters defined
* in the waiters specification , and then polls until it determines whether the resource entered the desired state
* or not , where polling criteria is bound by either default polling strategy or custom polling strategy . */
public Waiter < DescribeCustomerGatewaysRequest > customerGatewayAvailable ( ) { } } | return new WaiterBuilder < DescribeCustomerGatewaysRequest , DescribeCustomerGatewaysResult > ( ) . withSdkFunction ( new DescribeCustomerGatewaysFunction ( client ) ) . withAcceptors ( new CustomerGatewayAvailable . IsAvailableMatcher ( ) , new CustomerGatewayAvailable . IsDeletedMatcher ( ) , new CustomerGatewayAvailable . IsDeletingMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 40 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; |
public class DefaultGroovyMethods { /** * Compare two Characters . The ordinal values of the Characters
* are compared ( the ordinal value is the unicode
* value which for simple character sets is the ASCII value ) .
* @ param left a Character
* @ param right a Character
* @ return the result of the comparison
* @ since 1.0 */
public static int compareTo ( Character left , Character right ) { } } | return compareTo ( Integer . valueOf ( left ) , right ) ; |
public class TileDaoUtils { /** * Get the zoom level for the provided width and height in the default units
* @ param widths
* sorted widths
* @ param heights
* sorted heights
* @ param tileMatrices
* tile matrices
* @ param width
* in default units
* @ param height
* in default units
* @ return tile matrix zoom level
* @ since 1.2.1 */
public static Long getZoomLevel ( double [ ] widths , double [ ] heights , List < TileMatrix > tileMatrices , double width , double height ) { } } | return getZoomLevel ( widths , heights , tileMatrices , width , height , true ) ; |
public class LayerTree { /** * Updates the icons and the state of the buttons in the toolbar based upon the currently selected layer
* @ param toolStripMembers
* data for the toolbar */
private void updateButtonIconsAndStates ( Canvas [ ] toolStripMembers ) { } } | for ( Canvas toolStripMember : toolStripMembers ) { if ( toolStripMember instanceof LayerTreeModalButton ) { ( ( LayerTreeModalButton ) toolStripMember ) . update ( ) ; } else if ( toolStripMember instanceof LayerTreeButton ) { ( ( LayerTreeButton ) toolStripMember ) . update ( ) ; } } |
public class DeleteRepositoryPolicyRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteRepositoryPolicyRequest deleteRepositoryPolicyRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteRepositoryPolicyRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteRepositoryPolicyRequest . getRegistryId ( ) , REGISTRYID_BINDING ) ; protocolMarshaller . marshall ( deleteRepositoryPolicyRequest . getRepositoryName ( ) , REPOSITORYNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DatabaseProperties { /** * Returns a map of the meta data from the database properties . This
* primarily contains timestamps of when the NVD CVE information was last
* updated .
* @ return a map of the database meta data */
public synchronized Map < String , String > getMetaData ( ) { } } | final Map < String , String > map = new TreeMap < > ( ) ; for ( Entry < Object , Object > entry : properties . entrySet ( ) ) { final String key = ( String ) entry . getKey ( ) ; if ( ! "version" . equals ( key ) ) { if ( key . startsWith ( "NVD CVE " ) ) { try { final long epoch = Long . parseLong ( ( String ) entry . getValue ( ) ) ; final DateTime date = new DateTime ( epoch ) ; final DateTimeFormatter format = DateTimeFormat . forPattern ( "dd/MM/yyyy HH:mm:ss" ) ; final String formatted = format . print ( date ) ; // final Date date = new Date ( epoch ) ;
// final DateFormat format = new SimpleDateFormat ( " dd / MM / yyyy HH : mm : ss " ) ;
// final String formatted = format . format ( date ) ;
map . put ( key , formatted ) ; } catch ( Throwable ex ) { // deliberately being broad in this catch clause
LOGGER . debug ( "Unable to parse timestamp from DB" , ex ) ; map . put ( key , ( String ) entry . getValue ( ) ) ; } } else { map . put ( key , ( String ) entry . getValue ( ) ) ; } } } return map ; |
public class LockCache { /** * Returns whether the cache contains a particular key .
* @ param key the key to look up in the cache
* @ return true if the key is contained in the cache */
@ VisibleForTesting public boolean containsKey ( K key ) { } } | Preconditions . checkNotNull ( key , "key can not be null" ) ; return mCache . containsKey ( key ) ; |
public class DatasetTriggerMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DatasetTrigger datasetTrigger , ProtocolMarshaller protocolMarshaller ) { } } | if ( datasetTrigger == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( datasetTrigger . getSchedule ( ) , SCHEDULE_BINDING ) ; protocolMarshaller . marshall ( datasetTrigger . getDataset ( ) , DATASET_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class HeaderTemplate { /** * Append values to a Header Template .
* @ param headerTemplate to append to .
* @ param values to append .
* @ return a new Header Template with the values added . */
public static HeaderTemplate append ( HeaderTemplate headerTemplate , Iterable < String > values ) { } } | Set < String > headerValues = new LinkedHashSet < > ( headerTemplate . getValues ( ) ) ; headerValues . addAll ( StreamSupport . stream ( values . spliterator ( ) , false ) . filter ( Util :: isNotBlank ) . collect ( Collectors . toSet ( ) ) ) ; return create ( headerTemplate . getName ( ) , headerValues ) ; |
public class XMLReaderManager { /** * Retrieves a cached XMLReader for this thread , or creates a new
* XMLReader , if the existing reader is in use . When the caller no
* longer needs the reader , it must release it with a call to
* { @ link # releaseXMLReader } . */
public synchronized XMLReader getXMLReader ( ) throws SAXException { } } | XMLReader reader ; boolean readerInUse ; if ( m_readers == null ) { // When the m _ readers . get ( ) method is called for the first time
// on a thread , a new XMLReader will automatically be created .
m_readers = new ThreadLocal ( ) ; } if ( m_inUse == null ) { m_inUse = new Hashtable ( ) ; } // If the cached reader for this thread is in use , construct a new
// one ; otherwise , return the cached reader .
reader = ( XMLReader ) m_readers . get ( ) ; boolean threadHasReader = ( reader != null ) ; if ( ! threadHasReader || m_inUse . get ( reader ) == Boolean . TRUE ) { try { try { // According to JAXP 1.2 specification , if a SAXSource
// is created using a SAX InputSource the Transformer or
// TransformerFactory creates a reader via the
// XMLReaderFactory if setXMLReader is not used
reader = XMLReaderFactory . createXMLReader ( ) ; } catch ( Exception e ) { try { // If unable to create an instance , let ' s try to use
// the XMLReader from JAXP
if ( m_parserFactory == null ) { m_parserFactory = SAXParserFactory . newInstance ( ) ; m_parserFactory . setNamespaceAware ( true ) ; } reader = m_parserFactory . newSAXParser ( ) . getXMLReader ( ) ; } catch ( ParserConfigurationException pce ) { throw pce ; // pass along pce
} } try { reader . setFeature ( NAMESPACES_FEATURE , true ) ; reader . setFeature ( NAMESPACE_PREFIXES_FEATURE , false ) ; } catch ( SAXException se ) { // Try to carry on if we ' ve got a parser that
// doesn ' t know about namespace prefixes .
} } catch ( ParserConfigurationException ex ) { throw new SAXException ( ex ) ; } catch ( FactoryConfigurationError ex1 ) { throw new SAXException ( ex1 . toString ( ) ) ; } catch ( NoSuchMethodError ex2 ) { } catch ( AbstractMethodError ame ) { } // Cache the XMLReader if this is the first time we ' ve created
// a reader for this thread .
if ( ! threadHasReader ) { m_readers . set ( reader ) ; m_inUse . put ( reader , Boolean . TRUE ) ; } } else { m_inUse . put ( reader , Boolean . TRUE ) ; } return reader ; |
public class SyncPageLoader { /** * Display the target html in the pane . */
public void run ( ) { } } | if ( ( m_url == null ) && ( m_strHtmlText == null ) ) { // restore the original cursor
if ( m_bChangeCursor ) { if ( m_applet != null ) m_applet . setStatus ( 0 , m_editorPane , m_oldCursor ) ; else { Component component = m_editorPane ; while ( component . getParent ( ) != null ) { component = component . getParent ( ) ; } component . setCursor ( ( Cursor ) m_oldCursor ) ; } Container parent = m_editorPane . getParent ( ) ; parent . repaint ( ) ; } } else { if ( m_bChangeCursor ) { if ( m_applet != null ) m_oldCursor = m_applet . setStatus ( Cursor . WAIT_CURSOR , m_editorPane , null ) ; else { Component component = m_editorPane ; boolean bIsVisible = true ; while ( component . getParent ( ) != null ) { component = component . getParent ( ) ; if ( ! component . isVisible ( ) ) bIsVisible = false ; } m_oldCursor = component . getCursor ( ) ; Cursor cursor = Cursor . getPredefinedCursor ( Cursor . WAIT_CURSOR ) ; if ( bIsVisible ) component . setCursor ( cursor ) ; } } synchronized ( m_editorPane ) { Document doc = m_editorPane . getDocument ( ) ; try { if ( m_url != null ) { m_editorPane . setPage ( m_url ) ; } else { this . setText ( doc , m_strHtmlText ) ; } } catch ( IOException ioe ) { String error = ioe . getLocalizedMessage ( ) ; if ( ( error != null ) && ( error . length ( ) > 0 ) ) { String errorText = m_strHtmlErrorText ; if ( errorText == null ) errorText = DEFAULT_ERROR_TEXT ; errorText = MessageFormat . format ( errorText , m_url . toString ( ) , error ) ; this . setText ( doc , errorText ) ; } else m_editorPane . setDocument ( doc ) ; // getToolkit ( ) . beep ( ) ;
} finally { // schedule the cursor to revert after
// the paint has happened .
m_url = null ; m_strHtmlText = null ; if ( m_bChangeCursor ) SwingUtilities . invokeLater ( this ) ; } } } |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EEnum getIfcElementAssemblyTypeEnum ( ) { } } | if ( ifcElementAssemblyTypeEnumEEnum == null ) { ifcElementAssemblyTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 980 ) ; } return ifcElementAssemblyTypeEnumEEnum ; |
public class Converter { /** * / / / / MergeQuery */
static MergeQuery convert ( com . linecorp . centraldogma . common . MergeQuery < ? > mergeQuery ) { } } | return MergeQueryConverter . TO_DATA . convert ( mergeQuery ) ; |
public class TurfMeta { /** * Get all coordinates from a { @ link MultiPolygon } object , returning a { @ code List } of Point
* objects . If you have a geometry collection , you need to break it down to individual geometry
* objects before using { @ link # coordAll } .
* @ param multiPolygon any { @ link MultiPolygon } object
* @ param excludeWrapCoord whether or not to include the final coordinate of LinearRings that
* wraps the ring in its iteration . Used to handle { @ link Polygon } and
* { @ link MultiPolygon } geometries .
* @ return a { @ code List } made up of { @ link Point } s
* @ since 2.0.0 */
@ NonNull public static List < Point > coordAll ( @ NonNull MultiPolygon multiPolygon , boolean excludeWrapCoord ) { } } | return coordAll ( new ArrayList < Point > ( ) , multiPolygon , excludeWrapCoord ) ; |
public class PrefixedProperties { /** * Gets the prefixed key and parse it to an double [ ] < br >
* Each comma - separated list can be used .
* @ param key
* the key
* @ return double [ ] or null if the key couldn ' t get found . */
public double [ ] getDoubleArray ( final String key ) { } } | final String [ ] value = getArray ( key ) ; if ( value != null ) { final double [ ] result = new double [ value . length ] ; for ( int i = 0 ; i < value . length ; i ++ ) { result [ i ] = Double . parseDouble ( value [ i ] ) ; } return result ; } return null ; |
public class Basic2DMatrix { /** * Creates a block { @ link Basic2DMatrix } of the given blocks { @ code a } ,
* { @ code b } , { @ code c } and { @ code d } . */
public static Basic2DMatrix block ( Matrix a , Matrix b , Matrix c , Matrix d ) { } } | if ( ( a . rows ( ) != b . rows ( ) ) || ( a . columns ( ) != c . columns ( ) ) || ( c . rows ( ) != d . rows ( ) ) || ( b . columns ( ) != d . columns ( ) ) ) { throw new IllegalArgumentException ( "Sides of blocks are incompatible!" ) ; } int rows = a . rows ( ) + c . rows ( ) ; int columns = a . columns ( ) + b . columns ( ) ; double [ ] [ ] array = new double [ rows ] [ columns ] ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < columns ; j ++ ) { if ( ( i < a . rows ( ) ) && ( j < a . columns ( ) ) ) { array [ i ] [ j ] = a . get ( i , j ) ; } if ( ( i < a . rows ( ) ) && ( j > a . columns ( ) ) ) { array [ i ] [ j ] = b . get ( i , j ) ; } if ( ( i > a . rows ( ) ) && ( j < a . columns ( ) ) ) { array [ i ] [ j ] = c . get ( i , j ) ; } if ( ( i > a . rows ( ) ) && ( j > a . columns ( ) ) ) { array [ i ] [ j ] = d . get ( i , j ) ; } } } return new Basic2DMatrix ( array ) ; |
public class CommerceDiscountUtil { /** * Returns all the commerce discounts where displayDate & lt ; & # 63 ; and status = & # 63 ; .
* @ param displayDate the display date
* @ param status the status
* @ return the matching commerce discounts */
public static List < CommerceDiscount > findByLtD_S ( Date displayDate , int status ) { } } | return getPersistence ( ) . findByLtD_S ( displayDate , status ) ; |
public class AwsSecurityFindingFilters { /** * The timestamp of when the note was updated .
* @ param noteUpdatedAt
* The timestamp of when the note was updated . */
public void setNoteUpdatedAt ( java . util . Collection < DateFilter > noteUpdatedAt ) { } } | if ( noteUpdatedAt == null ) { this . noteUpdatedAt = null ; return ; } this . noteUpdatedAt = new java . util . ArrayList < DateFilter > ( noteUpdatedAt ) ; |
public class CmsSetupBean { /** * Returns a map of dependencies . < p >
* The component dependencies are get from the setup and module components . properties files found . < p >
* @ return a Map of component ids as keys and a list of dependency names as values */
public Map < String , List < String > > buildDepsForAllComponents ( ) { } } | Map < String , List < String > > ret = new HashMap < String , List < String > > ( ) ; Iterator < CmsSetupComponent > itComponents = CmsCollectionsGenericWrapper . < CmsSetupComponent > list ( m_components . elementList ( ) ) . iterator ( ) ; while ( itComponents . hasNext ( ) ) { CmsSetupComponent component = itComponents . next ( ) ; // if component a depends on component b , and component c depends also on component b :
// build a map with a list containing " a " and " c " keyed by " b " to get a
// list of components depending on component " b " . . .
Iterator < String > itDeps = component . getDependencies ( ) . iterator ( ) ; while ( itDeps . hasNext ( ) ) { String dependency = itDeps . next ( ) ; // get the list of dependent modules
List < String > componentDependencies = ret . get ( dependency ) ; if ( componentDependencies == null ) { // build a new list if " b " has no dependent modules yet
componentDependencies = new ArrayList < String > ( ) ; ret . put ( dependency , componentDependencies ) ; } // add " a " as a module depending on " b "
componentDependencies . add ( component . getId ( ) ) ; } } itComponents = CmsCollectionsGenericWrapper . < CmsSetupComponent > list ( m_components . elementList ( ) ) . iterator ( ) ; while ( itComponents . hasNext ( ) ) { CmsSetupComponent component = itComponents . next ( ) ; if ( ret . get ( component . getId ( ) ) == null ) { ret . put ( component . getId ( ) , new ArrayList < String > ( ) ) ; } } return ret ; |
public class XsdAsmUtils { /** * Obtains the { @ link XsdAttribute } objects which are specific to the given { @ link XsdElement } .
* @ param element The { @ link XsdElement } object containing the attributes .
* @ return A { @ link Stream } of { @ link XsdAttribute } that are exclusive to the received { @ link XsdElement } . */
static Stream < XsdAttribute > getOwnAttributes ( XsdElement element ) { } } | XsdComplexType complexType = element . getXsdComplexType ( ) ; if ( complexType != null ) { Stream < XsdAttribute > extensionAttributes = null ; Stream < XsdAttribute > complexTypeAttributes ; XsdComplexContent complexContent = complexType . getComplexContent ( ) ; if ( complexContent != null ) { XsdExtension extension = complexContent . getXsdExtension ( ) ; if ( extension != null ) { extensionAttributes = extension . getXsdAttributes ( ) ; } } complexTypeAttributes = complexType . getXsdAttributes ( ) . filter ( attribute -> attribute . getParent ( ) . getClass ( ) . equals ( XsdComplexType . class ) ) ; if ( extensionAttributes != null ) { return Stream . concat ( extensionAttributes , complexTypeAttributes ) ; } else { return complexTypeAttributes ; } } return Stream . empty ( ) ; |
public class AbstractConsumerKey { /** * Decrement the active message count
* @ param messages */
public void removeActiveMessages ( int messages ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeActiveMessages" , new Object [ ] { Integer . valueOf ( messages ) } ) ; // If we ' re a member of a ConsumerSet , inform them of the remove
if ( classifyingMessages ) consumerSet . removeActiveMessages ( messages ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeActiveMessages" ) ; |
public class FaunusPipeline { /** * Have the elements for the named step previous project an edge to the current vertex with provided label .
* @ param step the name of the step where the source vertices were
* @ param label the label of the edge to project
* @ return the extended FaunusPipeline */
public FaunusPipeline linkIn ( final String label , final String step ) { } } | return this . link ( IN , label , step , null ) ; |
public class UIViewRoot { /** * < p class = " changed _ added _ 2_0 " > < span
* class = " changed _ deleted _ 2_0 _ rev _ a " > The < / span > default
* implementation must call { @ link
* UIComponentBase # processRestoreState } from within a
* < code > try < / code > block . The < code > try < / code > block must have a
* < code > finally < / code > block that ensures that no { @ link
* FacesEvent } s remain in the event queue . < a
* class = " changed _ deleted _ 2_0 _ rev _ a " title = " text removed in 2.0 Rev a : and that the this . visitTree is called , passing a ContextCallback that takes the following action : call the processEvent method of the current component . The argument event must be an instance of PostRestoreStateEvent whose component property is the current component in the traversal . " > & nbsp ; & nbsp ; & nbsp ; < / a > < / p >
* @ param context the < code > FacesContext < / code > for this requets
* @ param state the opaque state object obtained from the { @ link
* javax . faces . application . StateManager } */
@ Override public void processRestoreState ( FacesContext context , Object state ) { } } | // hack to work around older state managers that may not set the
// view root early enough
if ( context . getViewRoot ( ) == null ) { context . setViewRoot ( this ) ; } super . processRestoreState ( context , state ) ; |
public class ProxyImpl { /** * ( non - Javadoc )
* @ see javax . servlet . sip . Proxy # setOutboundInterface ( java . net . InetAddress ) */
public void setOutboundInterface ( InetAddress inetAddress ) { } } | if ( inetAddress == null ) { throw new NullPointerException ( "outbound Interface param shouldn't be null" ) ; } String address = inetAddress . getHostAddress ( ) ; List < SipURI > list = this . sipFactoryImpl . getSipNetworkInterfaceManager ( ) . getOutboundInterfaces ( ) ; SipURI networkInterface = null ; for ( SipURI networkInterfaceURI : list ) { if ( networkInterfaceURI . toString ( ) . contains ( address ) ) { networkInterface = networkInterfaceURI ; break ; } } if ( networkInterface == null ) throw new IllegalArgumentException ( "Network interface for " + inetAddress . getHostAddress ( ) + " not found" ) ; outboundInterface = networkInterface ; |
public class ProcessContext { /** * Adds a data attribute for all given activities together with its
* usage . < br >
* The given activities / attributes have to be known by the context , i . e .
* be contained in the activity / attribute list .
* @ param activities Activities for which the attribute usage is set .
* @ param attribute Attribute used by the given activities .
* @ param dataUsage Usage of the data attribute by the given activities .
* @ throws ParameterException
* @ throws IllegalArgumentException IllegalArgumentException If the
* given activities / attributes are not known .
* @ see # getActivities ( )
* @ see # getAttributes ( )
* @ see # setAttributes ( Set ) */
public void addDataUsageForAll ( Collection < String > activities , String attribute , DataUsage dataUsage ) { } } | Validate . notNull ( activities ) ; Validate . notEmpty ( activities ) ; for ( String activity : activities ) { addDataUsageFor ( activity , attribute , dataUsage ) ; } |
public class SparseDataset { /** * Set a nonzero entry into the matrix . If the index exceeds the current
* matrix size , the matrix will resize itself .
* @ param i the row index of entry .
* @ param j the column index of entry .
* @ param x the value of entry . */
public void set ( int i , int j , double x ) { } } | if ( i < 0 || j < 0 ) { throw new IllegalArgumentException ( "Invalid index: i = " + i + " j = " + j ) ; } int nrows = size ( ) ; if ( i >= nrows ) { for ( int k = nrows ; k <= i ; k ++ ) { data . add ( new Datum < > ( new SparseArray ( ) ) ) ; } } if ( j >= ncols ( ) ) { numColumns = j + 1 ; if ( numColumns > colSize . length ) { int [ ] size = new int [ 3 * numColumns / 2 ] ; System . arraycopy ( colSize , 0 , size , 0 , colSize . length ) ; colSize = size ; } } if ( get ( i ) . x . set ( j , x ) ) { colSize [ j ] ++ ; n ++ ; } |
public class SearchUtils { /** * Find methods within a class where the parameter list contains a certain list of type .
* @ param methodNodes method nodes to search through
* @ param expectedParamType parameter type to search for
* @ return list of methods
* @ throws NullPointerException if any argument is { @ code null }
* @ throws IllegalArgumentException if { @ code expectedParamType } is either of sort { @ link Type # METHOD } or { @ link Type # VOID } */
public static List < MethodNode > findMethodsWithParameter ( Collection < MethodNode > methodNodes , Type expectedParamType ) { } } | Validate . notNull ( methodNodes ) ; Validate . notNull ( expectedParamType ) ; Validate . noNullElements ( methodNodes ) ; Validate . isTrue ( expectedParamType . getSort ( ) != Type . METHOD && expectedParamType . getSort ( ) != Type . VOID ) ; List < MethodNode > ret = new ArrayList < > ( ) ; for ( MethodNode methodNode : methodNodes ) { Type methodDescType = Type . getType ( methodNode . desc ) ; Type [ ] methodParamTypes = methodDescType . getArgumentTypes ( ) ; if ( Arrays . asList ( methodParamTypes ) . contains ( expectedParamType ) ) { ret . add ( methodNode ) ; } } return ret ; |
public class DictionaryImpl { /** * Parses the < typedefn / > attributes from a Dictionary XML Document
* @ param doc the DOM object representing the XML Document with the Dictionary definitions */
protected void parseTypeDefs ( Document doc ) { } } | // Parse type definitions . Handy to match against defined AVP types
// and to fill AVPs with generic function .
// Format : < typedefn type - name = " Integer32 " / >
// < typedefn type - name = " Enumerated " type - parent = " Integer32 " / >
NodeList typedefNodes = doc . getElementsByTagName ( "typedefn" ) ; for ( int td = 0 ; td < typedefNodes . getLength ( ) ; td ++ ) { Node typedefNode = typedefNodes . item ( td ) ; if ( typedefNode . getNodeType ( ) == Node . ELEMENT_NODE ) { Element typedefElement = ( Element ) typedefNode ; String typeName = typedefElement . getAttribute ( "type-name" ) ; String typeParent = typedefElement . getAttribute ( "type-parent" ) ; // UTF8String and Time are special situations , we don ' t want to convert these .
if ( typeParent == null || typeParent . equals ( "" ) || typeName . equals ( "UTF8String" ) || typeName . equals ( "Time" ) ) { typeParent = typeName ; } typedefMap . put ( typeName , typeParent ) ; } } |
public class TreeBuilder { /** * Build the tree
* @ return the tree */
public Tree < T > build ( ) { } } | Tree < T > result = base ; if ( null == base && treeStack . size ( ) == 1 ) { result = treeStack . get ( 0 ) ; } else if ( treeStack . size ( ) > 0 ) { result = new TreeStack < T > ( treeStack , base ) ; } else if ( null == base ) { throw new IllegalArgumentException ( "base tree was not set" ) ; } return result ; |
public class InternationalizationServiceSingleton { /** * Gets all the messages defined in the given locales AND default locale ( for messages not defined in the given
* any locale ) . The message are added to the map only if they are not provided in the previous locale ,
* meaning that the order is important . The returned map is composed pair of key : message .
* @ param locales the ordered set of locales
* @ return the set of defined messages . */
@ Override public Map < String , String > getAllMessages ( Locale ... locales ) { } } | Map < String , String > messages = new HashMap < > ( ) ; List < I18nExtension > extensionForLocale ; for ( Locale locale : locales ) { extensionForLocale = getExtension ( locale ) ; for ( I18nExtension extension : extensionForLocale ) { merge ( messages , extension . map ( ) ) ; } } // Now add the messages for the default locale
extensionForLocale = getExtension ( DEFAULT_LOCALE ) ; for ( I18nExtension extension : extensionForLocale ) { merge ( messages , extension . map ( ) ) ; } return messages ; |
public class CommerceWishListLocalServiceBaseImpl { /** * Updates the commerce wish list in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners .
* @ param commerceWishList the commerce wish list
* @ return the commerce wish list that was updated */
@ Indexable ( type = IndexableType . REINDEX ) @ Override public CommerceWishList updateCommerceWishList ( CommerceWishList commerceWishList ) { } } | return commerceWishListPersistence . update ( commerceWishList ) ; |
public class ApprovalStoreUserApprovalHandler { /** * Requires the authorization request to be explicitly approved , including all individual scopes , and the user to be
* authenticated . A scope that was requested in the authorization request can be approved by sending a request
* parameter < code > scope . & lt ; scopename & gt ; < / code > equal to " true " or " approved " ( otherwise it will be assumed to
* have been denied ) . The { @ link ApprovalStore } will be updated to reflect the inputs .
* @ param authorizationRequest The authorization request .
* @ param userAuthentication the current user authentication
* @ return An approved request if all scopes have been approved by the current user . */
public AuthorizationRequest updateAfterApproval ( AuthorizationRequest authorizationRequest , Authentication userAuthentication ) { } } | // Get the approved scopes
Set < String > requestedScopes = authorizationRequest . getScope ( ) ; Set < String > approvedScopes = new HashSet < String > ( ) ; Set < Approval > approvals = new HashSet < Approval > ( ) ; Date expiry = computeExpiry ( ) ; // Store the scopes that have been approved / denied
Map < String , String > approvalParameters = authorizationRequest . getApprovalParameters ( ) ; for ( String requestedScope : requestedScopes ) { String approvalParameter = scopePrefix + requestedScope ; String value = approvalParameters . get ( approvalParameter ) ; value = value == null ? "" : value . toLowerCase ( ) ; if ( "true" . equals ( value ) || value . startsWith ( "approve" ) ) { approvedScopes . add ( requestedScope ) ; approvals . add ( new Approval ( userAuthentication . getName ( ) , authorizationRequest . getClientId ( ) , requestedScope , expiry , ApprovalStatus . APPROVED ) ) ; } else { approvals . add ( new Approval ( userAuthentication . getName ( ) , authorizationRequest . getClientId ( ) , requestedScope , expiry , ApprovalStatus . DENIED ) ) ; } } approvalStore . addApprovals ( approvals ) ; boolean approved ; authorizationRequest . setScope ( approvedScopes ) ; if ( approvedScopes . isEmpty ( ) && ! requestedScopes . isEmpty ( ) ) { approved = false ; } else { approved = true ; } authorizationRequest . setApproved ( approved ) ; return authorizationRequest ; |
public class CmsSecurityManager { /** * Returns the uuid id for the given id ,
* remove this method as soon as possible . < p >
* @ param context the current cms context
* @ param id the old project id
* @ return the new uuid for the given id
* @ throws CmsException if something goes wrong */
public CmsUUID getProjectId ( CmsRequestContext context , int id ) throws CmsException { } } | CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; CmsUUID result = null ; try { result = m_driverManager . getProjectId ( dbc , id ) ; } catch ( CmsException e ) { dbc . report ( null , e . getMessageContainer ( ) , e ) ; } finally { dbc . clear ( ) ; } return result ; |
public class Reductions { /** * Yields true if EVERY predicate application on the given array yields
* true .
* @ param < E > the array element type parameter
* @ param array the array where elements are fetched from
* @ param predicate the predicate applied to every element fetched from the
* array
* @ return true if EVERY predicate application yields true */
public static < E > boolean every ( E [ ] array , Predicate < E > predicate ) { } } | return new Every < E > ( predicate ) . test ( new ArrayIterator < E > ( array ) ) ; |
public class Filtering { /** * Creates an iterator yielding last n elements from the source array .
* Consuming the resulting iterator yields an IllegalArgumentException if
* not enough elements can be fetched . E . g :
* < code > takeLast ( 2 , [ 1 , 2 , 3 ] ) - > [ 2 , 3 ] < / code >
* @ param < E > the array element type
* @ param howMany number of elements to be yielded
* @ param from the source array
* @ return the resulting iterator */
public static < E > Iterator < E > takeLast ( int howMany , E [ ] from ) { } } | return takeLast ( howMany , new ArrayIterator < E > ( from ) ) ; |
public class base_resource { /** * Use this method to perform a add operation on netscaler resource .
* @ param service nitro _ service object .
* @ param option options class object .
* @ return status of the operation performed .
* @ throws Exception */
protected base_response add_resource ( nitro_service service , options option ) throws Exception { } } | if ( ! service . isLogin ( ) && ! this . get_object_type ( ) . equals ( "login" ) ) service . login ( ) ; String sessionid = service . get_sessionid ( ) ; String request = resource_to_string ( service , sessionid , option ) ; return post_data ( service , request ) ; |
public class ServerBuilder { /** * Returns a list of { @ link ServerPort } s which consists of distinct port numbers except for the port
* { @ code 0 } . If there are the same port numbers with different { @ link SessionProtocol } s ,
* their { @ link SessionProtocol } s will be merged into a single { @ link ServerPort } instance .
* The returned list is sorted as the same order of the specified { @ code ports } . */
private static List < ServerPort > resolveDistinctPorts ( List < ServerPort > ports ) { } } | final List < ServerPort > distinctPorts = new ArrayList < > ( ) ; for ( final ServerPort p : ports ) { boolean found = false ; // Do not check the port number 0 because a user may want his or her server to be bound
// on multiple arbitrary ports .
if ( p . localAddress ( ) . getPort ( ) > 0 ) { for ( int i = 0 ; i < distinctPorts . size ( ) ; i ++ ) { final ServerPort port = distinctPorts . get ( i ) ; if ( port . localAddress ( ) . equals ( p . localAddress ( ) ) ) { final ServerPort merged = new ServerPort ( port . localAddress ( ) , Sets . union ( port . protocols ( ) , p . protocols ( ) ) ) ; distinctPorts . set ( i , merged ) ; found = true ; break ; } } } if ( ! found ) { distinctPorts . add ( p ) ; } } return Collections . unmodifiableList ( distinctPorts ) ; |
public class MCP4641 { /** * A MCP4641 is expected to be connected to I2C - bus 1 of Raspberry Pi .
* All address - pins are assumed to be low ( means address 0x28 ) .
* Both channels of the are initialized at mid - value ( the same value
* as hardware - preset ) . A is brought to max - value and B to min - value
* in about 3 seconds . After that A and B are going up and down ( 26
* steps per second for 5 seconds ) . Afterwards A and B are set at random
* ( 2 times per second for 5 seconds ) .
* At the end A and B are set to random - values for both the volatile
* and the non - volatile wipers . So after putting the IC off power and
* on power those random values should reloaded to the volatile wipers
* by the IC .
* @ param args no parameters expected
* @ throws IOException If anything goes wrong */
public static void main ( String [ ] args ) throws UnsupportedBusNumberException , IOException { } } | // initialize bus
final I2CBus bus = I2CFactory . getInstance ( I2CBus . BUS_1 ) ; try { final MicrochipPotentiometer a = new MCP4641 ( bus , false , false , false , MicrochipPotentiometerChannel . A , MicrochipPotentiometerNonVolatileMode . VOLATILE_ONLY ) ; final MicrochipPotentiometer b = new MCP4641 ( bus , false , false , false , MicrochipPotentiometerChannel . B , MicrochipPotentiometerNonVolatileMode . VOLATILE_ONLY ) ; // Check device - status
final MicrochipPotentiometerDeviceStatus aStatus = a . getDeviceStatus ( ) ; System . out . println ( "WiperLock for A active: " + aStatus . isWiperLockActive ( ) ) ; final MicrochipPotentiometerDeviceStatus bStatus = b . getDeviceStatus ( ) ; System . out . println ( "WiperLock for B active: " + bStatus . isWiperLockActive ( ) ) ; // print current values
System . out . println ( "A: " + a . getCurrentValue ( ) + "/" + a . updateCacheFromDevice ( ) ) ; System . out . println ( "B: " + b . getCurrentValue ( ) + "/" + b . updateCacheFromDevice ( ) ) ; // for about 3 seconds
for ( int i = 0 ; i < MCP4641 . maxValue ( ) / 2 ; ++ i ) { // increase a
a . increase ( ) ; // decrease b
b . decrease ( ) ; // wait a little bit
try { Thread . sleep ( 24 ) ; // assume 1 ms for I2C - communication
} catch ( InterruptedException e ) { // never mind
} } // print current values
System . out . println ( "A: " + a . getCurrentValue ( ) + "/" + a . updateCacheFromDevice ( ) ) ; System . out . println ( "B: " + b . getCurrentValue ( ) + "/" + b . updateCacheFromDevice ( ) ) ; // 5 seconds at 26 steps
boolean aDirectionUp = false ; boolean bDirectionUp = true ; final int counter1 = 5 * 26 ; for ( int i = 0 ; i < counter1 ; ++ i ) { // change wipers
if ( aDirectionUp ) { a . increase ( 10 ) ; } else { a . decrease ( 10 ) ; } if ( bDirectionUp ) { b . increase ( 10 ) ; } else { b . decrease ( 10 ) ; } // reverse direction
if ( ( aDirectionUp && ( a . getCurrentValue ( ) == a . getMaxValue ( ) ) ) || ( ! aDirectionUp && ( a . getCurrentValue ( ) == 0 ) ) ) { aDirectionUp = ! aDirectionUp ; } if ( ( bDirectionUp && ( b . getCurrentValue ( ) == b . getMaxValue ( ) ) ) || ( ! bDirectionUp && ( b . getCurrentValue ( ) == 0 ) ) ) { bDirectionUp = ! bDirectionUp ; } // wait a little bit
try { Thread . sleep ( 39 ) ; // assume 1 ms for I2C - communication
} catch ( InterruptedException e ) { // never mind
} } // 5 seconds at 2 steps
Random randomizer = new Random ( System . currentTimeMillis ( ) ) ; int counter2 = 5 * 2 ; for ( int i = 0 ; i < counter2 ; ++ i ) { int nextA = randomizer . nextInt ( MCP4641 . maxValue ( ) + 1 ) ; a . setCurrentValue ( nextA ) ; int nextB = randomizer . nextInt ( MCP4641 . maxValue ( ) + 1 ) ; b . setCurrentValue ( nextB ) ; // wait a little bit
try { Thread . sleep ( 499 ) ; // assume 1 ms for I2C - communication
} catch ( InterruptedException e ) { // never mind
} } // print current values
System . out . println ( "A: " + a . getCurrentValue ( ) + "/" + a . updateCacheFromDevice ( ) ) ; System . out . println ( "B: " + b . getCurrentValue ( ) + "/" + b . updateCacheFromDevice ( ) ) ; // set non - volatile wipers to random values
( ( MCP4641 ) a ) . setNonVolatileMode ( MicrochipPotentiometerNonVolatileMode . VOLATILE_AND_NONVOLATILE ) ; int nextA = randomizer . nextInt ( MCP4641 . maxValue ( ) + 1 ) ; a . setCurrentValue ( nextA ) ; int nextB = randomizer . nextInt ( MCP4641 . maxValue ( ) + 1 ) ; b . setCurrentValue ( nextB ) ; } finally { try { bus . close ( ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } } |
public class JStringUtils { /** * Returns true if the provided string is null or empty .
* @ param string
* @ return isNullOrEmpty boolean */
public static boolean isNullOrEmpty ( @ Nullable String string ) { } } | if ( string == null || string . isEmpty ( ) ) { return true ; } return false ; |
public class PrintWriter { /** * Writes a formatted string to this writer using the specified format
* string and arguments . If automatic flushing is enabled , calls to this
* method will flush the output buffer .
* @ param l
* The { @ linkplain java . util . Locale locale } to apply during
* formatting . If < tt > l < / tt > is < tt > null < / tt > then no localization
* is applied .
* @ param format
* A format string as described in < a
* href = " . . / util / Formatter . html # syntax " > Format string syntax < / a > .
* @ param args
* Arguments referenced by the format specifiers in the format
* string . If there are more arguments than format specifiers , the
* extra arguments are ignored . The number of arguments is
* variable and may be zero . The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* < cite > The Java & trade ; Virtual Machine Specification < / cite > .
* The behaviour on a
* < tt > null < / tt > argument depends on the < a
* href = " . . / util / Formatter . html # syntax " > conversion < / a > .
* @ throws java . util . IllegalFormatException
* If a format string contains an illegal syntax , a format
* specifier that is incompatible with the given arguments ,
* insufficient arguments given the format string , or other
* illegal conditions . For specification of all possible
* formatting errors , see the < a
* href = " . . / util / Formatter . html # detail " > Details < / a > section of the
* formatter class specification .
* @ throws NullPointerException
* If the < tt > format < / tt > is < tt > null < / tt >
* @ return This writer
* @ since 1.5 */
public PrintWriter format ( Locale l , String format , Object ... args ) { } } | try { synchronized ( lock ) { ensureOpen ( ) ; if ( ( formatter == null ) || ( formatter . locale ( ) != l ) ) formatter = new Formatter ( WeakProxy . forObject ( this ) , l ) ; formatter . format ( l , format , args ) ; if ( autoFlush ) out . flush ( ) ; } } catch ( InterruptedIOException x ) { Thread . currentThread ( ) . interrupt ( ) ; } catch ( IOException x ) { trouble = true ; } return this ; |
public class ConfigController { /** * Applies the configuration file .
* The input settings will be ignored if a default configuration was used . */
private void applyConfig ( ) { } } | this . components . applyConfig ( config ) ; switch ( config . getConfigType ( ) ) { case DEFAULT : break ; case IMPORT : this . archives . applyConfiguration ( config ) ; } repaint ( ) ; |
public class DataLayout { /** * Set the policy used to determine the visibility of each child component view . */
public final void setVisibilityPolicy ( @ NonNull VisibilityPolicy visibilityPolicy ) { } } | checkNotNull ( visibilityPolicy , "visibilityPolicy" ) ; if ( visibilityPolicy != mVisibilityPolicy ) { mVisibilityPolicy = visibilityPolicy ; updateViews ( ) ; } |
public class LengthCheckInputStream { /** * { @ inheritDoc }
* @ throws SdkClientException
* if { @ link # includeSkipped } is true and the data length
* skipped has exceeded the expected total . */
@ Override public long skip ( long n ) throws IOException { } } | final long skipped = super . skip ( n ) ; if ( includeSkipped && skipped > 0 ) { dataLength += skipped ; checkLength ( false ) ; } return skipped ; |
public class Layout { /** * Write a layout to be read by { @ link LayoutFactory # readLayoutFrom } .
* @ since 1.2.2 */
public void writeTo ( OutputStream out ) throws IOException , RepositoryException { } } | mStoredLayout . writeTo ( out ) ; Cursor < StoredLayoutProperty > cursor = mLayoutFactory . mPropertyStorage . query ( "layoutID = ?" ) . with ( mStoredLayout . getLayoutID ( ) ) . fetch ( ) ; try { while ( cursor . hasNext ( ) ) { StoredLayoutProperty prop = cursor . next ( ) ; // Write 1 to indicate that this was not the last property .
out . write ( 1 ) ; prop . writeTo ( out ) ; } } finally { cursor . close ( ) ; } out . write ( 0 ) ; |
public class SharedTreeNode { /** * Calculate whether the NA value for a particular colId can reach this node .
* @ param colIdToFind Column id to find
* @ return true if NA of colId reaches this node , false otherwise */
private boolean findInclusiveNa ( int colIdToFind ) { } } | if ( parent == null ) { return true ; } else if ( parent . getColId ( ) == colIdToFind ) { return inclusiveNa ; } return parent . findInclusiveNa ( colIdToFind ) ; |
public class UniqueKeyRangeManager { /** * Request an asynchronous update of the persistent state
* @ param generator to be updated */
public void scheduleUpdate ( UniqueKeyGenerator generator ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "scheduleUpdate" , "GeneratorName=" + generator . getName ( ) ) ; synchronized ( _asyncQ ) { _asyncQ . add ( generator ) ; _asyncQ . notify ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "scheduleUpdate" ) ; |
public class StripeRawJsonObjectDeserializer { /** * Deserializes a JSON payload into a { @ link StripeRawJsonObject } object . */
@ Override public StripeRawJsonObject deserialize ( JsonElement json , Type typeOfT , JsonDeserializationContext context ) throws JsonParseException { } } | StripeRawJsonObject object = new StripeRawJsonObject ( ) ; object . json = json . getAsJsonObject ( ) ; return object ; |
public class AuthorityKeyIdentifierExtension { /** * Encode only the extension value */
private void encodeThis ( ) throws IOException { } } | if ( id == null && names == null && serialNum == null ) { this . extensionValue = null ; return ; } DerOutputStream seq = new DerOutputStream ( ) ; DerOutputStream tmp = new DerOutputStream ( ) ; if ( id != null ) { DerOutputStream tmp1 = new DerOutputStream ( ) ; id . encode ( tmp1 ) ; tmp . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , false , TAG_ID ) , tmp1 ) ; } try { if ( names != null ) { DerOutputStream tmp1 = new DerOutputStream ( ) ; names . encode ( tmp1 ) ; tmp . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , TAG_NAMES ) , tmp1 ) ; } } catch ( Exception e ) { throw new IOException ( e . toString ( ) ) ; } if ( serialNum != null ) { DerOutputStream tmp1 = new DerOutputStream ( ) ; serialNum . encode ( tmp1 ) ; tmp . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , false , TAG_SERIAL_NUM ) , tmp1 ) ; } seq . write ( DerValue . tag_Sequence , tmp ) ; this . extensionValue = seq . toByteArray ( ) ; |
public class JavaClassService { /** * Indicates that we have found a . class or . java file for the given qualified name . This will either create a new { @ link JavaClassModel } or
* convert an existing { @ link PhantomJavaClassModel } if one exists . */
public synchronized JavaClassModel create ( String qualifiedName ) { } } | // if a phantom exists , just convert it
PhantomJavaClassModel phantom = new GraphService < > ( getGraphContext ( ) , PhantomJavaClassModel . class ) . getUniqueByProperty ( JavaClassModel . QUALIFIED_NAME , qualifiedName ) ; if ( phantom != null ) { GraphService . removeTypeFromModel ( getGraphContext ( ) , phantom , PhantomJavaClassModel . class ) ; return phantom ; } JavaClassModel javaClassModel = super . create ( ) ; setPropertiesFromName ( javaClassModel , qualifiedName ) ; return javaClassModel ; |
public class Browser { /** * Determines the text type for the current node using the mimeType ( if present ) and the extension . */
public String getTextType ( ) { } } | if ( textType == null ) { String mimeType = getMimeType ( ) ; String extension = getNameExtension ( ) ; textType = getTextType ( mimeType , extension ) ; } return textType ; |
public class XMLUtils { /** * Construct a new ( empty ) DOM Document and return it .
* @ return an empty DOM Document */
public static Document createDOMDocument ( ) { } } | try { return DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) . newDocument ( ) ; } catch ( ParserConfigurationException ex ) { LOGGER . error ( "Cannot create DOM Documents" , ex ) ; return null ; } |
public class ComparableExpression { /** * Create a { @ code this > = right } expression
* @ param right rhs of the comparison
* @ return this & gt ; = right
* @ see java . lang . Comparable # compareTo ( Object ) */
public BooleanExpression goe ( Expression < T > right ) { } } | return Expressions . booleanOperation ( Ops . GOE , mixin , right ) ; |
public class AnnotationTypeOptionalMemberWriterImpl { /** * { @ inheritDoc } */
public String [ ] getSummaryTableHeader ( ProgramElementDoc member ) { } } | String [ ] header = new String [ ] { writer . getModifierTypeHeader ( ) , configuration . getText ( "doclet.0_and_1" , configuration . getText ( "doclet.Annotation_Type_Optional_Member" ) , configuration . getText ( "doclet.Description" ) ) } ; return header ; |
public class ExpressionSpecBuilder { /** * Builds and returns the projection expression to be used in a dynamodb
* GetItem request ; or null if there is none . */
String buildProjectionExpression ( SubstitutionContext context ) { } } | if ( projections . size ( ) == 0 ) return null ; StringBuilder sb = new StringBuilder ( ) ; for ( PathOperand projection : projections ) { if ( sb . length ( ) > 0 ) sb . append ( ", " ) ; sb . append ( projection . asSubstituted ( context ) ) ; } return sb . toString ( ) ; |
public class Pipes { /** * Close the Adapter identified by the provided Key if it exists
* @ param key : Adapter identifier */
public void close ( final String key ) { } } | Optional . ofNullable ( registered . get ( key ) ) . ifPresent ( a -> a . close ( ) ) ; |
public class UnicodeSet { /** * Get the Regex equivalent for this UnicodeSet
* @ return regex pattern equivalent to this UnicodeSet
* @ deprecated This API is ICU internal only .
* @ hide original deprecated declaration
* @ hide draft / provisional / internal are hidden on Android */
@ Deprecated public String getRegexEquivalent ( ) { } } | if ( strings . size ( ) == 0 ) { return toString ( ) ; } StringBuilder result = new StringBuilder ( "(?:" ) ; appendNewPattern ( result , true , false ) ; for ( String s : strings ) { result . append ( '|' ) ; _appendToPat ( result , s , true ) ; } return result . append ( ")" ) . toString ( ) ; |
public class ApiOvhCloud { /** * cloud archives tasks for account
* REST : GET / cloud / { serviceName } / pca / { pcaServiceName } / tasks
* @ param todoDate _ to [ required ] Filter the value of todoDate property ( < = )
* @ param function [ required ] Filter the value of function property ( = )
* @ param todoDate _ from [ required ] Filter the value of todoDate property ( > = )
* @ param status [ required ] Filter the value of status property ( = )
* @ param serviceName [ required ] The internal name of your public cloud passport
* @ param pcaServiceName [ required ] The internal name of your PCA offer
* @ deprecated */
public ArrayList < String > serviceName_pca_pcaServiceName_tasks_GET ( String serviceName , String pcaServiceName , OvhFunctionTypeEnum function , OvhTaskStateEnum status , Date todoDate_from , Date todoDate_to ) throws IOException { } } | String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/tasks" ; StringBuilder sb = path ( qPath , serviceName , pcaServiceName ) ; query ( sb , "function" , function ) ; query ( sb , "status" , status ) ; query ( sb , "todoDate.from" , todoDate_from ) ; query ( sb , "todoDate.to" , todoDate_to ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t1 ) ; |
public class HierarchicalClustering { /** * Cuts a tree into several groups by specifying the cut height .
* @ param h the cut height .
* @ return the cluster label of each sample . */
public int [ ] partition ( double h ) { } } | for ( int i = 0 ; i < height . length - 1 ; i ++ ) { if ( height [ i ] > height [ i + 1 ] ) { throw new IllegalStateException ( "Non-monotonic cluster tree -- the linkage is probably not appropriate!" ) ; } } int n = merge . length + 1 ; int k = 2 ; for ( ; k <= n ; k ++ ) { if ( height [ n - k ] < h ) { break ; } } if ( k <= 2 ) { throw new IllegalArgumentException ( "The parameter h is too large." ) ; } return partition ( k - 1 ) ; |
public class CassQuery { /** * ( non - Javadoc ) .
* @ param m
* the m
* @ param client
* the client
* @ return the list
* @ see com . impetus . kundera . query . QueryImpl # recursivelyPopulateEntities ( com . impetus
* . kundera . metadata . model . EntityMetadata , com . impetus . kundera . client . Client ) */
@ SuppressWarnings ( "unchecked" ) @ Override protected List < Object > recursivelyPopulateEntities ( EntityMetadata m , Client client ) { } } | List < EnhanceEntity > ls = null ; ApplicationMetadata appMetadata = kunderaMetadata . getApplicationMetadata ( ) ; externalProperties = ( ( CassandraClientBase ) client ) . getExternalProperties ( ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; String query = appMetadata . getQuery ( getJPAQuery ( ) ) ; boolean isNative = kunderaQuery . isNative ( ) ; if ( isNative ) { ls = ( List < EnhanceEntity > ) ( ( CassandraClientBase ) client ) . executeQuery ( m . getEntityClazz ( ) , m . getRelationNames ( ) , isNative , query != null ? query : getJPAQuery ( ) ) ; } else if ( ! isNative && ( ( CassandraClientBase ) client ) . isCql3Enabled ( m ) ) { // edited
// check if lucene or indexer are enabled then populate
if ( MetadataUtils . useSecondryIndex ( ( ( ClientBase ) client ) . getClientMetadata ( ) ) ) { ls = ( ( CassandraClientBase ) client ) . executeQuery ( m . getEntityClazz ( ) , m . getRelationNames ( ) , isNative , onQueryOverCQL3 ( m , client , metaModel , m . getRelationNames ( ) ) ) ; } else { ls = populateUsingLucene ( m , client , null , getKunderaQuery ( ) . getResult ( ) ) ; } } else { // Index in Inverted Index table if applicable
boolean useInvertedIndex = CassandraIndexHelper . isInvertedIndexingApplicable ( m , MetadataUtils . useSecondryIndex ( ( ( ClientBase ) client ) . getClientMetadata ( ) ) ) ; Map < Boolean , List < IndexClause > > ixClause = MetadataUtils . useSecondryIndex ( ( ( ClientBase ) client ) . getClientMetadata ( ) ) ? prepareIndexClause ( m , useInvertedIndex ) : null ; if ( useInvertedIndex && ! getKunderaQuery ( ) . getFilterClauseQueue ( ) . isEmpty ( ) ) { ls = ( ( CassandraEntityReader ) getReader ( ) ) . readFromIndexTable ( m , client , ixClause ) ; } else { ( ( CassandraEntityReader ) getReader ( ) ) . setConditions ( ixClause ) ; ls = reader . populateRelation ( m , client , isSingleResult ? 1 : this . maxResult ) ; } } return setRelationEntities ( ls , client , m ) ; |
public class Vector2f { /** * Add a vector to this vector
* @ param v The vector to add
* @ return This vector - useful for chaning operations */
public Vector2f add ( Vector2f v ) { } } | x += v . getX ( ) ; y += v . getY ( ) ; return this ; |
public class BigramCollocationFinder { /** * Finds bigram collocations in the given corpus whose p - value is less than
* the given threshold .
* @ param p the p - value threshold
* @ return the array of significant bigram collocations in descending order
* of likelihood ratio . */
public BigramCollocation [ ] find ( Corpus corpus , double p ) { } } | if ( p <= 0.0 || p >= 1.0 ) { throw new IllegalArgumentException ( "Invalid p = " + p ) ; } double cutoff = chisq . quantile ( p ) ; ArrayList < BigramCollocation > bigrams = new ArrayList < > ( ) ; Iterator < Bigram > iterator = corpus . getBigrams ( ) ; while ( iterator . hasNext ( ) ) { Bigram bigram = iterator . next ( ) ; int c12 = corpus . getBigramFrequency ( bigram ) ; if ( c12 > minFreq ) { int c1 = corpus . getTermFrequency ( bigram . w1 ) ; int c2 = corpus . getTermFrequency ( bigram . w2 ) ; double score = likelihoodRatio ( c1 , c2 , c12 , corpus . size ( ) ) ; if ( score > cutoff ) { bigrams . add ( new BigramCollocation ( bigram . w1 , bigram . w2 , c12 , score ) ) ; } } } int n = bigrams . size ( ) ; BigramCollocation [ ] collocations = new BigramCollocation [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { collocations [ i ] = bigrams . get ( i ) ; } Arrays . sort ( collocations ) ; // Reverse to descending order
for ( int i = 0 ; i < n / 2 ; i ++ ) { BigramCollocation b = collocations [ i ] ; collocations [ i ] = collocations [ n - i - 1 ] ; collocations [ n - i - 1 ] = b ; } return collocations ; |
public class UpworkRestClient { /** * Get JSON response for GET
* @ param request Request object for GET
* @ param method HTTP Method
* @ throws JSONException
* @ return { @ link JSONObject } */
public static JSONObject getJSONObject ( HttpGet request , Integer method ) throws JSONException { } } | return UpworkRestClient . getJSONObject ( request , method , new HashMap < String , String > ( ) ) ; |
public class KernelWriter { /** * These three convert functions are here to perform
* any type conversion that may be required between
* Java and OpenCL .
* @ param _ typeDesc
* String in the Java JNI notation , [ I , etc
* @ return Suitably converted string , " char * " , etc */
@ Override public String convertType ( String _typeDesc , boolean useClassModel , boolean isLocal ) { } } | if ( _typeDesc . equals ( "Z" ) || _typeDesc . equals ( "boolean" ) ) { return ( cvtBooleanToChar ) ; } else if ( _typeDesc . equals ( "[Z" ) || _typeDesc . equals ( "boolean[]" ) ) { return isLocal ? ( cvtBooleanArrayToChar ) : ( cvtBooleanArrayToCharStar ) ; } else if ( _typeDesc . equals ( "B" ) || _typeDesc . equals ( "byte" ) ) { return ( cvtByteToChar ) ; } else if ( _typeDesc . equals ( "[B" ) || _typeDesc . equals ( "byte[]" ) ) { return isLocal ? ( cvtByteArrayToChar ) : ( cvtByteArrayToCharStar ) ; } else if ( _typeDesc . equals ( "C" ) || _typeDesc . equals ( "char" ) ) { return ( cvtCharToShort ) ; } else if ( _typeDesc . equals ( "[C" ) || _typeDesc . equals ( "char[]" ) ) { return isLocal ? ( cvtCharArrayToShort ) : ( cvtCharArrayToShortStar ) ; } else if ( _typeDesc . equals ( "[I" ) || _typeDesc . equals ( "int[]" ) ) { return isLocal ? ( cvtIntArrayToInt ) : ( cvtIntArrayToIntStar ) ; } else if ( _typeDesc . equals ( "[F" ) || _typeDesc . equals ( "float[]" ) ) { return isLocal ? ( cvtFloatArrayToFloat ) : ( cvtFloatArrayToFloatStar ) ; } else if ( _typeDesc . equals ( "[D" ) || _typeDesc . equals ( "double[]" ) ) { return isLocal ? ( cvtDoubleArrayToDouble ) : ( cvtDoubleArrayToDoubleStar ) ; } else if ( _typeDesc . equals ( "[J" ) || _typeDesc . equals ( "long[]" ) ) { return isLocal ? ( cvtLongArrayToLong ) : ( cvtLongArrayToLongStar ) ; } else if ( _typeDesc . equals ( "[S" ) || _typeDesc . equals ( "short[]" ) ) { return isLocal ? ( cvtShortArrayToShort ) : ( cvtShortArrayToShortStar ) ; } else if ( "[Ljava/util/concurrent/atomic/AtomicInteger;" . equals ( _typeDesc ) || "[Ljava.util.concurrent.atomic.AtomicInteger;" . equals ( _typeDesc ) ) { return ( cvtIntArrayToIntStar ) ; } // if we get this far , we haven ' t matched anything yet
if ( useClassModel ) { return ( ClassModel . convert ( _typeDesc , "" , true ) ) ; } else { return _typeDesc ; } |
public class RemotingStore { /** * - - - - - endpoint configuration */
@ Process ( actionType = ModifyEndpointConfiguration . class ) public void modifyEndpointConfiguration ( final ModifyEndpointConfiguration action , final Dispatcher . Channel channel ) { } } | operationDelegate . onSaveResource ( ENDPOINT_CONFIGURATION_ADDRESS , null , action . getChangedValues ( ) , new CrudOperationDelegate . Callback ( ) { @ Override public void onSuccess ( final AddressTemplate addressTemplate , final String name ) { final ModelNode op = readEndpointConfiguration ( ) ; dispatcher . execute ( new DMRAction ( op ) , new AsyncCallback < DMRResponse > ( ) { @ Override public void onFailure ( Throwable caught ) { channel . nack ( caught ) ; } @ Override public void onSuccess ( DMRResponse dmrResponse ) { ModelNode response = dmrResponse . get ( ) ; if ( response . isFailure ( ) ) { channel . nack ( new RuntimeException ( "Failed to read " + addressTemplate + " using " + op + ": " + response . getFailureDescription ( ) ) ) ; } else { endpointConfiguration = response . get ( RESULT ) ; channel . ack ( ) ; } } } ) ; } @ Override public void onFailure ( AddressTemplate addressTemplate , String name , Throwable t ) { channel . nack ( t ) ; } } ) ; |
public class Boot { /** * Called by prunsrv ( Windows ) or jsvc ( UNIX ) before start ( ) .
* @ param context
* @ throws Exception */
@ Override public void init ( DaemonContext context ) throws Exception { } } | log . debug ( "Fathom Daemon initialized" ) ; settings . applyArgs ( context . getArguments ( ) ) ; |
public class CopyConditions { /** * Set modified condition , copy object modified since given time .
* @ throws InvalidArgumentException
* When date is null */
public void setModified ( DateTime date ) throws InvalidArgumentException { } } | if ( date == null ) { throw new InvalidArgumentException ( "Date cannot be empty" ) ; } copyConditions . put ( "x-amz-copy-source-if-modified-since" , date . toString ( DateFormat . HTTP_HEADER_DATE_FORMAT ) ) ; |
public class TaskExecutor { @ Override public void disconnectJobManager ( JobID jobId , Exception cause ) { } } | closeJobManagerConnection ( jobId , cause ) ; jobLeaderService . reconnect ( jobId ) ; |
public class ReservoirLongsUnion { /** * should be called ONLY by twoWayMergeInternal */
private void twoWayMergeInternalStandard ( final ReservoirLongsSketch source ) { } } | assert ( source . getN ( ) <= source . getK ( ) ) ; final int numInputSamples = source . getNumSamples ( ) ; for ( int i = 0 ; i < numInputSamples ; ++ i ) { gadget_ . update ( source . getValueAtPosition ( i ) ) ; } |
public class ConvertImage { /** * Converts a { @ link InterleavedS32 } into the equivalent { @ link Planar }
* @ param input ( Input ) ImageInterleaved that is being converted . Not modified .
* @ param output ( Optional ) The output image . If null a new image is created . Modified .
* @ return Converted image . */
public static Planar < GrayS32 > convert ( InterleavedS32 input , Planar < GrayS32 > output ) { } } | if ( output == null ) { output = new Planar < > ( GrayS32 . class , input . width , input . height , input . numBands ) ; } else { output . reshape ( input . width , input . height , input . numBands ) ; } if ( BoofConcurrency . USE_CONCURRENT ) { ImplConvertImage_MT . convert ( input , output ) ; } else { ImplConvertImage . convert ( input , output ) ; } return output ; |
public class ElementMatchers { /** * Matches generic type descriptions of the given sort .
* @ param sort The generic type sort to match .
* @ param < T > The type of the matched object .
* @ return A matcher that matches generic types of the given sort . */
public static < T extends TypeDefinition > ElementMatcher . Junction < T > ofSort ( TypeDefinition . Sort sort ) { } } | return ofSort ( is ( sort ) ) ; |
public class JGitEnvironmentRepository { /** * Clones the remote repository and then opens a connection to it .
* @ throws GitAPIException when cloning fails
* @ throws IOException when repo opening fails */
private void initClonedRepository ( ) throws GitAPIException , IOException { } } | if ( ! getUri ( ) . startsWith ( FILE_URI_PREFIX ) ) { deleteBaseDirIfExists ( ) ; Git git = cloneToBasedir ( ) ; if ( git != null ) { git . close ( ) ; } git = openGitRepository ( ) ; if ( git != null ) { git . close ( ) ; } } |
public class StreamCutImpl { /** * Obtains the a StreamCut object from its compact Base64 representation obtained via { @ link StreamCutImpl # asText ( ) } .
* @ param base64String Compact Base64 representation of StreamCut .
* @ return The StreamCut object . */
public static StreamCutInternal from ( String base64String ) { } } | Exceptions . checkNotNullOrEmpty ( base64String , "base64String" ) ; String [ ] split = decompressFromBase64 ( base64String ) . split ( ":" , 5 ) ; Preconditions . checkArgument ( split . length == 5 , "Invalid string representation of StreamCut" ) ; final Stream stream = Stream . of ( split [ 1 ] ) ; List < Integer > segmentNumbers = stringToList ( split [ 2 ] , Integer :: valueOf ) ; List < Integer > epochs = stringToList ( split [ 3 ] , Integer :: valueOf ) ; List < Long > offsets = stringToList ( split [ 4 ] , Long :: valueOf ) ; final Map < Segment , Long > positions = IntStream . range ( 0 , segmentNumbers . size ( ) ) . boxed ( ) . collect ( Collectors . toMap ( i -> new Segment ( stream . getScope ( ) , stream . getStreamName ( ) , StreamSegmentNameUtils . computeSegmentId ( segmentNumbers . get ( i ) , epochs . get ( i ) ) ) , offsets :: get ) ) ; return new StreamCutImpl ( stream , positions ) ; |
public class AsciiArtUtils { /** * Print ascii art info .
* @ param out the out
* @ param asciiArt the ascii art
* @ param additional the additional */
@ SneakyThrows public static void printAsciiArtInfo ( final Logger out , final String asciiArt , final String additional ) { } } | out . info ( ANSI_CYAN ) ; out . info ( "\n\n" . concat ( FigletFont . convertOneLine ( asciiArt ) ) . concat ( additional ) ) ; out . info ( ANSI_RESET ) ; |
public class Version { /** * Method copied from http : / / www . jboss . com / index . html ? module = bb & op = viewtopic & t = 77231 */
public static String print ( short version ) { } } | int major = ( version & MAJOR_MASK ) >> MAJOR_SHIFT ; int minor = ( version & MINOR_MASK ) >> MINOR_SHIFT ; int micro = ( version & MICRO_MASK ) ; return major + "." + minor + "." + micro ; |
public class JUnit4 { /** * Validate arguments . */
private void validateArguments ( ) throws BuildException { } } | Path tempDir = getTempDir ( ) ; if ( tempDir == null ) { throw new BuildException ( "Temporary directory cannot be null." ) ; } if ( Files . exists ( tempDir ) ) { if ( ! Files . isDirectory ( tempDir ) ) { throw new BuildException ( "Temporary directory is not a folder: " + tempDir . toAbsolutePath ( ) ) ; } } else { try { Files . createDirectories ( tempDir ) ; } catch ( IOException e ) { throw new BuildException ( "Failed to create temporary folder: " + tempDir , e ) ; } } |
public class ByteList { /** * This is equivalent to :
* < pre >
* < code >
* if ( isEmpty ( ) ) {
* return identity ;
* byte result = identity ;
* for ( int i = 0 ; i < size ; i + + ) {
* result = accumulator . applyAsByte ( result , elementData [ i ] ) ;
* return result ;
* < / code >
* < / pre >
* @ param identity
* @ param accumulator
* @ return */
public < E extends Exception > byte reduce ( final byte identity , final Try . ByteBinaryOperator < E > accumulator ) throws E { } } | if ( isEmpty ( ) ) { return identity ; } byte result = identity ; for ( int i = 0 ; i < size ; i ++ ) { result = accumulator . applyAsByte ( result , elementData [ i ] ) ; } return result ; |
public class FFMPEGExecutor { /** * If there ' s a ffmpeg execution in progress , it kills it . */
public void destroy ( ) { } } | if ( inputStream != null ) { try { inputStream . close ( ) ; } catch ( Throwable t ) { LOG . warn ( "Error closing input stream" , t ) ; } inputStream = null ; } if ( outputStream != null ) { try { outputStream . close ( ) ; } catch ( Throwable t ) { LOG . warn ( "Error closing output stream" , t ) ; } outputStream = null ; } if ( errorStream != null ) { try { errorStream . close ( ) ; } catch ( Throwable t ) { LOG . warn ( "Error closing error stream" , t ) ; } errorStream = null ; } if ( ffmpeg != null ) { ffmpeg . destroy ( ) ; ffmpeg = null ; } if ( ffmpegKiller != null ) { Runtime runtime = Runtime . getRuntime ( ) ; runtime . removeShutdownHook ( ffmpegKiller ) ; ffmpegKiller = null ; } |
public class IssueIndexer { /** * Commits the DB transaction and adds the issues to Elasticsearch index .
* If indexing fails , then the recovery daemon will retry later and this
* method successfully returns . Meanwhile these issues will be " eventually
* consistent " when requesting the index . */
public void commitAndIndexIssues ( DbSession dbSession , Collection < IssueDto > issues ) { } } | ListMultimap < String , EsQueueDto > itemsByIssueKey = ArrayListMultimap . create ( ) ; issues . stream ( ) . map ( issue -> createQueueDto ( issue . getKey ( ) , ID_TYPE_ISSUE_KEY , issue . getProjectUuid ( ) ) ) // a mutable ListMultimap is needed for doIndexIssueItems , so MoreCollectors . index ( ) is
// not used
. forEach ( i -> itemsByIssueKey . put ( i . getDocId ( ) , i ) ) ; dbClient . esQueueDao ( ) . insert ( dbSession , itemsByIssueKey . values ( ) ) ; dbSession . commit ( ) ; doIndexIssueItems ( dbSession , itemsByIssueKey ) ; |
public class CommerceShipmentItemPersistenceImpl { /** * Creates a new commerce shipment item with the primary key . Does not add the commerce shipment item to the database .
* @ param commerceShipmentItemId the primary key for the new commerce shipment item
* @ return the new commerce shipment item */
@ Override public CommerceShipmentItem create ( long commerceShipmentItemId ) { } } | CommerceShipmentItem commerceShipmentItem = new CommerceShipmentItemImpl ( ) ; commerceShipmentItem . setNew ( true ) ; commerceShipmentItem . setPrimaryKey ( commerceShipmentItemId ) ; commerceShipmentItem . setCompanyId ( companyProvider . getCompanyId ( ) ) ; return commerceShipmentItem ; |
public class Persistables { /** * Returns an array containing a { @ link ByteBuffer } ' s { @ link ByteBuffer # remaining ( ) remaining } contents . < br > Upon returning
* from this method , the buffer ' s { @ link ByteBuffer # position ( ) position } will remain unchanged .
* @ param buffer The buffer to write into the array .
* @ return A newly allocated array of size { @ link ByteBuffer # remaining ( ) buffer . remaining ( ) } containing the buffer ' s contents . */
public static byte [ ] toByteArray ( ByteBuffer buffer ) { } } | if ( buffer . hasArray ( ) && buffer . arrayOffset ( ) == 0 && buffer . position ( ) == 0 && buffer . limit ( ) == buffer . capacity ( ) && buffer . array ( ) . length == buffer . capacity ( ) ) { final byte [ ] array = buffer . array ( ) ; return array ; } final int p = buffer . position ( ) ; final byte [ ] array = new byte [ buffer . remaining ( ) ] ; buffer . get ( array ) ; buffer . position ( p ) ; return array ; |
public class IntIntMap { /** * Increments the value associated with the specified key by the
* specified amount . If the key has no previously assigned value , it
* will be set to the amount specified ( as if incrementing from zero ) .
* @ return the incremented value now stored for the key */
public int increment ( int key , int amount ) { } } | Record rec = locateRecord ( key ) ; if ( rec == null ) { put ( key , amount ) ; return amount ; } else { return ( rec . value += amount ) ; } |
public class BasicScope { /** * { @ inheritDoc } */
public boolean isConnectionAllowed ( IConnection conn ) { } } | if ( log . isDebugEnabled ( ) ) { log . debug ( "isConnectionAllowed: {}" , conn ) ; } if ( securityHandlers != null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "securityHandlers: {}" , securityHandlers ) ; } // loop through the handlers
for ( IScopeSecurityHandler handler : securityHandlers ) { // if allowed continue to the next handler
if ( handler . allowed ( conn ) ) { continue ; } else { // if any handlers deny we return false
return false ; } } } // default is to allow
return true ; |
public class CmsLocaleManager { /** * Sets the configured locale handler . < p >
* @ param localeHandler the locale handler to set */
public void setLocaleHandler ( I_CmsLocaleHandler localeHandler ) { } } | if ( localeHandler != null ) { m_localeHandler = localeHandler ; } if ( CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_I18N_CONFIG_LOC_HANDLER_1 , m_localeHandler . getClass ( ) . getName ( ) ) ) ; } |
public class Messenger { /** * Bind File View Model
* @ param fileReference reference to file
* @ param isAutoStart automatically start download
* @ param callback View Model file state callback
* @ return File View Model */
@ NotNull @ ObjectiveCName ( "bindFileWithReference:autoStart:withCallback:" ) public FileVM bindFile ( FileReference fileReference , boolean isAutoStart , FileVMCallback callback ) { } } | return new FileVM ( fileReference , isAutoStart , modules , callback ) ; |
public class GBSTree { /** * Add some number of free nodes to the node pool for testing .
* @ param x The number of nodes to add . */
public void prePopulate ( int x ) { } } | for ( int i = 0 ; i < x ; i ++ ) { GBSNode p = new GBSNode ( this ) ; releaseNode ( p ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.