signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class FileCopyProgressMonitor { /** * Main method to test the monitor . Only for testing purposes . * @ param args * Not used . */ public static void main ( final String [ ] args ) { } }
// This runs in the " main " thread ( outside the EDT ) // Initialize the L & F in a thread safe way Utils4Swing . initSystemLookAndFeel ( ) ; // Create an cancel tracker final Cancelable cancelable = new CancelableVolatile ( ) ; // Create the monitor dialog final FileCopyProgressMonitor monitor = new FileCopyProgressMonitor ( cancelable , "Copy Test" , 10 ) ; // Make the UI visible monitor . open ( ) ; try { // Dummy loop to simulate copy . . . for ( int i = 0 ; i < 10 ; i ++ ) { // Check if the user canceled the copy process if ( cancelable . isCanceled ( ) ) { break ; } // Create a dummy source and target name . . . final int n = i + 1 ; final String fileName = "file" + n + ".jar" ; final int fileSize = n * 10 ; final String sourceFilename = "http://www.fuin.org/demo-app/" + fileName ; final String targetFilename = "/program files/demo app/" + fileName ; // Update the UI with names , count and filesize monitor . updateFile ( sourceFilename , targetFilename , n , fileSize ) ; // Simulate copying a file // Normally this would be done with a // " FileCopyProgressInputStream " for ( int j = 0 ; j < fileSize ; j ++ ) { // Update the lower progress bar monitor . updateByte ( j + 1 ) ; // Sleep to simulate slow copy . . . sleep ( 100 ) ; } } } finally { // Hide the UI monitor . close ( ) ; }
public class CurveArrayPropertyType { /** * Gets the value of the curve property . * This accessor method returns a reference to the live list , * not a snapshot . Therefore any modification you make to the * returned list will be present inside the JAXB object . * This is why there is not a < CODE > set < / CODE > method for the curve property . * For example , to add a new item , do as follows : * < pre > * get _ Curve ( ) . add ( newItem ) ; * < / pre > * Objects of the following type ( s ) are allowed in the list * { @ link JAXBElement } { @ code < } { @ link OrientableCurveType } { @ code > } * { @ link JAXBElement } { @ code < } { @ link LineStringType } { @ code > } * { @ link JAXBElement } { @ code < } { @ link CurveType } { @ code > } * { @ link JAXBElement } { @ code < } { @ link CompositeCurveType } { @ code > } * { @ link JAXBElement } { @ code < } { @ link AbstractCurveType } { @ code > } */ public List < JAXBElement < ? extends AbstractCurveType > > get_Curve ( ) { } }
if ( _Curve == null ) { _Curve = new ArrayList < JAXBElement < ? extends AbstractCurveType > > ( ) ; } return this . _Curve ;
public class DraggableBehavior { /** * Moves the dragging helper so the cursor always appears to drag from the same * position . Coordinates can be given as a hash using a combination of one or two * keys : { top , left , right , bottom } . * @ param cusorAt * @ return instance of the current behavior * @ deprecated will be removed in 1.2 */ @ Deprecated public DraggableBehavior setCursorAt ( CursorAtEnum cusorAt ) { } }
this . options . putLiteral ( "cusorAt" , cusorAt . toString ( ) . toLowerCase ( ) . replace ( '_' , ' ' ) ) ; return this ;
public class NumberExpression { /** * Create a { @ code abs ( this ) } expression * < p > Returns the absolute value of this expression < / p > * @ return abs ( this ) */ public NumberExpression < T > abs ( ) { } }
if ( abs == null ) { abs = Expressions . numberOperation ( getType ( ) , MathOps . ABS , mixin ) ; } return abs ;
public class PhynixxXAResource { /** * called when the current XAresource is expired ( time out occurred ) The * current Impl . does nothing but marked the associated TX as rollback only * The underlying core connection are not treated . . . . * There are two different situation that have to be handled If the * connection expires because of a long running method call the connection * isn ' t treated and the XAResource is marked as rollback only . The rollback * is done by the Transactionmanager . If the TX expires because the * Transactionmanagers doesn ' t answer , the underlying connection is * rolledback and the XAResource is marked as rollback only ( N . B . rolling * back the connection marks the XAResource as heuristically rolled back ) */ public void conditionViolated ( ) { } }
try { if ( this . xaConnection != null ) { XATransactionalBranch < C > transactionalBranch = this . xaConnection . toGlobalTransactionBranch ( ) ; if ( transactionalBranch != null ) { transactionalBranch . setRollbackOnly ( true ) ; } } if ( LOG . isInfoEnabled ( ) ) { String logString = "PhynixxXAResource.expired :: XAResource " + this . getId ( ) + " is expired (time out occurred) and all associated TX are rollbacked " ; LOG . info ( new ConditionViolatedLog ( this . timeoutCondition , logString ) . toString ( ) ) ; } } finally { // no monitoring anymore setTimeOutActive ( false ) ; }
public class MethodDocImpl { /** * Return the class that originally defined the method that * is overridden by the current definition , or null if no * such class exists . * @ return a ClassDocImpl representing the superclass that * originally defined this method , null if this method does * not override a definition in a superclass . */ public ClassDoc overriddenClass ( ) { } }
com . sun . javadoc . Type t = overriddenType ( ) ; return ( t != null ) ? t . asClassDoc ( ) : null ;
public class CmsSitemapTreeController { /** * If the given resource is the default file of a sitmeap entry folder , then returns that * folder , else the original file . < p > * @ param resource a resource * @ return the resource or its parent folder */ protected CmsResource readSitemapEntryFolderIfPossible ( CmsResource resource ) { } }
CmsObject cms = A_CmsUI . getCmsObject ( ) ; try { if ( resource . isFolder ( ) ) { return resource ; } CmsResource parent = cms . readParentFolder ( resource . getStructureId ( ) ) ; CmsResource defaultFile = cms . readDefaultFile ( parent , CmsResourceFilter . IGNORE_EXPIRATION ) ; if ( ( defaultFile != null ) && defaultFile . equals ( resource ) ) { return parent ; } return resource ; } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; return resource ; }
public class FessLoginAssist { @ Override protected void resolveCredential ( final CredentialResolver resolver ) { } }
resolver . resolve ( LocalUserCredential . class , credential -> { final LocalUserCredential userCredential = credential ; final String username = userCredential . getUser ( ) ; final String password = userCredential . getPassword ( ) ; if ( ! fessConfig . isAdminUser ( username ) ) { final OptionalEntity < FessUser > ldapUser = ComponentUtil . getLdapManager ( ) . login ( username , password ) ; if ( ldapUser . isPresent ( ) ) { return ldapUser ; } } return doFindLoginUser ( username , encryptPassword ( password ) ) ; } ) ; final LoginCredentialResolver loginResolver = new LoginCredentialResolver ( resolver ) ; for ( final SsoAuthenticator auth : ComponentUtil . getSsoManager ( ) . getAuthenticators ( ) ) { auth . resolveCredential ( loginResolver ) ; }
public class Parsers { /** * A { @ link Parser } that sequentially runs { @ code parsers } one by one and collects the return * values in an array . */ public static Parser < Object [ ] > array ( final Parser < ? > ... parsers ) { } }
return new Parser < Object [ ] > ( ) { @ Override boolean apply ( ParseContext ctxt ) { Object [ ] ret = new Object [ parsers . length ] ; for ( int i = 0 ; i < parsers . length ; i ++ ) { Parser < ? > parser = parsers [ i ] ; if ( ! parser . apply ( ctxt ) ) return false ; ret [ i ] = parser . getReturn ( ctxt ) ; } ctxt . result = ret ; return true ; } @ Override public String toString ( ) { return "array" ; } } ;
public class XmlRpcDataMarshaller { /** * < p > toRequirementSummary . < / p > * @ param xmlRpcParameters a { @ link java . util . Vector } object . * @ return a { @ link com . greenpepper . server . domain . RequirementSummary } object . */ public static RequirementSummary toRequirementSummary ( Vector < Object > xmlRpcParameters ) { } }
RequirementSummary summary = new RequirementSummary ( ) ; summary . setReferencesSize ( ( Integer ) xmlRpcParameters . get ( SUMMARY_REFERENCES_IDX ) ) ; summary . setFailures ( ( Integer ) xmlRpcParameters . get ( SUMMARY_FAILIURES_IDX ) ) ; summary . setErrors ( ( Integer ) xmlRpcParameters . get ( SUMMARY_ERRORS_IDX ) ) ; summary . setSuccess ( ( Integer ) xmlRpcParameters . get ( SUMMARY_SUCCESS_IDX ) ) ; summary . setExceptions ( ( Integer ) xmlRpcParameters . get ( SUMMARY_EXCEPTION_IDX ) ) ; return summary ;
public class ReadWriteLockPoint { /** * To call when a thread wants to enter write mode . * If write can start immediately , this method returns null . * If the lock point is used in read mode , this method will return a SynchronizationPoint unblocked when write can start . */ public SynchronizationPoint < NoException > startWriteAsync ( boolean returnNullIfReady ) { } }
SynchronizationPoint < NoException > sp ; synchronized ( this ) { // if nobody is using the resource , we can start writing if ( readers == 0 && ! writer ) { writer = true ; return returnNullIfReady ? null : new SynchronizationPoint < > ( true ) ; } // someone is doing something , we need to block sp = new SynchronizationPoint < NoException > ( ) ; if ( writersWaiting == null ) writersWaiting = new LinkedList < > ( ) ; writersWaiting . add ( sp ) ; } return sp ;
public class DefaultRenditionHandler { /** * Checks if the media args contain any with / height restriction , that means a rendition matching * the given size constraints is requested . Additionally it is checked that at least one image file * extension is requested . * @ param mediaArgs Media arguments * @ return true if any size restriction was defined . */ private boolean isSizeMatchingRequest ( MediaArgs mediaArgs , String [ ] requestedFileExtensions ) { } }
// check that at least one image file extension is in the list of requested extensions boolean anyImageFileExtension = false ; for ( String fileExtension : requestedFileExtensions ) { if ( FileExtension . isImage ( fileExtension ) ) { anyImageFileExtension = true ; } } if ( ! anyImageFileExtension && mediaArgs . getFixedWidth ( ) == 0 && mediaArgs . getFixedHeight ( ) == 0 ) { return false ; } // check for size restriction if ( mediaArgs . getFixedWidth ( ) > 0 || mediaArgs . getFixedHeight ( ) > 0 ) { return true ; } Boolean isSizeMatchingMediaFormat = visitMediaFormats ( mediaArgs , new MediaFormatVisitor < Boolean > ( ) { @ Override public Boolean visit ( MediaFormat mediaFormat ) { if ( mediaFormat . getEffectiveMinWidth ( ) > 0 || mediaFormat . getEffectiveMaxWidth ( ) > 0 || mediaFormat . getEffectiveMinHeight ( ) > 0 || mediaFormat . getEffectiveMaxHeight ( ) > 0 || mediaFormat . getRatio ( ) > 0 ) { return true ; } return null ; } } ) ; return isSizeMatchingMediaFormat != null && isSizeMatchingMediaFormat . booleanValue ( ) ;
public class FSElsewhere { private Path getHost ( String id , long version ) { } }
Path ret = root ; for ( String part : id . split ( "-" ) ) { ret = ret . resolve ( part ) ; } return ret . resolve ( "" + version ) ;
public class ZScreenField { /** * Display this screen ' s hidden params . * @ param out The html out stream . * @ exception DBException File exception . */ public Map < String , Object > getHiddenParams ( ) { } }
Map < String , Object > mapParams = this . getScreenField ( ) . getBasePanel ( ) . getHiddenParams ( ) ; String strParamRecord = this . getProperty ( DBParams . RECORD ) ; // Display record if ( strParamRecord == null ) strParamRecord = Constants . BLANK ; String strParamScreen = this . getProperty ( DBParams . SCREEN ) ; // Display screen if ( strParamScreen == null ) strParamScreen = Constants . BLANK ; String strParamForms = this . getProperty ( HtmlConstants . FORMS ) ; // Display record if ( ( strParamForms == null ) || ( strParamForms . length ( ) == 0 ) ) { strParamForms = Constants . BLANK ; if ( this . getScreenField ( ) . isToolbar ( ) ) if ( ( ! ( this . getScreenField ( ) instanceof DisplayToolbar ) ) && ( ! ( this . getScreenField ( ) instanceof MaintToolbar ) ) && ( ! ( this . getScreenField ( ) instanceof MenuToolbar ) ) && ( ! ( this . getScreenField ( ) instanceof HelpToolbar ) ) ) strParamForms = HtmlConstants . BOTH ; } String strTrxID = this . getProperty ( TrxMessageHeader . LOG_TRX_ID ) ; Record record = ( ( BasePanel ) this . getScreenField ( ) ) . getMainRecord ( ) ; String strRecord = strParamRecord ; if ( record != null ) strRecord = record . getClass ( ) . getName ( ) . toString ( ) ; if ( strParamRecord . length ( ) > 0 ) if ( ! strRecord . equals ( strParamRecord ) ) strParamScreen = Constants . BLANK ; // Special case - Main rec is not rec passed . if ( mapParams . get ( DBParams . RECORD ) == null ) mapParams . put ( DBParams . RECORD , strRecord ) ; if ( mapParams . get ( DBParams . SCREEN ) == null ) mapParams . put ( DBParams . SCREEN , strParamScreen ) ; if ( strParamForms . equalsIgnoreCase ( HtmlConstants . INPUT ) ) strParamForms = HtmlConstants . DATA ; String strDefaultFormParam = this . getDefaultFormsParam ( ) ; if ( strDefaultFormParam != null ) strParamForms = strDefaultFormParam ; if ( mapParams . get ( HtmlConstants . FORMS ) == null ) mapParams . put ( HtmlConstants . FORMS , strParamForms ) ; if ( strTrxID != null ) if ( mapParams . get ( TrxMessageHeader . LOG_TRX_ID ) == null ) mapParams . put ( TrxMessageHeader . LOG_TRX_ID , strTrxID ) ; if ( record != null ) if ( ( record . getEditMode ( ) == Constants . EDIT_IN_PROGRESS ) || ( record . getEditMode ( ) == Constants . EDIT_CURRENT ) ) { try { String strBookmark = record . getHandle ( DBConstants . OBJECT_ID_HANDLE ) . toString ( ) ; if ( mapParams . get ( DBConstants . STRING_OBJECT_ID_HANDLE ) == null ) mapParams . put ( DBConstants . STRING_OBJECT_ID_HANDLE , URLEncoder . encode ( strBookmark , DBConstants . URL_ENCODING ) ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; } catch ( java . io . UnsupportedEncodingException ex ) { ex . printStackTrace ( ) ; } } return mapParams ;
public class GeometryUtil { /** * Translates a molecule from the origin to a new point denoted by a vector . See comment for * center ( IAtomContainer atomCon , Dimension areaDim , HashMap renderingCoordinates ) for details * on coordinate sets * @ param atomCon molecule to be translated * @ param p Description of the Parameter */ public static void translate2DCentreOfMassTo ( IAtomContainer atomCon , Point2d p ) { } }
Point2d com = get2DCentreOfMass ( atomCon ) ; Vector2d translation = new Vector2d ( p . x - com . x , p . y - com . y ) ; for ( IAtom atom : atomCon . atoms ( ) ) { if ( atom . getPoint2d ( ) != null ) { atom . getPoint2d ( ) . add ( translation ) ; } }
public class TokenNode { /** * tags */ public void add ( char c ) { } }
if ( c > 0 ) { if ( chars . length ( ) == 0 ) { ContentNode co = new ContentNode ( ) ; addChild ( co ) ; co . chars = chars ; } chars . append ( c ) ; }
public class AxisSplitterMedian { /** * Select the maximum variance as the split */ private void computeAxisVariance ( List < P > points ) { } }
int numPoints = points . size ( ) ; for ( int i = 0 ; i < N ; i ++ ) { mean [ i ] = 0 ; var [ i ] = 0 ; } // compute the mean for ( int i = 0 ; i < numPoints ; i ++ ) { P p = points . get ( i ) ; for ( int j = 0 ; j < N ; j ++ ) { mean [ j ] += distance . valueAt ( p , j ) ; } } for ( int i = 0 ; i < N ; i ++ ) { mean [ i ] /= numPoints ; } // compute the variance * N for ( int i = 0 ; i < numPoints ; i ++ ) { P p = points . get ( i ) ; for ( int j = 0 ; j < N ; j ++ ) { double d = mean [ j ] - distance . valueAt ( p , j ) ; var [ j ] += d * d ; } }
public class FragmentJoiner { /** * Calculate the pairwise compatibility of fpairs . * Iterates through a list of fpairs and joins them if * they have compatible rotation and translation parameters . * @ param fraglst FragmentPair [ ] array * @ param angleDiff angle cutoff * @ param fragCompatDist distance cutoff * @ param maxRefine max number of solutions to keep * @ return JointFragments [ ] */ public JointFragments [ ] frag_pairwise_compat ( FragmentPair [ ] fraglst , int angleDiff , float fragCompatDist , int maxRefine ) { } }
FragmentPair [ ] tmpfidx = new FragmentPair [ fraglst . length ] ; for ( int i = 0 ; i < fraglst . length ; i ++ ) { tmpfidx [ i ] = ( FragmentPair ) fraglst [ i ] . clone ( ) ; } int n = tmpfidx . length ; // indicator if a fragment was already used int [ ] used = new int [ n ] ; // the final list of joined fragments stores as apairs List < JointFragments > fll = new ArrayList < JointFragments > ( ) ; double adiff = angleDiff * Math . PI / 180d ; logger . debug ( "addiff" + adiff ) ; // distance between two unit vectors with angle adiff double ddiff = Math . sqrt ( 2.0 - 2.0 * Math . cos ( adiff ) ) ; logger . debug ( "ddiff" + ddiff ) ; // the fpairs in the flist have to be sorted with respect to their positions while ( tmpfidx . length > 0 ) { int i = 0 ; int j = 1 ; used [ i ] = 1 ; JointFragments f = new JointFragments ( ) ; int p1i = tmpfidx [ i ] . getPos1 ( ) ; int p1j = tmpfidx [ i ] . getPos2 ( ) ; int maxi = p1i + tmpfidx [ i ] . getLength ( ) ; f . add ( p1i , p1j , 0 , tmpfidx [ i ] . getLength ( ) ) ; n = tmpfidx . length ; while ( j < n ) { int p2i = tmpfidx [ j ] . getPos1 ( ) ; int p2j = tmpfidx [ j ] . getPos2 ( ) ; int l2 = tmpfidx [ j ] . getLength ( ) ; if ( p2i > maxi ) { double dist = Calc . getDistance ( tmpfidx [ i ] . getUnitv ( ) , tmpfidx [ j ] . getUnitv ( ) ) ; if ( dist < ddiff ) { // centroids have to be closer than fragCompatDist double dd = Calc . getDistance ( tmpfidx [ i ] . getCenter1 ( ) , tmpfidx [ j ] . getCenter1 ( ) ) - Calc . getDistance ( tmpfidx [ i ] . getCenter2 ( ) , tmpfidx [ j ] . getCenter2 ( ) ) ; if ( dd < 0 ) dd = - dd ; if ( dd < fragCompatDist ) { maxi = p2i + l2 ; used [ j ] = 1 ; f . add ( p2i , p2j , 0 , tmpfidx [ j ] . getLength ( ) ) ; } } } j += 1 ; } int red = 0 ; for ( int k = 0 ; k < n ; k ++ ) { if ( used [ k ] == 0 ) { tmpfidx [ red ] = tmpfidx [ k ] ; red += 1 ; } } used = new int [ n ] ; tmpfidx = ( FragmentPair [ ] ) resizeArray ( tmpfidx , red ) ; fll . add ( f ) ; } Comparator < JointFragments > comp = new JointFragmentsComparator ( ) ; Collections . sort ( fll , comp ) ; Collections . reverse ( fll ) ; int m = Math . min ( maxRefine , fll . size ( ) ) ; List < JointFragments > retlst = new ArrayList < JointFragments > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { JointFragments jf = fll . get ( i ) ; retlst . add ( jf ) ; } return retlst . toArray ( new JointFragments [ retlst . size ( ) ] ) ;
public class MulticoreExecutor { /** * Creates the worker thread pool . */ private static void createThreadPool ( ) { } }
if ( nprocs == - 1 ) { int n = - 1 ; try { String env = System . getProperty ( "smile.threads" ) ; if ( env != null ) { n = Integer . parseInt ( env ) ; } } catch ( Exception ex ) { logger . error ( "Failed to create multi-core execution thread pool" , ex ) ; } if ( n < 1 ) { nprocs = Runtime . getRuntime ( ) . availableProcessors ( ) ; } else { nprocs = n ; } if ( nprocs > 1 ) { threads = ( ThreadPoolExecutor ) Executors . newFixedThreadPool ( nprocs , new SimpleDeamonThreadFactory ( ) ) ; } }
public class BufferedIterator { /** * Returns an list of the next tokens in the stream based on the requested * amount . If the stream did not contain as many tokens as was requested , * list will contain the remaining tokens , but will not throw an { @ code * NoSuchElementException } . * @ param tokens the number of tokens to access in the stream * @ return a list of the requested tokens or the remaining tokens in the * stream , whichever is fewer */ public List < String > peek ( int tokens ) { } }
advance ( tokens ) ; return new ArrayList < String > ( buffer . subList ( 0 , Math . min ( tokens , buffer . size ( ) ) ) ) ;
public class JSMessageImpl { /** * concurrency issues . Called by setCaseChain ( ) & assembledForField ( ) . */ private boolean setDominatingCases ( JSType field ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "setDominatingCases" , new Object [ ] { field } ) ; field = findDominatingCase ( field ) ; JSVariant parent = ( JSVariant ) field . getParent ( ) ; if ( parent == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "setDominatingCases" , Boolean . FALSE ) ; return false ; } boolean result = setCaseChain ( parent . getIndex ( ) , field . getSiblingPosition ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "setDominatingCases" , Boolean . valueOf ( result ) ) ; return result ;
public class ServerLogReaderPreTransactional { /** * Sets the current position of the input stream , after a * transaction has been successfully consumed . * @ throws IOException if a fatal error occurred . */ private void updateStreamPosition ( ) throws IOException { } }
try { editLogFilePosition = inputStream . getPosition ( ) ; } catch ( IOException e ) { LOG . error ( "Failed to get edit log file position" , e ) ; throw new IOException ( "updateStreamPosition failed" ) ; }
public class DocumentService { /** * RPC : TIU GET RECORD TEXT * < pre > * Get the textual portion of a TIU Document . * Input parameters : * IEN - IEN [ 8925 ] in the TIU Document file . * ACTION - Defaults to VIEW . . 01 Field for file USR ACTION . * Return format : * An array of text . * Example ( partial ) : * Dest [ 0 ] = TITLE : PC ACUTE CARE VISIT * Dest [ 1 ] = DATE OF NOTE : DEC 17 , 2004@11:05 ENTRY DATE : DEC 17,2004@11:05:28 * Dest [ 2 ] = AUTHOR : HAGER , MARY G EXP COSIGNER : * Dest [ 3 ] = URGENCY : STATUS : COMPLETED * Dest [ 4 ] = * Dest [ 5 ] = 12/16/04 16:14 * Dest [ 6 ] = * Dest [ 7 ] = Patient is a 49 year old MALE * Dest [ 8 ] = * Dest [ 9 ] = Vitals : * Dest [ 10 ] = WT : 240 ( 108 kg ) , HT : 70 ( 177 cm ) , TMP : 98.6 ( 37 C ) , BP : 140/90 , PU : 80 , RS : 16, * Dest [ 11 ] = PA : 0 * < / pre > * @ param documents Documents for which to retrieve contents . */ public void retrieveContents ( List < Document > documents ) { } }
for ( Document doc : documents ) { if ( doc . getBody ( ) == null ) { List < String > body = broker . callRPCList ( "TIU GET RECORD TEXT" , null , doc . getId ( ) . getIdPart ( ) ) ; doc . setBody ( StrUtil . fromList ( body ) ) ; } }
public class SymbolTable { /** * Method called when copy - on - write is needed ; generally when first * change is made to a derived symbol table . */ private void copyArrays ( ) { } }
String [ ] oldSyms = mSymbols ; int size = oldSyms . length ; mSymbols = new String [ size ] ; System . arraycopy ( oldSyms , 0 , mSymbols , 0 , size ) ; Bucket [ ] oldBuckets = mBuckets ; size = oldBuckets . length ; mBuckets = new Bucket [ size ] ; System . arraycopy ( oldBuckets , 0 , mBuckets , 0 , size ) ;
public class ApiOvhOrder { /** * Get prices and contracts information * REST : GET / order / dedicatedCloud / { serviceName } / vdi * @ param secondPublicIpAddress [ required ] Another avaiable ip from one of your Private Cloud public IP blocks * @ param firstPublicIpAddress [ required ] An avaiable ip from one of your Private Cloud public IP blocks * @ param datacenterId [ required ] Datacenter where the VDI option will be enabled * @ param serviceName [ required ] * API beta */ public OvhOrder dedicatedCloud_serviceName_vdi_GET ( String serviceName , Long datacenterId , String firstPublicIpAddress , String secondPublicIpAddress ) throws IOException { } }
String qPath = "/order/dedicatedCloud/{serviceName}/vdi" ; StringBuilder sb = path ( qPath , serviceName ) ; query ( sb , "datacenterId" , datacenterId ) ; query ( sb , "firstPublicIpAddress" , firstPublicIpAddress ) ; query ( sb , "secondPublicIpAddress" , secondPublicIpAddress ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhOrder . class ) ;
public class MaterialAPI { /** * 新增其他类型永久素材 * @ param access _ token access _ token * @ param mediaType mediaType * @ param media 多媒体文件有格式和大小限制 , 如下 : * 图片 ( image ) : 2M , 支持bmp / png / jpeg / jpg / gif格式 * 语音 ( voice ) : 5M , 播放长度不超过60s , 支持AMR \ MP3格式 * 视频 ( video ) : 10MB , 支持MP4格式 * 缩略图 ( thumb ) : 64KB , 支持JPG格式 * @ param description 视频文件类型额外字段 , 其它类型不用添加 * @ return Media */ public static Media add_material ( String access_token , MediaType mediaType , File media , Description description ) { } }
HttpPost httpPost = new HttpPost ( BASE_URI + "/cgi-bin/material/add_material" ) ; FileBody bin = new FileBody ( media ) ; MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder . create ( ) . addPart ( "media" , bin ) ; if ( description != null ) { multipartEntityBuilder . addTextBody ( "description" , JsonUtil . toJSONString ( description ) , ContentType . create ( "text/plain" , Charset . forName ( "utf-8" ) ) ) ; } HttpEntity reqEntity = multipartEntityBuilder . addTextBody ( PARAM_ACCESS_TOKEN , API . accessToken ( access_token ) ) . addTextBody ( "type" , mediaType . uploadType ( ) ) . build ( ) ; httpPost . setEntity ( reqEntity ) ; return LocalHttpClient . executeJsonResult ( httpPost , Media . class ) ;
public class WTable { /** * Retrieves the constraints for the given action . * @ param button the button to retrieve the constraints for . * @ return the constraints for the given action , or null if there are no constraints . */ public List < ActionConstraint > getActionConstraints ( final WButton button ) { } }
List < ActionConstraint > constraints = getComponentModel ( ) . actionConstraints . get ( button ) ; return constraints == null ? null : Collections . unmodifiableList ( constraints ) ;
public class DirectoryScanner { /** * Do we have to traverse a symlink when trying to reach path from * basedir ? * @ param base base File ( dir ) . * @ param path file path . * @ since Ant 1.6 */ private boolean isSymlink ( File base , String path ) { } }
return isSymlink ( base , SelectorUtils . tokenizePath ( path ) ) ;
public class ContentPackage { /** * If path parts contain namespace definitions they need to be escaped for the ZIP file . * Example : oak : index - > jcr _ root / _ oak _ index * @ param path Path * @ return Safe path */ @ VisibleForTesting static String buildJcrPathForZip ( final String path ) { } }
String normalizedPath = StringUtils . defaultString ( path ) ; if ( ! normalizedPath . startsWith ( "/" ) ) { normalizedPath = "/" + normalizedPath ; } return ROOT_DIR + PlatformNameFormat . getPlatformPath ( normalizedPath ) ;
public class SessionStateEventDispatcher { /** * Method sessionAttributeSet * @ see com . ibm . wsspi . session . ISessionStateObserver # sessionAttributeSet ( com . ibm . wsspi . session . ISession , java . lang . Object , java . lang . Object , java . lang . Object ) */ public void sessionAttributeSet ( ISession source , Object key , Object oldValue , Boolean oldIsListener , Object newValue , Boolean newIsListener ) { } }
// ArrayList sessionStateObservers = null ; /* * Check to see if there is a non - empty list of sessionStateObservers . */ if ( _sessionStateObservers == null || _sessionStateObservers . size ( ) < 1 ) { return ; } // synchronized ( _ sessionStateObservers ) { // sessionStateObservers = ( ArrayList ) _ sessionStateObservers . clone ( ) ; ISessionStateObserver sessionStateObserver = null ; for ( int i = 0 ; i < _sessionStateObservers . size ( ) ; i ++ ) { sessionStateObserver = ( ISessionStateObserver ) _sessionStateObservers . get ( i ) ; sessionStateObserver . sessionAttributeSet ( source , key , oldValue , oldIsListener , newValue , newIsListener ) ; }
public class CmsClientUgcSession { /** * Initializes the form belonging to this session . < p > * @ param formElement the form element */ @ NoExport public void initFormElement ( Element formElement ) { } }
m_formWrapper = new CmsUgcWrapper ( formElement , getSessionId ( ) ) ; m_formWrapper . setFormSession ( this ) ;
public class TaskManager { /** * Find out the TaskManager ' s own IP address . */ private InetAddress getTaskManagerAddress ( InetSocketAddress jobManagerAddress ) throws IOException { } }
AddressDetectionState strategy = AddressDetectionState . ADDRESS ; while ( true ) { Enumeration < NetworkInterface > e = NetworkInterface . getNetworkInterfaces ( ) ; while ( e . hasMoreElements ( ) ) { NetworkInterface n = e . nextElement ( ) ; Enumeration < InetAddress > ee = n . getInetAddresses ( ) ; while ( ee . hasMoreElements ( ) ) { InetAddress i = ee . nextElement ( ) ; switch ( strategy ) { case ADDRESS : if ( hasCommonPrefix ( jobManagerAddress . getAddress ( ) . getAddress ( ) , i . getAddress ( ) ) ) { if ( tryToConnect ( i , jobManagerAddress , strategy . getTimeout ( ) ) ) { LOG . info ( "Determined " + i + " as the TaskTracker's own IP address" ) ; return i ; } } break ; case FAST_CONNECT : case SLOW_CONNECT : boolean correct = tryToConnect ( i , jobManagerAddress , strategy . getTimeout ( ) ) ; if ( correct ) { LOG . info ( "Determined " + i + " as the TaskTracker's own IP address" ) ; return i ; } break ; default : throw new RuntimeException ( "Unkown address detection strategy: " + strategy ) ; } } } // state control switch ( strategy ) { case ADDRESS : strategy = AddressDetectionState . FAST_CONNECT ; break ; case FAST_CONNECT : strategy = AddressDetectionState . SLOW_CONNECT ; break ; case SLOW_CONNECT : throw new RuntimeException ( "The TaskManager failed to detect its own IP address" ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Defaulting to detection strategy " + strategy ) ; } }
public class BaseProxy { /** * Retrieve this record from the key . * @ param strSeekSign Which way to seek null / = matches data also & gt ; , & lt ; , & gt ; = , and & lt ; = . * @ param strKeyArea The name of the key area to seek on . * @ param objKeyData The data for the seek ( The raw data if a single field , a BaseBuffer if multiple ) . * @ returns The record ( as a vector ) if successful , The return code ( as an Boolean ) if not . * @ throws RemoteException TODO * @ exception DBException File exception . */ public Object checkRemoteException ( Object objData ) throws org . jbundle . model . RemoteException { } }
if ( objData instanceof RemoteException ) throw ( RemoteException ) objData ; return objData ;
public class LCharSupplierBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */ @ Nonnull public static LCharSupplier charSupplierFrom ( Consumer < LCharSupplierBuilder > buildingFunction ) { } }
LCharSupplierBuilder builder = new LCharSupplierBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ;
public class CanonicalRequest { /** * Extract parameters from a query string , preserving encoding . * We can ' t use Apache HTTP Client ' s URLEncodedUtils . parse , mainly because * we don ' t want to decode names / values . * @ param rawQuery * the query to parse * @ return The list of parameters , in the order they were found . */ private static List < Parameter > extractQueryParameters ( String rawQuery ) { } }
List < Parameter > results = new ArrayList < > ( ) ; int endIndex = rawQuery . length ( ) - 1 ; int index = 0 ; while ( 0 <= index && index <= endIndex ) { /* * Ideally we should first look for ' & ' , then look for ' = ' before * the ' & ' , but obviously that ' s not how AWS understand query * parsing ; see the test " post - vanilla - query - nonunreserved " in the * test suite . A string such as " ? foo & bar = qux " will be understood as * one parameter with name " foo & bar " and value " qux " . Don ' t ask me * why . */ String name ; String value ; int nameValueSeparatorIndex = rawQuery . indexOf ( QUERY_PARAMETER_VALUE_SEPARATOR , index ) ; if ( nameValueSeparatorIndex < 0 ) { // No value name = rawQuery . substring ( index ) ; value = null ; index = endIndex + 1 ; } else { int parameterSeparatorIndex = rawQuery . indexOf ( QUERY_PARAMETER_SEPARATOR , nameValueSeparatorIndex ) ; if ( parameterSeparatorIndex < 0 ) { parameterSeparatorIndex = endIndex + 1 ; } name = rawQuery . substring ( index , nameValueSeparatorIndex ) ; value = rawQuery . substring ( nameValueSeparatorIndex + 1 , parameterSeparatorIndex ) ; index = parameterSeparatorIndex + 1 ; } results . add ( new Parameter ( name , value ) ) ; } return results ;
public class UrlEncoded { /** * Decoded parameters to Map . * @ param in the stream containing the encoded parameters * @ param map the MultiMap to decode into * @ param charset the charset to use for decoding * @ param maxLength the maximum length of the form to decode * @ param maxKeys the maximum number of keys to decode * @ throws IOException if unable to decode input stream */ public static void decodeTo ( InputStream in , MultiMap < String > map , Charset charset , int maxLength , int maxKeys ) throws IOException { } }
// no charset present , use the configured default if ( charset == null ) charset = ENCODING ; if ( StandardCharsets . UTF_8 . equals ( charset ) ) { decodeUtf8To ( in , map , maxLength , maxKeys ) ; return ; } if ( StandardCharsets . ISO_8859_1 . equals ( charset ) ) { decode88591To ( in , map , maxLength , maxKeys ) ; return ; } if ( StandardCharsets . UTF_16 . equals ( charset ) ) // Should be all 2 byte encodings { decodeUtf16To ( in , map , maxLength , maxKeys ) ; return ; } synchronized ( map ) { String key = null ; String value = null ; int c ; int totalLength = 0 ; try ( ByteArrayOutputStream2 output = new ByteArrayOutputStream2 ( ) ; ) { int size = 0 ; while ( ( c = in . read ( ) ) > 0 ) { switch ( ( char ) c ) { case '&' : size = output . size ( ) ; value = size == 0 ? "" : output . toString ( charset ) ; output . setCount ( 0 ) ; if ( key != null ) { map . add ( key , value ) ; } else if ( value != null && value . length ( ) > 0 ) { map . add ( value , "" ) ; } key = null ; value = null ; if ( maxKeys > 0 && map . size ( ) > maxKeys ) throw new IllegalStateException ( String . format ( "Form with too many keys [%d > %d]" , map . size ( ) , maxKeys ) ) ; break ; case '=' : if ( key != null ) { output . write ( c ) ; break ; } size = output . size ( ) ; key = size == 0 ? "" : output . toString ( charset ) ; output . setCount ( 0 ) ; break ; case '+' : output . write ( ' ' ) ; break ; case '%' : int code0 = in . read ( ) ; int code1 = in . read ( ) ; output . write ( decodeHexChar ( code0 , code1 ) ) ; break ; default : output . write ( c ) ; break ; } totalLength ++ ; if ( maxLength >= 0 && totalLength > maxLength ) throw new IllegalStateException ( "Form is too large" ) ; } size = output . size ( ) ; if ( key != null ) { value = size == 0 ? "" : output . toString ( charset ) ; output . setCount ( 0 ) ; map . add ( key , value ) ; } else if ( size > 0 ) map . add ( output . toString ( charset ) , "" ) ; } }
public class IterableExtensions { /** * Creates a sorted list that contains the items of the given iterable . The resulting list is in ascending order , * according to the natural ordering of the elements in the iterable . * @ param iterable * the items to be sorted . May not be < code > null < / code > . * @ return a sorted list as a shallow copy of the given iterable . * @ see Collections # sort ( List ) * @ see # sort ( Iterable , Comparator ) * @ see # sortBy ( Iterable , org . eclipse . xtext . xbase . lib . Functions . Function1) * @ see ListExtensions # sortInplace ( List ) */ public static < T extends Comparable < ? super T > > List < T > sort ( Iterable < T > iterable ) { } }
List < T > asList = Lists . newArrayList ( iterable ) ; if ( iterable instanceof SortedSet < ? > ) { if ( ( ( SortedSet < T > ) iterable ) . comparator ( ) == null ) { return asList ; } } return ListExtensions . sortInplace ( asList ) ;
public class Task { /** * Continues a task with the equivalent of a Task - based while loop , where the body of the loop is * a task continuation . */ public Task < Void > continueWhile ( final Callable < Boolean > predicate , final Continuation < Void , Task < Void > > continuation , final Executor executor ) { } }
return continueWhile ( predicate , continuation , executor , null ) ;
public class EventClient { /** * Sends an asynchronous create event request to the API . * @ param event an instance of { @ link Event } that will be turned into a request */ public FutureAPIResponse createEventAsFuture ( Event event ) throws IOException { } }
RequestBuilder builder = new RequestBuilder ( "POST" ) ; builder . setUrl ( apiUrl + "/events.json?accessKey=" + accessKey ) ; String requestJsonString = event . toJsonString ( ) ; builder . setBody ( requestJsonString ) ; builder . setHeader ( "Content-Type" , "application/json" ) ; builder . setHeader ( "Content-Length" , "" + requestJsonString . length ( ) ) ; return new FutureAPIResponse ( client . executeRequest ( builder . build ( ) , getHandler ( ) ) ) ;
public class Workflow { /** * Gets and removes all responses for the specified correlation id * < b > Attention < / b > : When a workflow instance is resumed after a < code > Workflow . wait < / code > call , all corresponding * responses for this workflow instance in the storage are read . Each of these responses that you do NOT retrieve * using { @ link Workflow # getAndRemoveResponse ( String ) } or { @ link Workflow # getAndRemoveResponses ( String ) } are * discarded when calling the next < code > Workflow . wait < / code > * @ param correlationId * correlation id for which responses shall be get * @ param < T > * type of data holt in the response * @ return the list of responses or an empty list , if no response for the specified correlation id is found */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) protected < T > List < Response < T > > getAndRemoveResponses ( final String correlationId ) { synchronized ( responseMap ) { final List rv = responseMap . remove ( correlationId ) ; return rv == null ? Collections . emptyList ( ) : new ArrayList ( rv ) ; }
public class PutStatObjectEncrypted { /** * MinioClient . putObject ( ) and MinioClient . statObject ( ) example for SSE _ C . */ public static void main ( String [ ] args ) throws NoSuchAlgorithmException , IOException , InvalidKeyException , XmlPullParserException { } }
try { /* play . min . io for test and development . */ MinioClient minioClient = new MinioClient ( "https://play.min.io:9000" , "Q3AM3UQ867SPQQA43P2F" , "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" ) ; /* Amazon S3: */ // MinioClient minioClient = new MinioClient ( " https : / / s3 . amazonaws . com " , " YOUR - ACCESSKEYID " , // Create some content for the object . StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < 10 ; i ++ ) { builder . append ( "Sphinx of black quartz, judge my vow: Used by Adobe InDesign to display font samples. " ) ; builder . append ( "(29 letters)\n" ) ; builder . append ( "Jackdaws love my big sphinx of quartz: Similarly, used by Windows XP for some fonts. " ) ; builder . append ( "(31 letters)\n" ) ; builder . append ( "Pack my box with five dozen liquor jugs: According to Wikipedia, this one is used on " ) ; builder . append ( "NASAs Space Shuttle. (32 letters)\n" ) ; builder . append ( "The quick onyx goblin jumps over the lazy dwarf: Flavor text from an Unhinged Magic Card. " ) ; builder . append ( "(39 letters)\n" ) ; builder . append ( "How razorback-jumping frogs can level six piqued gymnasts!: Not going to win any brevity " ) ; builder . append ( "awards at 49 letters long, but old-time Mac users may recognize it.\n" ) ; builder . append ( "Cozy lummox gives smart squid who asks for job pen: A 41-letter tester sentence for Mac " ) ; builder . append ( "computers after System 7.\n" ) ; builder . append ( "A few others we like: Amazingly few discotheques provide jukeboxes; Now fax quiz Jack! my " ) ; builder . append ( "brave ghost pled; Watch Jeopardy!, Alex Trebeks fun TV quiz game.\n" ) ; builder . append ( "---\n" ) ; } // Create a InputStream for object upload . ByteArrayInputStream bais = new ByteArrayInputStream ( builder . toString ( ) . getBytes ( "UTF-8" ) ) ; // Generate a new 256 bit AES key - This key must be remembered by the client . KeyGenerator keyGen = KeyGenerator . getInstance ( "AES" ) ; keyGen . init ( 256 ) ; // To test SSE - C ServerSideEncryption sse = ServerSideEncryption . withCustomerKey ( keyGen . generateKey ( ) ) ; minioClient . putObject ( "my-bucketname" , "my-objectname" , bais , bais . available ( ) , sse ) ; bais . close ( ) ; System . out . println ( "my-objectname is encrypted and uploaded successfully" ) ; // Get the metadata of the object . ObjectStat objectStat = minioClient . statObject ( "my-bucketname" , "my-objectname" , sse ) ; System . out . println ( "my-objectname metadata: " ) ; System . out . println ( objectStat ) ; } catch ( MinioException e ) { System . out . println ( "Error occurred: " + e ) ; }
public class AllPageTitles { /** * { @ inheritDoc } */ @ Override protected Iterator < String > copy ( ) { } }
return new AllPageTitles ( bot ( ) , from , prefix , rf , namespaces ) ;
public class CmsResourceUtil { /** * Returns the resource type for the given resource . < p > * @ return the resource type for the given resource */ public I_CmsResourceType getResourceType ( ) { } }
if ( m_resourceType == null ) { m_resourceType = OpenCms . getResourceManager ( ) . getResourceType ( m_resource ) ; } return m_resourceType ;
public class ServerControllerImpl { /** * Build { @ link SSLContext } using arguments only * @ param keystorePath * @ param keystoreType * @ param keystorePassword * @ param keystoreCertAlias * @ param truststorePath * @ param truststoreType * @ param truststorePassword * @ param validateCerts * @ param crlPath * @ param secureRandomAlgorithm * @ param validatePeerCerts * @ param enableCRLDP * @ param enableOCSP * @ param ocspResponderURL * @ return */ private SSLContext buildSSLContext ( String keystorePath , String keystoreType , String keystorePassword , String keystoreKeyPassword , String keystoreCertAlias , String truststorePath , String truststoreType , String truststorePassword , boolean validateCerts , String crlPath , String secureRandomAlgorithm , boolean validatePeerCerts , boolean enableCRLDP , boolean enableOCSP , String ocspResponderURL , String sslKeystoreProvider , String sslTruststoreProvider , String sslProvider ) { } }
try { URL keyStoreURL = loadResource ( keystorePath ) ; KeyStore keyStore = getKeyStore ( keyStoreURL , keystoreType != null ? keystoreType : "JKS" , keystorePassword , sslKeystoreProvider ) ; // key managers String _keyManagerFactoryAlgorithm = Security . getProperty ( "ssl.KeyManagerFactory.algorithm" ) == null ? KeyManagerFactory . getDefaultAlgorithm ( ) : Security . getProperty ( "ssl.KeyManagerFactory.algorithm" ) ; KeyManagerFactory keyManagerFactory = KeyManagerFactory . getInstance ( _keyManagerFactoryAlgorithm ) ; keyManagerFactory . init ( keyStore , keystoreKeyPassword == null ? null : keystoreKeyPassword . toCharArray ( ) ) ; KeyManager [ ] keyManagers = keyManagerFactory . getKeyManagers ( ) ; // trust managers - possibly with OCSP TrustManager [ ] trustManagers = null ; SecureRandom random = ( secureRandomAlgorithm == null ) ? null : SecureRandom . getInstance ( secureRandomAlgorithm ) ; if ( truststorePath != null ) { URL trustStoreURL = loadResource ( truststorePath ) ; KeyStore trustStore = getKeyStore ( trustStoreURL , truststoreType != null ? truststoreType : "JKS" , truststorePassword , sslTruststoreProvider ) ; String _trustManagerFactoryAlgorithm = Security . getProperty ( "ssl.TrustManagerFactory.algorithm" ) == null ? TrustManagerFactory . getDefaultAlgorithm ( ) : Security . getProperty ( "ssl.TrustManagerFactory.algorithm" ) ; Collection < ? extends CRL > crls = crlPath == null ? null : loadCRL ( crlPath ) ; if ( validateCerts && keyStore != null ) { if ( keystoreCertAlias == null ) { List < String > aliases = Collections . list ( keyStore . aliases ( ) ) ; keystoreCertAlias = aliases . size ( ) == 1 ? aliases . get ( 0 ) : null ; } Certificate cert = keystoreCertAlias == null ? null : keyStore . getCertificate ( keystoreCertAlias ) ; if ( cert == null ) { throw new IllegalArgumentException ( "No certificate found in the keystore" + ( keystoreCertAlias == null ? "" : " for alias \"" + keystoreCertAlias + "\"" ) ) ; } CertificateValidator validator = new CertificateValidator ( trustStore , crls ) ; validator . setEnableCRLDP ( enableCRLDP ) ; validator . setEnableOCSP ( enableOCSP ) ; validator . setOcspResponderURL ( ocspResponderURL ) ; validator . validate ( keyStore , cert ) ; } // Revocation checking is only supported for PKIX algorithm // see org . eclipse . jetty . util . ssl . SslContextFactory . getTrustManagers ( ) if ( validatePeerCerts && _trustManagerFactoryAlgorithm . equalsIgnoreCase ( "PKIX" ) ) { PKIXBuilderParameters pbParams = new PKIXBuilderParameters ( trustStore , new X509CertSelector ( ) ) ; // Make sure revocation checking is enabled pbParams . setRevocationEnabled ( true ) ; if ( crls != null && ! crls . isEmpty ( ) ) { pbParams . addCertStore ( CertStore . getInstance ( "Collection" , new CollectionCertStoreParameters ( crls ) ) ) ; } if ( enableCRLDP ) { // Enable Certificate Revocation List Distribution Points ( CRLDP ) support System . setProperty ( "com.sun.security.enableCRLDP" , "true" ) ; } if ( enableOCSP ) { // Enable On - Line Certificate Status Protocol ( OCSP ) support Security . setProperty ( "ocsp.enable" , "true" ) ; if ( ocspResponderURL != null ) { // Override location of OCSP Responder Security . setProperty ( "ocsp.responderURL" , ocspResponderURL ) ; } } TrustManagerFactory trustManagerFactory = TrustManagerFactory . getInstance ( _trustManagerFactoryAlgorithm ) ; trustManagerFactory . init ( new CertPathTrustManagerParameters ( pbParams ) ) ; trustManagers = trustManagerFactory . getTrustManagers ( ) ; } else { TrustManagerFactory trustManagerFactory = TrustManagerFactory . getInstance ( _trustManagerFactoryAlgorithm ) ; trustManagerFactory . init ( trustStore ) ; trustManagers = trustManagerFactory . getTrustManagers ( ) ; } } SSLContext context ; if ( null == sslProvider || sslProvider . isEmpty ( ) ) { context = SSLContext . getInstance ( "TLS" ) ; } else { context = SSLContext . getInstance ( "TLS" , sslProvider ) ; } context . init ( keyManagers , trustManagers , random ) ; return context ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Unable to build SSL context" , e ) ; }
public class WButtonExample { /** * Examples showing use of client only buttons . */ private void addClientOnlyExamples ( ) { } }
// client command button add ( new WHeading ( HeadingLevel . H2 , "Client command buttons" ) ) ; add ( new ExplanatoryText ( "These examples show buttons which do not submit the form" ) ) ; // client command buttons witho a command WButton nothingButton = new WButton ( "Do nothing" ) ; add ( nothingButton ) ; nothingButton . setClientCommandOnly ( true ) ; nothingButton = new WButton ( "Do nothing link" ) ; add ( nothingButton ) ; nothingButton . setRenderAsLink ( true ) ; nothingButton . setClientCommandOnly ( true ) ; // client command buttons with command . HelloButton helloButton = new HelloButton ( "Hello" ) ; add ( helloButton ) ; helloButton = new HelloButton ( "Hello link" ) ; helloButton . setRenderAsLink ( true ) ; add ( helloButton ) ;
public class IssueDescriptionReader { /** * Checks the description version tag . * @ param pIssue * the issue * @ throws IssueParseException * the description version tag doesn ' t describe the expected version * { @ link IssueDescriptionUtils # DESCRIPTION _ VERSION } */ private void checkDescriptionVersion ( final Issue pIssue ) throws IssueParseException { } }
final Matcher m = DESCRIPTION_VERSION_PATTERN . matcher ( pIssue . getDescription ( ) ) ; final int version ; if ( m . find ( ) ) { version = Integer . parseInt ( m . group ( 1 ) ) ; } else { // default version is 1 version = 1 ; } if ( IssueDescriptionUtils . DESCRIPTION_VERSION != version ) { throw new IssueParseException ( String . format ( "Issue #%s has unsupported description: %d. Expected version %d " , pIssue . getId ( ) , version , IssueDescriptionUtils . DESCRIPTION_VERSION ) ) ; }
public class SharedCostReader { /** * Make the request to the Twilio API to perform the read . * @ param client TwilioRestClient with which to make the request * @ return SharedCost ResourceSet */ @ Override public ResourceSet < SharedCost > read ( final TwilioRestClient client ) { } }
return new ResourceSet < > ( this , client , firstPage ( client ) ) ;
public class EMMImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . EMM__MM_NAME : setMMName ( ( String ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class TokenPropagationHelper { /** * Authenticate the username , create it ' s Subject and push it on to the thread . * It ' s up to the caller to save off the prior subject and make sure it gets restored , * and guard against any threading issues . * @ param username * @ return true if successful */ public static synchronized boolean pushSubject ( String username ) { } }
if ( securityService == null || username == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "returning false because user or securityService is null," + " user= " + username + " secsvc= " + securityService ) ; } return false ; } AuthenticationService authenticationService = securityService . getAuthenticationService ( ) ; Subject tempSubject = new Subject ( ) ; Hashtable < String , Object > hashtable = new Hashtable < String , Object > ( ) ; if ( ! authenticationService . isAllowHashTableLoginWithIdOnly ( ) ) { hashtable . put ( AuthenticationConstants . INTERNAL_ASSERTION_KEY , Boolean . TRUE ) ; } hashtable . put ( "com.ibm.wsspi.security.cred.userId" , username ) ; tempSubject . getPublicCredentials ( ) . add ( hashtable ) ; try { Subject new_subject = authenticationService . authenticate ( JaasLoginConfigConstants . SYSTEM_WEB_INBOUND , tempSubject ) ; return setRunAsSubject ( new_subject ) ; } catch ( AuthenticationException e ) { FFDCFilter . processException ( e , TokenPropagationHelper . class . getName ( ) , "pushSubject" , new Object [ ] { username } ) ; Tr . error ( tc , "ERROR_AUTHENTICATE" , new Object [ ] { e . getMessage ( ) } ) ; // CWWKS6103E return false ; } catch ( Exception e ) { FFDCFilter . processException ( e , TokenPropagationHelper . class . getName ( ) , "pushSubject" , new Object [ ] { username } ) ; return false ; }
public class MedianOfWidestDimension { /** * Splits a node into two based on the median value of the dimension * in which the points have the widest spread . After splitting two * new nodes are created and correctly initialised . And , node . left * and node . right are set appropriately . * @ param node The node to split . * @ param numNodesCreated The number of nodes that so far have been * created for the tree , so that the newly created nodes are * assigned correct / meaningful node numbers / ids . * @ param nodeRanges The attributes ' range for the points inside * the node that is to be split . * @ param universe The attributes ' range for the whole * point - space . * @ throws Exception If there is some problem in splitting the * given node . */ public void splitNode ( KDTreeNode node , int numNodesCreated , double [ ] [ ] nodeRanges , double [ ] [ ] universe ) throws Exception { } }
correctlyInitialized ( ) ; int splitDim = widestDim ( nodeRanges , universe ) ; // In this case median is defined to be either the middle value ( in case of // odd number of values ) or the left of the two middle values ( in case of // even number of values ) . int medianIdxIdx = node . m_Start + ( node . m_End - node . m_Start ) / 2 ; // the following finds the median and also re - arranges the array so all // elements to the left are < median and those to the right are > median . int medianIdx = select ( splitDim , m_InstList , node . m_Start , node . m_End , ( node . m_End - node . m_Start ) / 2 + 1 ) ; node . m_SplitDim = splitDim ; node . m_SplitValue = m_Instances . instance ( m_InstList [ medianIdx ] ) . value ( splitDim ) ; node . m_Left = new KDTreeNode ( numNodesCreated + 1 , node . m_Start , medianIdxIdx , m_EuclideanDistance . initializeRanges ( m_InstList , node . m_Start , medianIdxIdx ) ) ; node . m_Right = new KDTreeNode ( numNodesCreated + 2 , medianIdxIdx + 1 , node . m_End , m_EuclideanDistance . initializeRanges ( m_InstList , medianIdxIdx + 1 , node . m_End ) ) ;
public class Inventory { /** * Removes entries whose configurations are unreadable from the inventory . * @ return the list of entries removed from the inventory */ List < File > removeUnreadable ( ) { } }
// List unreadable List < InventoryEntry > unreadable = configs . values ( ) . stream ( ) . filter ( v -> ! v . getConfiguration ( ) . isPresent ( ) ) . collect ( Collectors . toList ( ) ) ; // Remove from inventory unreadable . forEach ( v -> configs . remove ( v . getIdentifier ( ) ) ) ; // Return the list of removed files return unreadable . stream ( ) . map ( v -> v . getPath ( ) ) . collect ( Collectors . toList ( ) ) ;
public class CmsLogChannelTable { /** * Fills the context menu . < p > * @ param loggerSet Set of logger to open context menu for */ private void fillContextMenu ( final Set < Logger > loggerSet ) { } }
for ( LoggerLevel level : LoggerLevel . values ( ) ) { final LoggerLevel currentLevel = level ; ContextMenuItem item = m_menu . addItem ( level . getLevelStringComplet ( ) ) ; item . setData ( loggerSet ) ; item . addItemClickListener ( new ContextMenuItemClickListener ( ) { public void contextMenuItemClicked ( ContextMenuItemClickEvent event ) { changeLoggerLevel ( currentLevel , loggerSet ) ; } } ) ; if ( loggerSet . size ( ) == 1 ) { if ( level . getLevel ( ) . equals ( loggerSet . iterator ( ) . next ( ) . getLevel ( ) ) ) { item . setIcon ( FontOpenCms . CHECK_SMALL ) ; } } } if ( loggerSet . size ( ) == 1 ) { String message = CmsVaadinUtils . getMessageText ( Messages . GUI_LOGFILE_LOGSETTINGS_NEWFILE_0 ) ; if ( isloggingactivated ( loggerSet . iterator ( ) . next ( ) ) ) { message = CmsVaadinUtils . getMessageText ( Messages . GUI_LOGFILE_LOGSETTINGS_REMOVEFILE_0 ) ; } ContextMenuItem item = m_menu . addItem ( message ) ; item . setData ( loggerSet ) ; item . addItemClickListener ( new ContextMenuItemClickListener ( ) { public void contextMenuItemClicked ( ContextMenuItemClickEvent event ) { toggleOwnFile ( loggerSet . iterator ( ) . next ( ) ) ; } } ) ; }
public class SharingElectronMechanism { /** * Initiates the process for the given mechanism . The atoms to apply are mapped between * reactants and products . * @ param atomContainerSet * @ param atomList The list of atoms taking part in the mechanism . Only allowed two atoms * @ param bondList The list of bonds taking part in the mechanism . Only allowed one bond * @ return The Reaction mechanism */ @ Override public IReaction initiate ( IAtomContainerSet atomContainerSet , ArrayList < IAtom > atomList , ArrayList < IBond > bondList ) throws CDKException { } }
CDKAtomTypeMatcher atMatcher = CDKAtomTypeMatcher . getInstance ( atomContainerSet . getBuilder ( ) ) ; if ( atomContainerSet . getAtomContainerCount ( ) != 1 ) { throw new CDKException ( "SharingElectronMechanism only expects one IAtomContainer" ) ; } if ( atomList . size ( ) != 2 ) { throw new CDKException ( "SharingElectronMechanism expects two atoms in the ArrayList" ) ; } if ( bondList . size ( ) != 1 ) { throw new CDKException ( "SharingElectronMechanism only expect one bond in the ArrayList" ) ; } IAtomContainer molecule = atomContainerSet . getAtomContainer ( 0 ) ; IAtomContainer reactantCloned ; try { reactantCloned = ( IAtomContainer ) molecule . clone ( ) ; } catch ( CloneNotSupportedException e ) { throw new CDKException ( "Could not clone IAtomContainer!" , e ) ; } IAtom atom1 = atomList . get ( 0 ) ; // Atom containing the lone pair to share IAtom atom1C = reactantCloned . getAtom ( molecule . indexOf ( atom1 ) ) ; IAtom atom2 = atomList . get ( 1 ) ; // Atom to neutralize the deficiency of charge IAtom atom2C = reactantCloned . getAtom ( molecule . indexOf ( atom2 ) ) ; IBond bond1 = bondList . get ( 0 ) ; int posBond1 = molecule . indexOf ( bond1 ) ; BondManipulator . increaseBondOrder ( reactantCloned . getBond ( posBond1 ) ) ; List < ILonePair > lonePair = reactantCloned . getConnectedLonePairsList ( atom1C ) ; reactantCloned . removeLonePair ( lonePair . get ( lonePair . size ( ) - 1 ) ) ; int charge = atom1C . getFormalCharge ( ) ; atom1C . setFormalCharge ( charge + 1 ) ; charge = atom2C . getFormalCharge ( ) ; atom2C . setFormalCharge ( charge - 1 ) ; atom1C . setHybridization ( null ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( reactantCloned ) ; IAtomType type = atMatcher . findMatchingAtomType ( reactantCloned , atom1C ) ; if ( type == null || type . getAtomTypeName ( ) . equals ( "X" ) ) return null ; atom2C . setHybridization ( null ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( reactantCloned ) ; type = atMatcher . findMatchingAtomType ( reactantCloned , atom2C ) ; if ( type == null || type . getAtomTypeName ( ) . equals ( "X" ) ) return null ; IReaction reaction = atom2C . getBuilder ( ) . newInstance ( IReaction . class ) ; reaction . addReactant ( molecule ) ; /* mapping */ for ( IAtom atom : molecule . atoms ( ) ) { IMapping mapping = atom2C . getBuilder ( ) . newInstance ( IMapping . class , atom , reactantCloned . getAtom ( molecule . indexOf ( atom ) ) ) ; reaction . addMapping ( mapping ) ; } reaction . addProduct ( reactantCloned ) ; return reaction ;
public class PearsonDistance { /** * Computes the Pearson correlation between two vectors . If one of the vectors is all zeros , the result is undefined . * In cases where both are zero vectors , 1 will be returned to indicate they are the same . In cases where one of the * numerator coefficients is zero , its value will be bumped up to an epsilon to provide a near result . < br > * < br > * In cases where { @ code bothNonZero } is { @ code true } , and the vectors have no overlapping non zero values , 0 will * be returned . * @ param a the first vector * @ param b the second vector * @ param bothNonZero { @ code false } is the normal Pearson correlation . { @ code true } will make the computation ignore * all indexes where one of the values is zero , the mean will be from all non zero values in each vector . * @ return the Pearson correlation in [ - 1 , 1] */ public static double correlation ( Vec a , Vec b , boolean bothNonZero ) { } }
final double aMean ; final double bMean ; if ( bothNonZero ) { aMean = a . sum ( ) / a . nnz ( ) ; bMean = b . sum ( ) / b . nnz ( ) ; } else { aMean = a . mean ( ) ; bMean = b . mean ( ) ; } double r = 0 ; double aSqrd = 0 , bSqrd = 0 ; if ( a . isSparse ( ) || b . isSparse ( ) ) { Iterator < IndexValue > aIter = a . getNonZeroIterator ( ) ; Iterator < IndexValue > bIter = b . getNonZeroIterator ( ) ; // if one is empty , then a zero forms on the denomrinator if ( ! aIter . hasNext ( ) && ! bIter . hasNext ( ) ) return 1 ; if ( ! aIter . hasNext ( ) || ! bIter . hasNext ( ) ) return Double . MAX_VALUE ; IndexValue aCur = null ; IndexValue bCur = null ; boolean newA = true , newB = true ; int lastObservedIndex = - 1 ; do { if ( newA ) { if ( ! aIter . hasNext ( ) ) break ; aCur = aIter . next ( ) ; newA = false ; } if ( newB ) { if ( ! bIter . hasNext ( ) ) break ; bCur = bIter . next ( ) ; newB = false ; } if ( aCur . getIndex ( ) == bCur . getIndex ( ) ) { // accumulate skipped positions where both are zero if ( ! bothNonZero ) r += aMean * bMean * ( aCur . getIndex ( ) - lastObservedIndex - 1 ) ; lastObservedIndex = aCur . getIndex ( ) ; double aVal = aCur . getValue ( ) - aMean ; double bVal = bCur . getValue ( ) - bMean ; r += aVal * bVal ; aSqrd += aVal * aVal ; bSqrd += bVal * bVal ; newA = newB = true ; } else if ( aCur . getIndex ( ) > bCur . getIndex ( ) ) { if ( ! bothNonZero ) { // accumulate skipped positions where both are zero r += aMean * bMean * ( bCur . getIndex ( ) - lastObservedIndex - 1 ) ; lastObservedIndex = bCur . getIndex ( ) ; double bVal = bCur . getValue ( ) - bMean ; r += - aMean * bVal ; bSqrd += bVal * bVal ; } newB = true ; } else if ( aCur . getIndex ( ) < bCur . getIndex ( ) ) { if ( ! bothNonZero ) { // accumulate skipped positions where both are zero r += aMean * bMean * ( aCur . getIndex ( ) - lastObservedIndex - 1 ) ; lastObservedIndex = aCur . getIndex ( ) ; double aVal = aCur . getValue ( ) - aMean ; r += aVal * - bMean ; aSqrd += aVal * aVal ; } newA = true ; } } while ( true ) ; if ( ! bothNonZero ) { // only one of the loops bellow will execute while ( ! newA || ( newA && aIter . hasNext ( ) ) ) { if ( newA ) aCur = aIter . next ( ) ; // accumulate skipped positions where both are zero r += aMean * bMean * ( aCur . getIndex ( ) - lastObservedIndex - 1 ) ; lastObservedIndex = aCur . getIndex ( ) ; double aVal = aCur . getValue ( ) - aMean ; r += aVal * - bMean ; aSqrd += aVal * aVal ; newA = true ; } while ( ! newB || ( newB && bIter . hasNext ( ) ) ) { if ( newB ) bCur = bIter . next ( ) ; // accumulate skipped positions where both are zero r += aMean * bMean * ( bCur . getIndex ( ) - lastObservedIndex - 1 ) ; lastObservedIndex = bCur . getIndex ( ) ; double bVal = bCur . getValue ( ) - bMean ; r += - aMean * bVal ; bSqrd += bVal * bVal ; newB = true ; } r += aMean * bMean * ( a . length ( ) - lastObservedIndex - 1 ) ; aSqrd += aMean * aMean * ( a . length ( ) - a . nnz ( ) ) ; bSqrd += bMean * bMean * ( b . length ( ) - b . nnz ( ) ) ; } } else // dense ! { for ( int i = 0 ; i < a . length ( ) ; i ++ ) { double aTmp = a . get ( i ) ; double bTmp = b . get ( i ) ; if ( bothNonZero && ( aTmp == 0 || bTmp == 0 ) ) continue ; double aVal = aTmp - aMean ; double bVal = bTmp - bMean ; r += aVal * bVal ; aSqrd += aVal * aVal ; bSqrd += bVal * bVal ; } } if ( bSqrd == 0 && aSqrd == 0 ) return 0 ; else if ( bSqrd == 0 || aSqrd == 0 ) return r / Math . sqrt ( ( aSqrd + 1e-10 ) * ( bSqrd + 1e-10 ) ) ; return r / Math . sqrt ( aSqrd * bSqrd ) ;
public class UpdateEncryptionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateEncryption updateEncryption , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateEncryption == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateEncryption . getAlgorithm ( ) , ALGORITHM_BINDING ) ; protocolMarshaller . marshall ( updateEncryption . getKeyType ( ) , KEYTYPE_BINDING ) ; protocolMarshaller . marshall ( updateEncryption . getRoleArn ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( updateEncryption . getSecretArn ( ) , SECRETARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AmazonWorkspacesClient { /** * Describes the available AWS Directory Service directories that are registered with Amazon WorkSpaces . * @ param describeWorkspaceDirectoriesRequest * @ return Result of the DescribeWorkspaceDirectories operation returned by the service . * @ throws InvalidParameterValuesException * One or more parameter values are not valid . * @ sample AmazonWorkspaces . DescribeWorkspaceDirectories * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / workspaces - 2015-04-08 / DescribeWorkspaceDirectories " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeWorkspaceDirectoriesResult describeWorkspaceDirectories ( DescribeWorkspaceDirectoriesRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeWorkspaceDirectories ( request ) ;
public class InjectProgram { /** * Configures a bean given a class to instantiate . */ final protected < T > T create ( Class < T > type , InjectContext env ) throws ConfigException { } }
try { T value = type . newInstance ( ) ; inject ( value , env ) ; return value ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw ConfigException . wrap ( e ) ; }
public class TypeDesc { /** * Acquire a TypeDesc from a type descriptor . This syntax is described in * section 4.3.2 , Field Descriptors . */ public static TypeDesc forDescriptor ( String desc ) throws IllegalArgumentException { } }
// TODO : Figure out how to cache these . Using a plain IdentityMap poses // a problem . The back reference to the key causes a memory leak . TypeDesc td ; int cursor = 0 ; int dim = 0 ; try { char c ; while ( ( c = desc . charAt ( cursor ++ ) ) == '[' ) { dim ++ ; } switch ( c ) { case 'V' : td = VOID ; break ; case 'Z' : td = BOOLEAN ; break ; case 'C' : td = CHAR ; break ; case 'B' : td = BYTE ; break ; case 'S' : td = SHORT ; break ; case 'I' : td = INT ; break ; case 'J' : td = LONG ; break ; case 'F' : td = FLOAT ; break ; case 'D' : td = DOUBLE ; break ; case 'L' : if ( dim > 0 ) { desc = desc . substring ( dim ) ; cursor = 1 ; } StringBuffer name = new StringBuffer ( desc . length ( ) - 2 ) ; while ( ( c = desc . charAt ( cursor ++ ) ) != ';' ) { if ( c == '/' ) { c = '.' ; } name . append ( c ) ; } td = intern ( new ObjectType ( desc , name . toString ( ) ) ) ; break ; default : throw invalidDescriptor ( desc ) ; } } catch ( NullPointerException e ) { throw invalidDescriptor ( desc ) ; } catch ( IndexOutOfBoundsException e ) { throw invalidDescriptor ( desc ) ; } if ( cursor != desc . length ( ) ) { throw invalidDescriptor ( desc ) ; } while ( -- dim >= 0 ) { td = td . toArrayType ( ) ; } return td ;
public class GeneralPurposeFFT_F64_2D { /** * Computes 2D inverse DFT of real data leaving the result in < code > a < / code > * . This method computes full real inverse transform , i . e . you will get the * same result as from < code > complexInverse < / code > called with all imaginary * part equal 0 . Because the result is stored in < code > a < / code > , the input * array must be of size rows * 2 * columns , with only the first rows * columns * elements filled with real data . * @ param a * data to transform * @ param scale * if true then scaling is performed */ public void realInverseFull ( double [ ] a , boolean scale ) { } }
// handle special case if ( rows == 1 || columns == 1 ) { if ( rows > 1 ) fftRows . realInverseFull ( a , scale ) ; else fftColumns . realInverseFull ( a , scale ) ; return ; } if ( isPowerOfTwo ) { for ( int r = 0 ; r < rows ; r ++ ) { fftColumns . realInverse2 ( a , r * columns , scale ) ; } cdft2d_sub ( 1 , a , scale ) ; rdft2d_sub ( 1 , a ) ; fillSymmetric ( a ) ; } else { declareRadixRealData ( ) ; mixedRadixRealInverseFull ( a , scale ) ; }
public class SeleniumComponent { /** * The Selenium - Webdriver element that represents the component HTML of the * simulated page . * @ param element WebElement object */ public final void setElement ( final WebElement element ) { } }
if ( element == null ) { throw new IllegalArgumentException ( String . format ( ErrorMessages . ERROR_TEMPLATE_VARIABLE_NULL , "element" ) ) ; } this . element = element ; validateElementTag ( ) ; validateAttributes ( ) ;
public class FieldAnnotation { /** * Factory method . Class name , field name , and field signatures are taken * from the given visitor , which is visiting the field . * @ param visitor * the visitor which is visiting the field * @ return the FieldAnnotation object */ public static FieldAnnotation fromVisitedField ( PreorderVisitor visitor ) { } }
return new FieldAnnotation ( visitor . getDottedClassName ( ) , visitor . getFieldName ( ) , visitor . getFieldSig ( ) , visitor . getFieldIsStatic ( ) ) ;
public class SipResourceAdaptor { /** * ( non - Javadoc ) * @ see javax . sip . SipListener # processDialogTerminated ( javax . sip . DialogTerminatedEvent ) */ public void processDialogTerminated ( DialogTerminatedEvent dte ) { } }
final Dialog d = dte . getDialog ( ) ; if ( d != null ) { DialogWrapper dw = getDialogWrapper ( d ) ; if ( dw != null ) { processDialogTerminated ( dw ) ; } else { if ( tracer . isFineEnabled ( ) ) { tracer . fine ( "DialogTerminatedEvent dropped due to null app data." ) ; } } }
public class IOSPlatform { /** * Registers your application using the supplied configuration . */ public static IOSPlatform register ( UIApplication app , Config config ) { } }
return register ( app , null , config ) ;
public class PrivacyMetric { /** * < code > . google . privacy . dlp . v2 . PrivacyMetric . CategoricalStatsConfig categorical _ stats _ config = 2; * < / code > */ public com . google . privacy . dlp . v2 . PrivacyMetric . CategoricalStatsConfigOrBuilder getCategoricalStatsConfigOrBuilder ( ) { } }
if ( typeCase_ == 2 ) { return ( com . google . privacy . dlp . v2 . PrivacyMetric . CategoricalStatsConfig ) type_ ; } return com . google . privacy . dlp . v2 . PrivacyMetric . CategoricalStatsConfig . getDefaultInstance ( ) ;
public class Image { /** * Initialise internal data */ protected final void init ( ) { } }
if ( inited ) { return ; } inited = true ; if ( texture != null ) { width = texture . getImageWidth ( ) ; height = texture . getImageHeight ( ) ; textureOffsetX = 0 ; textureOffsetY = 0 ; textureWidth = texture . getWidth ( ) ; textureHeight = texture . getHeight ( ) ; } initImpl ( ) ; centerX = width / 2 ; centerY = height / 2 ;
public class UnorderedStreamElementQueue { /** * Add the given stream element queue entry to the current last set if it is not a watermark . * If it is a watermark , then stop adding to the current last set , insert the watermark into its * own set and add a new last set . * @ param streamElementQueueEntry to be inserted * @ param < T > Type of the stream element queue entry ' s result */ private < T > void addEntry ( StreamElementQueueEntry < T > streamElementQueueEntry ) { } }
assert ( lock . isHeldByCurrentThread ( ) ) ; if ( streamElementQueueEntry . isWatermark ( ) ) { lastSet = new HashSet < > ( capacity ) ; if ( firstSet . isEmpty ( ) ) { firstSet . add ( streamElementQueueEntry ) ; } else { Set < StreamElementQueueEntry < ? > > watermarkSet = new HashSet < > ( 1 ) ; watermarkSet . add ( streamElementQueueEntry ) ; uncompletedQueue . offer ( watermarkSet ) ; } uncompletedQueue . offer ( lastSet ) ; } else { lastSet . add ( streamElementQueueEntry ) ; } streamElementQueueEntry . onComplete ( ( StreamElementQueueEntry < T > value ) -> { try { onCompleteHandler ( value ) ; } catch ( InterruptedException e ) { // The accept executor thread got interrupted . This is probably cause by // the shutdown of the executor . LOG . debug ( "AsyncBufferEntry could not be properly completed because the " + "executor thread has been interrupted." , e ) ; } catch ( Throwable t ) { operatorActions . failOperator ( new Exception ( "Could not complete the " + "stream element queue entry: " + value + '.' , t ) ) ; } } , executor ) ; numberEntries ++ ;
public class CacheSetUtil { /** * retrial the cached set * @ param cacheConfigBean the datasource configuration * @ param key the key * @ return the value set */ public static Single < Set < String > > values ( CacheConfigBean cacheConfigBean , String key ) { } }
return SingleRxXian . call ( CacheService . CACHE_SERVICE , "cacheSetMembers" , new JSONObject ( ) { { put ( "cacheConfig" , cacheConfigBean ) ; put ( "key" , key ) ; } } ) . map ( unitResponseObject -> { unitResponseObject . throwExceptionIfNotSuccess ( ) ; return Reflection . toTypedSet ( unitResponseObject . getData ( ) , String . class ) ; } ) ;
public class EntityUpdatedData { /** * Adds a single change . * @ param name the name * @ param before the before state * @ param after the after state */ public void addChange ( String name , Enum < ? > before , Enum < ? > after ) { } }
String beforeStr = before != null ? before . name ( ) : null ; String afterStr = after != null ? after . name ( ) : null ; addChange ( name , beforeStr , afterStr ) ;
public class ParameterDefinition { /** * return parameter description , applying the configured MarkupFormatter for jenkins instance . * @ since 1.521 */ public String getFormattedDescription ( ) { } }
try { return Jenkins . getInstance ( ) . getMarkupFormatter ( ) . translate ( description ) ; } catch ( IOException e ) { LOGGER . warning ( "failed to translate description using configured markup formatter" ) ; return "" ; }
public class Gabor { /** * 1 - D Gabor function . * @ param x Value . * @ param mean Mean . * @ param amplitude Amplitude . * @ param position Position . * @ param width Width . * @ param phase Phase . * @ param frequency Frequency . * @ return Gabor response . */ public static double Function1D ( double x , double mean , double amplitude , double position , double width , double phase , double frequency ) { } }
double envelope = mean + amplitude * Math . exp ( - Math . pow ( ( x - position ) , 2 ) / Math . pow ( ( 2 * width ) , 2 ) ) ; double carry = Math . cos ( 2 * Math . PI * frequency * ( x - position ) + phase ) ; return envelope * carry ;
public class TemplateTypeMap { /** * Returns true if this map contains the specified template key , false * otherwise . */ @ SuppressWarnings ( "ReferenceEquality" ) public boolean hasTemplateKey ( TemplateType templateKey ) { } }
// Note : match by identity , not equality for ( TemplateType entry : templateKeys ) { if ( entry == templateKey ) { return true ; } } return false ;
public class EnvironmentCheck { /** * Report version information about JAXP interfaces . * Currently distinguishes between JAXP 1.0.1 and JAXP 1.1, * and not found ; only tests the interfaces , and does not * check for reference implementation versions . * @ param h Hashtable to put information in */ protected void checkJAXPVersion ( Hashtable h ) { } }
if ( null == h ) h = new Hashtable ( ) ; final Class noArgs [ ] = new Class [ 0 ] ; Class clazz = null ; try { final String JAXP1_CLASS = "javax.xml.parsers.DocumentBuilder" ; final String JAXP11_METHOD = "getDOMImplementation" ; clazz = ObjectFactory . findProviderClass ( JAXP1_CLASS , ObjectFactory . findClassLoader ( ) , true ) ; Method method = clazz . getMethod ( JAXP11_METHOD , noArgs ) ; // If we succeeded , we at least have JAXP 1.1 available h . put ( VERSION + "JAXP" , "1.1 or higher" ) ; } catch ( Exception e ) { if ( null != clazz ) { // We must have found the class itself , just not the // method , so we ( probably ) have JAXP 1.0.1 h . put ( ERROR + VERSION + "JAXP" , "1.0.1" ) ; h . put ( ERROR , ERROR_FOUND ) ; } else { // We couldn ' t even find the class , and don ' t have // any JAXP support at all , or only have the // transform half of it h . put ( ERROR + VERSION + "JAXP" , CLASS_NOTPRESENT ) ; h . put ( ERROR , ERROR_FOUND ) ; } }
public class CurrencyHelper { /** * Get the passed value rounded to the appropriate number of fraction digits , * based on this currencies default fraction digits . < br > * The default scaling of this currency is used . * @ param eCurrency * The currency it is about . If < code > null < / code > is provided * { @ link # DEFAULT _ CURRENCY } is used instead . * @ param aValue * The value to be rounded . May not be < code > null < / code > . * @ return The rounded value . Never < code > null < / code > . */ @ Nonnull public static BigDecimal getRounded ( @ Nullable final ECurrency eCurrency , @ Nonnull final BigDecimal aValue ) { } }
ValueEnforcer . notNull ( aValue , "Value" ) ; final PerCurrencySettings aPCS = getSettings ( eCurrency ) ; return aValue . setScale ( aPCS . getScale ( ) , aPCS . getRoundingMode ( ) ) ;
public class FeatureCollection { /** * Create a new instance of this class by giving the feature collection a single { @ link Feature } . * @ param feature a single feature * @ return a new instance of this class defined by the values passed inside this static factory * method * @ since 3.0.0 */ public static FeatureCollection fromFeature ( @ NonNull Feature feature ) { } }
List < Feature > featureList = Arrays . asList ( feature ) ; return new FeatureCollection ( TYPE , null , featureList ) ;
public class ReactiveNetwork { /** * Observes connectivity with the Internet with default settings . It pings remote host * ( www . google . com ) at port 80 every 2 seconds with 2 seconds of timeout . This operation is used * for determining if device is connected to the Internet or not . Please note that this method is * less efficient than { @ link # observeNetworkConnectivity ( Context ) } method and consumes data * transfer , but it gives you actual information if device is connected to the Internet or not . * @ return RxJava Observable with Boolean - true , when we have an access to the Internet * and false if not */ @ RequiresPermission ( Manifest . permission . INTERNET ) public static Observable < Boolean > observeInternetConnectivity ( ) { } }
InternetObservingSettings settings = InternetObservingSettings . create ( ) ; return observeInternetConnectivity ( settings . strategy ( ) , settings . initialInterval ( ) , settings . interval ( ) , settings . host ( ) , settings . port ( ) , settings . timeout ( ) , settings . httpResponse ( ) , settings . errorHandler ( ) ) ;
public class BaseDateKeyDeserializer { /** * { @ inheritDoc } */ @ Override protected D doDeserialize ( String key , JsonDeserializationContext ctx ) { } }
// TODO could probably find a better way to handle the parsing without try / catch // Default configuration for serializing keys is using ISO - 8601 , we try that one first // in ISO - 8601 try { return deserializeDate ( ISO_8601_FORMAT . parse ( key ) ) ; } catch ( IllegalArgumentException e ) { // can happen if it ' s not the correct format } // maybe it ' s in milliseconds try { return deserializeMillis ( Long . parseLong ( key ) ) ; } catch ( NumberFormatException e ) { // can happen if the key is string - based like an ISO - 8601 format } // or in RFC - 2822 try { return deserializeDate ( RFC_2822_FORMAT . parse ( key ) ) ; } catch ( IllegalArgumentException e ) { // can happen if it ' s not the correct format } throw new JsonDeserializationException ( "Cannot parse the key '" + key + "' as a date" ) ;
public class KeyVaultClientBaseImpl { /** * Sets the specified certificate issuer . * The SetCertificateIssuer operation adds or updates the specified certificate issuer . This operation requires the certificates / setissuers permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param issuerName The name of the issuer . * @ param provider The issuer provider . * @ param credentials The credentials to be used for the issuer . * @ param organizationDetails Details of the organization as provided to the issuer . * @ param attributes Attributes of the issuer object . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the IssuerBundle object */ public Observable < IssuerBundle > setCertificateIssuerAsync ( String vaultBaseUrl , String issuerName , String provider , IssuerCredentials credentials , OrganizationDetails organizationDetails , IssuerAttributes attributes ) { } }
return setCertificateIssuerWithServiceResponseAsync ( vaultBaseUrl , issuerName , provider , credentials , organizationDetails , attributes ) . map ( new Func1 < ServiceResponse < IssuerBundle > , IssuerBundle > ( ) { @ Override public IssuerBundle call ( ServiceResponse < IssuerBundle > response ) { return response . body ( ) ; } } ) ;
public class ClientBuilderForConnector { /** * Sets SSLConfig from defined credentials id . * @ param credentialsId credentials to find in jenkins * @ return docker - java client */ public ClientBuilderForConnector withCredentialsId ( String credentialsId ) throws UnrecoverableKeyException , NoSuchAlgorithmException , KeyStoreException , KeyManagementException { } }
if ( isNotBlank ( credentialsId ) ) { withCredentials ( lookupSystemCredentials ( credentialsId ) ) ; } else { withSslConfig ( null ) ; } return this ;
public class CrumbFilter { /** * Because servlet containers generally don ' t specify the ordering of the initialization * ( and different implementations indeed do this differently - - - See HUDSON - 3878 ) , * we cannot use Hudson to the CrumbIssuer into CrumbFilter eagerly . */ public CrumbIssuer getCrumbIssuer ( ) { } }
Jenkins h = Jenkins . getInstanceOrNull ( ) ; if ( h == null ) return null ; // before Jenkins is initialized ? return h . getCrumbIssuer ( ) ;
public class JavacParser { /** * ArgumentsOpt = [ Arguments ] */ JCExpression argumentsOpt ( List < JCExpression > typeArgs , JCExpression t ) { } }
if ( ( mode & EXPR ) != 0 && token . kind == LPAREN || typeArgs != null ) { mode = EXPR ; return arguments ( typeArgs , t ) ; } else { return t ; }
public class VariationDataReader { /** * Performs one read of from a CellBase variation collection . * @ return List of variants . It can be expected to contain only one variant . */ public List < Variant > read ( ) { } }
Variant variant = null ; boolean valid = false ; while ( iterator . hasNext ( ) && ! valid ) { variant = iterator . next ( ) ; valid = isValid ( variant ) ; } if ( valid ) { // New variants in the variation collection created during the update of the frequencies may not have // the variant type set and this might cause NPE if ( variant . getType ( ) == null ) { variant . setType ( variant . inferType ( variant . getReference ( ) , variant . getAlternate ( ) ) ) ; } return Collections . singletonList ( variant ) ; } else { return null ; }
public class BundleMap { private BundleNodeMap lookupScriptableBundle ( String name ) { } }
BundleNodeMap map = null ; /* check to see if the bundle was explicitly registered */ if ( _registeredBundles != null && _registeredBundles . containsKey ( name ) ) { map = new BundleNodeMap ( name , ( BundleNode ) _registeredBundles . get ( name ) ) ; } else if ( name . equals ( DEFAULT_STRUTS_BUNDLE_NAME ) ) { MessageResources resources = lookupDefaultStrutsBundle ( ) ; if ( resources != null ) { BundleNode bundleNode = BundleNodeFactory . getInstance ( ) . getStrutsBundleNode ( name , resources , retrieveUserLocale ( ) ) ; map = new BundleNodeMap ( name , bundleNode ) ; } } else if ( _servletContext . getAttribute ( name ) != null ) { MessageResources resources = lookupStrutsBundle ( name ) ; if ( resources != null ) { BundleNode bundleNode = BundleNodeFactory . getInstance ( ) . getStrutsBundleNode ( name , resources , retrieveUserLocale ( ) ) ; map = new BundleNodeMap ( name , bundleNode ) ; } } else { ModuleConfig moduleConfig = lookupCurrentModuleConfig ( ) ; if ( moduleConfig != null ) { MessageResourcesConfig [ ] mrs = moduleConfig . findMessageResourcesConfigs ( ) ; if ( mrs != null ) { for ( int i = 0 ; i < mrs . length ; i ++ ) { /* skip the default bundle */ if ( mrs [ i ] . getKey ( ) . equals ( Globals . MESSAGES_KEY ) ) continue ; else if ( mrs [ i ] . getKey ( ) . equals ( name ) ) { String resourceKey = mrs [ i ] . getKey ( ) + moduleConfig . getPrefix ( ) ; MessageResources resources = lookupStrutsBundle ( resourceKey ) ; BundleNode bundleNode = BundleNodeFactory . getInstance ( ) . getStrutsBundleNode ( name , resources , retrieveUserLocale ( ) ) ; map = new BundleNodeMap ( name , bundleNode ) ; break ; } } } } } return map ;
public class ScriptBytecodeAdapter { public static Object invokeMethodOnCurrentN ( Class senderClass , GroovyObject receiver , String messageName , Object [ ] messageArguments ) throws Throwable { } }
Object result = null ; boolean intercepting = receiver instanceof GroovyInterceptable ; try { try { // if it ' s a pure interceptable object ( even intercepting toString ( ) , clone ( ) , . . . ) if ( intercepting ) { result = receiver . invokeMethod ( messageName , messageArguments ) ; } // else if there ' s a statically typed method or a GDK method else { result = receiver . getMetaClass ( ) . invokeMethod ( senderClass , receiver , messageName , messageArguments , false , true ) ; } } catch ( MissingMethodException e ) { if ( e instanceof MissingMethodExecutionFailed ) { throw ( MissingMethodException ) e . getCause ( ) ; } else if ( ! intercepting && receiver . getClass ( ) == e . getType ( ) && e . getMethod ( ) . equals ( messageName ) ) { // in case there ' s nothing else , invoke the object ' s own invokeMethod ( ) result = receiver . invokeMethod ( messageName , messageArguments ) ; } else { throw e ; } } } catch ( GroovyRuntimeException gre ) { throw unwrap ( gre ) ; } return result ;
public class AbstractSarlLaunchShortcut { /** * Collect the listing of { @ link ILaunchConfiguration } s that apply to the given element . * @ param projectName the name of the project . * @ param fullyQualifiedName the element . * @ return the list of { @ link ILaunchConfiguration } s or an empty list , never < code > null < / code > * @ throws CoreException if something is going wrong . */ protected List < ILaunchConfiguration > getCandidates ( String projectName , String fullyQualifiedName ) throws CoreException { } }
final ILaunchConfigurationType ctype = getLaunchManager ( ) . getLaunchConfigurationType ( getConfigurationType ( ) ) ; List < ILaunchConfiguration > candidateConfigs = Collections . emptyList ( ) ; final ILaunchConfiguration [ ] configs = getLaunchManager ( ) . getLaunchConfigurations ( ctype ) ; candidateConfigs = new ArrayList < > ( configs . length ) ; for ( int i = 0 ; i < configs . length ; i ++ ) { final ILaunchConfiguration config = configs [ i ] ; if ( Objects . equals ( getElementQualifiedName ( config ) , fullyQualifiedName ) && Objects . equals ( config . getAttribute ( IJavaLaunchConfigurationConstants . ATTR_PROJECT_NAME , "" ) , // $ NON - NLS - 1 $ projectName ) ) { candidateConfigs . add ( config ) ; } } return candidateConfigs ;
public class WordStemmer { /** * Reads , stems , and prints the trees in the file . * @ param args Usage : WordStemmer file */ public static void main ( String [ ] args ) { } }
Treebank treebank = new DiskTreebank ( ) ; treebank . loadPath ( args [ 0 ] ) ; WordStemmer ls = new WordStemmer ( ) ; for ( Tree tree : treebank ) { ls . visitTree ( tree ) ; System . out . println ( tree ) ; }
public class CheckArg { /** * Check that the map contains the key * @ param argument Map to check * @ param key Key to check for , may be null * @ param name The name of the argument * @ throws IllegalArgumentException If map is null or doesn ' t contain key */ public static void containsKey ( Map < ? , ? > argument , Object key , String name ) { } }
isNotNull ( argument , name ) ; if ( ! argument . containsKey ( key ) ) { throw new IllegalArgumentException ( CommonI18n . argumentDidNotContainKey . text ( name , getObjectName ( key ) ) ) ; }
public class MesosArtifactServer { /** * Stops the artifact server . * @ throws Exception */ public synchronized void stop ( ) throws Exception { } }
if ( this . serverChannel != null ) { this . serverChannel . close ( ) . awaitUninterruptibly ( ) ; this . serverChannel = null ; } if ( bootstrap != null ) { if ( bootstrap . group ( ) != null ) { bootstrap . group ( ) . shutdownGracefully ( ) ; } bootstrap = null ; }
public class ExternalScriptable { /** * We convert script values to the nearest Java value . * We unwrap wrapped Java objects so that access from * Bindings . get ( ) would return " workable " value for Java . * But , at the same time , we need to make few special cases * and hence the following function is used . */ private Object jsToJava ( Object jsObj ) { } }
if ( jsObj instanceof Wrapper ) { Wrapper njb = ( Wrapper ) jsObj ; /* importClass feature of ImporterTopLevel puts * NativeJavaClass in global scope . If we unwrap * it , importClass won ' t work . */ if ( njb instanceof NativeJavaClass ) { return njb ; } /* script may use Java primitive wrapper type objects * ( such as java . lang . Integer , java . lang . Boolean etc ) * explicitly . If we unwrap , then these script objects * will become script primitive types . For example , * var x = new java . lang . Double ( 3.0 ) ; print ( typeof x ) ; * will print ' number ' . We don ' t want that to happen . */ Object obj = njb . unwrap ( ) ; if ( obj instanceof Number || obj instanceof String || obj instanceof Boolean || obj instanceof Character ) { // special type wrapped - - we just leave it as is . return njb ; } else { // return unwrapped object for any other object . return obj ; } } else { // not - a - Java - wrapper return jsObj ; }
public class MarshallableTypeHints { /** * Returns whether a type can be serialized . In order for a type to be * considered marshallable , the type must have been marked as marshallable * using the { @ link # markMarshallable ( Class , boolean ) } method earlier , * passing true as parameter . If a type has not yet been marked as * marshallable , this method will return false . */ public boolean isMarshallable ( Class < ? > type ) { } }
MarshallingType marshallingType = typeHints . get ( type ) ; if ( marshallingType != null ) { Boolean marshallable = marshallingType . isMarshallable ; return marshallable != null ? marshallable . booleanValue ( ) : false ; } return false ;
public class LocatorSoapServiceImpl { /** * Unregister the endpoint for given service . * @ param input * UnregisterEndpointRequestType encapsulate name of service and * endpointURL . Must not be < code > null < / code > */ @ Override public void unregisterEndpoint ( QName serviceName , String endpointURL ) throws ServiceLocatorFault , InterruptedExceptionFault { } }
if ( LOG . isLoggable ( Level . FINE ) ) { LOG . fine ( "Unregistering endpoint " + endpointURL + " for service " + serviceName + "..." ) ; } try { initLocator ( ) ; locatorClient . unregister ( serviceName , endpointURL ) ; } catch ( ServiceLocatorException e ) { ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail ( ) ; serviceFaultDetail . setLocatorFaultDetail ( serviceName . toString ( ) + "throws ServiceLocatorFault" ) ; throw new ServiceLocatorFault ( e . getMessage ( ) , serviceFaultDetail ) ; } catch ( InterruptedException e ) { InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail ( ) ; interruptionFaultDetail . setInterruptionDetail ( serviceName . toString ( ) + "throws InterruptionFault" ) ; throw new InterruptedExceptionFault ( e . getMessage ( ) , interruptionFaultDetail ) ; }
public class DynamoDBMapperTableModel { /** * Creates a new key map from the specified hash and range key . * @ param < H > The hash key type . * @ param < R > The range key type . * @ param hashKey The hash key . * @ param rangeKey The range key ( optional if not present on table ) . * @ return The key map . */ public < H , R > Map < String , AttributeValue > convertKey ( final H hashKey , final R rangeKey ) { } }
final Map < String , AttributeValue > key = new LinkedHashMap < String , AttributeValue > ( 4 ) ; final DynamoDBMapperFieldModel < T , H > hk = this . < H > hashKey ( ) ; final AttributeValue hkValue = hashKey == null ? null : hk . convert ( hashKey ) ; if ( hkValue != null ) { key . put ( hk . name ( ) , hkValue ) ; } else { throw new DynamoDBMappingException ( targetType . getSimpleName ( ) + "[" + hk . name ( ) + "]; no HASH key value present" ) ; } final DynamoDBMapperFieldModel < T , R > rk = this . < R > rangeKeyIfExists ( ) ; final AttributeValue rkValue = rangeKey == null ? null : rk . convert ( rangeKey ) ; if ( rkValue != null ) { key . put ( rk . name ( ) , rkValue ) ; } else if ( rk != null ) { throw new DynamoDBMappingException ( targetType . getSimpleName ( ) + "[" + rk . name ( ) + "]; no RANGE key value present" ) ; } return key ;
public class ImportNodeData { /** * Factory method * @ param parent NodeData * @ param name InternalQName * @ param primaryTypeName InternalQName * @ param index int * @ param orderNumber int * @ return */ public static ImportNodeData createNodeData ( NodeData parent , InternalQName name , InternalQName primaryTypeName , int index , int orderNumber ) { } }
ImportNodeData nodeData = null ; QPath path = QPath . makeChildPath ( parent . getQPath ( ) , name , index ) ; nodeData = new ImportNodeData ( path , IdGenerator . generate ( ) , - 1 , primaryTypeName , new InternalQName [ 0 ] , orderNumber , parent . getIdentifier ( ) , parent . getACL ( ) ) ; return nodeData ;
public class FlowImpl { /** * Returns all < code > split < / code > elements * @ return list of < code > split < / code > */ public List < Split < Flow < T > > > getAllSplit ( ) { } }
List < Split < Flow < T > > > list = new ArrayList < Split < Flow < T > > > ( ) ; List < Node > nodeList = childNode . get ( "split" ) ; for ( Node node : nodeList ) { Split < Flow < T > > type = new SplitImpl < Flow < T > > ( this , "split" , childNode , node ) ; list . add ( type ) ; } return list ;
public class GoyyaSmsService { /** * Returns the message type . * @ param message the message * @ return the message type */ protected String getMessageType ( final String message ) { } }
if ( StringUtils . isBlank ( defaultMessageType ) || MESSAGE_TYPE_TEXT_VALUE . equalsIgnoreCase ( defaultMessageType ) || MESSAGE_TYPE_LONG_TEXT_VALUE . equalsIgnoreCase ( defaultMessageType ) ) { return message . length ( ) > getMaxLengthOfOneSms ( ) ? MESSAGE_TYPE_LONG_TEXT_VALUE : MESSAGE_TYPE_TEXT_VALUE ; } return defaultMessageType ;
public class NameUtils { /** * Returns the class name for the given logical name and trailing name . For example " person " and " Controller " would evaluate to " PersonController " . * @ param logicalName The logical name * @ param trailingName The trailing name * @ return The class name */ public static String getClassName ( String logicalName , String trailingName ) { } }
if ( isBlank ( logicalName ) ) { throw new IllegalArgumentException ( "Argument [logicalName] cannot be null or blank" ) ; } String className = logicalName . substring ( 0 , 1 ) . toUpperCase ( Locale . ENGLISH ) + logicalName . substring ( 1 ) ; if ( trailingName != null ) { className = className + trailingName ; } return className ;
public class AdminToolUtils { /** * Utility function that fetches partitions . * @ param adminClient An instance of AdminClient points to given cluster * @ return all partitions on cluster */ public static List < Integer > getAllPartitions ( AdminClient adminClient ) { } }
List < Integer > partIds = Lists . newArrayList ( ) ; partIds = Lists . newArrayList ( ) ; for ( Node node : adminClient . getAdminClientCluster ( ) . getNodes ( ) ) { partIds . addAll ( node . getPartitionIds ( ) ) ; } return partIds ;
public class OperationRequestHandler { /** * / * ( non - Javadoc ) * @ see org . jboss . as . cli . CommandHandler # handle ( org . jboss . as . cli . CommandContext ) */ @ Override public void handle ( CommandContext ctx ) throws CommandLineException { } }
ModelControllerClient client = ctx . getModelControllerClient ( ) ; if ( client == null ) { throw new CommandFormatException ( "You are disconnected at the moment." + " Type 'connect' to connect to the server" + " or 'help' for the list of supported commands." ) ; } RequestWithAttachments reqWithAttachments = ( RequestWithAttachments ) ctx . get ( Scope . REQUEST , "OP_REQ" ) ; if ( reqWithAttachments == null ) { throw new CommandLineException ( "Parsed request isn't available." ) ; } ModelNode request = reqWithAttachments . getRequest ( ) ; OperationBuilder opBuilder = new OperationBuilder ( request , true ) ; for ( String path : reqWithAttachments . getAttachedFiles ( ) ) { opBuilder . addFileAsAttachment ( new File ( path ) ) ; } Operation op = opBuilder . build ( ) ; if ( ctx . getConfig ( ) . isValidateOperationRequests ( ) ) { ModelNode opDescOutcome = Util . validateRequest ( ctx , request ) ; if ( opDescOutcome != null ) { // operation has params that might need to be replaced Util . replaceFilePathsWithBytes ( request , opDescOutcome ) ; } } try { final ModelNode result = ctx . execute ( op , "Operation request" ) ; if ( Util . isSuccess ( result ) ) { ctx . printDMR ( result ) ; } else { throw new CommandLineException ( result . toString ( ) ) ; } } catch ( NoSuchElementException e ) { throw new CommandLineException ( "ModelNode request is incomplete" , e ) ; } catch ( CancellationException e ) { throw new CommandLineException ( "The result couldn't be retrieved (perhaps the task was cancelled" , e ) ; } catch ( IOException e ) { if ( e . getCause ( ) != null && ! ( e . getCause ( ) instanceof InterruptedException ) ) { ctx . disconnectController ( ) ; } throw new CommandLineException ( "Communication error" , e ) ; } catch ( RuntimeException e ) { throw new CommandLineException ( "Failed to execute operation." , e ) ; }
public class AmazonAlexaForBusinessClient { /** * Searches room profiles and lists the ones that meet a set of filter criteria . * @ param searchProfilesRequest * @ return Result of the SearchProfiles operation returned by the service . * @ sample AmazonAlexaForBusiness . SearchProfiles * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / alexaforbusiness - 2017-11-09 / SearchProfiles " * target = " _ top " > AWS API Documentation < / a > */ @ Override public SearchProfilesResult searchProfiles ( SearchProfilesRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeSearchProfiles ( request ) ;
public class WindDirection { /** * Sets the colordefinition of the second pointer * @ param POINTER2 _ COLOR */ public void setPointer2Color ( final ColorDef POINTER2_COLOR ) { } }
pointer2Color = POINTER2_COLOR ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . height ) ; repaint ( getInnerBounds ( ) ) ;
public class GenericsResolver { /** * By default returned context set on root class ( but generic types for root class will be resolved from specified * generics bounds ) . To use it switch context to required type from hierarchy : * { @ code returnedContext . type ( SomeTypeFromHierarchy . class ) } . * Note : when ignore classes provided , produced { @ code GenericsInfo } instance will not be cached * ( and full version from cache will not be used also ) * @ param type root class to resolve generics hierarchy * @ param ignoreClasses list of classes to ignore during inspection ( useful to avoid interface clashes * or to limit resolution depth ) * @ return resolved generics context object */ public static GenericsContext resolve ( final Class < ? > type , final Class < ? > ... ignoreClasses ) { } }
final Class < ? > notPrimitiveType = TypeUtils . wrapPrimitive ( type ) ; return new GenericsContext ( GenericsInfoFactory . create ( notPrimitiveType , ignoreClasses ) , notPrimitiveType ) ;