signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class LoadAndDisplayImageTask { /** * Decodes image file into Bitmap , resize it and save it back */
private boolean resizeAndSaveImage ( int maxWidth , int maxHeight ) throws IOException { } } | // Decode image file , compress and re - save it
boolean saved = false ; File targetFile = configuration . diskCache . get ( uri ) ; if ( targetFile != null && targetFile . exists ( ) ) { ImageSize targetImageSize = new ImageSize ( maxWidth , maxHeight ) ; DisplayImageOptions specialOptions = new DisplayImageOptions . Builder ( ) . cloneFrom ( options ) . imageScaleType ( ImageScaleType . IN_SAMPLE_INT ) . build ( ) ; ImageDecodingInfo decodingInfo = new ImageDecodingInfo ( memoryCacheKey , Scheme . FILE . wrap ( targetFile . getAbsolutePath ( ) ) , uri , targetImageSize , ViewScaleType . FIT_INSIDE , getDownloader ( ) , specialOptions ) ; Bitmap bmp = decoder . decode ( decodingInfo ) ; if ( bmp != null && configuration . processorForDiskCache != null ) { L . d ( LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK , memoryCacheKey ) ; bmp = configuration . processorForDiskCache . process ( bmp ) ; if ( bmp == null ) { L . e ( ERROR_PROCESSOR_FOR_DISK_CACHE_NULL , memoryCacheKey ) ; } } if ( bmp != null ) { saved = configuration . diskCache . save ( uri , bmp ) ; bmp . recycle ( ) ; } } return saved ; |
public class HttpSocketClient { /** * Asynchronously connects . */
public void connect ( final String endpoint , final Callback < ? super HttpSocket > onConnect , final Callback < ? super Exception > onError ) { } } | executors . getUnbounded ( ) . submit ( new Runnable ( ) { @ Override public void run ( ) { try { // Build request bytes
AoByteArrayOutputStream bout = new AoByteArrayOutputStream ( ) ; try { try ( DataOutputStream out = new DataOutputStream ( bout ) ) { out . writeBytes ( "action=connect" ) ; } } finally { bout . close ( ) ; } long connectTime = System . currentTimeMillis ( ) ; URL endpointURL = new URL ( endpoint ) ; HttpURLConnection conn = ( HttpURLConnection ) endpointURL . openConnection ( ) ; conn . setAllowUserInteraction ( false ) ; conn . setConnectTimeout ( CONNECT_TIMEOUT ) ; conn . setDoOutput ( true ) ; conn . setFixedLengthStreamingMode ( bout . size ( ) ) ; conn . setInstanceFollowRedirects ( false ) ; conn . setReadTimeout ( CONNECT_TIMEOUT ) ; conn . setRequestMethod ( "POST" ) ; conn . setUseCaches ( false ) ; // Write request
OutputStream out = conn . getOutputStream ( ) ; try { out . write ( bout . getInternalByteArray ( ) , 0 , bout . size ( ) ) ; out . flush ( ) ; } finally { out . close ( ) ; } // Get response
int responseCode = conn . getResponseCode ( ) ; if ( responseCode != 200 ) throw new IOException ( "Unexpect response code: " + responseCode ) ; if ( DEBUG ) System . out . println ( "DEBUG: HttpSocketClient: connect: got connection" ) ; DocumentBuilder builder = builderFactory . newDocumentBuilder ( ) ; Element document = builder . parse ( conn . getInputStream ( ) ) . getDocumentElement ( ) ; if ( ! "connection" . equals ( document . getNodeName ( ) ) ) throw new IOException ( "Unexpected root node name: " + document . getNodeName ( ) ) ; Identifier id = Identifier . valueOf ( document . getAttribute ( "id" ) ) ; if ( DEBUG ) System . out . println ( "DEBUG: HttpSocketClient: connect: got id=" + id ) ; HttpSocket httpSocket = new HttpSocket ( HttpSocketClient . this , id , connectTime , endpointURL ) ; if ( DEBUG ) System . out . println ( "DEBUG: HttpSocketClient: connect: adding socket" ) ; addSocket ( httpSocket ) ; if ( onConnect != null ) { if ( DEBUG ) System . out . println ( "DEBUG: HttpSocketClient: connect: calling onConnect" ) ; onConnect . call ( httpSocket ) ; } } catch ( Exception exc ) { if ( onError != null ) { if ( DEBUG ) System . out . println ( "DEBUG: HttpSocketClient: connect: calling onError" ) ; onError . call ( exc ) ; } } } } ) ; |
public class GetTypedLinkFacetInformationRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetTypedLinkFacetInformationRequest getTypedLinkFacetInformationRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getTypedLinkFacetInformationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getTypedLinkFacetInformationRequest . getSchemaArn ( ) , SCHEMAARN_BINDING ) ; protocolMarshaller . marshall ( getTypedLinkFacetInformationRequest . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class LRUMap { /** * Creates a new LRU Map .
* @ param < K > the key type
* @ param < V > the value type
* @ return the map */
public static < K , V > LRUMap < K , V > create ( int maxSize ) { } } | Preconditions . checkArgument ( maxSize > 0 , "Max size must be greater than zero." ) ; return new LRUMap < > ( maxSize ) ; |
public class AccessControlList { /** * Gives all the permission entries
* @ return a safe copy of all the permission entries */
public List < AccessControlEntry > getPermissionEntries ( ) { } } | List < AccessControlEntry > list = new ArrayList < AccessControlEntry > ( ) ; for ( int i = 0 , length = accessList . size ( ) ; i < length ; i ++ ) { AccessControlEntry entry = accessList . get ( i ) ; list . add ( new AccessControlEntry ( entry . getIdentity ( ) , entry . getPermission ( ) ) ) ; } return list ; |
public class ControlCurve { /** * add a control point , return index of new control point */
public double addPoint ( double x , double y ) { } } | pts . add ( new Coordinate ( x , y ) ) ; return selection = pts . size ( ) - 1 ; |
public class StatementBuilder { /** * Build and return a string version of the query . If you change the where or make other calls you will need to
* re - call this method to re - prepare the query for execution . */
public String prepareStatementString ( ) throws SQLException { } } | List < ArgumentHolder > argList = new ArrayList < ArgumentHolder > ( ) ; return buildStatementString ( argList ) ; |
public class XInstanceOfExpressionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case XbasePackage . XINSTANCE_OF_EXPRESSION__TYPE : setType ( ( JvmTypeReference ) newValue ) ; return ; case XbasePackage . XINSTANCE_OF_EXPRESSION__EXPRESSION : setExpression ( ( XExpression ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class RBBIRuleScanner { void nextChar ( RBBIRuleChar c ) { } } | // Unicode Character constants needed for the processing done by nextChar ( ) ,
// in hex because literals wont work on EBCDIC machines .
fScanIndex = fNextIndex ; c . fChar = nextCharLL ( ) ; c . fEscaped = false ; // check for ' ' sequence .
// These are recognized in all contexts , whether in quoted text or not .
if ( c . fChar == '\'' ) { if ( UTF16 . charAt ( fRB . fRules , fNextIndex ) == '\'' ) { c . fChar = nextCharLL ( ) ; // get nextChar officially so character counts
c . fEscaped = true ; // stay correct .
} else { // Single quote , by itself .
// Toggle quoting mode .
// Return either ' ( ' or ' ) ' , because quotes cause a grouping of the quoted text .
fQuoteMode = ! fQuoteMode ; if ( fQuoteMode == true ) { c . fChar = '(' ; } else { c . fChar = ')' ; } c . fEscaped = false ; // The paren that we return is not escaped .
return ; } } if ( fQuoteMode ) { c . fEscaped = true ; } else { // We are not in a ' quoted region ' of the source .
if ( c . fChar == '#' ) { // Start of a comment . Consume the rest of it .
// The new - line char that terminates the comment is always returned .
// It will be treated as white - space , and serves to break up anything
// that might otherwise incorrectly clump together with a comment in
// the middle ( a variable name , for example . )
for ( ; ; ) { c . fChar = nextCharLL ( ) ; if ( c . fChar == - 1 || // EOF
c . fChar == '\r' || c . fChar == '\n' || c . fChar == chNEL || c . fChar == chLS ) { break ; } } } if ( c . fChar == - 1 ) { return ; } // check for backslash escaped characters .
// Use String . unescapeAt ( ) to handle them .
if ( c . fChar == '\\' ) { c . fEscaped = true ; int [ ] unescapeIndex = new int [ 1 ] ; unescapeIndex [ 0 ] = fNextIndex ; c . fChar = Utility . unescapeAt ( fRB . fRules , unescapeIndex ) ; if ( unescapeIndex [ 0 ] == fNextIndex ) { error ( RBBIRuleBuilder . U_BRK_HEX_DIGITS_EXPECTED ) ; } fCharNum += unescapeIndex [ 0 ] - fNextIndex ; fNextIndex = unescapeIndex [ 0 ] ; } } // putc ( c . fChar , stdout ) ; |
public class AppServicePlansInner { /** * Get all Virtual Networks associated with an App Service plan .
* Get all Virtual Networks associated with an App Service plan .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service plan .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the List & lt ; VnetInfoInner & gt ; object if successful . */
public List < VnetInfoInner > listVnets ( String resourceGroupName , String name ) { } } | return listVnetsWithServiceResponseAsync ( resourceGroupName , name ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class SourceLineAnnotation { /** * Factory method for creating a source line annotation describing the
* source line numbers for a range of instructions in the method being
* visited by the given visitor .
* @ param classContext
* the ClassContext
* @ param visitor
* a BetterVisitor which is visiting the method
* @ param startPC
* the bytecode offset of the start instruction in the range
* @ param endPC
* the bytecode offset of the end instruction in the range
* @ return the SourceLineAnnotation , or null if we do not have line number
* information for the instruction */
public static @ Nonnull SourceLineAnnotation fromVisitedInstructionRange ( ClassContext classContext , PreorderVisitor visitor , int startPC , int endPC ) { } } | if ( startPC > endPC ) { throw new IllegalArgumentException ( "Start pc " + startPC + " greater than end pc " + endPC ) ; } LineNumberTable lineNumberTable = getLineNumberTable ( visitor ) ; String className = visitor . getDottedClassName ( ) ; String sourceFile = visitor . getSourceFile ( ) ; if ( lineNumberTable == null ) { return createUnknown ( className , sourceFile , startPC , endPC ) ; } int startLine = lineNumberTable . getSourceLine ( startPC ) ; int endLine = lineNumberTable . getSourceLine ( endPC ) ; return new SourceLineAnnotation ( className , sourceFile , startLine , endLine , startPC , endPC ) ; |
public class GroupReader { /** * Entry point for processing group definitions .
* @ param file project file
* @ param fixedData group fixed data
* @ param varData group var data
* @ param fontBases map of font bases */
public void process ( ProjectFile file , FixedData fixedData , Var2Data varData , Map < Integer , FontBase > fontBases ) { } } | int groupCount = fixedData . getItemCount ( ) ; for ( int groupLoop = 0 ; groupLoop < groupCount ; groupLoop ++ ) { byte [ ] groupFixedData = fixedData . getByteArrayValue ( groupLoop ) ; if ( groupFixedData == null || groupFixedData . length < 4 ) { continue ; } Integer groupID = Integer . valueOf ( MPPUtility . getInt ( groupFixedData , 0 ) ) ; byte [ ] groupVarData = varData . getByteArray ( groupID , getVarDataType ( ) ) ; if ( groupVarData == null ) { continue ; } String groupName = MPPUtility . getUnicodeString ( groupFixedData , 4 ) ; // 8 byte header , 48 byte blocks for each clause
// System . out . println ( ByteArrayHelper . hexdump ( groupVarData , true , 16 , " " ) ) ;
// header = 4 byte int for unique id
// short 4 = show summary tasks
// short int at byte 6 for number of clauses
// Integer groupUniqueID = Integer . valueOf ( MPPUtility . getInt ( groupVarData , 0 ) ) ;
boolean showSummaryTasks = ( MPPUtility . getShort ( groupVarData , 4 ) != 0 ) ; Group group = new Group ( groupID , groupName , showSummaryTasks ) ; file . getGroups ( ) . add ( group ) ; int clauseCount = MPPUtility . getShort ( groupVarData , 6 ) ; int offset = 8 ; for ( int clauseIndex = 0 ; clauseIndex < clauseCount ; clauseIndex ++ ) { if ( offset + 47 > groupVarData . length ) { break ; } GroupClause clause = new GroupClause ( ) ; group . addGroupClause ( clause ) ; int fieldID = MPPUtility . getInt ( groupVarData , offset ) ; FieldType type = FieldTypeHelper . getInstance ( fieldID ) ; clause . setField ( type ) ; // from byte 0 2 byte short int - field type
// byte 3 - entity type 0b / 0c
// 4th byte in clause is 1 = asc 0 = desc
// offset + 8 = font index , from font bases
// offset + 12 = color , byte
// offset + 13 = pattern , byte
boolean ascending = ( MPPUtility . getByte ( groupVarData , offset + 4 ) != 0 ) ; clause . setAscending ( ascending ) ; int fontIndex = MPPUtility . getByte ( groupVarData , offset + 8 ) ; FontBase fontBase = fontBases . get ( Integer . valueOf ( fontIndex ) ) ; int style = MPPUtility . getByte ( groupVarData , offset + 9 ) ; boolean bold = ( ( style & 0x01 ) != 0 ) ; boolean italic = ( ( style & 0x02 ) != 0 ) ; boolean underline = ( ( style & 0x04 ) != 0 ) ; int fontColorIndex = MPPUtility . getByte ( groupVarData , offset + 10 ) ; ColorType fontColor = ColorType . getInstance ( fontColorIndex ) ; FontStyle fontStyle = new FontStyle ( fontBase , italic , bold , underline , false , fontColor . getColor ( ) , null , BackgroundPattern . SOLID ) ; clause . setFont ( fontStyle ) ; int colorIndex = MPPUtility . getByte ( groupVarData , offset + 12 ) ; ColorType color = ColorType . getInstance ( colorIndex ) ; clause . setCellBackgroundColor ( color . getColor ( ) ) ; clause . setPattern ( BackgroundPattern . getInstance ( MPPUtility . getByte ( groupVarData , offset + 13 ) & 0x0F ) ) ; // offset + 14 = group on
int groupOn = MPPUtility . getShort ( groupVarData , offset + 14 ) ; clause . setGroupOn ( groupOn ) ; // offset + 24 = start at
// offset + 40 = group interval
Object startAt = null ; Object groupInterval = null ; switch ( type . getDataType ( ) ) { case DURATION : case NUMERIC : case CURRENCY : { startAt = Double . valueOf ( MPPUtility . getDouble ( groupVarData , offset + 24 ) ) ; groupInterval = Double . valueOf ( MPPUtility . getDouble ( groupVarData , offset + 40 ) ) ; break ; } case PERCENTAGE : { startAt = Integer . valueOf ( MPPUtility . getInt ( groupVarData , offset + 24 ) ) ; groupInterval = Integer . valueOf ( MPPUtility . getInt ( groupVarData , offset + 40 ) ) ; break ; } case BOOLEAN : { startAt = ( MPPUtility . getShort ( groupVarData , offset + 24 ) == 1 ? Boolean . TRUE : Boolean . FALSE ) ; break ; } case DATE : { startAt = MPPUtility . getTimestamp ( groupVarData , offset + 24 ) ; groupInterval = Integer . valueOf ( MPPUtility . getInt ( groupVarData , offset + 40 ) ) ; break ; } default : { break ; } } clause . setStartAt ( startAt ) ; clause . setGroupInterval ( groupInterval ) ; offset += 48 ; } // System . out . println ( group ) ;
} |
public class TimeParametersImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setSetUpTime ( Parameter newSetUpTime ) { } } | if ( newSetUpTime != setUpTime ) { NotificationChain msgs = null ; if ( setUpTime != null ) msgs = ( ( InternalEObject ) setUpTime ) . eInverseRemove ( this , EOPPOSITE_FEATURE_BASE - BpsimPackage . TIME_PARAMETERS__SET_UP_TIME , null , msgs ) ; if ( newSetUpTime != null ) msgs = ( ( InternalEObject ) newSetUpTime ) . eInverseAdd ( this , EOPPOSITE_FEATURE_BASE - BpsimPackage . TIME_PARAMETERS__SET_UP_TIME , null , msgs ) ; msgs = basicSetSetUpTime ( newSetUpTime , msgs ) ; if ( msgs != null ) msgs . dispatch ( ) ; } else if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , BpsimPackage . TIME_PARAMETERS__SET_UP_TIME , newSetUpTime , newSetUpTime ) ) ; |
public class MetricAdjustmentImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setHBaselineIncrement ( Integer newHBaselineIncrement ) { } } | Integer oldHBaselineIncrement = hBaselineIncrement ; hBaselineIncrement = newHBaselineIncrement ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . METRIC_ADJUSTMENT__HBASELINE_INCREMENT , oldHBaselineIncrement , hBaselineIncrement ) ) ; |
public class appflowglobal_appflowpolicy_binding { /** * Use this API to fetch filtered set of appflowglobal _ appflowpolicy _ binding resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static appflowglobal_appflowpolicy_binding [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | appflowglobal_appflowpolicy_binding obj = new appflowglobal_appflowpolicy_binding ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; appflowglobal_appflowpolicy_binding [ ] response = ( appflowglobal_appflowpolicy_binding [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class GetPresetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetPresetRequest getPresetRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getPresetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getPresetRequest . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class PushbackReader { /** * Reads characters into a portion of an array .
* @ param cbuf Destination buffer
* @ param off Offset at which to start writing characters
* @ param len Maximum number of characters to read
* @ return The number of characters read , or - 1 if the end of the
* stream has been reached
* @ exception IOException If an I / O error occurs */
public int read ( char cbuf [ ] , int off , int len ) throws IOException { } } | synchronized ( lock ) { ensureOpen ( ) ; try { if ( len <= 0 ) { if ( len < 0 ) { throw new IndexOutOfBoundsException ( ) ; } else if ( ( off < 0 ) || ( off > cbuf . length ) ) { throw new IndexOutOfBoundsException ( ) ; } return 0 ; } int avail = buf . length - pos ; if ( avail > 0 ) { if ( len < avail ) avail = len ; System . arraycopy ( buf , pos , cbuf , off , avail ) ; pos += avail ; off += avail ; len -= avail ; } if ( len > 0 ) { len = super . read ( cbuf , off , len ) ; if ( len == - 1 ) { return ( avail == 0 ) ? - 1 : avail ; } return avail + len ; } return avail ; } catch ( ArrayIndexOutOfBoundsException e ) { throw new IndexOutOfBoundsException ( ) ; } } |
public class CmsFieldsList { /** * Returns the configured fields of the current field configuration .
* @ return the configured fields of the current field configuration */
private List < CmsSearchField > getFields ( ) { } } | CmsSearchManager manager = OpenCms . getSearchManager ( ) ; I_CmsSearchFieldConfiguration fieldConfig = manager . getFieldConfiguration ( getParamFieldconfiguration ( ) ) ; List < CmsSearchField > result ; if ( fieldConfig != null ) { result = fieldConfig . getFields ( ) ; } else { result = Collections . emptyList ( ) ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1 , A_CmsFieldConfigurationDialog . PARAM_FIELDCONFIGURATION ) ) ; } } return result ; |
public class diff_match_patch { /** * Compute the Levenshtein distance ; the number of inserted , deleted or
* substituted characters .
* @ param diffs
* LinkedList of Diff objects .
* @ return Number of changes . */
public int diff_levenshtein ( LinkedList < Diff > diffs ) { } } | int levenshtein = 0 ; int insertions = 0 ; int deletions = 0 ; for ( Diff aDiff : diffs ) { switch ( aDiff . operation ) { case INSERT : insertions += aDiff . text . length ( ) ; break ; case DELETE : deletions += aDiff . text . length ( ) ; break ; case EQUAL : // A deletion and an insertion is one substitution .
levenshtein += Math . max ( insertions , deletions ) ; insertions = 0 ; deletions = 0 ; break ; } } levenshtein += Math . max ( insertions , deletions ) ; return levenshtein ; |
public class DescribeTimeToLiveRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeTimeToLiveRequest describeTimeToLiveRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeTimeToLiveRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeTimeToLiveRequest . getTableName ( ) , TABLENAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Project { /** * Helper to print comma , semi colon , double slash etc . inside velocity foreach loop . < br >
* Example : < code > $ { enumValue . name } ( " $ enumValue . value " ) $ project . print ( $ velocityHasNext , " , / / " , " ; " ) < / code >
* @ param velocityHasNext special velocity var available inside foreach loop .
* @ param whenTrue the string to return when velocityHasNext is true
* @ param whenFalse the string to to return when velocityHasNext is false */
public String print ( boolean velocityHasNext , String whenTrue , String whenFalse ) { } } | return velocityHasNext ? whenTrue : whenFalse ; |
public class SoyTypeRegistry { /** * Factory function which creates a union type , given the member types . This folds identical union
* types together .
* @ param members The members of the union .
* @ return The union type . */
public SoyType getOrCreateUnionType ( Collection < SoyType > members ) { } } | SoyType type = UnionType . of ( members ) ; if ( type . getKind ( ) == SoyType . Kind . UNION ) { type = unionTypes . intern ( ( UnionType ) type ) ; } return type ; |
public class RunScriptProcess { /** * Lookup this record for this recordowner .
* @ param The record ' s name .
* @ return The record with this name ( or null if not found ) . */
public Record getRecord ( String strFileName ) { } } | Record record = super . getRecord ( strFileName ) ; if ( record == null ) if ( Script . SCRIPT_FILE . equalsIgnoreCase ( strFileName ) ) record = new Script ( this ) ; return record ; |
public class EJBInjectionBinding { /** * d432816 */
private Class < ? > loadClass ( String className , boolean required ) throws InjectionConfigurationException { } } | if ( className == null || className . equals ( "" ) || ivClassLoader == null ) // F743-32443
{ return null ; } final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "loadClass : " + className ) ; Class < ? > loadedClass = null ; try { loadedClass = ivClassLoader . loadClass ( className ) ; } catch ( ClassNotFoundException ex ) { FFDCFilter . processException ( ex , CLASS_NAME + ".loadClass" , "575" , this , new Object [ ] { className } ) ; // Prior to EJB 3.0 , the classes specified for the bean interface were
// never validated , so an app would work fine even if garbage was
// specified . To allow the EJB 2.1 apps to continue to function , the
// bean interface class is only ' required ' if there is not a home .
// A warning will be logged if the class name is invalid . d447590
if ( required ) { InjectionConfigurationException icex = new InjectionConfigurationException ( "The " + className + " interface specified for <ejb-ref> or <ejb-local-ref> could not be found" , ex ) ; Tr . error ( tc , "EJB_INTERFACE_IS_NOT_SPECIFIED_CORRECTLY_CWNEN0039E" , className ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "loadClass : " + icex ) ; throw icex ; } Tr . warning ( tc , "EJB_INTERFACE_IS_NOT_SPECIFIED_CORRECTLY_CWNEN0033W" , className ) ; if ( isValidationFailable ( ) ) // fail if enabled F743-14449
{ InjectionConfigurationException icex = new InjectionConfigurationException ( "The " + className + " interface specified for <ejb-ref> or <ejb-local-ref> could not be found" , ex ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "loadClass : " + icex ) ; throw icex ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "loadClass : " + loadedClass ) ; return loadedClass ; |
public class BpmnExportHelper { /** * This deals with creating and drawing subprocess elements like exception
* handler
* @ param process
* @ param processVO
* @ throws XmlException */
private void addSubprocesses ( TBaseElement process , Process processVO ) { } } | List < Process > subprocs = processVO . getSubprocesses ( ) ; if ( subprocs != null ) { for ( Process subproc : subprocs ) { // Add for subprocesses
XmlObject flow = getProcessFlowElement ( process ) ; if ( flow != null ) { // Convert for substitutes
flow = substitute ( flow , SubProcessDocument . type . getDocumentElementName ( ) , TSubProcess . type ) ; TSubProcess subProcess = ( TSubProcess ) flow . changeType ( TSubProcess . type ) ; subProcess . setId ( "P" + subproc . getId ( ) ) ; subProcess . setName ( subproc . getName ( ) ) ; subProcess . addNewExtensionElements ( ) . set ( getExtentionElements ( subproc ) ) ; addProcessElements ( subProcess , subproc ) ; } } } |
public class AnalyticsContext { /** * Fill this instance with device info from the provided { @ link Context } . */
void putDevice ( Context context , boolean collectDeviceID ) { } } | Device device = new Device ( ) ; String identifier = collectDeviceID ? getDeviceId ( context ) : traits ( ) . anonymousId ( ) ; device . put ( Device . DEVICE_ID_KEY , identifier ) ; device . put ( Device . DEVICE_MANUFACTURER_KEY , Build . MANUFACTURER ) ; device . put ( Device . DEVICE_MODEL_KEY , Build . MODEL ) ; device . put ( Device . DEVICE_NAME_KEY , Build . DEVICE ) ; put ( DEVICE_KEY , device ) ; |
public class N { /** * The present order is kept in the result list .
* @ param a
* @ param fromIndex
* @ param toIndex
* @ param n
* @ param cmp
* @ return */
@ SuppressWarnings ( "rawtypes" ) public static < T > List < T > topp ( final T [ ] a , final int fromIndex , final int toIndex , final int n , final Comparator < ? super T > cmp ) { } } | N . checkArgNotNegative ( n , "n" ) ; if ( n == 0 ) { return new ArrayList < > ( ) ; } else if ( n >= toIndex - fromIndex ) { return N . toList ( a , fromIndex , toIndex ) ; } final Comparator < Indexed < T > > comparator = cmp == null ? ( Comparator ) new Comparator < Indexed < Comparable > > ( ) { @ Override public int compare ( final Indexed < Comparable > o1 , final Indexed < Comparable > o2 ) { return N . compare ( o1 . value ( ) , o2 . value ( ) ) ; } } : new Comparator < Indexed < T > > ( ) { @ Override public int compare ( final Indexed < T > o1 , final Indexed < T > o2 ) { return cmp . compare ( o1 . value ( ) , o2 . value ( ) ) ; } } ; final Queue < Indexed < T > > heap = new PriorityQueue < > ( n , comparator ) ; Indexed < T > indexed = null ; for ( int i = fromIndex ; i < toIndex ; i ++ ) { indexed = Indexed . of ( a [ i ] , i ) ; if ( heap . size ( ) >= n ) { if ( comparator . compare ( heap . peek ( ) , indexed ) < 0 ) { heap . poll ( ) ; heap . add ( indexed ) ; } } else { heap . offer ( indexed ) ; } } final Indexed < T > [ ] arrayOfIndexed = heap . toArray ( new Indexed [ heap . size ( ) ] ) ; N . sort ( arrayOfIndexed , new Comparator < Indexed < T > > ( ) { @ Override public int compare ( final Indexed < T > o1 , final Indexed < T > o2 ) { return o1 . index ( ) - o2 . index ( ) ; } } ) ; final List < T > res = new ArrayList < > ( arrayOfIndexed . length ) ; for ( int i = 0 , len = arrayOfIndexed . length ; i < len ; i ++ ) { res . add ( arrayOfIndexed [ i ] . value ( ) ) ; } return res ; |
public class Matrix { /** * Converts Euler angles to a rotation matrix
* @ param rm returns the result
* @ param rmOffset index into rm where the result matrix starts
* @ param x angle of rotation , in degrees
* @ param y angle of rotation , in degrees
* @ param z angle of rotation , in degrees */
public static void setRotateEulerM ( float [ ] rm , int rmOffset , float x , float y , float z ) { } } | x *= ( float ) ( Math . PI / 180.0f ) ; y *= ( float ) ( Math . PI / 180.0f ) ; z *= ( float ) ( Math . PI / 180.0f ) ; float cx = ( float ) Math . cos ( x ) ; float sx = ( float ) Math . sin ( x ) ; float cy = ( float ) Math . cos ( y ) ; float sy = ( float ) Math . sin ( y ) ; float cz = ( float ) Math . cos ( z ) ; float sz = ( float ) Math . sin ( z ) ; float cxsy = cx * sy ; float sxsy = sx * sy ; rm [ rmOffset + 0 ] = cy * cz ; rm [ rmOffset + 1 ] = - cy * sz ; rm [ rmOffset + 2 ] = sy ; rm [ rmOffset + 3 ] = 0.0f ; rm [ rmOffset + 4 ] = cxsy * cz + cx * sz ; rm [ rmOffset + 5 ] = - cxsy * sz + cx * cz ; rm [ rmOffset + 6 ] = - sx * cy ; rm [ rmOffset + 7 ] = 0.0f ; rm [ rmOffset + 8 ] = - sxsy * cz + sx * sz ; rm [ rmOffset + 9 ] = sxsy * sz + sx * cz ; rm [ rmOffset + 10 ] = cx * cy ; rm [ rmOffset + 11 ] = 0.0f ; rm [ rmOffset + 12 ] = 0.0f ; rm [ rmOffset + 13 ] = 0.0f ; rm [ rmOffset + 14 ] = 0.0f ; rm [ rmOffset + 15 ] = 1.0f ; |
public class DOReaderCache { /** * remove expired entries from the cache */
public final void removeExpired ( ) { } } | mapLock . lock ( ) ; Iterator < Entry < String , TimestampedCacheEntry < DOReader > > > entries = cacheMap . entrySet ( ) . iterator ( ) ; if ( entries . hasNext ( ) ) { long now = System . currentTimeMillis ( ) ; while ( entries . hasNext ( ) ) { Entry < String , TimestampedCacheEntry < DOReader > > entry = entries . next ( ) ; TimestampedCacheEntry < DOReader > e = entry . getValue ( ) ; long age = e . ageAt ( now ) ; if ( age > ( maxSeconds * 1000 ) ) { entries . remove ( ) ; String pid = entry . getKey ( ) ; LOG . debug ( "removing entry {} after {} milliseconds" , pid , age ) ; } } } mapLock . unlock ( ) ; |
public class HtmlQuoting { /** * Quote the given item to make it html - safe .
* @ param item the string to quote
* @ return the quoted string */
public static String quoteHtmlChars ( String item ) { } } | if ( item == null ) { return null ; } byte [ ] bytes = item . getBytes ( ) ; if ( needsQuoting ( bytes , 0 , bytes . length ) ) { ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; try { quoteHtmlChars ( buffer , bytes , 0 , bytes . length ) ; } catch ( IOException ioe ) { // Won ' t happen , since it is a bytearrayoutputstream
} return buffer . toString ( ) ; } else { return item ; } |
public class AbstractPlugin { /** * Plugs with the specified data model and the args from request .
* @ param dataModel dataModel
* @ param context context */
public void plug ( final Map < String , Object > dataModel , final RequestContext context ) { } } | String content = ( String ) dataModel . get ( Plugin . PLUGINS ) ; if ( null == content ) { dataModel . put ( Plugin . PLUGINS , "" ) ; } handleLangs ( dataModel ) ; fillDefault ( dataModel ) ; postPlug ( dataModel , context ) ; content = ( String ) dataModel . get ( Plugin . PLUGINS ) ; final StringBuilder contentBuilder = new StringBuilder ( content ) ; contentBuilder . append ( getViewContent ( dataModel ) ) ; final String pluginsContent = contentBuilder . toString ( ) ; dataModel . put ( Plugin . PLUGINS , pluginsContent ) ; LOGGER . log ( Level . DEBUG , "Plugin[name={0}] has been plugged" , getName ( ) ) ; |
public class StackTracePrinter { /** * Method prints the stack trace of the calling thread in a human readable way .
* @ param message the reason for printing the stack trace .
* @ param logger the logger used for printing .
* @ param logLevel the log level used for logging the stack trace . */
public static void printStackTrace ( final String message , final Logger logger , final LogLevel logLevel ) { } } | StackTraceElement [ ] stackTrace = Thread . currentThread ( ) . getStackTrace ( ) ; printStackTrace ( message , Arrays . copyOfRange ( stackTrace , 2 , stackTrace . length ) , logger , logLevel ) ; |
public class PreviewImageView { /** * Check image bounday against imageView */
private void checkMatrixBounds ( ) { } } | RectF rect = getMatrixRectF ( ) ; float deltaX = 0 , deltaY = 0 ; final float viewWidth = getWidth ( ) ; final float viewHeight = getHeight ( ) ; // Check if image boundary exceeds imageView boundary
if ( rect . top > 0 && isCheckTopAndBottom ) { deltaY = - rect . top ; } if ( rect . bottom < viewHeight && isCheckTopAndBottom ) { deltaY = viewHeight - rect . bottom ; } if ( rect . left > 0 && isCheckLeftAndRight ) { deltaX = - rect . left ; } if ( rect . right < viewWidth && isCheckLeftAndRight ) { deltaX = viewWidth - rect . right ; } scaleMatrix . postTranslate ( deltaX , deltaY ) ; |
public class DecisionTableImpl { /** * No hits matched for the DT , so calculate result based on default outputs */
private Object defaultToOutput ( EvaluationContext ctx , FEEL feel ) { } } | Map < String , Object > values = ctx . getAllValues ( ) ; if ( outputs . size ( ) == 1 ) { Object value = feel . evaluate ( outputs . get ( 0 ) . getDefaultValue ( ) , values ) ; return value ; } else { // zip outputEntries with its name :
return IntStream . range ( 0 , outputs . size ( ) ) . boxed ( ) . collect ( toMap ( i -> outputs . get ( i ) . getName ( ) , i -> feel . evaluate ( outputs . get ( i ) . getDefaultValue ( ) , values ) ) ) ; } |
public class ApplicationSecurityGroupsInner { /** * Creates or updates an application security group .
* @ param resourceGroupName The name of the resource group .
* @ param applicationSecurityGroupName The name of the application security group .
* @ param parameters Parameters supplied to the create or update ApplicationSecurityGroup operation .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < ApplicationSecurityGroupInner > beginCreateOrUpdateAsync ( String resourceGroupName , String applicationSecurityGroupName , ApplicationSecurityGroupInner parameters , final ServiceCallback < ApplicationSecurityGroupInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , applicationSecurityGroupName , parameters ) , serviceCallback ) ; |
public class ParametersSupport { /** * Internal helper method that will consume all raw parameters until we find the specified name
* or if the name is null , then that will be the same as " consume all " .
* @ param name
* @ return */
private Buffer consumeUntil ( final Buffer name ) { } } | try { while ( this . params . hasReadableBytes ( ) ) { SipParser . consumeSEMI ( this . params ) ; final Buffer [ ] keyValue = SipParser . consumeGenericParam ( this . params ) ; ensureParamsMap ( ) ; final Buffer value = keyValue [ 1 ] == null ? Buffers . EMPTY_BUFFER : keyValue [ 1 ] ; this . paramMap . put ( keyValue [ 0 ] , value ) ; if ( name != null && name . equals ( keyValue [ 0 ] ) ) { return value ; } } return null ; } catch ( final IndexOutOfBoundsException e ) { throw new SipParseException ( this . params . getReaderIndex ( ) , "Unable to process the value due to a IndexOutOfBoundsException" , e ) ; } catch ( final IOException e ) { throw new SipParseException ( this . params . getReaderIndex ( ) , "Could not read from the underlying stream while parsing the value" ) ; } |
public class PhoneNumberProvisioningManagerProvider { /** * Tries to retrieve the manager from the Servlet context . If it ' s not there it creates is , stores it
* in the context and also returns it .
* @ param context
* @ return */
public PhoneNumberProvisioningManager get ( ) { } } | PhoneNumberProvisioningManager manager = ( PhoneNumberProvisioningManager ) context . getAttribute ( "PhoneNumberProvisioningManager" ) ; if ( manager != null ) // ok , it ' s already in the context . Return it
return manager ; manager = create ( ) ; // put it into the context for next time that is requested
context . setAttribute ( "PhoneNumberProvisioningManager" , manager ) ; return manager ; |
public class MediaFidelityImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . MEDIA_FIDELITY__STP_MED_EX : return getStpMedEx ( ) ; case AfplibPackage . MEDIA_FIDELITY__RESERVED : return getReserved ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class Processor { /** * Transforms an input file into HTML using the given Configuration .
* @ param file
* The File to process .
* @ param configuration
* the Configuration
* @ return The processed String .
* @ throws IOException
* if an IO error occurs
* @ since 0.7
* @ see Configuration */
public final static String process ( final File file , final Configuration configuration ) throws IOException { } } | final FileInputStream input = new FileInputStream ( file ) ; final String ret = process ( input , configuration ) ; input . close ( ) ; return ret ; |
public class AbstractDateProcessorBuilder { /** * 日時のフォーマッタを作成する 。
* < p > アノテーション { @ link CsvDateTimeFormat } が付与されていない場合は 、 各種タイプごとの標準の書式で作成する 。 < / p >
* @ param field プロパティ情報
* @ param config システム設定
* @ return { @ link DateFormatWrapper } のインスタンス 。 */
@ SuppressWarnings ( "unchecked" ) protected DateFormatWrapper < T > getDefaultFormatter ( final FieldAccessor field , final Configuration config ) { } } | final Optional < CsvDateTimeFormat > formatAnno = field . getAnnotation ( CsvDateTimeFormat . class ) ; if ( ! formatAnno . isPresent ( ) ) { return new DateFormatWrapper < > ( new SimpleDateFormat ( getDefaultPattern ( ) ) , ( Class < T > ) field . getType ( ) ) ; } String pattern = formatAnno . get ( ) . pattern ( ) ; if ( pattern . isEmpty ( ) ) { pattern = getDefaultPattern ( ) ; } final boolean lenient = formatAnno . get ( ) . lenient ( ) ; final Locale locale = Utils . getLocale ( formatAnno . get ( ) . locale ( ) ) ; final TimeZone timeZone = formatAnno . get ( ) . timezone ( ) . isEmpty ( ) ? TimeZone . getDefault ( ) : TimeZone . getTimeZone ( formatAnno . get ( ) . timezone ( ) ) ; final DateFormat formatter = SimpleDateFormatBuilder . create ( pattern ) . lenient ( lenient ) . locale ( locale ) . timeZone ( timeZone ) . build ( ) ; final DateFormatWrapper < T > wrapper = new DateFormatWrapper < > ( formatter , ( Class < T > ) field . getType ( ) ) ; wrapper . setValidationMessage ( formatAnno . get ( ) . message ( ) ) ; return wrapper ; |
public class DefaultZoomableController { /** * Maps array of 2D points from view - absolute to image - relative coordinates .
* This does NOT take into account the zoomable transformation .
* Points are represented by a float array of [ x0 , y0 , x1 , y1 , . . . ] .
* @ param destPoints destination array ( may be the same as source array )
* @ param srcPoints source array
* @ param numPoints number of points to map */
private void mapAbsoluteToRelative ( float [ ] destPoints , float [ ] srcPoints , int numPoints ) { } } | for ( int i = 0 ; i < numPoints ; i ++ ) { destPoints [ i * 2 + 0 ] = ( srcPoints [ i * 2 + 0 ] - mImageBounds . left ) / mImageBounds . width ( ) ; destPoints [ i * 2 + 1 ] = ( srcPoints [ i * 2 + 1 ] - mImageBounds . top ) / mImageBounds . height ( ) ; } |
public class TemplateAstMatcher { /** * Returns whether the template matches an AST structure node starting with
* node , taking into account the template parameters that were provided to
* this matcher .
* Here only the template shape is checked , template local declarations and
* parameters are checked later . */
private boolean matchesTemplateShape ( Node template , Node ast ) { } } | while ( template != null ) { if ( ast == null || ! matchesNodeShape ( template , ast ) ) { return false ; } template = template . getNext ( ) ; ast = ast . getNext ( ) ; } return true ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "typeId" , scope = GetObjectRelationships . class ) public JAXBElement < String > createGetObjectRelationshipsTypeId ( String value ) { } } | return new JAXBElement < String > ( _GetTypeChildrenTypeId_QNAME , String . class , GetObjectRelationships . class , value ) ; |
public class DelegatingMetaTagHandler { /** * < p class = " changed _ added _ 2_0 _ rev _ a " > Invoke the < code > apply ( ) < / code >
* method on this instance ' s { @ link TagHandler # nextHandler } . < / p >
* @ param ctx the < code > FaceletContext < / code > for this view execution
* @ param c the < code > UIComponent < / code > of the
* component represented by this element instance .
* @ since 2.0 */
public void applyNextHandler ( FaceletContext ctx , UIComponent c ) throws IOException , FacesException , ELException { } } | // first allow c to get populated
this . nextHandler . apply ( ctx , c ) ; |
public class ReviewResultDetailMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ReviewResultDetail reviewResultDetail , ProtocolMarshaller protocolMarshaller ) { } } | if ( reviewResultDetail == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( reviewResultDetail . getActionId ( ) , ACTIONID_BINDING ) ; protocolMarshaller . marshall ( reviewResultDetail . getSubjectId ( ) , SUBJECTID_BINDING ) ; protocolMarshaller . marshall ( reviewResultDetail . getSubjectType ( ) , SUBJECTTYPE_BINDING ) ; protocolMarshaller . marshall ( reviewResultDetail . getQuestionId ( ) , QUESTIONID_BINDING ) ; protocolMarshaller . marshall ( reviewResultDetail . getKey ( ) , KEY_BINDING ) ; protocolMarshaller . marshall ( reviewResultDetail . getValue ( ) , VALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TextUtility { /** * 是否全为英文
* @ param text
* @ return */
public static boolean isAllLetter ( String text ) { } } | for ( int i = 0 ; i < text . length ( ) ; ++ i ) { char c = text . charAt ( i ) ; if ( ( ( ( c < 'a' || c > 'z' ) ) && ( ( c < 'A' || c > 'Z' ) ) ) ) { return false ; } } return true ; |
public class CompilingLoader { /** * Returns the classes which need compilation . */
private void findAllModifiedClasses ( String name , PathImpl sourceDir , PathImpl classDir , String sourcePath , ArrayList < String > sources ) throws IOException , ClassNotFoundException { } } | String [ ] list ; try { list = sourceDir . list ( ) ; } catch ( IOException e ) { return ; } for ( int i = 0 ; list != null && i < list . length ; i ++ ) { if ( list [ i ] . startsWith ( "." ) ) continue ; if ( _excludedDirectories . contains ( list [ i ] ) ) continue ; PathImpl subSource = sourceDir . lookup ( list [ i ] ) ; if ( subSource . isDirectory ( ) ) { findAllModifiedClasses ( name + list [ i ] + "/" , subSource , classDir . lookup ( list [ i ] ) , sourcePath , sources ) ; } else if ( list [ i ] . endsWith ( _sourceExt ) ) { int tail = list [ i ] . length ( ) - _sourceExt . length ( ) ; String prefix = list [ i ] . substring ( 0 , tail ) ; PathImpl subClass = classDir . lookup ( prefix + ".class" ) ; if ( subClass . getLastModified ( ) < subSource . getLastModified ( ) ) { sources . add ( name + list [ i ] ) ; } } } if ( ! _requireSource ) return ; try { list = classDir . list ( ) ; } catch ( IOException e ) { return ; } for ( int i = 0 ; list != null && i < list . length ; i ++ ) { if ( list [ i ] . startsWith ( "." ) ) continue ; if ( _excludedDirectories . contains ( list [ i ] ) ) continue ; PathImpl subClass = classDir . lookup ( list [ i ] ) ; if ( list [ i ] . endsWith ( ".class" ) ) { String prefix = list [ i ] . substring ( 0 , list [ i ] . length ( ) - 6 ) ; PathImpl subSource = sourceDir . lookup ( prefix + _sourceExt ) ; if ( ! subSource . exists ( ) ) { String tail = subSource . getTail ( ) ; boolean doRemove = true ; if ( tail . indexOf ( '$' ) > 0 ) { String subTail = tail . substring ( 0 , tail . indexOf ( '$' ) ) + _sourceExt ; PathImpl subJava = subSource . getParent ( ) . lookup ( subTail ) ; if ( subJava . exists ( ) ) doRemove = false ; } if ( doRemove ) { log . finer ( L . l ( "removing obsolete class '{0}'." , subClass . getPath ( ) ) ) ; subClass . remove ( ) ; } } } } |
public class Queue { /** * Returns the next item on the queue or null if the queue is
* empty . This method will not block waiting for an item to be added
* to the queue . */
public synchronized T getNonBlocking ( ) { } } | if ( _count == 0 ) { return null ; } // pull the object off , and clear our reference to it
T retval = _items [ _start ] ; _items [ _start ] = null ; _start = ( _start + 1 ) % _size ; _count -- ; return retval ; |
public class BoxApiFile { /** * Gets a request that gets the collaborations of a file
* @ param id id of file to request collaborations of
* @ return request to get collaborations */
public BoxRequestsFile . GetCollaborations getCollaborationsRequest ( String id ) { } } | BoxRequestsFile . GetCollaborations request = new BoxRequestsFile . GetCollaborations ( id , getFileCollaborationsUrl ( id ) , mSession ) ; return request ; |
public class MoreTables { /** * Gets the value of { @ code rowKey } and { @ code columnKey } from { @ code table } , or computes
* the value using { @ code valueFunction } and inserts it into the table .
* @ param table the table
* @ param rowKey the row key
* @ param columnKey the column key
* @ param valueFunction the value function
* @ param < R > the row type
* @ param < C > the column type
* @ param < V > the value type
* @ return the value */
public static < R , C , V > /* @ Nullable */
V computeIfAbsent ( final @ NonNull Table < R , C , V > table , final @ Nullable R rowKey , final @ Nullable C columnKey , final @ NonNull BiFunction < ? super R , ? super C , ? extends V > valueFunction ) { } } | /* @ Nullable */
V value = table . get ( rowKey , columnKey ) ; if ( value == null ) { value = valueFunction . apply ( rowKey , columnKey ) ; table . put ( rowKey , columnKey , value ) ; } return value ; |
public class TextureFutureHelper { /** * Gets an immutable { @ linkplain GVRBitmapTexture texture } with the specified color ,
* returning a cached instance if possible .
* @ param color An Android { @ link Color } .
* @ return And immutable instance of { @ link GVRBitmapTexture } . */
public GVRBitmapTexture getSolidColorTexture ( int color ) { } } | GVRBitmapTexture texture ; synchronized ( mColorTextureCache ) { texture = mColorTextureCache . get ( color ) ; Log . d ( TAG , "getSolidColorTexture(): have cached texture for 0x%08X: %b" , color , texture != null ) ; if ( texture == null ) { texture = new ImmutableBitmapTexture ( mContext , makeSolidColorBitmap ( color ) ) ; Log . d ( TAG , "getSolidColorTexture(): caching texture for 0x%08X" , color ) ; mColorTextureCache . put ( color , texture ) ; Log . d ( TAG , "getSolidColorTexture(): succeeded caching for 0x%08X: %b" , color , mColorTextureCache . indexOfKey ( color ) >= 0 ) ; } } return texture ; |
public class OHLCChart { private void sanityCheck ( String seriesName , double [ ] openData , double [ ] highData , double [ ] lowData , double [ ] closeData ) { } } | checkData ( seriesName , "Open" , openData ) ; checkData ( seriesName , "High" , highData ) ; checkData ( seriesName , "Low" , lowData ) ; checkData ( seriesName , "Close" , closeData ) ; checkDataLengths ( seriesName , "Open" , "Close" , openData , closeData ) ; checkDataLengths ( seriesName , "High" , "Close" , highData , closeData ) ; checkDataLengths ( seriesName , "Low" , "Close" , lowData , closeData ) ; |
public class ProcessSection { /** * reflectively runs the relevant method */
protected Integer invokeSection ( ) { } } | try { // run object is a JavaProcessRunner
S runner = getRunner ( getRunObject ( ) ) ; if ( run_method_str == null ) return null ; createRunMethod ( param_types , runner ) ; Object [ ] local_params = ( Object [ ] ) params . clone ( ) ; Integer result_code = ( Integer ) run_method . invoke ( runner , local_params ) ; return result_code ; } // Allow ProcessImpl exceptions to be rethrown
catch ( ForceProcessComplete fpc ) { throw fpc ; } catch ( ForceRescheduleException fre ) { throw fre ; } catch ( InvocationTargetException ite ) { Throwable cause = ite . getCause ( ) ; if ( cause instanceof ForceProcessComplete || cause instanceof ForceRescheduleException ) throw ( RuntimeException ) cause ; new QueujException ( ite ) ; return BatchProcessServer . FAILURE ; } catch ( Exception e ) { new QueujException ( e ) ; return BatchProcessServer . FAILURE ; } |
public class ScreenVideo { /** * { @ inheritDoc } */
@ Override public boolean addData ( IoBuffer data ) { } } | if ( ! this . canHandleData ( data ) ) { return false ; } data . get ( ) ; this . updateSize ( data ) ; int idx = 0 ; int pos = 0 ; byte [ ] tmpData = new byte [ this . blockDataSize ] ; int countBlocks = this . blockCount ; while ( data . remaining ( ) > 0 && countBlocks > 0 ) { short size = data . getShort ( ) ; countBlocks -- ; if ( size == 0 ) { // Block has not been modified
idx += 1 ; pos += this . blockDataSize ; continue ; } // Store new block data
this . blockSize [ idx ] = size ; data . get ( tmpData , 0 , size ) ; System . arraycopy ( tmpData , 0 , this . blockData , pos , size ) ; idx += 1 ; pos += this . blockDataSize ; } data . rewind ( ) ; return true ; |
public class HttpOutputStream { public Writer getWriter ( String encoding ) throws IOException { } } | if ( encoding == null || StringUtil . __ISO_8859_1 . equalsIgnoreCase ( encoding ) || "ISO8859_1" . equalsIgnoreCase ( encoding ) ) return getISO8859Writer ( ) ; if ( "UTF-8" . equalsIgnoreCase ( encoding ) || "UTF8" . equalsIgnoreCase ( encoding ) ) return getUTF8Writer ( ) ; if ( "US-ASCII" . equalsIgnoreCase ( encoding ) ) return getASCIIWriter ( ) ; return new OutputStreamWriter ( this , encoding ) ; |
public class AbstractChemistryManipulator { /** * recycles and set stereo information on firstContaner
* @ param firstContainer a first molecule instance of { @ link AbstractMolecule }
* @ param firstRgroup atom to remove , instance of { @ link IAtomBase }
* @ param secondContainer a second molecule , instance of { @ link AbstractMolecule }
* @ param secondRgroup atom to remove , instance of { @ link IAtomBase }
* @ param atom1 atom connected to firstGroup
* @ param atom2 atom connected to secondGroup
* @ return true , if stereo information was set , false otherwise
* @ throws CTKException general ChemToolKit exception passed to HELMToolKit */
protected boolean setStereoInformation ( AbstractMolecule firstContainer , IAtomBase firstRgroup , AbstractMolecule secondContainer , IAtomBase secondRgroup , IAtomBase atom1 , IAtomBase atom2 ) throws CTKException { } } | IStereoElementBase stereo = null ; boolean result = false ; if ( firstContainer . isSingleStereo ( firstRgroup ) ) { stereo = getStereoInformation ( firstContainer , firstRgroup , atom2 , atom1 ) ; } if ( secondContainer . isSingleStereo ( secondRgroup ) ) { stereo = getStereoInformation ( secondContainer , secondRgroup , atom1 , atom2 ) ; } if ( stereo != null ) { firstContainer . addIBase ( stereo ) ; result = true ; } return result ; |
public class STOImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . STO__IORNTION : return getIORNTION ( ) ; case AfplibPackage . STO__BORNTION : return getBORNTION ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class LeapSeconds { /** * / * [ deutsch ]
* < p > Ermittelt das zum angegebenen UTC - Zeitstempel n & auml ; chste
* Schaltsekundenereignis . < / p >
* @ param utc elapsed SI - seconds relative to UTC epoch
* [ 1972-01-01T00:00:00Z ] including leap seconds
* @ return following leap second event or { @ code null } if not known
* @ since 2.1 */
public LeapSecondEvent getNextEvent ( long utc ) { } } | ExtendedLSE [ ] events = this . getEventsInDescendingOrder ( ) ; LeapSecondEvent result = null ; for ( int i = 0 ; i < events . length ; i ++ ) { ExtendedLSE lse = events [ i ] ; if ( utc >= lse . utc ( ) ) { break ; } else { result = lse ; } } return result ; |
public class AwsSecurityFindingFilters { /** * The name of the image related to a finding .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setResourceContainerImageName ( java . util . Collection ) } or
* { @ link # withResourceContainerImageName ( java . util . Collection ) } if you want to override the existing values .
* @ param resourceContainerImageName
* The name of the image related to a finding .
* @ return Returns a reference to this object so that method calls can be chained together . */
public AwsSecurityFindingFilters withResourceContainerImageName ( StringFilter ... resourceContainerImageName ) { } } | if ( this . resourceContainerImageName == null ) { setResourceContainerImageName ( new java . util . ArrayList < StringFilter > ( resourceContainerImageName . length ) ) ; } for ( StringFilter ele : resourceContainerImageName ) { this . resourceContainerImageName . add ( ele ) ; } return this ; |
public class RequestConnection { /** * the headless inTrace client aims to allow the user to have method - level granularity ,
* when deciding what events they want to see .
* This makes things complicated , because the InTrace server agent only supports class granularity .
* This method makes it easy for the consumer to place there preferences in one place
* to specify their instrumentation preferences .
* NOTE : currently there is no way for the consumer of this API to distinguish
* between two overloaded methods . The InTrace server agent doesn ' t provide enough information .
* @ param startupCommandAry
* @ throws BadCompletedRequestListener */
private void enhanceCommandArray ( IAgentCommand [ ] startupCommandAry ) throws BadCompletedRequestListener { } } | if ( getTraceWriter ( ) . getTraceFilterExt ( ) instanceof IncludeAnyOfTheseEventsFilterExt ) { IncludeAnyOfTheseEventsFilterExt myFilter = ( IncludeAnyOfTheseEventsFilterExt ) getTraceWriter ( ) . getTraceFilterExt ( ) ; ClassInstrumentationCommand cic = new ClassInstrumentationCommand ( ) ; cic . setIncludeClassRegEx ( myFilter . getDelimitedListOfAllClasses ( ) ) ; if ( getCommandArray ( ) == null ) { this . setCommandArray ( new IAgentCommand [ ] { } ) ; } // Expand by one
IAgentCommand [ ] tmp = Arrays . copyOf ( getCommandArray ( ) , getCommandArray ( ) . length + 1 ) ; tmp [ tmp . length - 1 ] = cic ; this . setCommandArray ( tmp ) ; } |
public class ObjenesisHelper { /** * Will create an object just like it ' s done by ObjectInputStream . readObject ( the default
* constructor of the first non serializable class will be called )
* @ param < T > Type instantiated
* @ param clazz Class to instantiate
* @ return New instance of clazz */
public static < T extends Serializable > T newSerializableInstance ( Class < T > clazz ) { } } | return OBJENESIS_SERIALIZER . newInstance ( clazz ) ; |
public class AbstractCache { /** * This method adds specified SequenceElement to vocabulary
* @ param element the word to add */
@ Override public boolean addToken ( T element ) { } } | boolean ret = false ; T oldElement = vocabulary . putIfAbsent ( element . getStorageId ( ) , element ) ; if ( oldElement == null ) { // putIfAbsent added our element
if ( element . getLabel ( ) != null ) { extendedVocabulary . put ( element . getLabel ( ) , element ) ; } oldElement = element ; ret = true ; } else { oldElement . incrementSequencesCount ( element . getSequencesCount ( ) ) ; oldElement . increaseElementFrequency ( ( int ) element . getElementFrequency ( ) ) ; } totalWordCount . addAndGet ( ( long ) oldElement . getElementFrequency ( ) ) ; return ret ; |
public class WsEchoServer { /** * Handle upgrade confirmation .
* @ param event the event
* @ param channel the channel */
@ Handler public void onUpgraded ( Upgraded event , IOSubchannel channel ) { } } | if ( ! openChannels . contains ( channel ) ) { return ; } channel . respond ( Output . from ( "/Greetings!" , true ) ) ; |
public class RegistriesInner { /** * Gets the properties of the specified container registry .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the RegistryInner object */
public Observable < RegistryInner > getByResourceGroupAsync ( String resourceGroupName , String registryName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , registryName ) . map ( new Func1 < ServiceResponse < RegistryInner > , RegistryInner > ( ) { @ Override public RegistryInner call ( ServiceResponse < RegistryInner > response ) { return response . body ( ) ; } } ) ; |
public class FsPermission { /** * Write { @ link FsPermission } to { @ link DataInput } */
public static void write ( DataOutput out , FsPermission masked ) throws IOException { } } | FsPermission perm = new FsPermission ( masked ) ; perm . write ( out ) ; |
public class SimpleMisoSceneModel { /** * Get the index into the baseTileIds [ ] for the specified
* x and y coordinates , or return - 1 if the specified coordinates
* are outside of the viewable area .
* Assumption : The viewable area is centered and aligned as far
* to the top of the isometric scene as possible , such that
* the upper - left corner is at the point where the tiles
* ( 0 , vwid ) and ( 0 , vwid - 1 ) touch . The upper - right corner
* is at the point where the tiles ( vwid - 1 , 0 ) and ( vwid , 0)
* touch .
* The viewable area is made up of " fat " rows and " thin " rows . The
* fat rows display one more tile than the thin rows because their
* first and last tiles are halfway off the viewable area . The thin
* rows are fully contained within the viewable area except for the
* first and last thin rows , which display only their bottom and top
* halves , respectively . Note that # fatrows = = # thinrows - 1; */
protected int getIndex ( int x , int y ) { } } | // check to see if the index lies in one of the " fat " rows
if ( ( ( x + y ) & 1 ) == ( vwidth & 1 ) ) { int col = ( vwidth + x - y ) >> 1 ; int row = x - col ; if ( ( col < 0 ) || ( col > vwidth ) || ( row < 0 ) || ( row >= vheight ) ) { return - 1 ; // out of view
} return ( vwidth + 1 ) * row + col ; } else { // the index must be in a " thin " row
int col = ( vwidth + x - y - 1 ) >> 1 ; int row = x - col ; if ( ( col < 0 ) || ( col >= vwidth ) || ( row < 0 ) || ( row > vheight ) ) { return - 1 ; // out of view
} // we store the all the fat rows first , then all the thin
// rows , the ' ( vwidth + 1 ) * vheight ' is the size of all
// the fat rows .
return row * vwidth + col + ( vwidth + 1 ) * vheight ; } |
public class WebSocketExtensionFactory { /** * Creates a new instance of WebSocketExtensionFactory . It uses the specified { @ link ClassLoader } to load
* { @ link WebSocketExtensionFactorySpi } objects that are registered using META - INF / services .
* @ return WebSocketExtensionFactory */
public static WebSocketExtensionFactory newInstance ( ClassLoader cl ) { } } | ServiceLoader < WebSocketExtensionFactorySpi > services = load ( WebSocketExtensionFactorySpi . class , cl ) ; return newInstance ( services ) ; |
public class ResourceName { /** * Creates a new resource name from a template and a value assignment for variables .
* @ throws ValidationException if not all variables in the template are bound . */
public static ResourceName create ( PathTemplate template , Map < String , String > values ) { } } | if ( ! values . keySet ( ) . containsAll ( template . vars ( ) ) ) { Set < String > unbound = Sets . newLinkedHashSet ( template . vars ( ) ) ; unbound . removeAll ( values . keySet ( ) ) ; throw new ValidationException ( "unbound variables: %s" , unbound ) ; } return new ResourceName ( template , values , null ) ; |
public class GroovyRowResult { /** * Retrieve the value of the property by its index .
* A negative index will count backwards from the last column .
* @ param index is the number of the column to look at
* @ return the value of the property */
public Object getAt ( int index ) { } } | try { // a negative index will count backwards from the last column .
if ( index < 0 ) index += result . size ( ) ; Iterator it = result . values ( ) . iterator ( ) ; int i = 0 ; Object obj = null ; while ( ( obj == null ) && ( it . hasNext ( ) ) ) { if ( i == index ) obj = it . next ( ) ; else it . next ( ) ; i ++ ; } return obj ; } catch ( Exception e ) { throw new MissingPropertyException ( Integer . toString ( index ) , GroovyRowResult . class , e ) ; } |
public class NullAway { /** * does the constructor invoke another constructor in the same class via this ( . . . ) ? */
private boolean constructorInvokesAnother ( MethodTree constructor , VisitorState state ) { } } | BlockTree body = constructor . getBody ( ) ; List < ? extends StatementTree > statements = body . getStatements ( ) ; if ( statements . size ( ) > 0 ) { StatementTree statementTree = statements . get ( 0 ) ; if ( isThisCall ( statementTree , state ) ) { return true ; } } return false ; |
public class ParameterizedTypeReference { /** * Here we already know that we don ' t have type arguments */
private boolean isRawType ( JvmTypeParameter current , RecursionGuard < JvmTypeParameter > guard ) { } } | if ( guard . tryNext ( current ) ) { List < JvmTypeConstraint > constraints = current . getConstraints ( ) ; for ( int i = 0 , size = constraints . size ( ) ; i < size ; i ++ ) { JvmTypeConstraint constraint = constraints . get ( i ) ; if ( constraint . eClass ( ) == TypesPackage . Literals . JVM_UPPER_BOUND && constraint . getTypeReference ( ) != null ) { JvmTypeReference superType = constraint . getTypeReference ( ) ; JvmType rawSuperType = superType . getType ( ) ; if ( rawSuperType != null ) { if ( rawSuperType . eClass ( ) == TypesPackage . Literals . JVM_TYPE_PARAMETER ) { if ( isRawType ( ( JvmTypeParameter ) rawSuperType , guard ) ) { return true ; } } if ( rawSuperType . eClass ( ) == TypesPackage . Literals . JVM_GENERIC_TYPE ) { if ( ! ( ( JvmGenericType ) rawSuperType ) . getTypeParameters ( ) . isEmpty ( ) ) { if ( superType . eClass ( ) == TypesPackage . Literals . JVM_PARAMETERIZED_TYPE_REFERENCE ) { JvmParameterizedTypeReference casted = ( JvmParameterizedTypeReference ) superType ; if ( casted . getArguments ( ) . isEmpty ( ) ) { return true ; } } } } } } } } return false ; |
public class Incremental { /** * { @ inheritDoc } */
@ Override public DataBucket combineBuckets ( final DataBucket [ ] pBuckets ) { } } | checkArgument ( pBuckets . length > 0 , "At least one DataBucket must be provided" ) ; // create entire bucket . .
final DataBucket returnVal = new DataBucket ( pBuckets [ 0 ] . getBucketKey ( ) , pBuckets [ 0 ] . getLastBucketPointer ( ) ) ; // . . . iterate through the datas and check if it is stored . .
for ( int i = 0 ; i < pBuckets [ 0 ] . getDatas ( ) . length ; i ++ ) { boolean bucketSkip = false ; // . . . form the newest version to the oldest one . .
for ( int j = 0 ; ! bucketSkip && j < pBuckets . length ; j ++ ) { // if the data is not set yet but existing in the current version . .
if ( pBuckets [ j ] . getData ( i ) != null ) { // . . . break out the loop the next time and . .
bucketSkip = true ; // . . . set it
returnVal . setData ( i , pBuckets [ j ] . getData ( i ) ) ; } } } return returnVal ; |
public class ApiOvhMe { /** * Retrieve payment method ID list
* REST : GET / me / payment / method
* @ param status [ required ] Status
* @ param paymentType [ required ] Payment method type
* API beta */
public ArrayList < Long > payment_thod_GET ( String paymentType , OvhStatus status ) throws IOException { } } | String qPath = "/me/payment/method" ; StringBuilder sb = path ( qPath ) ; query ( sb , "paymentType" , paymentType ) ; query ( sb , "status" , status ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t2 ) ; |
public class SimpleQuery { /** * Sets the fields that this query will return .
* @ param fields The fields that this query will return . */
void setFields ( Field [ ] fields ) { } } | this . fields = fields ; this . resultSetColumnNameIndexMap = null ; this . cachedMaxResultRowSize = null ; this . needUpdateFieldFormats = fields != null ; this . hasBinaryFields = false ; // just in case |
public class ProposalLineItemConstraints { /** * Gets the builtInCreativeRotationType value for this ProposalLineItemConstraints .
* @ return builtInCreativeRotationType * The built - in creative rotation type for the created { @ link
* ProposalLineItem } .
* < p > This attribute is read - only . */
public com . google . api . ads . admanager . axis . v201811 . CreativeRotationType getBuiltInCreativeRotationType ( ) { } } | return builtInCreativeRotationType ; |
public class MethodAnnotation { /** * Create a MethodAnnotation from an XMethod .
* @ param xmethod
* the XMethod
* @ return the MethodAnnotation */
public static MethodAnnotation fromXMethod ( XMethod xmethod ) { } } | return fromForeignMethod ( xmethod . getClassName ( ) , xmethod . getName ( ) , xmethod . getSignature ( ) , xmethod . isStatic ( ) ) ; |
public class OracleDdlParser { /** * Utility method to parse a generic statement given a start phrase and statement mixin type .
* @ param tokens the tokenized { @ link DdlTokenStream } of the DDL input content ; may not be null
* @ param stmt _ start _ phrase the string array statement start phrase
* @ param parentNode the parent { @ link AstNode } node ; may not be null
* @ param mixinType the mixin type of the newly created statement node
* @ return the new node */
protected AstNode parseSlashedStatement ( DdlTokenStream tokens , String [ ] stmt_start_phrase , AstNode parentNode , String mixinType ) { } } | assert tokens != null ; assert stmt_start_phrase != null && stmt_start_phrase . length > 0 ; assert parentNode != null ; markStartOfStatement ( tokens ) ; tokens . consume ( stmt_start_phrase ) ; AstNode result = nodeFactory ( ) . node ( getStatementTypeName ( stmt_start_phrase ) , parentNode , mixinType ) ; parseUntilFwdSlash ( tokens , false ) ; consumeSlash ( tokens ) ; markEndOfStatement ( tokens , result ) ; return result ; |
public class Intersection { /** * modifies by intersecting with another intersection
* @ param arg another intersection */
public void intersectWith ( Intersection < T > arg ) { } } | // if the argument is top then leave all as is
if ( arg . elements != null ) { // if arg is empty , the result is empty
if ( arg . elements . isEmpty ( ) ) elements = Collections . emptySet ( ) ; else { if ( elements == null ) // we have top , the intersection is sub
elements = new HashSet < > ( arg . elements ) ; // copy the set
else elements . retainAll ( arg . elements ) ; } } |
public class DistributedReentrantLockProcess { /** * 解锁
* @ param cacheConfigBean
* @ param key
* @ param valueObj
* @ return
* @ throws Exception */
public static long unLock ( CacheConfigBean cacheConfigBean , String key , Object valueObj ) throws Exception { } } | final LockData lockData = LOCK_THREAD_DATA . get ( ) ; if ( lockData == null ) throw new IllegalMonitorStateException ( "You do not own the lock: " + key ) ; long startNano = System . nanoTime ( ) ; final int newLockCount = lockData . getLockCount ( ) . decrementAndGet ( ) ; if ( newLockCount > 0 ) { return 1 ; } else if ( newLockCount < 0 ) { throw new IllegalMonitorStateException ( "Lock count has gone negative for lock: " + key ) ; } else { try ( Jedis jedis = Redis . useDataSource ( cacheConfigBean ) . getResource ( ) ) { final String _value = ObjectCacheOperate . get ( jedis , key ) ; if ( _value == null ) { LOG . warn ( String . format ( "key: %s, -1 (没有对应的缓存)" , key ) ) ; return - 1 ; } final String value = FormatUtil . formatValue ( valueObj ) ; if ( ! _value . equals ( value ) ) { LOG . warn ( String . format ( "key: %s, (_value: %s) != (value: %s), -2 (入参值 和 缓存值 不匹配)" , key , ( _value == null ? "null" : _value ) , ( value == null ? "null" : value ) ) ) ; return - 2 ; } final long result = ObjectCacheOperate . del ( jedis , key ) ; if ( ! EnvUtil . getEnv ( ) . equals ( EnvUtil . PRODUCTION ) ) { long endNano = System . nanoTime ( ) ; LOG . info ( String . format ( "key: %s, 分布式解锁, 累计耗时: %s 纳秒" , key , ( endNano - startNano ) / 1000000 ) ) ; LOG . info ( String . format ( "DEL key: %s = result: %s" , key , result ) ) ; } return result ; } catch ( Exception e ) { LOG . error ( e ) ; return - 3 ; } finally { LOCK_THREAD_DATA . remove ( ) ; } } |
public class AABBd { /** * Set < code > this < / code > to the union of < code > this < / code > and the given point < code > p < / code > .
* @ param p
* the point
* @ return this */
public AABBd union ( Vector3dc p ) { } } | return union ( p . x ( ) , p . y ( ) , p . z ( ) , this ) ; |
public class TagsUtils { /** * Configured tags will be validated against the instance tags .
* If one or more tags are missing on the instance , an exception will be thrown .
* @ throws IllegalStateException */
public TagsUtils validateTags ( ) { } } | final List < String > instanceTags = getInstanceTags ( ) . stream ( ) . map ( Tag :: getKey ) . collect ( Collectors . toList ( ) ) ; final List < String > missingTags = getAwsTagNames ( ) . map ( List :: stream ) . orElse ( Stream . empty ( ) ) . filter ( configuredTag -> ! instanceTags . contains ( configuredTag ) ) . collect ( Collectors . toList ( ) ) ; if ( ! missingTags . isEmpty ( ) ) { throw new IllegalStateException ( "expected instance tag(s) missing: " + missingTags . stream ( ) . collect ( Collectors . joining ( ", " ) ) ) ; } return this ; |
public class HttpDownloadHandler { /** * { @ inheritDoc } */
@ Override public DownloadFile download ( URL url ) throws IOException { } } | if ( url == null ) { throw new InvalidArgument ( "url" , url ) ; } final HttpURLConnection huc = ( HttpURLConnection ) url . openConnection ( ) ; FileOutputStream fos = null ; try { huc . setConnectTimeout ( CONNECTION_TIMEOUT ) ; huc . setInstanceFollowRedirects ( true ) ; final int code = huc . getResponseCode ( ) ; if ( code != HttpURLConnection . HTTP_OK ) { throw new IOException ( format ( "Bad response code: %d" , code ) ) ; } final String downloadDir = asPath ( getSystemConfiguration ( ) . getWorkingDirectory ( ) . getAbsolutePath ( ) , DOWNLOAD_DIRECTORY ) ; createDirectory ( downloadDir ) ; final String filename = UUID . randomUUID ( ) . toString ( ) ; String downloadFile = asPath ( downloadDir , filename ) ; fos = new FileOutputStream ( downloadFile ) ; copy ( huc . getInputStream ( ) , fos ) ; // attempt to download checksum
String checksum = null ; final String checksumLocation = url . toString ( ) + SHA256_EXTENSION ; HttpURLConnection chksum = null ; BufferedReader br = null ; try { URL checksumUrl = new URL ( checksumLocation ) ; chksum = ( HttpURLConnection ) checksumUrl . openConnection ( ) ; chksum . setConnectTimeout ( CONNECTION_TIMEOUT ) ; chksum . setInstanceFollowRedirects ( true ) ; br = new BufferedReader ( new InputStreamReader ( chksum . getInputStream ( ) ) ) ; checksum = br . readLine ( ) ; } catch ( IOException e ) { // checksum is optional , so do not propogate exception
} finally { closeQuietly ( br ) ; } return new DownloadFile ( new File ( downloadFile ) , checksum ) ; } finally { if ( huc != null ) { closeQuietly ( huc . getInputStream ( ) ) ; } closeQuietly ( fos ) ; } |
public class ImgUtil { /** * 写出图像为目标文件扩展名对应的格式
* @ param image { @ link Image }
* @ param targetFile 目标文件
* @ throws IORuntimeException IO异常
* @ since 3.1.0 */
public static void write ( Image image , File targetFile ) throws IORuntimeException { } } | ImageOutputStream out = null ; try { out = getImageOutputStream ( targetFile ) ; write ( image , FileUtil . extName ( targetFile ) , out ) ; } finally { IoUtil . close ( out ) ; } |
public class BaseBot { /** * Search for a method whose { @ link Controller # pattern ( ) } match with the { @ code Event } text or payload
* received from Slack / Facebook and also filter out the methods in { @ code methodWrappers } whose
* { @ link Controller # pattern ( ) } do not match .
* @ param text is the message from the user
* @ param methodWrappers
* @ return the MethodWrapper whose method pattern match with that of the slack message received , { @ code null } if no
* such method is found . */
protected MethodWrapper getMethodWithMatchingPatternAndFilterUnmatchedMethods ( String text , List < MethodWrapper > methodWrappers ) { } } | if ( methodWrappers != null ) { Iterator < MethodWrapper > listIterator = methodWrappers . listIterator ( ) ; while ( listIterator . hasNext ( ) ) { MethodWrapper methodWrapper = listIterator . next ( ) ; String pattern = methodWrapper . getPattern ( ) ; int patternFlags = methodWrapper . getPatternFlags ( ) ; if ( ! StringUtils . isEmpty ( pattern ) ) { if ( StringUtils . isEmpty ( text ) ) { listIterator . remove ( ) ; continue ; } Pattern p = Pattern . compile ( pattern , patternFlags ) ; Matcher m = p . matcher ( text ) ; if ( m . find ( ) ) { methodWrapper . setMatcher ( m ) ; return methodWrapper ; } else { listIterator . remove ( ) ; // remove methods from the original list whose pattern do not match
} } } } return null ; |
public class Interval { /** * Gets the gap between this interval and another interval .
* The other interval can be either before or after this interval .
* Intervals are inclusive of the start instant and exclusive of the end .
* An interval has a gap to another interval if there is a non - zero
* duration between them . This method returns the amount of the gap only
* if the intervals do actually have a gap between them .
* If the intervals overlap or abut , then null is returned .
* When two intervals are compared the result is one of three states :
* ( a ) they abut , ( b ) there is a gap between them , ( c ) they overlap .
* The abuts state takes precedence over the other two , thus a zero duration
* interval at the start of a larger interval abuts and does not overlap .
* The chronology of the returned interval is the same as that of
* this interval ( the chronology of the interval parameter is not used ) .
* Note that the use of the chronology was only correctly implemented
* in version 1.3.
* @ param interval the interval to examine , null means now
* @ return the gap interval , null if no gap
* @ since 1.1 */
public Interval gap ( ReadableInterval interval ) { } } | interval = DateTimeUtils . getReadableInterval ( interval ) ; long otherStart = interval . getStartMillis ( ) ; long otherEnd = interval . getEndMillis ( ) ; long thisStart = getStartMillis ( ) ; long thisEnd = getEndMillis ( ) ; if ( thisStart > otherEnd ) { return new Interval ( otherEnd , thisStart , getChronology ( ) ) ; } else if ( otherStart > thisEnd ) { return new Interval ( thisEnd , otherStart , getChronology ( ) ) ; } else { return null ; } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcGlobalOrLocalEnum ( ) { } } | if ( ifcGlobalOrLocalEnumEEnum == null ) { ifcGlobalOrLocalEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 845 ) ; } return ifcGlobalOrLocalEnumEEnum ; |
public class CrawlerPack { /** * Creates a cookie with the given name , value , domain attribute ,
* path attribute , expiration attribute , and secure attribute
* @ param name the cookie name
* @ param value the cookie value
* @ param domain the domain this cookie can be sent to
* @ param path the path prefix for which this cookie can be sent
* @ param expires the { @ link Date } at which this cookie expires ,
* or < tt > null < / tt > if the cookie expires at the end
* of the session
* @ param secure if true this cookie can only be sent over secure
* connections */
public CrawlerPack addCookie ( String domain , String name , String value , String path , Date expires , boolean secure ) { } } | if ( null == name ) { log . warn ( "addCookie: Cookie name null." ) ; return this ; } cookies . add ( new Cookie ( domain , name , value , path , expires , secure ) ) ; return this ; |
public class Java8 { /** * Programmatic emulation of INVOKEDYNAMIC so initialize the callsite via use of the bootstrap method then invoke
* the result .
* @ param executorClass the executor that will contain the lambda function , null if not yet reloaded
* @ param handle bootstrap method handle
* @ param bsmArgs bootstrap method arguments
* @ param lookup The MethodHandles . Lookup object that can be used to find types
* @ param indyNameAndDescriptor Method name and descriptor at invokedynamic site
* @ param indyParams parameters when the invokedynamic call is made
* @ return the result of the invokedynamic call */
public static Object emulateInvokeDynamic ( ReloadableType rtype , Class < ? > executorClass , Handle handle , Object [ ] bsmArgs , Object lookup , String indyNameAndDescriptor , Object [ ] indyParams ) { } } | try { CallSite callsite = callLambdaMetaFactory ( rtype , bsmArgs , lookup , indyNameAndDescriptor , executorClass ) ; return callsite . dynamicInvoker ( ) . invokeWithArguments ( indyParams ) ; } catch ( Throwable t ) { throw new RuntimeException ( t ) ; } |
public class EventPointImpl { /** * / * ( non - Javadoc )
* @ see org . jboss . arquillian . api . InjectionPoint # set ( org . jboss . arquillian . api . Instance ) */
@ Override public void set ( Event < ? > value ) throws InvocationException { } } | try { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; } field . set ( target , value ) ; } catch ( Exception e ) { throw new InvocationException ( e ) ; } |
public class CommercePriceEntryLocalServiceUtil { /** * Returns the commerce price entry matching the UUID and group .
* @ param uuid the commerce price entry ' s UUID
* @ param groupId the primary key of the group
* @ return the matching commerce price entry
* @ throws PortalException if a matching commerce price entry could not be found */
public static com . liferay . commerce . price . list . model . CommercePriceEntry getCommercePriceEntryByUuidAndGroupId ( String uuid , long groupId ) throws com . liferay . portal . kernel . exception . PortalException { } } | return getService ( ) . getCommercePriceEntryByUuidAndGroupId ( uuid , groupId ) ; |
public class FileMgr { /** * Returns the number of blocks in the specified file .
* @ param fileName
* the name of the file
* @ return the number of blocks in the file */
public long size ( String fileName ) { } } | try { IoChannel fileChannel = getFileChannel ( fileName ) ; return fileChannel . size ( ) / BLOCK_SIZE ; } catch ( IOException e ) { throw new RuntimeException ( "cannot access " + fileName ) ; } |
public class OmsRasterReader { /** * Utility method to quickly read a grid in default mode .
* @ param path the path to the file .
* @ return the read coverage .
* @ throws Exception */
public static GridCoverage2D readRaster ( String path ) throws Exception { } } | OmsRasterReader reader = new OmsRasterReader ( ) ; reader . file = path ; reader . process ( ) ; GridCoverage2D geodata = reader . outRaster ; return geodata ; |
public class Sources { /** * Returns the given source as a { @ link Properties }
* @ param contextClass
* @ param resourceName
* @ return
* @ throws IOException */
public static Properties asProperties ( Class < ? > contextClass , String resourceName ) throws IOException { } } | Closer closer = Closer . create ( ) ; try { Properties p = new Properties ( ) ; p . load ( closer . register ( asCharSource ( contextClass , resourceName ) . openStream ( ) ) ) ; return p ; } catch ( Throwable e ) { throw closer . rethrow ( e ) ; } finally { closer . close ( ) ; } |
public class CmsCmisRelationHelper { /** * Fills in an ObjectData record . < p >
* @ param context the call context
* @ param cms the CMS context
* @ param resource the resource for which we want the ObjectData
* @ param relation the relation object
* @ param filter the property filter string
* @ param includeAllowableActions true if the allowable actions should be included
* @ param includeAcl true if the ACL entries should be included
* @ return the object data */
protected ObjectData collectObjectData ( CmsCmisCallContext context , CmsObject cms , CmsResource resource , CmsRelation relation , Set < String > filter , boolean includeAllowableActions , boolean includeAcl ) { } } | ObjectDataImpl result = new ObjectDataImpl ( ) ; ObjectInfoImpl objectInfo = new ObjectInfoImpl ( ) ; result . setProperties ( collectProperties ( cms , resource , relation , filter , objectInfo ) ) ; if ( includeAllowableActions ) { result . setAllowableActions ( collectAllowableActions ( cms , resource , relation ) ) ; } if ( includeAcl ) { result . setAcl ( collectAcl ( cms , resource , true ) ) ; result . setIsExactAcl ( Boolean . FALSE ) ; } if ( context . isObjectInfoRequired ( ) ) { objectInfo . setObject ( result ) ; context . getObjectInfoHandler ( ) . addObjectInfo ( objectInfo ) ; } return result ; |
public class DynamicReportBuilder { /** * Because the groups are not created until we call the " build ( ) " method ,
* all the subreports that must go inside a group are handled here . */
protected void addSubreportsToGroups ( ) { } } | for ( Integer groupNum : groupFooterSubreports . keySet ( ) ) { List < Subreport > list = groupFooterSubreports . get ( groupNum ) ; DJGroup group = report . getColumnsGroups ( ) . get ( groupNum - 1 ) ; group . getFooterSubreports ( ) . addAll ( list ) ; } for ( Integer groupNum : groupHeaderSubreports . keySet ( ) ) { List < Subreport > list = groupHeaderSubreports . get ( groupNum ) ; DJGroup group = report . getColumnsGroups ( ) . get ( groupNum - 1 ) ; group . getHeaderSubreports ( ) . addAll ( list ) ; } |
public class LogSignAlgebra { /** * Gets the compacted version from the sign and natural log . */
public static final double compact ( long sign , double natlog ) { } } | return Double . longBitsToDouble ( sign | ( FLOAT_MASK & Double . doubleToRawLongBits ( natlog ) ) ) ; |
public class QYMenuAPI { /** * 创建自定义菜单 。
* @ param menu 自定义菜单
* @ param agentId 需要生成菜单的应用ID
* @ return 操作结果 */
public QYResultType create ( QYMenu menu , String agentId ) { } } | BeanUtil . requireNonNull ( menu , "菜单不能为空!" ) ; String url = BASE_API_URL + "cgi-bin/menu/create?access_token=#&agentid=" + agentId ; BaseResponse response = executePost ( url , JSONUtil . toJson ( menu ) ) ; return QYResultType . get ( response . getErrcode ( ) ) ; |
public class NodeEntryImpl { /** * Extract a username from a " username @ hostname " pattern .
* @ param hostname value
* @ return username extracted , or null */
public static String extractUserName ( final String hostname ) { } } | if ( containsUserName ( hostname ) ) { return hostname . substring ( 0 , hostname . indexOf ( "@" ) ) ; } else { return null ; } |
public class DCacheBase { /** * enableListener - enable or disable the invalidation , change and preInvalidation listener support . You must call
* enableListener ( true ) before calling addInvalidationListner ( ) , addChangeListener ( ) or
* addPreInvalidationListener ( ) .
* @ param enable
* - true to enable support for invalidation , change and preInvalidation listeners or false to disable
* support for invalidation , change and preInvalidation listeners
* @ return boolean " true " means listener support was successfully enabled or disabled . " false " means this cache is
* configurated to use the listener ' s J2EE context for event notification and the callback registration
* failed . In this case , the caller ' s thread context will be used for event notification . */
public synchronized boolean enableListener ( boolean enable ) { } } | boolean success = true ; if ( enable && eventSource == null ) { success = initEventSource ( ) ; } bEnableListener = enable ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "enableListener() cacheName=" + this . cacheName + " enable=" + enable + " success=" + success + " ignoreValueInInvalidationEvent=" + this . ignoreValueInInvalidationEvent ) ; } return success ; |
public class SegmentsResponse { /** * The list of segments .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setItem ( java . util . Collection ) } or { @ link # withItem ( java . util . Collection ) } if you want to override the
* existing values .
* @ param item
* The list of segments .
* @ return Returns a reference to this object so that method calls can be chained together . */
public SegmentsResponse withItem ( SegmentResponse ... item ) { } } | if ( this . item == null ) { setItem ( new java . util . ArrayList < SegmentResponse > ( item . length ) ) ; } for ( SegmentResponse ele : item ) { this . item . add ( ele ) ; } return this ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.