signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class GroupElement { /** * Negates this group element by subtracting it from the neutral group element .
* TODO - CR BR : why not simply negate the coordinates $ X $ and $ T $ ?
* @ return The negative of this group element . */
public org . mariadb . jdbc . internal . com . send . authentication . ed25519 . math . GroupElement negate ( ) { } } | if ( this . repr != Representation . P3 ) { throw new UnsupportedOperationException ( ) ; } return this . curve . getZero ( Representation . P3 ) . sub ( toCached ( ) ) . toP3 ( ) ; |
public class GBSNode { /** * Search the whole node .
* < p > Look in the whole node to find an index entry that is one of < / p >
* < ol >
* < li > an exact match for the supplied key ,
* < li > greater than the supplied key , or
* < li > greater than or equal to the supplied key .
* < / ol >
* < p > The type of the supplied SearchComparator indicate which of the
* above three conditions apply < / p > .
* @ param comp The SearchComparator to use for the key comparisons .
* @ param searchKey The key to find .
* @ return Index of key within node . - 1 if key does not exist . */
int searchAll ( SearchComparator comp , Object searchKey ) { } } | int idx = - 1 ; if ( comp . type ( ) == SearchComparator . EQ ) idx = findEqual ( comp , 0 , rightMostIndex ( ) , searchKey ) ; else idx = findGreater ( comp , 0 , rightMostIndex ( ) , searchKey ) ; return idx ; |
public class Snappy { /** * Validates that the offset extracted from a compressed reference is within
* the permissible bounds of an offset ( 0 < offset < Integer . MAX _ VALUE ) , and does not
* exceed the length of the chunk currently read so far .
* @ param offset The offset extracted from the compressed reference
* @ param chunkSizeSoFar The number of bytes read so far from this chunk
* @ throws DecompressionException if the offset is invalid */
private static void validateOffset ( int offset , int chunkSizeSoFar ) { } } | if ( offset == 0 ) { throw new DecompressionException ( "Offset is less than minimum permissible value" ) ; } if ( offset < 0 ) { // Due to arithmetic overflow
throw new DecompressionException ( "Offset is greater than maximum value supported by this implementation" ) ; } if ( offset > chunkSizeSoFar ) { throw new DecompressionException ( "Offset exceeds size of chunk" ) ; } |
public class ImageUtils { /** * Calculates the bounds of the non - transparent parts of the given image .
* @ param p the image
* @ return the bounds of the non - transparent area */
public static Rectangle getSelectedBounds ( BufferedImage p ) { } } | int width = p . getWidth ( ) ; int height = p . getHeight ( ) ; int maxX = 0 , maxY = 0 , minX = width , minY = height ; boolean anySelected = false ; int y1 ; int [ ] pixels = null ; for ( y1 = height - 1 ; y1 >= 0 ; y1 -- ) { pixels = getRGB ( p , 0 , y1 , width , 1 , pixels ) ; for ( int x = 0 ; x < minX ; x ++ ) { if ( ( pixels [ x ] & 0xff000000 ) != 0 ) { minX = x ; maxY = y1 ; anySelected = true ; break ; } } for ( int x = width - 1 ; x >= maxX ; x -- ) { if ( ( pixels [ x ] & 0xff000000 ) != 0 ) { maxX = x ; maxY = y1 ; anySelected = true ; break ; } } if ( anySelected ) break ; } pixels = null ; for ( int y = 0 ; y < y1 ; y ++ ) { pixels = getRGB ( p , 0 , y , width , 1 , pixels ) ; for ( int x = 0 ; x < minX ; x ++ ) { if ( ( pixels [ x ] & 0xff000000 ) != 0 ) { minX = x ; if ( y < minY ) minY = y ; anySelected = true ; break ; } } for ( int x = width - 1 ; x >= maxX ; x -- ) { if ( ( pixels [ x ] & 0xff000000 ) != 0 ) { maxX = x ; if ( y < minY ) minY = y ; anySelected = true ; break ; } } } if ( anySelected ) return new Rectangle ( minX , minY , maxX - minX + 1 , maxY - minY + 1 ) ; return null ; |
public class CharsetScanner { /** * Find the GEDCOM charset in the attributes of the header .
* @ param gob the header ged object
* @ return the GEDCOM charset */
private String findCharsetInHeader ( final GedObject gob ) { } } | for ( final GedObject hgob : gob . getAttributes ( ) ) { if ( "Character Set" . equals ( hgob . getString ( ) ) ) { return ( ( Attribute ) hgob ) . getTail ( ) ; } } return "UTF-8" ; |
public class IssueGridScreen { /** * Add button ( s ) to the toolbar . */
public void addToolbarButtons ( ToolScreen toolScreen ) { } } | new SCannedBox ( toolScreen . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . SET_ANCHOR ) , toolScreen , null , ScreenConstants . DEFAULT_DISPLAY , null , MenuConstants . FORMDETAIL , MenuConstants . FORMDETAIL , MenuConstants . FORMDETAIL , null ) ; toolScreen . getScreenRecord ( ) . getField ( IssueScreenRecord . PROJECT_ID ) . setupDefaultView ( toolScreen . getNextLocation ( ScreenConstants . RIGHT_WITH_DESC , ScreenConstants . SET_ANCHOR ) , toolScreen , ScreenConstants . DEFAULT_DISPLAY ) ; toolScreen . getScreenRecord ( ) . getField ( IssueScreenRecord . PROJECT_VERSION_ID ) . setupDefaultView ( toolScreen . getNextLocation ( ScreenConstants . NEXT_INPUT_LOCATION , ScreenConstants . SET_ANCHOR ) , toolScreen , ScreenConstants . DEFAULT_DISPLAY ) ; toolScreen . getScreenRecord ( ) . getField ( IssueScreenRecord . ISSUE_TYPE_ID ) . setupDefaultView ( toolScreen . getNextLocation ( ScreenConstants . RIGHT_WITH_DESC , ScreenConstants . SET_ANCHOR ) , toolScreen , ScreenConstants . DEFAULT_DISPLAY ) ; toolScreen . getScreenRecord ( ) . getField ( IssueScreenRecord . ISSUE_STATUS_ID ) . setupDefaultView ( toolScreen . getNextLocation ( ScreenConstants . RIGHT_WITH_DESC , ScreenConstants . SET_ANCHOR ) , toolScreen , ScreenConstants . DEFAULT_DISPLAY ) ; toolScreen . getScreenRecord ( ) . getField ( IssueScreenRecord . ASSIGNED_USER_ID ) . setupDefaultView ( toolScreen . getNextLocation ( ScreenConstants . NEXT_INPUT_LOCATION , ScreenConstants . SET_ANCHOR ) , toolScreen , ScreenConstants . DEFAULT_DISPLAY ) ; toolScreen . getScreenRecord ( ) . getField ( IssueScreenRecord . ISSUE_PRIORITY_ID ) . setupDefaultView ( toolScreen . getNextLocation ( ScreenConstants . RIGHT_WITH_DESC , ScreenConstants . SET_ANCHOR ) , toolScreen , ScreenConstants . DEFAULT_DISPLAY ) ; new SCannedBox ( toolScreen . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . SET_ANCHOR ) , toolScreen , null , ScreenConstants . DEFAULT_DISPLAY , null , MenuConstants . FORMDETAIL , MenuConstants . FORMDETAIL , MenuConstants . FORMDETAIL , null ) ; |
public class ImageAnchorCell { /** * Sets the client - side image map declaration for the HTML iage tag .
* @ param usemap the map declaration .
* @ jsptagref . attributedescription The client - side image map declaration for the HTML image tag .
* @ jsptagref . attributesyntaxvalue < i > string _ useMap < / i >
* @ netui : attribute required = " false " rtexprvalue = " true "
* description = " The client - side image map declaration for the HTML image tag . " */
public void setUsemap ( String usemap ) { } } | _imageState . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . USEMAP , usemap ) ; |
public class WhitespaceTokenizer { /** * Separates the tokens of a string by splitting it on white space .
* @ param text
* @ return */
@ Override public List < String > tokenize ( String text ) { } } | List < String > tokens = new ArrayList < > ( Arrays . asList ( text . split ( "[\\p{Z}\\p{C}]+" ) ) ) ; return tokens ; |
public class TriggerBuilder { /** * Produce the < code > Trigger < / code > .
* @ return a Trigger that meets the specifications of the builder . */
@ Nonnull public T build ( ) { } } | if ( m_aScheduleBuilder == null ) m_aScheduleBuilder = SimpleScheduleBuilder . simpleSchedule ( ) ; final IMutableTrigger trig = m_aScheduleBuilder . build ( ) ; trig . setCalendarName ( m_sCalendarName ) ; trig . setDescription ( m_sDescription ) ; trig . setStartTime ( m_aStartTime ) ; trig . setEndTime ( m_aEndTime ) ; if ( m_aKey == null ) m_aKey = new TriggerKey ( Key . createUniqueName ( null ) , null ) ; trig . setKey ( m_aKey ) ; if ( m_aJobKey != null ) trig . setJobKey ( m_aJobKey ) ; trig . setPriority ( m_nPriority ) ; if ( ! m_aJobDataMap . isEmpty ( ) ) trig . setJobDataMap ( m_aJobDataMap ) ; return GenericReflection . uncheckedCast ( trig ) ; |
public class QueryBuilder { /** * Similar to { @ link # join ( QueryBuilder ) } but this allows you to link two tables that share a field of the same
* type . So even if there is _ not _ a foreign - object relationship between the tables , you can JOIN them . This will
* add into the SQL something close to " INNER JOIN other - table . . . " . */
public QueryBuilder < T , ID > join ( String localColumnName , String joinedColumnName , QueryBuilder < ? , ? > joinedQueryBuilder ) throws SQLException { } } | addJoinInfo ( JoinType . INNER , localColumnName , joinedColumnName , joinedQueryBuilder , JoinWhereOperation . AND ) ; return this ; |
public class PaginationAutoMapInterceptor { /** * 获取总记录数
* @ param sql 原始sql语句
* @ param conn
* @ param ms
* @ param boundSql
* @ return
* @ throws SQLException */
private int getTotalCount ( String sql , Connection conn , MappedStatement ms , BoundSql boundSql ) throws SQLException { } } | int start = sql . indexOf ( "from" ) ; if ( start == - 1 ) { throw new RuntimeException ( "statement has no 'from' keyword" ) ; } int stop = sql . indexOf ( "order by" ) ; if ( stop == - 1 ) { stop = sql . length ( ) ; } String countSql = "select count(0) " + sql . substring ( start , stop ) ; BoundSql countBoundSql = new BoundSql ( ms . getConfiguration ( ) , countSql , boundSql . getParameterMappings ( ) , boundSql . getParameterObject ( ) ) ; ParameterHandler parameterHandler = new DefaultParameterHandler ( ms , boundSql . getParameterObject ( ) , countBoundSql ) ; PreparedStatement stmt = null ; ResultSet rs = null ; int count = 0 ; try { stmt = conn . prepareStatement ( countSql ) ; // 通过parameterHandler给PreparedStatement对象设置参数
parameterHandler . setParameters ( stmt ) ; rs = stmt . executeQuery ( ) ; if ( rs . next ( ) ) { count = rs . getInt ( 1 ) ; } } finally { CloseableUtil . closeQuietly ( rs ) ; CloseableUtil . closeQuietly ( stmt ) ; } return count ; |
public class FacebookRestClient { /** * Logs an exception with an introductory message in addition to the
* exception ' s getMessage ( ) .
* @ param msg message
* @ param e exception
* @ see Exception # getMessage */
protected void logException ( CharSequence msg , Exception e ) { } } | System . err . println ( msg + ":" + e . getMessage ( ) ) ; e . printStackTrace ( ) ; |
public class ISPNQuotaPersister { /** * { @ inheritDoc } */
public boolean isNodeQuotaAsync ( String repositoryName , String workspaceName , String nodePath ) throws UnknownQuotaLimitException { } } | String workspaceUniqueName = composeWorkspaceUniqueName ( repositoryName , workspaceName ) ; CacheKey key = new NodeQuotaKey ( workspaceUniqueName , nodePath ) ; return getQuotaValue ( key ) . getAsyncUpdate ( ) ; |
public class ProviderUtil { /** * Loads an individual Provider implementation . This method is really only useful for the OSGi bundle activator and
* this class itself .
* @ param url the URL to the provider properties file
* @ param cl the ClassLoader to load the provider classes with */
protected static void loadProvider ( final URL url , final ClassLoader cl ) { } } | try { final Properties props = PropertiesUtil . loadClose ( url . openStream ( ) , url ) ; if ( validVersion ( props . getProperty ( API_VERSION ) ) ) { final Provider provider = new Provider ( props , url , cl ) ; PROVIDERS . add ( provider ) ; LOGGER . debug ( "Loaded Provider {}" , provider ) ; } } catch ( final IOException e ) { LOGGER . error ( "Unable to open {}" , url , e ) ; } |
public class DigesterImpl { /** * Returns the message digest . The representation of the message digest
* depends on the outputMode property .
* @ param message the message
* @ return the message digest
* @ see # setOutputMode ( OutputMode ) */
public String digest ( String message ) { } } | final byte [ ] messageAsByteArray ; try { messageAsByteArray = message . getBytes ( charsetName ) ; } catch ( UnsupportedEncodingException e ) { throw new DigestException ( "error converting message to byte array: charsetName=" + charsetName , e ) ; } final byte [ ] digest = digest ( messageAsByteArray ) ; switch ( outputMode ) { case BASE64 : return Base64 . encodeBase64String ( digest ) ; case HEX : return Hex . encodeHexString ( digest ) ; default : return null ; } |
public class ResponseCacheInterceptor { /** * Set the appropriate response headers for caching or not caching the response .
* @ param renderContext the rendering context */
@ Override public void paint ( final RenderContext renderContext ) { } } | // Set headers
getResponse ( ) . setHeader ( "Cache-Control" , type . getSettings ( ) ) ; // Add extra no cache headers
if ( ! type . isCache ( ) ) { getResponse ( ) . setHeader ( "Pragma" , "no-cache" ) ; getResponse ( ) . setHeader ( "Expires" , "-1" ) ; } super . paint ( renderContext ) ; |
public class ClassGraph { /** * Returns { @ link ModuleRef } references for all the visible modules .
* @ return a list of { @ link ModuleRef } references for all the visible modules .
* @ throws ClassGraphException
* if any of the worker threads throws an uncaught exception , or the scan was interrupted . */
public List < ModuleRef > getModules ( ) { } } | scanSpec . performScan = false ; try ( ScanResult scanResult = scan ( ) ) { return scanResult . getModules ( ) ; } |
public class AlgorithmOptions { /** * This method clones the specified AlgorithmOption object with the possibility for further
* changes . */
public static Builder start ( AlgorithmOptions opts ) { } } | Builder b = new Builder ( ) ; if ( opts . algorithm != null ) b . algorithm ( opts . getAlgorithm ( ) ) ; if ( opts . traversalMode != null ) b . traversalMode ( opts . getTraversalMode ( ) ) ; if ( opts . weighting != null ) b . weighting ( opts . getWeighting ( ) ) ; if ( opts . maxVisitedNodes >= 0 ) b . maxVisitedNodes ( opts . maxVisitedNodes ) ; if ( ! opts . hints . isEmpty ( ) ) b . hints ( opts . hints ) ; return b ; |
public class UrlUtils { /** * adds the domain if missing .
* @ param aUrl the url to check
* @ param aDomain the domain to add
* @ return the url including the domain */
public static String addDomainIfMissing ( final String aUrl , final String aDomain ) { } } | if ( aUrl != null && ! aUrl . isEmpty ( ) && aUrl . startsWith ( "/" ) ) { return aDomain + aUrl ; } return aUrl ; |
public class ClassFileImporter { /** * Delegates to { @ link # importPaths ( Collection ) } */
@ PublicAPI ( usage = ACCESS ) public JavaClasses importPaths ( Path ... paths ) { } } | return importPaths ( ImmutableSet . copyOf ( paths ) ) ; |
public class GroupApi { /** * Get a list of variables for the specified group in the specified page range .
* < pre > < code > GitLab Endpoint : GET / groups / : id / variables < / code > < / pre >
* @ param groupIdOrPath the group ID , path of the group , or a Group instance holding the group ID or path
* @ param page the page to get
* @ param perPage the number of Variable instances per page
* @ return a list of variables belonging to the specified group in the specified page range
* @ throws GitLabApiException if any exception occurs */
public List < Variable > getVariables ( Object groupIdOrPath , int page , int perPage ) throws GitLabApiException { } } | Response response = get ( Response . Status . OK , getPageQueryParams ( page , perPage ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "variables" ) ; return ( response . readEntity ( new GenericType < List < Variable > > ( ) { } ) ) ; |
public class NikeFS2LazyRandomAccessStorageImpl { /** * This method alerts all child soft copies of this storage to consolidate ;
* called prior to modification of this instance . The child soft copies so
* alerted will detach from this instance consequently . */
public synchronized void alertSoftCopies ( ) throws IOException { } } | // make a copy of the list of soft copies , as they will deregister
// within the loop ( removing themselves from our internal list )
NikeFS2LazyRandomAccessStorageImpl [ ] copies = softCopies . toArray ( new NikeFS2LazyRandomAccessStorageImpl [ softCopies . size ( ) ] ) ; for ( NikeFS2LazyRandomAccessStorageImpl copy : copies ) { if ( copy . isSoftCopy ) { copy . consolidateSoftCopy ( ) ; copy . alertSoftCopies ( ) ; // HV
} } |
public class WebSecurityScannerClient { /** * Stops a ScanRun . The stopped ScanRun is returned .
* < p > Sample code :
* < pre > < code >
* try ( WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient . create ( ) ) {
* ScanRunName name = ScanRunName . of ( " [ PROJECT ] " , " [ SCAN _ CONFIG ] " , " [ SCAN _ RUN ] " ) ;
* ScanRun response = webSecurityScannerClient . stopScanRun ( name . toString ( ) ) ;
* < / code > < / pre >
* @ param name Required . The resource name of the ScanRun to be stopped . The name follows the
* format of ' projects / { projectId } / scanConfigs / { scanConfigId } / scanRuns / { scanRunId } ' .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final ScanRun stopScanRun ( String name ) { } } | StopScanRunRequest request = StopScanRunRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return stopScanRun ( request ) ; |
public class Choice5 { /** * { @ inheritDoc } */
@ Override public < F > Choice5 < A , B , C , D , E > discardR ( Applicative < F , Choice5 < A , B , C , D , ? > > appB ) { } } | return Monad . super . discardR ( appB ) . coerce ( ) ; |
public class SearchUtils { /** * Converts a date to the default string representation in FTS ( RFC 3339 ) .
* @ param date the { @ link Date } to convert .
* @ return the RFC 3339 representation of the date , in UTC timezone ( eg . " 2016-01-19T14:44:01Z " ) */
public static String toFtsUtcString ( Date date ) { } } | if ( date == null ) { return null ; } DateFormat rfc3339 = df . get ( ) ; String zDate = rfc3339 . format ( date ) ; String xDate = zDate . replaceFirst ( "\\+0000$" , "Z" ) ; return xDate ; |
public class InMemoryValueInspector { /** * { @ inheritDoc } .
* If present in the cache , return the cached { @ link com . typesafe . config . Config } for given input
* Otherwise , simply delegate the functionality to the internal { ConfigStoreValueInspector } and store the value into cache */
@ Override public Config getResolvedConfig ( final ConfigKeyPath configKey ) { } } | return getResolvedConfig ( configKey , Optional . < Config > absent ( ) ) ; |
public class EJSContainer { /** * This method is driven when dispatch is called upon a server request .
* It should return a ' cookie ' Object which uniquely identifies this preinvoke .
* This ' cookie ' should be passed as a paramater when the corresponding
* postinvoke is called .
* @ param object the IDL Servant or RMI Tie
* @ param operation the operation being invoked
* @ return Object a ' cookie ' which uniquely identifies this preinvoke ( ) */
@ Override public Object preInvokeORBDispatch ( Object object , String operation ) { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) { // toString of ' object ' can be quite large and can really bloat the
// trace . . . . so just trace the class name ; usually the tie name or
// class loader name . The IOR or classpath is not traced . d133384
String objStr = null ; if ( object != null ) objStr = object . getClass ( ) . getName ( ) ; Tr . debug ( tc , "preInvokeORBDispatch(" + objStr + ", " + operation + ")" ) ; } EJBThreadData threadData = null ; if ( object instanceof javax . rmi . CORBA . Tie ) { object = ( ( javax . rmi . CORBA . Tie ) object ) . getTarget ( ) ; if ( object instanceof EJSWrapperBase ) { final EJSWrapperBase wrapper = ( EJSWrapperBase ) object ; BeanMetaData bmd = wrapper . bmd ; // null if EJBFactory
if ( bmd != null ) { threadData = svThreadData . get ( ) ; // d153263
// push the old class loader to the ORB dispatch stack so that the wrapper classloader
// can be popped off the " stack " before the marshalling the return object in the stub .
// See any generated stub with input param and return to see the problem described in defect
// There are 2 paths need to be taken care of :
// 1 . in the normal case , the wrapper classloader is popped off when from container . postinvoke ( ) .
// 2 . after the object resolver preInvoke is performed and exception takes place before
// wrapper . postInvoke ( ) has a chance to clean up .
threadData . pushClassLoader ( bmd ) ; } } } // d646139.2 - For performance , return the EJBThreadData as the cookie to
// avoid needing to look it up again in postInvokeORBDispatch .
// d717291 - Return null to indicate a non - EJB request .
return threadData ; // d646139.2 |
public class DefaultFacelet { /** * Delegates resolution to DefaultFaceletFactory reference . Also , caches URLs for relative paths .
* @ param path
* a relative url path
* @ return URL pointing to destination
* @ throws IOException
* if there is a problem creating the URL for the path specified */
private URL getRelativePath ( FacesContext facesContext , String path ) throws IOException { } } | URL url = ( URL ) _relativePaths . get ( path ) ; if ( url == null ) { url = _factory . resolveURL ( facesContext , _src , path ) ; if ( url != null ) { ViewResource viewResource = ( ViewResource ) facesContext . getAttributes ( ) . get ( FaceletFactory . LAST_RESOURCE_RESOLVED ) ; if ( viewResource != null ) { // If a view resource has been used to resolve a resource , the cache is in
// the ResourceHandler implementation . No need to cache in _ relativeLocations .
} else { _relativePaths . put ( path , url ) ; } } } return url ; |
public class CmsXmlHtmlValue { /** * Creates the String value for this HTML value element . < p >
* @ param cms an initialized instance of a CmsObject
* @ param document the XML document this value belongs to
* @ return the String value for this HTML value element */
private String createStringValue ( CmsObject cms , I_CmsXmlDocument document ) { } } | Element data = m_element . element ( CmsXmlPage . NODE_CONTENT ) ; if ( data == null ) { String content = m_element . getText ( ) ; m_element . clearContent ( ) ; int index = m_element . getParent ( ) . elements ( m_element . getQName ( ) ) . indexOf ( m_element ) ; m_element . addAttribute ( CmsXmlPage . ATTRIBUTE_NAME , getName ( ) + index ) ; m_element . addElement ( CmsXmlPage . NODE_LINKS ) ; m_element . addElement ( CmsXmlPage . NODE_CONTENT ) . addCDATA ( content ) ; data = m_element . element ( CmsXmlPage . NODE_CONTENT ) ; } Attribute enabled = m_element . attribute ( CmsXmlPage . ATTRIBUTE_ENABLED ) ; String content = "" ; if ( ( enabled == null ) || Boolean . valueOf ( enabled . getText ( ) ) . booleanValue ( ) ) { content = data . getText ( ) ; CmsLinkTable linkTable = getLinkTable ( ) ; if ( ! linkTable . isEmpty ( ) ) { // link processing : replace macros with links
CmsLinkProcessor linkProcessor = document . getLinkProcessor ( cms , linkTable ) ; try { content = linkProcessor . processLinks ( content ) ; } catch ( ParserException e ) { // should better not happen
LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_XMLCONTENT_LINK_PROCESS_FAILED_0 ) , e ) ; } } } return content ; |
public class MakeValidOp { /** * Use map to restore M values on the coordinate array */
private CoordinateSequence restoreDim4 ( CoordinateSequence cs , Map < Coordinate , Double > map ) { } } | CoordinateSequence seq = new PackedCoordinateSequenceFactory ( DOUBLE , 4 ) . create ( cs . size ( ) , 4 ) ; for ( int i = 0 ; i < cs . size ( ) ; i ++ ) { seq . setOrdinate ( i , 0 , cs . getOrdinate ( i , 0 ) ) ; seq . setOrdinate ( i , 1 , cs . getOrdinate ( i , 1 ) ) ; seq . setOrdinate ( i , 2 , cs . getOrdinate ( i , 2 ) ) ; Double d = map . get ( cs . getCoordinate ( i ) ) ; seq . setOrdinate ( i , 3 , d == null ? Double . NaN : d ) ; } return seq ; |
public class Geometry { /** * < p > Compute the pairwise squared distances between all columns of the two
* matrices . < / p >
* < p > An efficient way to do this is to observe that < i > ( x - y ) ^ 2 = x ^ 2 - 2xy - y ^ 2 < / i >
* and to then properly carry out the computation with matrices . < / p > */
public static FloatMatrix pairwiseSquaredDistances ( FloatMatrix X , FloatMatrix Y ) { } } | if ( X . rows != Y . rows ) throw new IllegalArgumentException ( "Matrices must have same number of rows" ) ; FloatMatrix XX = X . mul ( X ) . columnSums ( ) ; FloatMatrix YY = Y . mul ( Y ) . columnSums ( ) ; FloatMatrix Z = X . transpose ( ) . mmul ( Y ) ; Z . muli ( - 2.0f ) ; // Z . print ( ) ;
Z . addiColumnVector ( XX ) ; Z . addiRowVector ( YY ) ; return Z ; |
public class SRTServletRequest { /** * { @ inheritDoc } Returns true if the user is authenticated and is in the
* specified role . False otherwise .
* This logic is delegatd to the registered IWebAppSecurityCollaborator . */
public boolean isUserInRole ( String role ) { } } | if ( WCCustomProperties . CHECK_REQUEST_OBJECT_IN_USE ) { checkRequestObjectInUse ( ) ; } boolean userInRole ; IWebAppSecurityCollaborator webAppSec = CollaboratorHelperImpl . getCurrentSecurityCollaborator ( ) ; if ( webAppSec != null ) { userInRole = webAppSec . isUserInRole ( role , this ) ; } else { // No IWebAppSecurityCollaborator means no security , so not authenticated
userInRole = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { // 306998.15
logger . logp ( Level . FINE , CLASS_NAME , "isUserInRole" , " role --> " + role + " result --> " + String . valueOf ( userInRole ) ) ; } return userInRole ; |
public class VlcjDevice { /** * Get capture device protocol . This will be :
* < ul >
* < li > < code > dshow : / / < / code > for Windows < / li >
* < li > < code > qtcapture : / / < / code > for Mac < / li >
* < li > < code > v4l2 : / / < / code > for linux < / li >
* < / ul >
* @ return Capture device protocol
* @ throws WebcamException in case when there is no support for given operating system */
public String getCaptureDevice ( ) { } } | switch ( OsUtils . getOS ( ) ) { case WIN : return "dshow://" ; case OSX : return "qtcapture://" ; case NIX : return "v4l2://" ; default : throw new WebcamException ( "Capture device not supported on " + OsUtils . getOS ( ) ) ; } |
public class HBaseSchemaManager { /** * get Table metadata method returns the HTableDescriptor of table for given
* tableInfo
* @ return HHTableDescriptor object for tableInfo */
private HTableDescriptor getTableMetaData ( List < TableInfo > tableInfos ) { } } | HTableDescriptor tableDescriptor = new HTableDescriptor ( databaseName ) ; Properties tableProperties = null ; schemas = HBasePropertyReader . hsmd . getDataStore ( ) != null ? HBasePropertyReader . hsmd . getDataStore ( ) . getSchemas ( ) : null ; if ( schemas != null && ! schemas . isEmpty ( ) ) { for ( Schema s : schemas ) { if ( s . getName ( ) != null && s . getName ( ) . equalsIgnoreCase ( databaseName ) ) { tableProperties = s . getSchemaProperties ( ) ; tables = s . getTables ( ) ; } } } for ( TableInfo tableInfo : tableInfos ) { if ( tableInfo != null ) { HColumnDescriptor hColumnDescriptor = getColumnDescriptor ( tableInfo ) ; tableDescriptor . addFamily ( hColumnDescriptor ) ; } } if ( tableProperties != null ) { for ( Object o : tableProperties . keySet ( ) ) { tableDescriptor . setValue ( Bytes . toBytes ( o . toString ( ) ) , Bytes . toBytes ( tableProperties . get ( o ) . toString ( ) ) ) ; } } return tableDescriptor ; |
public class MaxValueReducer { /** * ~ Methods * * * * * */
@ Override public Double reduce ( List < Double > values ) { } } | if ( values == null || values . isEmpty ( ) ) { return null ; } Stream < Double > stream = StreamSupport . stream ( values . spliterator ( ) , true ) ; if ( stream . allMatch ( o -> o == null ) ) { stream . close ( ) ; return null ; } stream . close ( ) ; double max = Double . NEGATIVE_INFINITY ; for ( Double value : values ) { if ( value == null ) { continue ; } double candidate = value ; if ( candidate > max ) { max = candidate ; } } return max ; |
public class ExternalType { /** * { @ inheritDoc } */
@ Override public final void to ( File f ) throws IOException { } } | if ( f == null ) throw new NullPointerException ( ) ; FileOutputStream fos = null ; try { fos = new FileOutputStream ( f ) ; ObjectOutputStream oos = new ObjectOutputStream ( fos ) ; to ( oos ) ; } finally { if ( fos != null ) fos . close ( ) ; } |
public class ASN1 { /** * Decode an EC PKCS # 8 private key structure
* @ param encodedData bytes containing the private key
* @ return tag / value from the decoded object
* @ throws CoseException - ASN . 1 encoding errors */
public static ArrayList < TagValue > DecodePKCS8 ( byte [ ] encodedData ) throws CoseException { } } | TagValue pkcs8 = DecodeCompound ( 0 , encodedData ) ; if ( pkcs8 . tag != 0x30 ) throw new CoseException ( "Invalid PKCS8 structure" ) ; ArrayList < TagValue > retValue = pkcs8 . list ; if ( retValue . size ( ) != 3 && retValue . size ( ) != 4 ) { throw new CoseException ( "Invalid PKCS8 structure" ) ; } // Version number - we currently only support one version
if ( retValue . get ( 0 ) . tag != 2 && ( ( byte [ ] ) retValue . get ( 0 ) . value ) [ 0 ] != 0 ) { throw new CoseException ( "Invalid PKCS8 structure" ) ; } // Algorithm identifier
if ( retValue . get ( 1 ) . tag != 0x30 ) throw new CoseException ( "Invalid PKCS8 structure" ) ; if ( retValue . get ( 1 ) . list . isEmpty ( ) || retValue . get ( 1 ) . list . size ( ) > 2 ) { throw new CoseException ( "Invalid PKCS8 structure" ) ; } if ( retValue . get ( 1 ) . list . get ( 0 ) . tag != 6 ) throw new CoseException ( "Invalid PKCS8 structure" ) ; // Dont check the next item as it is an ANY
if ( retValue . get ( 2 ) . tag != 4 ) throw new CoseException ( "Invalid PKCS8 structure" ) ; // This is attributes , but we are not going to check for correctness .
if ( retValue . size ( ) == 4 && retValue . get ( 3 ) . tag != 0xa0 ) { throw new CoseException ( "Invalid PKCS8 structure" ) ; } // Decode the contents of the octet string PrivateKey
byte [ ] pk = ( byte [ ] ) retValue . get ( 2 ) . value ; TagValue pkd = DecodeCompound ( 0 , pk ) ; ArrayList < TagValue > pkdl = pkd . list ; if ( pkd . tag != 0x30 ) throw new CoseException ( "Invalid ECPrivateKey" ) ; if ( pkdl . size ( ) < 2 || pkdl . size ( ) > 4 ) throw new CoseException ( "Invalid ECPrivateKey" ) ; if ( pkdl . get ( 0 ) . tag != 2 && ( ( byte [ ] ) retValue . get ( 0 ) . value ) [ 0 ] != 1 ) { throw new CoseException ( "Invalid ECPrivateKey" ) ; } if ( pkdl . get ( 1 ) . tag != 4 ) throw new CoseException ( "Invalid ECPrivateKey" ) ; if ( pkdl . size ( ) > 2 ) { if ( ( pkdl . get ( 2 ) . tag & 0xff ) != 0xA0 ) { if ( pkdl . size ( ) != 3 || ( pkdl . get ( 2 ) . tag & 0xff ) != 0xa1 ) { throw new CoseException ( "Invalid ECPrivateKey" ) ; } } else { if ( pkdl . size ( ) == 4 && ( pkdl . get ( 3 ) . tag & 0xff ) != 0xa1 ) throw new CoseException ( "Invalid ECPrivateKey" ) ; } } retValue . get ( 2 ) . list = pkdl ; retValue . get ( 2 ) . value = null ; retValue . get ( 2 ) . tag = 0x30 ; return retValue ; |
public class EBCImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . EBC__BCDO_NAME : setBCdoName ( ( String ) newValue ) ; return ; case AfplibPackage . EBC__TRIPLETS : getTriplets ( ) . clear ( ) ; getTriplets ( ) . addAll ( ( Collection < ? extends Triplet > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class DRL6Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 653:1 : createdName : ( ID ( typeArguments ) ? ( DOT ID ( typeArguments ) ? ) * | primitiveType ) ; */
public final void createdName ( ) throws RecognitionException { } } | try { // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 654:5 : ( ID ( typeArguments ) ? ( DOT ID ( typeArguments ) ? ) * | primitiveType )
int alt79 = 2 ; int LA79_0 = input . LA ( 1 ) ; if ( ( LA79_0 == ID ) ) { int LA79_1 = input . LA ( 2 ) ; if ( ( ! ( ( ( ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . SHORT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . LONG ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . CHAR ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . INT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . FLOAT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . BOOLEAN ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . DOUBLE ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . BYTE ) ) ) ) ) ) ) ) { alt79 = 1 ; } else if ( ( ( ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . SHORT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . LONG ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . CHAR ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . INT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . FLOAT ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . BOOLEAN ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . DOUBLE ) ) ) || ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . BYTE ) ) ) ) ) ) { alt79 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } int nvaeMark = input . mark ( ) ; try { input . consume ( ) ; NoViableAltException nvae = new NoViableAltException ( "" , 79 , 1 , input ) ; throw nvae ; } finally { input . rewind ( nvaeMark ) ; } } } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 79 , 0 , input ) ; throw nvae ; } switch ( alt79 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 654:7 : ID ( typeArguments ) ? ( DOT ID ( typeArguments ) ? ) *
{ match ( input , ID , FOLLOW_ID_in_createdName3907 ) ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 654:10 : ( typeArguments ) ?
int alt76 = 2 ; int LA76_0 = input . LA ( 1 ) ; if ( ( LA76_0 == LESS ) ) { alt76 = 1 ; } switch ( alt76 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 654:10 : typeArguments
{ pushFollow ( FOLLOW_typeArguments_in_createdName3909 ) ; typeArguments ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 655:9 : ( DOT ID ( typeArguments ) ? ) *
loop78 : while ( true ) { int alt78 = 2 ; int LA78_0 = input . LA ( 1 ) ; if ( ( LA78_0 == DOT ) ) { alt78 = 1 ; } switch ( alt78 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 655:11 : DOT ID ( typeArguments ) ?
{ match ( input , DOT , FOLLOW_DOT_in_createdName3922 ) ; if ( state . failed ) return ; match ( input , ID , FOLLOW_ID_in_createdName3924 ) ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 655:18 : ( typeArguments ) ?
int alt77 = 2 ; int LA77_0 = input . LA ( 1 ) ; if ( ( LA77_0 == LESS ) ) { alt77 = 1 ; } switch ( alt77 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 655:18 : typeArguments
{ pushFollow ( FOLLOW_typeArguments_in_createdName3926 ) ; typeArguments ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } break ; default : break loop78 ; } } } break ; case 2 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 656:11 : primitiveType
{ pushFollow ( FOLLOW_primitiveType_in_createdName3941 ) ; primitiveType ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving
} |
public class AbstractHtmlTableCell { /** * Base HTML table cell rendering functionality which opens and closes the HTML & lt ; td & gt ; tags with
* the correct style and attribute information . Between the table cell tags , the tag
* calls the { @ link # renderDataCellContents ( org . apache . beehive . netui . tags . rendering . AbstractRenderAppender , String ) }
* method so that subclasses implementing this method can provide content inside of the table cell .
* The style information rendered here includes the following in order :
* < ol >
* < li > the { @ link org . apache . beehive . netui . databinding . datagrid . api . rendering . StyleModel # getDataCellFilteredClass ( ) }
* if the cell has a filter expression and is filtered
* < / li >
* < li > the { @ link org . apache . beehive . netui . databinding . datagrid . api . rendering . StyleModel # getDataCellSortedClass ( ) }
* if the cell has a sort expression and is sorted
* < li > the { @ link # setCellStyleClass ( String ) } attribute if set ;
* { @ link org . apache . beehive . netui . databinding . datagrid . api . rendering . StyleModel # getDataCellClass ( ) } otherwise < / li >
* < / ol >
* @ param appender the { @ link AbstractRenderAppender } to which any output should be rendered
* @ throws IOException
* @ throws JspException */
protected void renderCell ( AbstractRenderAppender appender ) throws IOException , JspException { } } | DataGridTagModel dataGridModel = DataGridUtil . getDataGridTagModel ( getJspContext ( ) ) ; if ( dataGridModel == null ) throw new JspException ( Bundle . getErrorString ( "DataGridTags_MissingDataGridModel" ) ) ; TableRenderer tableRenderer = dataGridModel . getTableRenderer ( ) ; assert tableRenderer != null ; /* todo : refactor . extensibility in supporting style decorators */
ArrayList /* < String > */
styleClasses = new ArrayList /* < String > */
( ) ; FilterModel filterModel = dataGridModel . getState ( ) . getFilterModel ( ) ; if ( _filterExpression != null && filterModel . isFiltered ( _filterExpression ) ) styleClasses . add ( dataGridModel . getStyleModel ( ) . getDataCellFilteredClass ( ) ) ; SortModel sortModel = dataGridModel . getState ( ) . getSortModel ( ) ; if ( _sortExpression != null && sortModel . isSorted ( _sortExpression ) ) styleClasses . add ( dataGridModel . getStyleModel ( ) . getDataCellSortedClass ( ) ) ; if ( _cellState . styleClass == null ) styleClasses . add ( dataGridModel . getStyleModel ( ) . getDataCellClass ( ) ) ; else styleClasses . add ( _cellState . styleClass ) ; _cellState . styleClass = dataGridModel . getStyleModel ( ) . buildStyleClassValue ( styleClasses ) ; /* note , this runs in order to allow any nested tags to do their work .
this provides support for formatters , parameters , etc */
JspFragment fragment = getJspBody ( ) ; StringWriter sw = new StringWriter ( ) ; if ( fragment != null ) fragment . invoke ( sw ) ; tableRenderer . openTableCell ( _cellState , appender ) ; renderDataCellContents ( appender , sw . toString ( ) ) ; tableRenderer . closeTableCell ( appender ) ; /* todo : need to add the JavaScript rendering for any tagIds that were set on < td > s */
if ( _cellState . id != null ) { HttpServletRequest request = JspUtil . getRequest ( getJspContext ( ) ) ; String script = renderNameAndId ( request , _cellState , null ) ; if ( script != null ) appender . append ( script ) ; } |
public class RegisterWebAppVisitorWC { /** * Registers servlets with web container .
* @ throws NullArgumentException if servlet is null
* @ see WebAppVisitor # visit ( org . ops4j . pax . web . extender . war . internal . model . WebAppServlet ) */
public void visit ( final WebAppServlet webAppServlet ) { } } | NullArgumentException . validateNotNull ( webAppServlet , "Web app servlet" ) ; final String [ ] urlPatterns = webAppServlet . getAliases ( ) ; if ( urlPatterns == null || urlPatterns . length == 0 ) { LOG . warn ( "Servlet [" + webAppServlet + "] does not have any mapping. Skipped." ) ; } try { if ( webAppServlet instanceof WebAppJspServlet ) { webContainer . registerJspServlet ( urlPatterns , httpContext , ( ( WebAppJspServlet ) webAppServlet ) . getJspPath ( ) ) ; } else { Class < ? extends Servlet > servletClass = RegisterWebAppVisitorHS . loadClass ( Servlet . class , bundleClassLoader , webAppServlet . getServletClassName ( ) ) ; webContainer . registerServlet ( servletClass , urlPatterns , RegisterWebAppVisitorHS . convertInitParams ( webAppServlet . getInitParams ( ) ) , webAppServlet . getLoadOnStartup ( ) , webAppServlet . getAsyncSupported ( ) , webAppServlet . getMultipartConfig ( ) , httpContext ) ; } // CHECKSTYLE : OFF
} catch ( Exception ignore ) { LOG . error ( REGISTRATION_EXCEPTION_SKIPPING , ignore ) ; } // CHECKSTYLE : ON |
public class DeleteProvisionedProductPlanRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteProvisionedProductPlanRequest deleteProvisionedProductPlanRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( deleteProvisionedProductPlanRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteProvisionedProductPlanRequest . getAcceptLanguage ( ) , ACCEPTLANGUAGE_BINDING ) ; protocolMarshaller . marshall ( deleteProvisionedProductPlanRequest . getPlanId ( ) , PLANID_BINDING ) ; protocolMarshaller . marshall ( deleteProvisionedProductPlanRequest . getIgnoreErrors ( ) , IGNOREERRORS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class RoomInfoImpl { /** * / * ( non - Javadoc )
* @ see com . tvd12 . ezyfox . core . command . UpdateRoomInfo # addUser ( com . tvd12 . ezyfox . core . entities . ApiBaseUser ) */
@ Override public void addUser ( ApiBaseUser user ) { } } | try { room . addUser ( CommandUtil . getSfsUser ( user , api ) ) ; } catch ( SFSJoinRoomException e ) { throw new IllegalStateException ( e ) ; } |
public class ConfigCache { /** * Gets from the cache or create , an instance of the given class using the given imports .
* @ param factory the factory to use to eventually create the instance .
* @ param key the key object to be used to identify the instance in the cache .
* @ param clazz the interface extending from { @ link Config } that you want to instantiate .
* @ param imports additional variables to be used to resolve the properties .
* @ param < T > type of the interface .
* @ return an object implementing the given interface , that can be taken from the cache ,
* which maps methods to property values . */
public static < T extends Config > T getOrCreate ( Factory factory , Object key , Class < ? extends T > clazz , Map < ? , ? > ... imports ) { } } | T existing = get ( key ) ; if ( existing != null ) return existing ; T created = factory . create ( clazz , imports ) ; T raced = add ( key , created ) ; return raced != null ? raced : created ; |
public class WebPage { /** * Method for creating WebPage only with name
* ( this can be useful for really simple sitemaps
* or with combination of default settings
* set on SitemapGenerator )
* @ param nameSupplier Name supplier ( cannot return null ! ! ! )
* @ return WebPage instance
* @ throws NullPointerException When nameSupplier or nameSupplier . get ( ) returns null */
public static WebPage of ( Supplier < String > nameSupplier ) { } } | Objects . requireNonNull ( nameSupplier ) ; Objects . requireNonNull ( nameSupplier . get ( ) ) ; WebPage webPage = new WebPage ( ) ; webPage . setName ( nameSupplier . get ( ) ) ; return webPage ; |
public class BaseSparseNDArrayCOO { /** * Returns a subset of this array based on the specified
* indexes
* @ param indexes the indexes in to the array
* @ return a view of the array with the specified indices */
@ Override public INDArray get ( INDArrayIndex ... indexes ) { } } | sort ( ) ; if ( indexes . length == 1 && indexes [ 0 ] instanceof NDArrayIndexAll || ( indexes . length == 2 && ( isRowVector ( ) && indexes [ 0 ] instanceof PointIndex && indexes [ 0 ] . offset ( ) == 0 && indexes [ 1 ] instanceof NDArrayIndexAll || isColumnVector ( ) && indexes [ 1 ] instanceof PointIndex && indexes [ 0 ] . offset ( ) == 0 && indexes [ 0 ] instanceof NDArrayIndexAll ) ) ) return this ; throw new UnsupportedOperationException ( "Not implemented" ) ; |
public class RythmEngine { /** * Not an API for user application
* @ param event
* @ param param
* @ return event handler process result */
@ Override public Object accept ( IEvent event , Object param ) { } } | return eventDispatcher ( ) . accept ( event , param ) ; |
public class DefaultTraceCollector { /** * This method sets the configuration service .
* @ param configService The configuration service */
protected void setConfigurationService ( ConfigurationService configService ) { } } | if ( log . isLoggable ( Level . FINER ) ) { log . finer ( "Set configuration service = " + configService ) ; } configurationService = configService ; if ( configurationService != null ) { initConfig ( ) ; } |
public class ExprParser { /** * assign : < assoc = right > ID ( ' [ ' expr ' ] ' ) ? ' = ' expr */
Expr assign ( ) { } } | Tok idTok = peek ( ) ; if ( idTok . sym != Sym . ID ) { return ternary ( ) ; } int begin = forward ; // ID = expr
if ( move ( ) . sym == Sym . ASSIGN ) { move ( ) ; return new Assign ( idTok . value ( ) , expr ( ) , location ) ; } // array 、 map 赋值 : ID [ expr ] = expr
if ( peek ( ) . sym == Sym . LBRACK ) { move ( ) ; Expr index = expr ( ) ; match ( Sym . RBRACK ) ; if ( peek ( ) . sym == Sym . ASSIGN ) { move ( ) ; return new Assign ( idTok . value ( ) , index , expr ( ) , location ) ; // 右结合无限连
} } resetForward ( begin ) ; return ternary ( ) ; |
public class TaskDescriptorChainBuilder { /** * Creates { @ link TaskDescriptor } for stream combine operations ( i . e . , join , union , unionAll ) */
private TaskDescriptor createTaskDescriptorForStreamCombineOperations ( DStreamOperation streamOperation ) { } } | TaskDescriptor taskDescriptor = this . createTaskDescriptor ( streamOperation . getLastOperationName ( ) ) ; for ( DStreamExecutionGraph dependentOps : streamOperation . getCombinableExecutionGraphs ( ) ) { TaskDescriptorChainBuilder builder = new TaskDescriptorChainBuilder ( executionName , dependentOps , executionConfig ) ; List < TaskDescriptor > dependentDescriptors = builder . build ( ) ; taskDescriptor . addDependentTasksChain ( dependentDescriptors ) ; } return taskDescriptor ; |
public class Slice { /** * Sets the specified 32 - bit integer at the specified absolute
* { @ code index } in this buffer .
* @ throws IndexOutOfBoundsException if the specified { @ code index } is less than { @ code 0 } or
* { @ code index + 4 } is greater than { @ code this . capacity } */
public void setInt ( int index , int value ) { } } | checkPositionIndexes ( index , index + SIZE_OF_INT , this . length ) ; index += offset ; data [ index ] = ( byte ) ( value ) ; data [ index + 1 ] = ( byte ) ( value >>> 8 ) ; data [ index + 2 ] = ( byte ) ( value >>> 16 ) ; data [ index + 3 ] = ( byte ) ( value >>> 24 ) ; |
public class DRL5Lexer { /** * $ ANTLR start " EQUALS _ ASSIGN " */
public final void mEQUALS_ASSIGN ( ) throws RecognitionException { } } | try { int _type = EQUALS_ASSIGN ; int _channel = DEFAULT_TOKEN_CHANNEL ; // src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 234:5 : ( ' = ' )
// src / main / resources / org / drools / compiler / lang / DRL5Lexer . g : 234:7 : ' = '
{ match ( '=' ) ; if ( state . failed ) return ; } state . type = _type ; state . channel = _channel ; } finally { // do for sure before leaving
} |
public class AbstractID { /** * Gets the bytes underlying this ID .
* @ return The bytes underlying this ID . */
public byte [ ] getBytes ( ) { } } | byte [ ] bytes = new byte [ SIZE ] ; longToByteArray ( lowerPart , bytes , 0 ) ; longToByteArray ( upperPart , bytes , SIZE_OF_LONG ) ; return bytes ; |
public class InternalSimpleAntlrParser { /** * InternalSimpleAntlr . g : 216:1 : entryRuleOptionValue returns [ EObject current = null ] : iv _ ruleOptionValue = ruleOptionValue EOF ; */
public final EObject entryRuleOptionValue ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleOptionValue = null ; try { // InternalSimpleAntlr . g : 217:2 : ( iv _ ruleOptionValue = ruleOptionValue EOF )
// InternalSimpleAntlr . g : 218:2 : iv _ ruleOptionValue = ruleOptionValue EOF
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getOptionValueRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleOptionValue = ruleOptionValue ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleOptionValue ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class AndroidOperationTube { /** * response notifier */
public void onOperationCompleted ( String clientId , String conversationId , int requestId , Conversation . AVIMOperation operation , Throwable throwable ) { } } | if ( AVIMOperation . CONVERSATION_QUERY == operation ) { AVCallback callback = RequestCache . getInstance ( ) . getRequestCallback ( clientId , null , requestId ) ; if ( null != callback ) { // internal query conversation .
callback . internalDone ( null , AVIMException . wrapperAVException ( throwable ) ) ; RequestCache . getInstance ( ) . cleanRequestCallback ( clientId , null , requestId ) ; return ; } } IntentUtil . sendIMLocalBroadcast ( clientId , conversationId , requestId , throwable , operation ) ; |
public class CmsShellCommands { /** * Prints the OpenCms copyright information . < p > */
public void copyright ( ) { } } | String [ ] copy = Messages . COPYRIGHT_BY_ALKACON ; for ( int i = 0 ; i < copy . length ; i ++ ) { m_shell . getOut ( ) . println ( copy [ i ] ) ; } |
public class HSQLDeleteOperation { /** * { @ inheritDoc } . Delete all data from all tables given by { @ link # getTableNames ( java . sql . Connection ) } .
* @ throws SQLException
* if a database access error occurs */
@ Override public void tearDownOperation ( ) throws SQLException { } } | Statement statement = null ; try { Connection connection = getConnection ( ) ; statement = connection . createStatement ( ) ; disableReferentialIntegrity ( statement ) ; List < String > tableNames = getTableNames ( getConnection ( ) ) ; deleteContent ( tableNames , statement ) ; } catch ( SQLException e ) { LOG . error ( e . getMessage ( ) , e ) ; try { rollback ( ) ; } catch ( SQLException e1 ) { LOG . error ( e1 . getMessage ( ) , e1 ) ; } } finally { try { enableReferentialIntegrity ( statement ) ; if ( statement != null ) { statement . close ( ) ; } commit ( ) ; closeConnection ( ) ; } catch ( Exception e ) { rollback ( ) ; LOG . error ( e . getMessage ( ) , e ) ; } } |
public class SimpleFormatter { /** * Creates a formatter from the pattern string .
* The number of arguments checked against the given limits is the
* highest argument number plus one , not the number of occurrences of arguments .
* @ param pattern The pattern string .
* @ param min The pattern must have at least this many arguments .
* @ param max The pattern must have at most this many arguments .
* @ return The new SimpleFormatter object .
* @ throws IllegalArgumentException for bad argument syntax and too few or too many arguments .
* @ hide draft / provisional / internal are hidden on Android */
public static SimpleFormatter compileMinMaxArguments ( CharSequence pattern , int min , int max ) { } } | StringBuilder sb = new StringBuilder ( ) ; String compiledPattern = SimpleFormatterImpl . compileToStringMinMaxArguments ( pattern , sb , min , max ) ; return new SimpleFormatter ( compiledPattern ) ; |
public class J4pClient { /** * Execute multiple requests at once . All given request will result in a single HTTP request where it gets
* dispatched on the agent side . The results are given back in the same order as the arguments provided .
* @ param pRequests requests to execute
* @ param pProcessingOptions processing options to use
* @ param < RESP > response type
* @ param < REQ > request type
* @ return list of responses , one response for each request
* @ throws J4pException when an communication error occurs */
public < RESP extends J4pResponse < REQ > , REQ extends J4pRequest > List < RESP > execute ( List < REQ > pRequests , Map < J4pQueryParameter , String > pProcessingOptions ) throws J4pException { } } | return execute ( pRequests , pProcessingOptions , responseExtractor ) ; |
public class KeyVaultClientBaseImpl { /** * Lists deleted secrets for the specified vault .
* The Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled for soft - delete . This operation requires the secrets / list permission .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; DeletedSecretItem & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < DeletedSecretItem > > > getDeletedSecretsNextSinglePageAsync ( final String nextPageLink ) { } } | if ( nextPageLink == null ) { throw new IllegalArgumentException ( "Parameter nextPageLink is required and cannot be null." ) ; } String nextUrl = String . format ( "%s" , nextPageLink ) ; return service . getDeletedSecretsNext ( nextUrl , this . acceptLanguage ( ) , this . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < DeletedSecretItem > > > > ( ) { @ Override public Observable < ServiceResponse < Page < DeletedSecretItem > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < DeletedSecretItem > > result = getDeletedSecretsNextDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < DeletedSecretItem > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class MultipleDataProviderContext { /** * Adds the specified rules to the validator under construction .
* @ param rules Rules to be added .
* @ param < RO > Type of rule output .
* @ return Context allowing further construction of the validator using the DSL . */
public < RO > SingleRuleContext < DPO , Collection < DPO > , RO > check ( Collection < Rule < Collection < DPO > , RO > > rules ) { } } | List < Rule < Collection < DPO > , RO > > addedRules = new ArrayList < Rule < Collection < DPO > , RO > > ( ) ; if ( rules != null ) { addedRules . addAll ( rules ) ; } // Change context
return new SingleRuleContext < DPO , Collection < DPO > , RO > ( addedTriggers , addedDataProviders , GeneralValidator . MappingStrategy . JOIN , null , addedRules ) ; |
public class JacksonHelper { /** * Navigate a chain of parametric types ( e . g . Resources & lt ; Resource & lt ; String & gt ; & gt ; ) until you find the innermost type ( String ) .
* @ param contentType
* @ return */
public static JavaType findRootType ( JavaType contentType ) { } } | if ( contentType . hasGenericTypes ( ) ) { return findRootType ( contentType . containedType ( 0 ) ) ; } else { return contentType ; } |
public class NessUUID { /** * FROM STRING */
public static UUID fromString ( String str ) { } } | try { int dashCount = 4 ; final int [ ] dashPos = new int [ 6 ] ; dashPos [ 0 ] = - 1 ; dashPos [ 5 ] = str . length ( ) ; for ( int i = str . length ( ) - 1 ; i >= 0 ; i -- ) { if ( str . charAt ( i ) == '-' ) { if ( dashCount == 0 ) { throw new IllegalArgumentException ( "Too many dashes (-)" ) ; } dashPos [ dashCount -- ] = i ; } } if ( dashCount > 0 ) { throw new IllegalArgumentException ( "Not enough dashes (-)" ) ; } long mostSigBits = decode ( str , dashPos , 0 ) & 0xffffffffL ; mostSigBits <<= 16 ; mostSigBits |= ( decode ( str , dashPos , 1 ) & 0xffffL ) ; mostSigBits <<= 16 ; mostSigBits |= ( decode ( str , dashPos , 2 ) & 0xffffL ) ; long leastSigBits = ( decode ( str , dashPos , 3 ) & 0xffffL ) ; leastSigBits <<= 48 ; leastSigBits |= ( decode ( str , dashPos , 4 ) & 0xffffffffffffL ) ; return new UUID ( mostSigBits , leastSigBits ) ; } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( "Invalid UUID string: " + str , e ) ; } |
public class TokenOrListParam { /** * Add a new token to this list
* @ param theSystem
* The system to use for the one token to pre - populate in this list */
public TokenOrListParam add ( String theSystem , String theValue ) { } } | add ( new TokenParam ( theSystem , theValue ) ) ; return this ; |
public class HeaderInterceptor { /** * Method called by framework , to enrich current request chain with requested header information .
* @ param chain the execution chain for the request .
* @ return the response received .
* @ throws IOException in case of failure down the line . */
@ Override public Response intercept ( Chain chain ) throws IOException { } } | final Request request = chain . request ( ) ; return chain . proceed ( request . newBuilder ( ) . addHeader ( name , value ) . build ( ) ) ; |
public class UnitUtil { /** * Multiply { @ code size } by { @ code factor } accounting for overflow . */
static long multiply ( long size , long factor , long over ) { } } | if ( size > over ) { return Long . MAX_VALUE ; } if ( size < - over ) { return Long . MIN_VALUE ; } return size * factor ; |
public class sent_sms { /** * < pre >
* Use this operation to get sent sms details . .
* < / pre > */
public static sent_sms [ ] get ( nitro_service client ) throws Exception { } } | sent_sms resource = new sent_sms ( ) ; resource . validate ( "get" ) ; return ( sent_sms [ ] ) resource . get_resources ( client ) ; |
public class Function { /** * Calls { @ link # bindAndInvoke ( Object , StaplerRequest , StaplerResponse , Object . . . ) } and then
* optionally serve the response object .
* @ return
* true if the request was dispatched and processed . false if the dispatch was cancelled
* and the search for the next request handler should continue . An exception is thrown
* if the request was dispatched but the processing failed . */
boolean bindAndInvokeAndServeResponse ( Object node , RequestImpl req , ResponseImpl rsp , Object ... headArgs ) throws IllegalAccessException , InvocationTargetException , ServletException , IOException { } } | try { Object r = bindAndInvoke ( node , req , rsp , headArgs ) ; if ( getReturnType ( ) != void . class ) renderResponse ( req , rsp , node , r ) ; return true ; } catch ( CancelRequestHandlingException _ ) { return false ; } catch ( InvocationTargetException e ) { // exception as an HttpResponse
Throwable te = e . getTargetException ( ) ; if ( te instanceof CancelRequestHandlingException ) return false ; if ( renderResponse ( req , rsp , node , te ) ) return true ; // exception rendered the response
throw e ; // unprocessed exception
} |
public class ActiveStatusCode { /** * Infer the correct active status code given what dates are available and
* whether or not the encounter information is finalized .
* @ param bFinal < code > true < / code > if the visit information is finalized
* according to the EHR , < code > false < / code > if not . This parameter is
* ignored if the visit has neither a start date nor an end date .
* @ param startDate the start date of the visit . May be < code > null < / code > .
* @ param endDate the end date of the visit . May be < code > null < / code > .
* @ return the appropriate active status code . */
public static String getInstance ( Date startDate , Granularity startGran , Date endDate , Granularity endGran ) { } } | ActiveStatusCodeStartDate codeStartDate ; if ( startDate == null ) { codeStartDate = ActiveStatusCodeStartDate . UNKNOWN ; } else if ( startGran == AbsoluteTimeGranularity . YEAR ) { codeStartDate = ActiveStatusCodeStartDate . YEAR ; } else if ( startGran == AbsoluteTimeGranularity . MONTH ) { codeStartDate = ActiveStatusCodeStartDate . MONTH ; } else if ( startGran == AbsoluteTimeGranularity . DAY ) { codeStartDate = ActiveStatusCodeStartDate . DAY ; } else if ( startGran == AbsoluteTimeGranularity . HOUR ) { codeStartDate = ActiveStatusCodeStartDate . HOUR ; } else if ( startGran == AbsoluteTimeGranularity . MINUTE ) { codeStartDate = ActiveStatusCodeStartDate . MINUTE ; } else if ( startGran == AbsoluteTimeGranularity . SECOND ) { codeStartDate = ActiveStatusCodeStartDate . SECOND ; } else { codeStartDate = ActiveStatusCodeStartDate . NULL ; } ActiveStatusCodeEndDate codeEndDate ; if ( startDate == null ) { codeEndDate = ActiveStatusCodeEndDate . UNKNOWN ; } else if ( startGran == AbsoluteTimeGranularity . YEAR ) { codeEndDate = ActiveStatusCodeEndDate . YEAR ; } else if ( startGran == AbsoluteTimeGranularity . MONTH ) { codeEndDate = ActiveStatusCodeEndDate . MONTH ; } else if ( startGran == AbsoluteTimeGranularity . DAY ) { codeEndDate = ActiveStatusCodeEndDate . DAY ; } else if ( startGran == AbsoluteTimeGranularity . HOUR ) { codeEndDate = ActiveStatusCodeEndDate . HOUR ; } else if ( startGran == AbsoluteTimeGranularity . MINUTE ) { codeEndDate = ActiveStatusCodeEndDate . MINUTE ; } else if ( startGran == AbsoluteTimeGranularity . SECOND ) { codeEndDate = ActiveStatusCodeEndDate . SECOND ; } else { codeEndDate = ActiveStatusCodeEndDate . NULL ; } return codeEndDate . getCode ( ) + codeStartDate . getCode ( ) ; |
public class Xsd2CobolTypesModelBuilder { /** * Retrieve the maxLength facet if it exists .
* @ param facets the list of facets
* @ return the maxlength value or - 1 if there are no maxLength facets */
private int getMaxLength ( List < XmlSchemaFacet > facets ) { } } | for ( XmlSchemaFacet facet : facets ) { if ( facet instanceof XmlSchemaMaxLengthFacet ) { return Integer . parseInt ( ( String ) ( ( XmlSchemaMaxLengthFacet ) facet ) . getValue ( ) ) ; } } return - 1 ; |
public class VdmBreakpointManager { private int classifyBreakpointChange ( IMarkerDelta delta , IVdmBreakpoint breakpoint , String attr ) throws CoreException { } } | final boolean conditional = VdmBreakpointUtils . isConditional ( breakpoint ) ; if ( conditional && AbstractVdmBreakpoint . EXPRESSION . equals ( attr ) ) { return MAJOR_CHANGE ; } final boolean oldExprState = delta . getAttribute ( AbstractVdmBreakpoint . EXPRESSION_STATE , false ) ; final String oldExpr = delta . getAttribute ( AbstractVdmBreakpoint . EXPRESSION , null ) ; if ( VdmBreakpointUtils . isConditional ( oldExprState , oldExpr ) != conditional ) { return MAJOR_CHANGE ; } if ( IMarker . LINE_NUMBER . equals ( attr ) && ! target . getOptions ( ) . get ( DebugOption . DBGP_BREAKPOINT_UPDATE_LINE_NUMBER ) ) { return MAJOR_CHANGE ; } return MINOR_CHANGE ; |
public class PrimaveraPMFileWriter { /** * Populate a sorted list of custom fields to ensure that these fields
* are written to the file in a consistent order . */
private void populateSortedCustomFieldsList ( ) { } } | m_sortedCustomFieldsList = new ArrayList < CustomField > ( ) ; for ( CustomField field : m_projectFile . getCustomFields ( ) ) { FieldType fieldType = field . getFieldType ( ) ; if ( fieldType != null ) { m_sortedCustomFieldsList . add ( field ) ; } } // Sort to ensure consistent order in file
Collections . sort ( m_sortedCustomFieldsList , new Comparator < CustomField > ( ) { @ Override public int compare ( CustomField customField1 , CustomField customField2 ) { FieldType o1 = customField1 . getFieldType ( ) ; FieldType o2 = customField2 . getFieldType ( ) ; String name1 = o1 . getClass ( ) . getSimpleName ( ) + "." + o1 . getName ( ) + " " + customField1 . getAlias ( ) ; String name2 = o2 . getClass ( ) . getSimpleName ( ) + "." + o2 . getName ( ) + " " + customField2 . getAlias ( ) ; return name1 . compareTo ( name2 ) ; } } ) ; |
public class ImageGL { /** * Creates and populates a texture for use as our power - of - two texture . This is used when our
* main image data is already power - of - two - sized . */
protected int createPow2RepTex ( int width , int height , boolean repeatX , boolean repeatY , boolean mipmapped ) { } } | int powtex = ctx . createTexture ( width , height , repeatX , repeatY , mipmapped ) ; updateTexture ( powtex ) ; return powtex ; |
public class SelectContext { /** * Selects an option by its text .
* @ param text The text of the option that shall be selected .
* @ return A { @ link de . codecentric . zucchini . web . steps . SelectStep } that selects an option by its text . */
public SelectStep text ( String text ) { } } | return new SelectStep ( element , text , SelectStep . OptionSelectorType . TEXT ) ; |
public class WaveformGenerator { /** * Triangle : The upper 12 bits of the accumulator are used . The MSB is used
* to create the falling edge of the triangle by inverting the lower 11
* bits . The MSB is thrown away and the lower 11 bits are left - shifted ( half
* the resolution , full amplitude ) . Ring modulation substitutes the MSB with
* MSB EOR sync _ source MSB .
* @ return triangle */
protected int /* reg12 */
output___T ( ) { } } | int /* reg24 */
msb = ( ( ring_mod != 0 ) ? accumulator ^ sync_source . accumulator : accumulator ) & 0x800000 ; return ( ( ( msb != 0 ) ? ~ accumulator : accumulator ) >> 11 ) & 0xfff ; |
public class ClusterLabeledImage { /** * Examines pixels along the left and right border */
protected void connectLeftRight ( GrayS32 input , GrayS32 output ) { } } | for ( int y = 0 ; y < input . height ; y ++ ) { int x = input . width - 1 ; int inputLabel = input . unsafe_get ( x , y ) ; int outputLabel = output . unsafe_get ( x , y ) ; if ( outputLabel == - 1 ) { // see if it needs to create a new output segment
outputLabel = regionMemberCount . size ; output . unsafe_set ( x , y , outputLabel ) ; regionMemberCount . add ( 1 ) ; mergeList . add ( outputLabel ) ; } // check right first
for ( int i = 0 ; i < edges . length ; i ++ ) { Point2D_I32 offset = edges [ i ] ; // make sure it is inside the image
if ( ! input . isInBounds ( x + offset . x , y + offset . y ) ) continue ; if ( inputLabel == input . unsafe_get ( x + offset . x , y + offset . y ) ) { int outputAdj = output . unsafe_get ( x + offset . x , y + offset . y ) ; if ( outputAdj == - 1 ) { // see if not assigned
regionMemberCount . data [ outputLabel ] ++ ; output . unsafe_set ( x + offset . x , y + offset . y , outputLabel ) ; } else if ( outputLabel != outputAdj ) { // see if assigned to different regions
markMerge ( outputLabel , outputAdj ) ; } // do nothing , same input and output labels
} } // skip check of left of 4 - connect
if ( connectRule != ConnectRule . EIGHT ) continue ; x = 0 ; inputLabel = input . unsafe_get ( x , y ) ; outputLabel = output . unsafe_get ( x , y ) ; if ( outputLabel == - 1 ) { // see if it needs to create a new output segment
outputLabel = regionMemberCount . size ; output . unsafe_set ( x , y , outputLabel ) ; regionMemberCount . add ( 1 ) ; mergeList . add ( outputLabel ) ; } for ( int i = 0 ; i < edges . length ; i ++ ) { Point2D_I32 offset = edges [ i ] ; // make sure it is inside the image
if ( ! input . isInBounds ( x + offset . x , y + offset . y ) ) continue ; if ( inputLabel == input . unsafe_get ( x + offset . x , y + offset . y ) ) { int outputAdj = output . unsafe_get ( x + offset . x , y + offset . y ) ; if ( outputAdj == - 1 ) { // see if not assigned
regionMemberCount . data [ outputLabel ] ++ ; output . unsafe_set ( x + offset . x , y + offset . y , outputLabel ) ; } else if ( outputLabel != outputAdj ) { // see if assigned to different regions
markMerge ( outputLabel , outputAdj ) ; } // do nothing , same input and output labels
} } } |
public class GraphicsUtilities { /** * < p > Returns a new compatible image from a URL . The image is loaded from the
* specified location and then turned , if necessary into a compatible
* image . < / p >
* @ see # createCompatibleImage ( java . awt . image . BufferedImage )
* @ see # createCompatibleImage ( java . awt . image . BufferedImage , int , int )
* @ see # createCompatibleImage ( int , int )
* @ see # createCompatibleTranslucentImage ( int , int )
* @ see # toCompatibleImage ( java . awt . image . BufferedImage )
* @ param resource the URL of the picture to load as a compatible image
* @ return a new translucent compatible < code > BufferedImage < / code > of the
* specified width and height
* @ throws java . io . IOException if the image cannot be read or loaded */
public static BufferedImage loadCompatibleImage ( URL resource ) throws IOException { } } | BufferedImage image = ImageIO . read ( resource ) ; return toCompatibleImage ( image ) ; |
public class PolygonHoleMarkers { /** * { @ inheritDoc } */
@ Override public void setVisibleMarkers ( boolean visible ) { } } | for ( Marker marker : markers ) { if ( visible ) marker . setAlpha ( 1f ) ; else marker . setAlpha ( 0f ) ; } |
public class WaveData { /** * Creates a WaveData container from the specified ByetBuffer .
* If the buffer is backed by an array , it will be used directly ,
* else the contents of the buffer will be copied using get ( byte [ ] ) .
* @ param buffer ByteBuffer containing sound file
* @ return WaveData containing data , or null if a failure occured */
public static WaveData create ( ByteBuffer buffer ) { } } | try { byte [ ] bytes = null ; if ( buffer . hasArray ( ) ) { bytes = buffer . array ( ) ; } else { bytes = new byte [ buffer . capacity ( ) ] ; buffer . get ( bytes ) ; } return create ( bytes ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } |
public class DRL6Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 775:1 : int _ key : { . . . } ? = > id = ID ; */
public final void int_key ( ) throws RecognitionException { } } | Token id = null ; try { // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 776:5 : ( { . . . } ? = > id = ID )
// src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 776:12 : { . . . } ? = > id = ID
{ if ( ! ( ( ( helper . validateIdentifierKey ( DroolsSoftKeywords . INT ) ) ) ) ) { if ( state . backtracking > 0 ) { state . failed = true ; return ; } throw new FailedPredicateException ( input , "int_key" , "(helper.validateIdentifierKey(DroolsSoftKeywords.INT))" ) ; } id = ( Token ) match ( input , ID , FOLLOW_ID_in_int_key4940 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { helper . emit ( id , DroolsEditorType . KEYWORD ) ; } } } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving
} |
public class JenkinsController { /** * Gets the configuration descriptors */
@ RequestMapping ( value = "configurations/descriptors" , method = RequestMethod . GET ) public Resources < ConfigurationDescriptor > getConfigurationsDescriptors ( ) { } } | return Resources . of ( jenkinsService . getConfigurationDescriptors ( ) , uri ( on ( getClass ( ) ) . getConfigurationsDescriptors ( ) ) ) ; |
public class EmbeddedNeo4jEntityQueries { /** * When the id is mapped with a single property */
private ResourceIterator < Node > singlePropertyIdFindEntities ( GraphDatabaseService executionEngine , EntityKey [ ] keys ) { } } | Object [ ] paramsValues = new Object [ keys . length ] ; for ( int i = 0 ; i < keys . length ; i ++ ) { paramsValues [ i ] = keys [ i ] . getColumnValues ( ) [ 0 ] ; } Map < String , Object > params = Collections . singletonMap ( "0" , ( Object ) paramsValues ) ; Result result = executionEngine . execute ( multiGetQuery , params ) ; return result . columnAs ( ENTITY_ALIAS ) ; |
public class UserDAOPgSQL { /** * { @ inheritDoc }
* 安全考虑 , 返回 User 的 password 属性为 null 。 < / p > */
public User get ( Connection conn , String loginname , String cryptpassword ) throws SQLException { } } | ResultSetHandler < User > h = new BeanHandler < User > ( User . class ) ; String sql = "SELECT id,username,fullname,type,emailaddress,registered_ts,invited_by,enabled \n" + "FROM userbase \n" ; if ( loginname . indexOf ( "@" ) < 0 ) sql = sql + "WHERE username=? AND password=? and enabled=true" ; else sql = sql + "WHERE emailaddress=? AND password=? and enabled=true" ; return run . query ( conn , sql , h , loginname , cryptpassword ) ; |
public class StatefulBeanO { /** * Removes the servant routing affinity for this bean . This method should
* only be called on z / OS .
* @ return < tt > false < / tt > if removal fails , or < tt > true < / tt > otherwise */
private boolean removeServantRoutingAffinity ( ) { } } | if ( ivServantRoutingAffinity ) { StatefulSessionKey sskey = ( StatefulSessionKey ) beanId . getPrimaryKey ( ) ; byte [ ] pKeyBytes = sskey . getBytes ( ) ; int retcode = container . ivStatefulBeanEnqDeq . SSBeanDeq ( pKeyBytes , ! home . beanMetaData . sessionActivateTran , true ) ; if ( retcode != 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "Could not DEQ session bean with key = " + sskey ) ; return false ; } ivServantRoutingAffinity = false ; } return true ; |
public class PathValueClient { /** * Remove any overrides for an endpoint
* @ param pathValue path ( endpoint ) value
* @ param requestType path request type . " GET " , " POST " , etc
* @ return true if success , false otherwise */
public boolean removeCustomResponse ( String pathValue , String requestType ) { } } | try { JSONObject path = getPathFromEndpoint ( pathValue , requestType ) ; if ( path == null ) { return false ; } String pathId = path . getString ( "pathId" ) ; return resetResponseOverride ( pathId ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return false ; |
public class InternalUtilities { /** * Return the host from the host array based on a random fashion
* @ param hosts a WritableArray of host names
* @ return the host name
* @ throws IOException */
public static String getHost ( TextArrayWritable hosts ) throws IOException { } } | String [ ] hostStrings = hosts . toStrings ( ) ; if ( hostStrings == null || hostStrings . length == 0 ) throw new IOException ( "Number of forests is 0: " + "check forests in database" ) ; int count = hostStrings . length ; int position = ( int ) ( Math . random ( ) * count ) ; return hostStrings [ position ] ; |
public class AbstractSubCodeBuilderFragment { /** * Replies the type for the factory for the given type .
* @ param type the type of the object to create .
* @ return the factory . */
@ Pure protected TypeReference getXFactoryFor ( TypeReference type ) { } } | final String packageName = type . getPackageName ( ) ; final Grammar grammar = getGrammar ( ) ; TypeReference reference = getXFactoryFor ( packageName , grammar ) ; if ( reference != null ) { return reference ; } for ( final Grammar usedGrammar : GrammarUtil . allUsedGrammars ( grammar ) ) { reference = getXFactoryFor ( packageName , usedGrammar ) ; if ( reference != null ) { return reference ; } } throw new IllegalStateException ( "Cannot find the XFactory for " + type ) ; // $ NON - NLS - 1 $ |
public class HttpMediaType { /** * Sets the sub media type , for example { @ code " plain " } when using { @ code " text " } .
* @ param subType sub media type */
public HttpMediaType setSubType ( String subType ) { } } | Preconditions . checkArgument ( TYPE_REGEX . matcher ( subType ) . matches ( ) , "Subtype contains reserved characters" ) ; this . subType = subType ; cachedBuildResult = null ; return this ; |
public class Timeouts { /** * Add a cache entry .
* @ param hashEntryAdr address of the cache entry
* @ param expireAt absolute expiration timestamp */
void add ( long hashEntryAdr , long expireAt ) { } } | // just ignore the fact that expireAt can be less than current time
int slotNum = slot ( expireAt ) ; slots [ slotNum ] . add ( hashEntryAdr , expireAt ) ; |
public class SMILESReader { /** * Private method that actually parses the input to read a ChemFile
* object .
* @ param som The set of molecules that came from the file
* @ return A ChemFile containing the data parsed from input . */
private IAtomContainerSet readAtomContainerSet ( IAtomContainerSet som ) { } } | try { String line = input . readLine ( ) . trim ( ) ; while ( line != null ) { logger . debug ( "Line: " , line ) ; final String name = suffix ( line ) ; try { IAtomContainer molecule = sp . parseSmiles ( line ) ; molecule . setProperty ( "SMIdbNAME" , name ) ; som . addAtomContainer ( molecule ) ; } catch ( CDKException exception ) { logger . warn ( "This SMILES could not be parsed: " , line ) ; logger . warn ( "Because of: " , exception . getMessage ( ) ) ; logger . debug ( exception ) ; IAtomContainer empty = som . getBuilder ( ) . newInstance ( IAtomContainer . class , 0 , 0 , 0 , 0 ) ; empty . setProperty ( IteratingSMILESReader . BAD_SMILES_INPUT , line ) ; som . addAtomContainer ( empty ) ; } if ( input . ready ( ) ) { line = input . readLine ( ) ; } else { line = null ; } } } catch ( Exception exception ) { logger . error ( "Error while reading SMILES line: " , exception . getMessage ( ) ) ; logger . debug ( exception ) ; } return som ; |
public class Relation { /** * Returns an unmodifiable wrapper backed by the given relation
* < code > rel < / code > . This allows " read - only " access , although
* changes in the backing collection show up in this view .
* Attempts to modify the relation will fail with { @ link
* UnsupportedOperationException } . */
public static < K , V > Relation < K , V > unmodifiableRelation ( final Relation < K , V > rel ) { } } | return new UnmodifiableRelation < K , V > ( rel ) ; |
public class MemRepository { /** * - Id must be valid ; Class must be valid .
* - Ask ClassStore to createInstance .
* - Ask ClassStore to load instance .
* - load instance traits
* - add to GraphWalker */
ITypedReferenceableInstance getDuringWalk ( Id id , ObjectGraphWalker walker ) throws RepositoryException { } } | ClassStore cS = getClassStore ( id . getTypeName ( ) ) ; if ( cS == null ) { throw new RepositoryException ( String . format ( "Unknown Class %s" , id . getTypeName ( ) ) ) ; } cS . validate ( this , id ) ; ReferenceableInstance r = cS . createInstance ( this , id ) ; cS . load ( r ) ; for ( String traitName : r . getTraits ( ) ) { HierarchicalTypeStore tt = typeStores . get ( traitName ) ; tt . load ( r ) ; } walker . addRoot ( r ) ; return r ; |
public class TimeSlot { /** * Add a timer item .
* @ param addItem
* @ param curTime */
public void addEntry ( TimerWorkItem addItem , long curTime ) { } } | // this routine assumes the slot is not full
this . mostRecentlyAccessedTime = curTime ; this . lastEntryIndex ++ ; this . entries [ lastEntryIndex ] = addItem ; |
public class IfcCostScheduleImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < IfcActorSelect > getTargetUsers ( ) { } } | return ( EList < IfcActorSelect > ) eGet ( Ifc2x3tc1Package . Literals . IFC_COST_SCHEDULE__TARGET_USERS , true ) ; |
public class AstNode { /** * evaluate and return the ( optionally coerced ) result . */
public final Object getValue ( Bindings bindings , ELContext context , Class < ? > type ) { } } | Object value = eval ( bindings , context ) ; if ( type != null ) { value = bindings . convert ( value , type ) ; } return value ; |
public class CmsContainerpageController { /** * Updates the container level info on the present containers . < p > */
private void updateContainerLevelInfo ( ) { } } | Map < String , CmsContainerPageContainer > containers = new HashMap < String , CmsContainerPageContainer > ( ) ; List < CmsContainerPageContainer > temp = new ArrayList < CmsContainerPageContainer > ( m_targetContainers . values ( ) ) ; m_maxContainerLevel = 0 ; boolean progress = true ; while ( ! temp . isEmpty ( ) && progress ) { int size = containers . size ( ) ; Iterator < CmsContainerPageContainer > it = temp . iterator ( ) ; while ( it . hasNext ( ) ) { CmsContainerPageContainer container = it . next ( ) ; int level = - 1 ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( container . getParentContainerId ( ) ) ) { level = 0 ; } else if ( containers . containsKey ( container . getParentContainerId ( ) ) ) { level = containers . get ( container . getParentContainerId ( ) ) . getContainerLevel ( ) + 1 ; } if ( level > - 1 ) { container . setContainerLevel ( level ) ; containers . put ( container . getContainerId ( ) , container ) ; it . remove ( ) ; if ( level > m_maxContainerLevel ) { m_maxContainerLevel = level ; } } } progress = containers . size ( ) > size ; } |
public class CmsContainerpageController { /** * Returns the server id for a given client element id . < p >
* @ param clientId the client id including an optional element settings hash
* @ return the server id */
public static String getServerId ( String clientId ) { } } | String serverId = clientId ; if ( clientId . contains ( CLIENT_ID_SEPERATOR ) ) { serverId = clientId . substring ( 0 , clientId . lastIndexOf ( CLIENT_ID_SEPERATOR ) ) ; } return serverId ; |
public class GitManager { /** * Returns a List of Pair < key , value > which contains the git credentials to use .
* Key - url to repository
* Value - StandardCredentials , containing username and password */
private List < Pair < String , StandardCredentials > > getGitClientCredentials ( ) { } } | List < Pair < String , StandardCredentials > > credentialsList = new ArrayList < > ( ) ; GitSCM gitScm = getJenkinsScm ( ) ; for ( UserRemoteConfig uc : gitScm . getUserRemoteConfigs ( ) ) { String url = uc . getUrl ( ) ; // In case overriding credentials are defined , we will use it for this URL
if ( this . credentials != null ) { credentialsList . add ( Pair . of ( url , this . credentials ) ) ; continue ; } // Get credentials from jenkins credentials plugin
if ( uc . getCredentialsId ( ) != null ) { StandardUsernameCredentials credentials = CredentialsMatchers . firstOrNull ( CredentialsProvider . lookupCredentials ( StandardUsernameCredentials . class , build . getProject ( ) , ACL . SYSTEM , URIRequirementBuilder . fromUri ( url ) . build ( ) ) , CredentialsMatchers . allOf ( CredentialsMatchers . withId ( uc . getCredentialsId ( ) ) , GitClient . CREDENTIALS_MATCHER ) ) ; if ( credentials != null ) { credentialsList . add ( Pair . of ( url , ( StandardCredentials ) credentials ) ) ; } } } return credentialsList ; |
public class SLF4JLoggerFactory { /** * Pobiera loggera SLF4J niezależnego od lokalizacji dla określonej klasy . */
public static < T , E extends I18nId > SLF4JLogger < T , ? , E > getLogger ( Class < T > clazz , Class < ? > caller ) { } } | org . slf4j . Logger logger = LoggerFactory . getLogger ( clazz ) ; if ( logger instanceof LocationAwareLogger ) { return new SLF4JCallerLocationAwareLogger < T , E > ( ( LocationAwareLogger ) logger , caller ) ; } else { return new SLF4JLogger < T , org . slf4j . Logger , E > ( logger ) ; } |
public class RuntimeModelIo { /** * Loads an application from a directory .
* The directory structure must be the following one :
* < ul >
* < li > descriptor < / li >
* < li > graph < / li >
* < li > instances ( optional ) < / li >
* < / ul >
* @ param projectDirectory the project directory
* @ return a load result ( never null ) */
public static ApplicationLoadResult loadApplication ( File projectDirectory ) { } } | ApplicationLoadResult result = new ApplicationLoadResult ( ) ; ApplicationTemplate app = new ApplicationTemplate ( ) ; result . applicationTemplate = app ; ApplicationTemplateDescriptor appDescriptor = null ; File descDirectory = new File ( projectDirectory , Constants . PROJECT_DIR_DESC ) ; // Read the application descriptor
DESC : if ( ! descDirectory . exists ( ) ) { RoboconfError error = new RoboconfError ( ErrorCode . PROJ_NO_DESC_DIR , directory ( projectDirectory ) ) ; result . loadErrors . add ( error ) ; } else { File descriptorFile = new File ( descDirectory , Constants . PROJECT_FILE_DESCRIPTOR ) ; if ( ! descriptorFile . exists ( ) ) { result . loadErrors . add ( new RoboconfError ( ErrorCode . PROJ_NO_DESC_FILE ) ) ; break DESC ; } try { // Prepare the application
appDescriptor = ApplicationTemplateDescriptor . load ( descriptorFile ) ; app . setName ( appDescriptor . getName ( ) ) ; app . setDescription ( appDescriptor . getDescription ( ) ) ; app . setVersion ( appDescriptor . getVersion ( ) ) ; app . setDslId ( appDescriptor . getDslId ( ) ) ; app . setExternalExportsPrefix ( appDescriptor . getExternalExportsPrefix ( ) ) ; app . setTags ( appDescriptor . tags ) ; for ( Map . Entry < String , String > entry : appDescriptor . externalExports . entrySet ( ) ) app . externalExports . put ( entry . getKey ( ) , app . getExternalExportsPrefix ( ) + "." + entry . getValue ( ) ) ; // Update the parsing context so that we can resolve errors locations
result . objectToSource . put ( appDescriptor , new SourceReference ( appDescriptor , descriptorFile , 1 ) ) ; for ( Map . Entry < String , Integer > entry : appDescriptor . propertyToLine . entrySet ( ) ) { result . objectToSource . put ( entry . getKey ( ) , new SourceReference ( entry . getKey ( ) , descriptorFile , entry . getValue ( ) ) ) ; } // Resolve errors locations
Collection < ModelError > errors = RuntimeModelValidator . validate ( appDescriptor ) ; result . loadErrors . addAll ( errors ) ; } catch ( IOException e ) { RoboconfError error = new RoboconfError ( ErrorCode . PROJ_READ_DESC_FILE , exception ( e ) ) ; result . loadErrors . add ( error ) ; } } return loadApplication ( projectDirectory , appDescriptor , result ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.