signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class Color { /** * Converts the number to a two - digit hex string ,
* e . g . 0 becomes " 00 " and 255 becomes " FF " .
* @ param number int between 0 and 255
* @ return String */
private static final String toBrowserHexValue ( final int number ) { } }
|
final String chex = Integer . toHexString ( fixRGB ( number ) & 0xFF ) . toUpperCase ( ) ; if ( chex . length ( ) < 2 ) { return "0" + chex ; } return chex ;
|
public class BackendManager { /** * Final private error log for use in the constructor above */
private void intError ( String message , Throwable t ) { } }
|
logHandler . error ( message , t ) ; debugStore . log ( message , t ) ;
|
public class JSONObject { /** * Put a key / boolean pair in the JSONObject .
* @ param key
* A key string .
* @ param value
* A boolean which is the value .
* @ return this .
* @ throws JSONException
* If the key is null . */
public JSONObject put ( Enum < ? > key , boolean value ) throws JSONException { } }
|
return put ( key . name ( ) , value ) ;
|
public class AbstractGISTreeSet { /** * Replies the set of nodes that have an intersection with the specified rectangle .
* < p > This function replies the nodes with a broad - first iteration on the elements ' tree .
* @ param clipBounds is the bounds outside which the nodes will not be replied
* @ return the nodes inside the specified bounds . */
@ Pure Iterator < N > nodeIterator ( Rectangle2afp < ? , ? , ? , ? , ? , ? > clipBounds ) { } }
|
return new BroadFirstTreeIterator < > ( this . tree , new FrustumSelector < P , N > ( clipBounds ) ) ;
|
public class JavaScriptEscape { /** * Perform a ( configurable ) JavaScript < strong > escape < / strong > operation on a < tt > String < / tt > input ,
* writing results to a < tt > Writer < / tt > .
* This method will perform an escape operation according to the specified
* { @ link org . unbescape . javascript . JavaScriptEscapeType } and
* { @ link org . unbescape . javascript . JavaScriptEscapeLevel } argument values .
* All other < tt > String < / tt > / < tt > Writer < / tt > - based < tt > escapeJavaScript * ( . . . ) < / tt > methods call this one with preconfigured
* < tt > type < / tt > and < tt > level < / tt > values .
* This method is < strong > thread - safe < / strong > .
* @ param text the < tt > String < / tt > to be escaped .
* @ param writer the < tt > java . io . Writer < / tt > to which the escaped result will be written . Nothing will
* be written at all to this writer if input is < tt > null < / tt > .
* @ param type the type of escape operation to be performed , see
* { @ link org . unbescape . javascript . JavaScriptEscapeType } .
* @ param level the escape level to be applied , see { @ link org . unbescape . javascript . JavaScriptEscapeLevel } .
* @ throws IOException if an input / output exception occurs
* @ since 1.1.2 */
public static void escapeJavaScript ( final String text , final Writer writer , final JavaScriptEscapeType type , final JavaScriptEscapeLevel level ) throws IOException { } }
|
if ( writer == null ) { throw new IllegalArgumentException ( "Argument 'writer' cannot be null" ) ; } if ( type == null ) { throw new IllegalArgumentException ( "The 'type' argument cannot be null" ) ; } if ( level == null ) { throw new IllegalArgumentException ( "The 'level' argument cannot be null" ) ; } JavaScriptEscapeUtil . escape ( new InternalStringReader ( text ) , writer , type , level ) ;
|
public class ProcessStateListenerService { /** * This will < strong > NEVER < / strong > be called on a HostController .
* @ param newState the new running state . */
private void suspendTransition ( Process . RunningState oldState , Process . RunningState newState ) { } }
|
synchronized ( stopLock ) { if ( oldState == newState ) { return ; } this . runningState = newState ; final RunningStateChangeEvent event = new RunningStateChangeEvent ( oldState , newState ) ; Future < ? > suspendStateTransition = executorServiceSupplier . get ( ) . submit ( ( ) -> { CoreManagementLogger . ROOT_LOGGER . debugf ( "Executing runningStateChanged %s in thread %s" , event , Thread . currentThread ( ) . getName ( ) ) ; listener . runningStateChanged ( event ) ; } ) ; try { suspendStateTransition . get ( timeout , TimeUnit . SECONDS ) ; } catch ( InterruptedException ex ) { Thread . currentThread ( ) . interrupt ( ) ; CoreManagementLogger . ROOT_LOGGER . processStateInvokationError ( ex , name ) ; } catch ( TimeoutException ex ) { CoreManagementLogger . ROOT_LOGGER . processStateTimeoutError ( ex , name ) ; } catch ( ExecutionException | RuntimeException t ) { CoreManagementLogger . ROOT_LOGGER . processStateInvokationError ( t , name ) ; } finally { if ( ! suspendStateTransition . isDone ( ) ) { suspendStateTransition . cancel ( true ) ; } } }
|
public class ArrayComprehension { /** * Adds a child loop node , and sets its parent to this node .
* @ throws IllegalArgumentException if acl is { @ code null } */
public void addLoop ( ArrayComprehensionLoop acl ) { } }
|
assertNotNull ( acl ) ; loops . add ( acl ) ; acl . setParent ( this ) ;
|
public class DatabaseDAODefaultImpl { public String [ ] getPossibleTangoHosts ( Database database ) { } }
|
String [ ] tangoHosts = null ; try { DeviceData deviceData = database . command_inout ( "DbGetCSDbServerList" ) ; tangoHosts = deviceData . extractStringArray ( ) ; } catch ( DevFailed e ) { String desc = e . errors [ 0 ] . desc . toLowerCase ( ) ; try { if ( desc . startsWith ( "command " ) && desc . endsWith ( "not found" ) ) { tangoHosts = new String [ ] { database . getFullTangoHost ( ) } ; } else System . err . println ( e . errors [ 0 ] . desc ) ; } catch ( DevFailed e2 ) { System . err . println ( e2 . errors [ 0 ] . desc ) ; } } return tangoHosts ;
|
public class RecursiveObjectReader { /** * Get values of all properties in specified object and its subobjects and
* returns them as a map .
* The object can be a user defined object , map or array . Returned properties
* correspondently are object properties , map key - pairs or array elements with
* their indexes .
* @ param obj an object to get properties from .
* @ return a map , containing the names of the object ' s properties and their
* values . */
public static Map < String , Object > getProperties ( Object obj ) { } }
|
Map < String , Object > properties = new HashMap < String , Object > ( ) ; if ( obj == null ) { return properties ; } else { List < Object > cycleDetect = new ArrayList < Object > ( ) ; performGetProperties ( obj , null , properties , cycleDetect ) ; return properties ; }
|
public class SqlBuilder { /** * param .
* @ param name a { @ link java . lang . String } object .
* @ param value a { @ link java . lang . Object } object .
* @ return a { @ link org . beangle . commons . dao . query . builder . SqlBuilder } object . */
public SqlBuilder param ( String name , Object value ) { } }
|
params . put ( name , value ) ; return this ;
|
public class CachedInstanceQuery { /** * Get a CachedInstanceQuery that will only cache during a request .
* @ param _ typeUUID uuid of the Type the query is based on
* @ return the 4 request
* @ throws EFapsException on error */
public static CachedInstanceQuery get4Request ( final UUID _typeUUID ) throws EFapsException { } }
|
return new CachedInstanceQuery ( Context . getThreadContext ( ) . getRequestId ( ) , _typeUUID ) . setLifespan ( 5 ) . setLifespanUnit ( TimeUnit . MINUTES ) ;
|
public class ZKPaths { /** * Make sure all the nodes in the path are created . NOTE : Unlike File . mkdirs ( ) , Zookeeper doesn ' t distinguish
* between directories and files . So , every node in the path is created . The data for each node is an empty blob
* @ param zookeeper the client
* @ param path path to ensure
* @ throws InterruptedException thread interruption
* @ throws org . apache . zookeeper . KeeperException Zookeeper errors */
public static void mkdirs ( ZooKeeper zookeeper , String path ) throws InterruptedException , KeeperException { } }
|
mkdirs ( zookeeper , path , true , null , false ) ;
|
public class AbstractGenericController { /** * ( non - Javadoc ) .
* @ param key
* the key
* @ return the controller */
@ Override public Controller < M , V > removeChild ( final String key ) { } }
|
return children . remove ( key ) ;
|
public class KeyVaultClientCustomImpl { /** * The update key operation changes specified attributes of a stored key and can
* be applied to any key type and key version stored in Azure Key Vault . The
* cryptographic material of a key itself cannot be changed . In order to perform
* this operation , the key must already exist in the Key Vault . Authorization :
* requires the keys / update permission .
* @ param updateKeyRequest
* the grouped properties for updating a key request
* @ return the KeyBundle if successful . */
public KeyBundle updateKey ( UpdateKeyRequest updateKeyRequest ) { } }
|
return updateKey ( updateKeyRequest . vaultBaseUrl ( ) , updateKeyRequest . keyName ( ) , updateKeyRequest . keyVersion ( ) , updateKeyRequest . keyOperations ( ) , updateKeyRequest . keyAttributes ( ) , updateKeyRequest . tags ( ) ) ;
|
public class JsResources { /** * async load of resources .
* @ param function function to call on load */
public static void whenReady ( final String scriptname , final EventListener function ) { } }
|
List < EventListener > eventList = JsResources . eventLisenerQueue . get ( scriptname ) ; if ( eventList == null ) { eventList = new ArrayList < > ( ) ; JsResources . eventLisenerQueue . put ( scriptname , eventList ) ; } eventList . add ( function ) ; if ( BooleanUtils . isTrue ( JsResources . initializationStarted . get ( scriptname ) ) || JsResources . isInHeader ( scriptname ) ) { if ( JsResources . isInitialized ( scriptname ) ) { JsResources . eventLisenerQueue . get ( scriptname ) . forEach ( action -> action . handleEvent ( JsResources . rememberEvent . get ( scriptname ) ) ) ; JsResources . eventLisenerQueue . get ( scriptname ) . clear ( ) ; } return ; } JsResources . initializationStarted . put ( scriptname , Boolean . TRUE ) ; final ScriptElement jsScript = Browser . getDocument ( ) . createScriptElement ( ) ; if ( StringUtils . endsWith ( scriptname , ".js" ) ) { jsScript . setSrc ( scriptname ) ; } else { jsScript . setInnerHTML ( scriptname ) ; } jsScript . setType ( JsResources . SCRIPT_TYPE ) ; Browser . getDocument ( ) . getHead ( ) . appendChild ( jsScript ) ; jsScript . setOnload ( event -> { JsResources . eventLisenerQueue . get ( scriptname ) . forEach ( action -> action . handleEvent ( event ) ) ; JsResources . eventLisenerQueue . get ( scriptname ) . clear ( ) ; JsResources . rememberEvent . put ( scriptname , event ) ; } ) ;
|
public class SecurityManagerImpl { /** * translate a string access value ( all , local , none , no , yes ) to int type
* @ param accessValue
* @ return return int access value ( VALUE _ ALL , VALUE _ LOCAL , VALUE _ NO , VALUE _ NONE , VALUE _ YES )
* @ throws SecurityException */
public static short toShortAccessValue ( String accessValue ) throws SecurityException { } }
|
accessValue = accessValue . trim ( ) . toLowerCase ( ) ; if ( accessValue . equals ( "all" ) ) return VALUE_ALL ; else if ( accessValue . equals ( "local" ) ) return VALUE_LOCAL ; else if ( accessValue . equals ( "none" ) ) return VALUE_NONE ; else if ( accessValue . equals ( "no" ) ) return VALUE_NO ; else if ( accessValue . equals ( "yes" ) ) return VALUE_YES ; else if ( accessValue . equals ( "1" ) ) return VALUE_1 ; else if ( accessValue . equals ( "2" ) ) return VALUE_2 ; else if ( accessValue . equals ( "3" ) ) return VALUE_3 ; else if ( accessValue . equals ( "4" ) ) return VALUE_4 ; else if ( accessValue . equals ( "5" ) ) return VALUE_5 ; else if ( accessValue . equals ( "6" ) ) return VALUE_6 ; else if ( accessValue . equals ( "7" ) ) return VALUE_7 ; else if ( accessValue . equals ( "8" ) ) return VALUE_8 ; else if ( accessValue . equals ( "9" ) ) return VALUE_9 ; else if ( accessValue . equals ( "10" ) ) return VALUE_10 ; else throw new SecurityException ( "invalid access value [" + accessValue + "]" , "valid access values are [all,local,no,none,yes,1,...,10]" ) ;
|
public class FeatureTileGen { /** * Get a r , g , b , a color string from the color
* @ param color
* @ return color string */
private static String colorString ( Color color ) { } }
|
return color . getRed ( ) + "," + color . getGreen ( ) + "," + color . getBlue ( ) + "," + color . getAlpha ( ) ;
|
public class JdbcCpoXaAdapter { /** * Retrieves the bean from the datasource . The assumption is that the bean exists in the datasource . If the retrieve
* function defined for this beans returns more than one row , an exception will be thrown .
* @ param name DOCUMENT ME !
* @ param bean This is an bean that has been defined within the metadata of the datasource . If the class is not
* defined an exception will be thrown . If the bean does not exist in the datasource , an exception will be thrown . The
* input bean is used to specify the search criteria , the output bean is populated with the results of the function .
* @ param wheres A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
* @ param orderBy The CpoOrderBy bean that defines the order in which beans should be returned
* @ param nativeExpressions Native expression that will be used to augment the expression stored in the meta data . This
* text will be embedded at run - time
* @ return An bean of the same type as the result parameter that is filled in as specified the metadata for the
* retireve .
* @ throws CpoException Thrown if there are errors accessing the datasource */
@ Override public < T > T retrieveBean ( String name , T bean , Collection < CpoWhere > wheres , Collection < CpoOrderBy > orderBy , Collection < CpoNativeFunction > nativeExpressions ) throws CpoException { } }
|
return getCurrentResource ( ) . retrieveBean ( name , bean , wheres , orderBy , nativeExpressions ) ;
|
public class JoltUtils { /** * Given a json document checks if its jst blank doc , i . e . [ ] or { }
* @ param obj source
* @ return true if the json doc is [ ] or { } */
public static boolean isBlankJson ( final Object obj ) { } }
|
if ( obj == null ) { return true ; } if ( obj instanceof Collection ) { return ( ( ( Collection ) obj ) . size ( ) == 0 ) ; } if ( obj instanceof Map ) { return ( ( ( Map ) obj ) . size ( ) == 0 ) ; } throw new UnsupportedOperationException ( "map or list is supported, got ${obj?obj.getClass():null}" ) ;
|
public class CalledRemoteApiCounter { public CalledRemoteApiCounter increment ( String facadeName ) { } }
|
if ( facadeName == null ) { throw new IllegalArgumentException ( "The argument 'facadeName' should not be null." ) ; } if ( facadeCountMap == null ) { facadeCountMap = new LinkedHashMap < String , Integer > ( ) ; } final Integer count = facadeCountMap . get ( facadeName ) ; if ( count != null ) { facadeCountMap . put ( facadeName , count + 1 ) ; } else { facadeCountMap . put ( facadeName , 1 ) ; } return this ;
|
public class PermissionOverrideAction { /** * Sets the value of explicitly granted permissions
* using a set of { @ link net . dv8tion . jda . core . Permission Permissions } .
* < br > < b > Note : Permissions not marked as { @ link net . dv8tion . jda . core . Permission # isChannel ( ) isChannel ( ) } will have no affect ! < / b >
* @ param permissions
* The Permissions representing the granted
* permissions for the new PermissionOverride .
* < br > If the provided value is { @ code null } the permissions are reset to the default of none
* @ throws java . lang . IllegalArgumentException
* If the any of the specified Permissions is { @ code null }
* @ return The current PermissionOverrideAction - for chaining convenience */
@ CheckReturnValue public PermissionOverrideAction setAllow ( Permission ... permissions ) { } }
|
if ( permissions == null || permissions . length < 1 ) return setAllow ( 0 ) ; checkNull ( permissions , "Permission" ) ; return setAllow ( Permission . getRaw ( permissions ) ) ;
|
public class SonarResultParser { /** * Returns the path of the file linked to an issue created by Sonar .
* The path is relative to the folder where Sonar has been run .
* @ param issueComponent " component " field in an issue .
* @ param components information about all components . */
private String getIssueFilePath ( String issueComponent , Map < String , Component > components ) { } }
|
Component comp = components . get ( issueComponent ) ; String file = comp . path ; if ( ! Strings . isNullOrEmpty ( comp . moduleKey ) ) { String theKey = comp . moduleKey ; while ( ! theKey . isEmpty ( ) ) { Component theChildComp = components . get ( theKey ) ; int p = theKey . lastIndexOf ( ":" ) ; if ( p > 0 ) { theKey = theKey . substring ( 0 , p ) ; } else { theKey = "" ; } if ( theChildComp != null && ! Strings . isNullOrEmpty ( theChildComp . path ) ) { file = theChildComp . path + '/' + file ; } } } return file ;
|
public class ConfusionMatrix { /** * The percentage of negative labeled instances that were predicted as negative .
* @ return TNR / Specificity */
public double specificity ( ) { } }
|
if ( ! isBinary ( ) ) throw new UnsupportedOperationException ( "specificity is only implemented for 2 class problems." ) ; if ( tooLarge ( ) ) throw new UnsupportedOperationException ( "specificity cannot be computed: too many classes" ) ; double tn = _cm [ 0 ] [ 0 ] ; double fp = _cm [ 0 ] [ 1 ] ; return tn / ( tn + fp ) ;
|
public class DataSourceProperties { /** * Determine the name to used based on this configuration .
* @ return the database name to use or { @ code null }
* @ since 2.0.0 */
public String determineDatabaseName ( ) { } }
|
if ( this . generateUniqueName ) { if ( this . uniqueName == null ) { this . uniqueName = UUID . randomUUID ( ) . toString ( ) ; } return this . uniqueName ; } if ( StringUtils . hasLength ( this . name ) ) { return this . name ; } if ( this . embeddedDatabaseConnection != EmbeddedDatabaseConnection . NONE ) { return "testdb" ; } return null ;
|
public class StringMan { /** * Converts a string with possible high - ascii values into their ascii7 equiv . , for instance ' é '
* maps to ' e ' . All low ascii characters are left untouched . Any character above 255 is converted
* to a space . */
public static String getUS7ASCIIEquiv ( String convertString ) { } }
|
if ( convertString == null ) return null ; StringBuilder convertedString = new StringBuilder ( ) ; String upperConvertString = convertString . toUpperCase ( ) ; Collator collator = Collator . getInstance ( Locale . US ) ; collator . setStrength ( Collator . PRIMARY ) ; String chars = "abcdefghijklmnopqrstuvwxyz" ; for ( int i = 0 ; i < convertString . length ( ) ; i ++ ) { char currentChar = convertString . charAt ( i ) ; boolean isUppercase = currentChar == upperConvertString . charAt ( i ) ; char mappedChar = ' ' ; if ( currentChar < 128 ) { // Within low - ascii , leave it alone .
mappedChar = currentChar ; } else if ( currentChar < 256 ) { for ( int j = 0 ; j < chars . length ( ) ; j ++ ) { if ( collator . compare ( currentChar + "" , chars . charAt ( j ) + "" ) == 0 ) { if ( isUppercase ) mappedChar = Character . toUpperCase ( chars . charAt ( j ) ) ; else mappedChar = chars . charAt ( j ) ; break ; } } } else { // Out of our mapping range . It just becomes a space
} convertedString . append ( mappedChar ) ; } return convertedString . toString ( ) ;
|
public class Node { /** * Called by the { @ link Queue } to determine whether or not this node can
* take the given task . The default checks include whether or not this node
* is part of the task ' s assigned label , whether this node is in
* { @ link Mode # EXCLUSIVE } mode if it is not in the task ' s assigned label ,
* and whether or not any of this node ' s { @ link NodeProperty } s say that the
* task cannot be run .
* @ since 1.413 */
public CauseOfBlockage canTake ( Queue . BuildableItem item ) { } }
|
Label l = item . getAssignedLabel ( ) ; if ( l != null && ! l . contains ( this ) ) return CauseOfBlockage . fromMessage ( Messages . _Node_LabelMissing ( getDisplayName ( ) , l ) ) ; // the task needs to be executed on label that this node doesn ' t have .
if ( l == null && getMode ( ) == Mode . EXCLUSIVE ) { // flyweight tasks need to get executed somewhere , if every node
if ( ! ( item . task instanceof Queue . FlyweightTask && ( this instanceof Jenkins || Jenkins . getInstance ( ) . getNumExecutors ( ) < 1 || Jenkins . getInstance ( ) . getMode ( ) == Mode . EXCLUSIVE ) ) ) { return CauseOfBlockage . fromMessage ( Messages . _Node_BecauseNodeIsReserved ( getDisplayName ( ) ) ) ; // this node is reserved for tasks that are tied to it
} } Authentication identity = item . authenticate ( ) ; if ( ! ( SKIP_BUILD_CHECK_ON_FLYWEIGHTS && item . task instanceof Queue . FlyweightTask ) && ! hasPermission ( identity , Computer . BUILD ) ) { // doesn ' t have a permission
return CauseOfBlockage . fromMessage ( Messages . _Node_LackingBuildPermission ( identity . getName ( ) , getDisplayName ( ) ) ) ; } // Check each NodeProperty to see whether they object to this node
// taking the task
for ( NodeProperty prop : getNodeProperties ( ) ) { CauseOfBlockage c = prop . canTake ( item ) ; if ( c != null ) return c ; } if ( ! isAcceptingTasks ( ) ) { return new CauseOfBlockage . BecauseNodeIsNotAcceptingTasks ( this ) ; } // Looks like we can take the task
return null ;
|
public class Record { /** * Retrieves a CodePage instance . Defaults to ANSI .
* @ param field the index number of the field to be retrieved
* @ return the value of the required field */
public CodePage getCodePage ( int field ) { } }
|
CodePage result ; if ( ( field < m_fields . length ) && ( m_fields [ field ] . length ( ) != 0 ) ) { result = CodePage . getInstance ( m_fields [ field ] ) ; } else { result = CodePage . getInstance ( null ) ; } return ( result ) ;
|
public class DevicesManagementApi { /** * Updates a task for all devices - For now just allows changing the state to cancelled .
* Updates a task for all devices - For now just allows changing the state to cancelled .
* @ param tid Task ID . ( required )
* @ param taskUpdateRequest Task update request ( required )
* @ return TaskUpdateResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public TaskUpdateResponse updateTask ( String tid , TaskUpdateRequest taskUpdateRequest ) throws ApiException { } }
|
ApiResponse < TaskUpdateResponse > resp = updateTaskWithHttpInfo ( tid , taskUpdateRequest ) ; return resp . getData ( ) ;
|
public class Calendar { /** * Sets the values for the fields year , month , date , hour , and minute .
* Previous values of other fields are retained . If this is not desired ,
* call { @ link # clear ( ) } first .
* @ param year the value used to set the YEAR time field .
* @ param month the value used to set the MONTH time field .
* Month value is 0 - based . e . g . , 0 for January .
* @ param date the value used to set the DATE time field .
* @ param hour the value used to set the HOUR _ OF _ DAY time field .
* @ param minute the value used to set the MINUTE time field . */
public final void set ( int year , int month , int date , int hour , int minute ) { } }
|
set ( YEAR , year ) ; set ( MONTH , month ) ; set ( DATE , date ) ; set ( HOUR_OF_DAY , hour ) ; set ( MINUTE , minute ) ;
|
public class RansacMulti { /** * { @ inheritDoc } */
@ Override public boolean process ( List < Point > _dataSet ) { } }
|
// see if it has the minimum number of points
if ( _dataSet . size ( ) < sampleSize ) return false ; dataSet . clear ( ) ; dataSet . addAll ( _dataSet ) ; // configure internal data structures
initialize ( dataSet ) ; // iterate until it has exhausted all iterations or stop if the entire data set
// is in the inlier set
for ( iteration = 0 ; checkExitIteration ( ) ; iteration ++ ) { // sample the a small set of points
initialSample . reset ( ) ; Ransac . randomDraw ( dataSet , sampleSize , initialSample . toList ( ) , rand ) ; // try fitting all the different kinds of objects
for ( int j = 0 ; j < objectTypes . size ( ) ; j ++ ) { ObjectType model = objectTypes . get ( j ) ; Object param = objectCandidateParam . get ( j ) ; // adjust the list size to what was requested by this particular model
initialSample . size = model . sampleSize ; // get the candidate ( s ) for this sample set
if ( model . modelGenerator . generate ( initialSample . toList ( ) , param ) ) { // see if it can find a model better than the current best one
selectMatchSet ( _dataSet , model . modelDistance , model . thresholdFit , param ) ; // save this results
if ( bestFitPoints . size ( ) < candidatePoints . size ( ) ) { bestFitModelIndex = j ; objectCandidateParam . set ( j , objectParam . get ( j ) ) ; objectParam . set ( j , param ) ; setBestModel ( param ) ; } } } } return bestFitPoints . size ( ) > 0 ;
|
public class QYWeixinControllerSupport { /** * 微信消息交互处理
* @ param request 请求
* @ param response 响应
* @ return 结果
* @ throws ServletException servlet异常
* @ throws IOException IO异常 */
@ RequestMapping ( method = RequestMethod . POST ) @ ResponseBody protected final String process ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { } }
|
// if ( StrUtil . isBlank ( legalStr ( request ) ) ) {
// return " " ;
String result = processRequest ( request ) ; response . getWriter ( ) . write ( result ) ; return null ;
|
public class AbstractWebApplicationServiceResponseBuilder { /** * Build header response .
* @ param service the service
* @ param parameters the parameters
* @ return the response */
protected Response buildHeader ( final WebApplicationService service , final Map < String , String > parameters ) { } }
|
return DefaultResponse . getHeaderResponse ( service . getOriginalUrl ( ) , parameters ) ;
|
public class FindObjects { /** * Parses an XML based response and removes the items that are not
* permitted .
* @ param request
* the http servlet request
* @ param response
* the http servlet response
* @ return the new response body without non - permissable objects .
* @ throws ServletException */
private byte [ ] filterXML ( HttpServletRequest request , DataResponseWrapper response ) throws ServletException { } }
|
byte [ ] data = response . getData ( ) ; DocumentBuilder docBuilder = null ; Document doc = null ; try { synchronized ( BUILDER_FACTORY ) { docBuilder = BUILDER_FACTORY . newDocumentBuilder ( ) ; } doc = docBuilder . parse ( new ByteArrayInputStream ( data ) ) ; } catch ( Exception e ) { throw new ServletException ( e ) ; } XPath xpath ; synchronized ( XPATH_FACTORY ) { xpath = XPATH_FACTORY . newXPath ( ) ; } xpath . setNamespaceContext ( TYPES_NAMESPACE ) ; NodeList rows = null ; try { rows = ( NodeList ) xpath . evaluate ( "/:result/:resultList/:objectFields/:pid" , doc , XPathConstants . NODESET ) ; } catch ( XPathExpressionException xpe ) { throw new ServletException ( "Error parsing XML for search results: " , xpe ) ; } if ( rows . getLength ( ) == 0 ) { logger . debug ( "No results to filter." ) ; return data ; } Map < String , Node > pids = new HashMap < String , Node > ( ) ; for ( int x = 0 ; x < rows . getLength ( ) ; x ++ ) { Node pid = rows . item ( x ) ; pids . put ( pid . getFirstChild ( ) . getNodeValue ( ) , pid . getParentNode ( ) ) ; } Set < Result > results = evaluatePids ( pids . keySet ( ) , request , response ) ; for ( Result r : results ) { String resource = r . getResource ( ) ; if ( resource == null || resource . isEmpty ( ) ) { logger . warn ( "This resource has no resource identifier in the xacml response results!" ) ; } else if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Checking: {}" , resource ) ; } int lastSlash = resource . lastIndexOf ( '/' ) ; String rid = resource . substring ( lastSlash + 1 ) ; if ( r . getStatus ( ) . getCode ( ) . contains ( Status . STATUS_OK ) && r . getDecision ( ) != Result . DECISION_PERMIT ) { Node node = pids . get ( rid ) ; node . getParentNode ( ) . removeChild ( node ) ; logger . debug ( "Removing: {} [{}]" , resource , rid ) ; } } // since namespaces are disabled , set the attribute explicitly
doc . getDocumentElement ( ) . setAttribute ( "xmlns" , "http://www.fedora.info/definitions/1/0/types/" ) ; Source src = new DOMSource ( doc ) ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; javax . xml . transform . Result dst = new StreamResult ( os ) ; try { xFormer . transform ( src , dst ) ; } catch ( TransformerException te ) { throw new ServletException ( "error generating output" , te ) ; } return os . toByteArray ( ) ;
|
public class Parse { /** * Appends the specified string buffer with a string representation of this parse .
* @ param sb A string buffer into which the parse string can be appended . */
public void show ( StringBuffer sb ) { } }
|
int start ; start = span . getStart ( ) ; if ( ! type . equals ( ParserME . TOK_NODE ) ) { sb . append ( "(" ) ; sb . append ( type + " " ) ; // System . out . print ( label + " " ) ;
// System . out . print ( head + " " ) ;
// System . out . print ( df . format ( prob ) + " " ) ;
} for ( Iterator i = parts . iterator ( ) ; i . hasNext ( ) ; ) { Parse c = ( Parse ) i . next ( ) ; Span s = c . span ; if ( start < s . getStart ( ) ) { // System . out . println ( " pre " + start + " " + s . getStart ( ) ) ;
sb . append ( text . substring ( start , s . getStart ( ) ) ) ; } c . show ( sb ) ; start = s . getEnd ( ) ; } sb . append ( text . substring ( start , span . getEnd ( ) ) ) ; if ( ! type . equals ( ParserME . TOK_NODE ) ) { sb . append ( ")" ) ; }
|
public class XCasePartImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setFallThrough ( boolean newFallThrough ) { } }
|
boolean oldFallThrough = fallThrough ; fallThrough = newFallThrough ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , XbasePackage . XCASE_PART__FALL_THROUGH , oldFallThrough , fallThrough ) ) ;
|
public class LeaderCache { /** * Get a current snapshot of the watched root node ' s children . This snapshot
* promises no cross - children atomicity guarantees . */
@ Override public ImmutableMap < Integer , Long > pointInTimeCache ( ) { } }
|
if ( m_shutdown . get ( ) ) { throw new RuntimeException ( "Requested cache from shutdown LeaderCache." ) ; } HashMap < Integer , Long > cacheCopy = new HashMap < Integer , Long > ( ) ; for ( Entry < Integer , LeaderCallBackInfo > e : m_publicCache . entrySet ( ) ) { cacheCopy . put ( e . getKey ( ) , e . getValue ( ) . m_HSId ) ; } return ImmutableMap . copyOf ( cacheCopy ) ;
|
public class UberLinkDiscoverer { /** * ( non - Javadoc )
* @ see org . springframework . hateoas . LinkDiscoverer # findLinksWithRel ( org . springframework . hateoas . LinkRelation , java . lang . String ) */
@ Override public Links findLinksWithRel ( LinkRelation rel , String representation ) { } }
|
return getLinks ( representation ) . stream ( ) . filter ( it -> it . hasRel ( rel ) ) . collect ( Links . collector ( ) ) ;
|
public class ActivityChooserModel { /** * Loads the activities for the current intent if needed which is
* if they are not already loaded for the current intent .
* @ return Whether loading was performed . */
private boolean loadActivitiesIfNeeded ( ) { } }
|
if ( mReloadActivities && mIntent != null ) { mReloadActivities = false ; mActivities . clear ( ) ; List < ResolveInfo > resolveInfos = mContext . getPackageManager ( ) . queryIntentActivities ( mIntent , 0 ) ; final int resolveInfoCount = resolveInfos . size ( ) ; for ( int i = 0 ; i < resolveInfoCount ; i ++ ) { ResolveInfo resolveInfo = resolveInfos . get ( i ) ; mActivities . add ( new ActivityResolveInfo ( resolveInfo ) ) ; } return true ; } return false ;
|
public class MtasSolrComponentStats { /** * Prepare tokens .
* @ param rb the rb
* @ param mtasFields the mtas fields
* @ throws IOException Signals that an I / O exception has occurred . */
private void prepareTokens ( ResponseBuilder rb , ComponentFields mtasFields ) throws IOException { } }
|
Set < String > ids = MtasSolrResultUtil . getIdsFromParameters ( rb . req . getParams ( ) , PARAM_MTAS_STATS_TOKENS ) ; if ( ! ids . isEmpty ( ) ) { int tmpCounter = 0 ; String [ ] fields = new String [ ids . size ( ) ] ; String [ ] keys = new String [ ids . size ( ) ] ; String [ ] minima = new String [ ids . size ( ) ] ; String [ ] maxima = new String [ ids . size ( ) ] ; String [ ] types = new String [ ids . size ( ) ] ; for ( String id : ids ) { fields [ tmpCounter ] = rb . req . getParams ( ) . get ( PARAM_MTAS_STATS_TOKENS + "." + id + "." + NAME_MTAS_STATS_TOKENS_FIELD , null ) ; keys [ tmpCounter ] = rb . req . getParams ( ) . get ( PARAM_MTAS_STATS_TOKENS + "." + id + "." + NAME_MTAS_STATS_TOKENS_KEY , String . valueOf ( tmpCounter ) ) . trim ( ) ; minima [ tmpCounter ] = rb . req . getParams ( ) . get ( PARAM_MTAS_STATS_TOKENS + "." + id + "." + NAME_MTAS_STATS_TOKENS_MINIMUM , null ) ; maxima [ tmpCounter ] = rb . req . getParams ( ) . get ( PARAM_MTAS_STATS_TOKENS + "." + id + "." + NAME_MTAS_STATS_TOKENS_MAXIMUM , null ) ; types [ tmpCounter ] = rb . req . getParams ( ) . get ( PARAM_MTAS_STATS_TOKENS + "." + id + "." + NAME_MTAS_STATS_TOKENS_TYPE , null ) ; tmpCounter ++ ; } String uniqueKeyField = rb . req . getSchema ( ) . getUniqueKeyField ( ) . getName ( ) ; mtasFields . doStats = true ; mtasFields . doStatsTokens = true ; rb . setNeedDocSet ( true ) ; for ( String field : fields ) { if ( field == null || field . isEmpty ( ) ) { throw new IOException ( "no (valid) field in mtas stats tokens" ) ; } else if ( ! mtasFields . list . containsKey ( field ) ) { mtasFields . list . put ( field , new ComponentField ( uniqueKeyField ) ) ; } } MtasSolrResultUtil . compareAndCheck ( keys , fields , NAME_MTAS_STATS_TOKENS_KEY , NAME_MTAS_STATS_TOKENS_FIELD , true ) ; MtasSolrResultUtil . compareAndCheck ( minima , fields , NAME_MTAS_STATS_TOKENS_MINIMUM , NAME_MTAS_STATS_TOKENS_FIELD , false ) ; MtasSolrResultUtil . compareAndCheck ( maxima , fields , NAME_MTAS_STATS_TOKENS_MAXIMUM , NAME_MTAS_STATS_TOKENS_FIELD , false ) ; MtasSolrResultUtil . compareAndCheck ( types , fields , NAME_MTAS_STATS_TOKENS_TYPE , NAME_MTAS_STATS_TOKENS_FIELD , false ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { String field = fields [ i ] ; String key = keys [ i ] ; String type = ( types [ i ] == null ) || ( types [ i ] . isEmpty ( ) ) ? null : types [ i ] . trim ( ) ; Double minimum = ( minima [ i ] == null ) || ( minima [ i ] . isEmpty ( ) ) ? null : Double . parseDouble ( minima [ i ] ) ; Double maximum = ( maxima [ i ] == null ) || ( maxima [ i ] . isEmpty ( ) ) ? null : Double . parseDouble ( maxima [ i ] ) ; try { mtasFields . list . get ( field ) . statsTokenList . add ( new ComponentToken ( key , minimum , maximum , type ) ) ; } catch ( ParseException e ) { throw new IOException ( e . getMessage ( ) ) ; } } }
|
public class ReflectionUtils { /** * Checks if the 2 methods are equals .
* @ param method the first method
* @ param other the second method
* @ return true if the 2 methods are equals */
public static boolean methodEquals ( Method method , Method other ) { } }
|
if ( ( method . getDeclaringClass ( ) . equals ( other . getDeclaringClass ( ) ) ) && ( method . getName ( ) . equals ( other . getName ( ) ) ) ) { if ( ! method . getReturnType ( ) . equals ( other . getReturnType ( ) ) ) return false ; Class < ? > [ ] params1 = method . getParameterTypes ( ) ; Class < ? > [ ] params2 = other . getParameterTypes ( ) ; if ( params1 . length == params2 . length ) { for ( int i = 0 ; i < params1 . length ; i ++ ) { if ( params1 [ i ] != params2 [ i ] ) return false ; } return true ; } } return false ;
|
public class AbstractCodeGen { /** * Output right curly bracket
* @ param out Writer
* @ param indent space number
* @ throws IOException ioException */
void writeRightCurlyBracket ( Writer out , int indent ) throws IOException { } }
|
writeEol ( out ) ; writeWithIndent ( out , indent , "}\n" ) ;
|
public class PathQueryNode { /** * Returns an array of all currently set location step nodes .
* @ return an array of all currently set location step nodes . */
public LocationStepQueryNode [ ] getPathSteps ( ) { } }
|
if ( operands == null ) { return EMPTY ; } else { return ( LocationStepQueryNode [ ] ) operands . toArray ( new LocationStepQueryNode [ operands . size ( ) ] ) ; }
|
public class UsagesInner { /** * Gets the current usage count and the limit for the resources under the subscription .
* @ return the observable to the List & lt ; UsageInner & gt ; object */
public Observable < Page < UsageInner > > listAsync ( ) { } }
|
return listWithServiceResponseAsync ( ) . map ( new Func1 < ServiceResponse < List < UsageInner > > , Page < UsageInner > > ( ) { @ Override public Page < UsageInner > call ( ServiceResponse < List < UsageInner > > response ) { PageImpl < UsageInner > page = new PageImpl < > ( ) ; page . setItems ( response . body ( ) ) ; return page ; } } ) ;
|
public class NatsTransporter { /** * Closes transporter . */
@ Override public void stopped ( ) { } }
|
// Mark as stopped
started . set ( false ) ; // Stop timers
super . stopped ( ) ; // Disconnect
try { Thread . sleep ( 100 ) ; } catch ( InterruptedException interrupt ) { } disconnect ( ) ;
|
public class ScalarMult { /** * @ description
* Multiplies an integer n by a group element p and
* returns the resulting group element . */
public static byte [ ] scalseMult ( byte [ ] n , byte [ ] p ) { } }
|
if ( ! ( n . length == scalarLength && p . length == groupElementLength ) ) return null ; byte [ ] q = new byte [ scalarLength ] ; crypto_scalarmult ( q , n , p ) ; return q ;
|
public class DependencyTree { /** * 错误 */
private void getWords ( String [ ] words ) { } }
|
words [ id ] = word ; for ( int i = 0 ; i < leftChilds . size ( ) ; i ++ ) { leftChilds . get ( i ) . getWords ( words ) ; } for ( int i = 0 ; i < rightChilds . size ( ) ; i ++ ) { rightChilds . get ( i ) . getWords ( words ) ; }
|
public class ProcessApplicationProcessor { /** * Detect an existing { @ link ProcessApplication } component . */
protected ComponentDescription detectExistingComponent ( DeploymentUnit deploymentUnit ) throws DeploymentUnitProcessingException { } }
|
final EEModuleDescription eeModuleDescription = deploymentUnit . getAttachment ( Attachments . EE_MODULE_DESCRIPTION ) ; final EEApplicationClasses eeApplicationClasses = deploymentUnit . getAttachment ( Attachments . EE_APPLICATION_CLASSES_DESCRIPTION ) ; final CompositeIndex compositeIndex = deploymentUnit . getAttachment ( org . jboss . as . server . deployment . Attachments . COMPOSITE_ANNOTATION_INDEX ) ; final WarMetaData warMetaData = deploymentUnit . getAttachment ( WarMetaData . ATTACHMENT_KEY ) ; // extract deployment metadata
List < AnnotationInstance > processApplicationAnnotations = null ; List < AnnotationInstance > postDeployAnnnotations = null ; List < AnnotationInstance > preUndeployAnnnotations = null ; Set < ClassInfo > servletProcessApplications = null ; if ( compositeIndex != null ) { processApplicationAnnotations = compositeIndex . getAnnotations ( DotName . createSimple ( ProcessApplication . class . getName ( ) ) ) ; postDeployAnnnotations = compositeIndex . getAnnotations ( DotName . createSimple ( PostDeploy . class . getName ( ) ) ) ; preUndeployAnnnotations = compositeIndex . getAnnotations ( DotName . createSimple ( PreUndeploy . class . getName ( ) ) ) ; servletProcessApplications = compositeIndex . getAllKnownSubclasses ( DotName . createSimple ( ServletProcessApplication . class . getName ( ) ) ) ; } else { return null ; } if ( processApplicationAnnotations . isEmpty ( ) ) { // no pa found , this is not a process application deployment .
return null ; } else if ( processApplicationAnnotations . size ( ) > 1 ) { // found multiple PAs - > unsupported .
throw new DeploymentUnitProcessingException ( "Detected multiple classes annotated with @" + ProcessApplication . class . getSimpleName ( ) + ". A deployment must only provide a single @" + ProcessApplication . class . getSimpleName ( ) + " class." ) ; } else { // found single PA
AnnotationInstance annotationInstance = processApplicationAnnotations . get ( 0 ) ; ClassInfo paClassInfo = ( ClassInfo ) annotationInstance . target ( ) ; String paClassName = paClassInfo . name ( ) . toString ( ) ; ComponentDescription paComponent = null ; // it can either be a Servlet Process Application or a Singleton Session Bean Component or
if ( servletProcessApplications . contains ( paClassInfo ) ) { // Servlet Process Applications can only be deployed inside Web Applications
if ( warMetaData == null ) { throw new DeploymentUnitProcessingException ( "@ProcessApplication class is a ServletProcessApplication but deployment is not a Web Application." ) ; } // check whether it ' s already a servlet context listener :
JBossWebMetaData mergedJBossWebMetaData = warMetaData . getMergedJBossWebMetaData ( ) ; List < ListenerMetaData > listeners = mergedJBossWebMetaData . getListeners ( ) ; if ( listeners == null ) { listeners = new ArrayList < ListenerMetaData > ( ) ; mergedJBossWebMetaData . setListeners ( listeners ) ; } boolean isListener = false ; for ( ListenerMetaData listenerMetaData : listeners ) { if ( listenerMetaData . getListenerClass ( ) . equals ( paClassInfo . name ( ) . toString ( ) ) ) { isListener = true ; } } if ( ! isListener ) { // register as Servlet Context Listener
ListenerMetaData listener = new ListenerMetaData ( ) ; listener . setListenerClass ( paClassName ) ; listeners . add ( listener ) ; // synthesize WebComponent
WebComponentDescription paWebComponent = new WebComponentDescription ( paClassName , paClassName , eeModuleDescription , deploymentUnit . getServiceName ( ) , eeApplicationClasses ) ; eeModuleDescription . addComponent ( paWebComponent ) ; deploymentUnit . addToAttachmentList ( WebComponentDescription . WEB_COMPONENTS , paWebComponent . getStartServiceName ( ) ) ; paComponent = paWebComponent ; } else { // lookup the existing component
paComponent = eeModuleDescription . getComponentsByClassName ( paClassName ) . get ( 0 ) ; } // deactivate sci
} else { // if its not a ServletProcessApplication it must be a session bean component
List < ComponentDescription > componentsByClassName = eeModuleDescription . getComponentsByClassName ( paClassName ) ; if ( ! componentsByClassName . isEmpty ( ) && ( componentsByClassName . get ( 0 ) instanceof SessionBeanComponentDescription ) ) { paComponent = componentsByClassName . get ( 0 ) ; } else { throw new DeploymentUnitProcessingException ( "Class " + paClassName + " is annotated with @" + ProcessApplication . class . getSimpleName ( ) + " but is neither a ServletProcessApplication nor an EJB Session Bean Component." ) ; } } // attach additional metadata to the deployment unit
if ( ! postDeployAnnnotations . isEmpty ( ) ) { if ( postDeployAnnnotations . size ( ) == 1 ) { ProcessApplicationAttachments . attachPostDeployDescription ( deploymentUnit , postDeployAnnnotations . get ( 0 ) ) ; } else { throw new DeploymentUnitProcessingException ( "There can only be a single method annotated with @PostDeploy. Found [" + postDeployAnnnotations + "]" ) ; } } if ( ! preUndeployAnnnotations . isEmpty ( ) ) { if ( preUndeployAnnnotations . size ( ) == 1 ) { ProcessApplicationAttachments . attachPreUndeployDescription ( deploymentUnit , preUndeployAnnnotations . get ( 0 ) ) ; } else { throw new DeploymentUnitProcessingException ( "There can only be a single method annotated with @PreUndeploy. Found [" + preUndeployAnnnotations + "]" ) ; } } return paComponent ; }
|
public class ClassMap { /** * Returns the vale associated with the any
* interface implemented by the supplied class .
* This method will return the first match only , if
* more than one value can be resolved the first is
* returned .
* @ param clazz Class to inspect interfaces of .
* @ return The resolved value if found , else null . */
public T getByInterfaces ( Class < ? > clazz ) { } }
|
T object = null ; Class < ? > [ ] interfaces = clazz . getInterfaces ( ) ; for ( Class < ? > interfaceClass : interfaces ) { object = map . get ( interfaceClass ) ; if ( object != null ) { break ; } } return object ;
|
public class AbstractFaxClientSpi { /** * This function will cancel an existing fax job .
* @ param faxJob
* The fax job object containing the needed information */
public void cancelFaxJob ( FaxJob faxJob ) { } }
|
// validate fax job ID
this . invokeFaxJobIDValidation ( faxJob ) ; // invoke action
this . cancelFaxJobImpl ( faxJob ) ; // fire event
this . fireFaxEvent ( FaxClientActionEventID . CANCEL_FAX_JOB , faxJob ) ;
|
public class BackendTransaction { /** * Acquires a lock for the key - column pair on the edge store which ensures that nobody else can take a lock on that
* respective entry for the duration of this lock ( but somebody could potentially still overwrite
* the key - value entry without taking a lock ) .
* The expectedValue defines the value expected to match the value at the time the lock is acquired ( or null if it is expected
* that the key - column pair does not exist ) .
* If this method is called multiple times with the same key - column pair in the same transaction , all but the first invocation are ignored .
* The lock has to be released when the transaction closes ( commits or aborts ) .
* @ param key Key on which to lock
* @ param column Column the column on which to lock */
public void acquireEdgeLock ( StaticBuffer key , StaticBuffer column ) throws BackendException { } }
|
acquiredLock = true ; edgeStore . acquireLock ( key , column , null , storeTx ) ;
|
public class InstantAdapter { /** * Read a time from the Places API and convert to a { @ link Instant } */
@ Override public Instant read ( JsonReader reader ) throws IOException { } }
|
if ( reader . peek ( ) == JsonToken . NULL ) { reader . nextNull ( ) ; return null ; } if ( reader . peek ( ) == JsonToken . NUMBER ) { // Number is the number of seconds since Epoch .
return Instant . ofEpochMilli ( reader . nextLong ( ) * 1000L ) ; } throw new UnsupportedOperationException ( "Unsupported format" ) ;
|
public class AbcGrammar { /** * field - rhythm : : = % x52.3A * WSP tex - text header - eol < p >
* < tt > R : < / tt > */
Rule FieldRhythm ( ) { } }
|
return Sequence ( String ( "R:" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , TexText ( ) , HeaderEol ( ) ) . label ( FieldRhythm ) ;
|
public class ResourceList { /** * Customer iterator calls out to BW API when there is more data to retrieve */
public Iterator < E > iterator ( ) { } }
|
final Iterator < E > it = new Iterator < E > ( ) { @ Override public boolean hasNext ( ) { return ( index < size ( ) ) ; } @ Override public E next ( ) { final E elem = get ( index ++ ) ; if ( index >= size ( ) && nextLink != null ) { getNextPage ( ) ; } return elem ; } @ Override public void remove ( ) { // TODO Auto - generated method stub
} } ; return it ; // return super . iterator ( ) ;
|
public class RecurlyClient { /** * Refund an invoice given an open amount
* Returns the refunded invoice
* @ deprecated Please use refundInvoice ( String , InvoiceRefund )
* @ param invoiceId The id of the invoice to refund
* @ param amountInCents The open amount to refund
* @ param method If credit line items exist on the invoice , this parameter specifies which refund method to use first
* @ return the refunded invoice */
@ Deprecated public Invoice refundInvoice ( final String invoiceId , final Integer amountInCents , final RefundMethod method ) { } }
|
final InvoiceRefund invoiceRefund = new InvoiceRefund ( ) ; invoiceRefund . setRefundMethod ( method ) ; invoiceRefund . setAmountInCents ( amountInCents ) ; return refundInvoice ( invoiceId , invoiceRefund ) ;
|
public class ProjectReportToolbar { /** * SetupSFields Method . */
public void setupSFields ( ) { } }
|
super . setupSFields ( ) ; this . getRecord ( ProjectTaskScreenRecord . PROJECT_TASK_SCREEN_RECORD_FILE ) . getField ( ProjectTaskScreenRecord . PROJECT_TASK_ID ) . setupDefaultView ( this . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . ANCHOR_DEFAULT ) , this , ScreenConstants . DEFAULT_DISPLAY ) ;
|
public class Assets { /** * Normalizes the path , by removing { @ code foo / . . } pairs until the path contains no { @ code . . } s .
* For example :
* { @ code foo / bar / . . / baz / bif / . . / bonk . png } becomes { @ code foo / baz / bonk . png } and
* { @ code foo / bar / baz / . . / . . / bing . png } becomes { @ code foo / bing . png } . */
protected static String normalizePath ( String path ) { } }
|
int pathLen ; do { pathLen = path . length ( ) ; path = path . replaceAll ( "[^/]+/\\.\\./" , "" ) ; } while ( path . length ( ) != pathLen ) ; return path ;
|
public class Ix { /** * Calls the given function ( with per - iterator state ) to generate a value or terminate
* whenever the next ( ) is called on the resulting Ix . iterator ( ) .
* The result ' s iterator ( ) doesn ' t support remove ( ) .
* The action may call { @ code onNext } at most once to signal the next value per action invocation .
* The { @ code onCompleted } should be called to indicate no further values will be generated ( may be
* called with an onNext in the same action invocation ) . Calling { @ code onError } will immediately
* throw the given exception ( as is if it ' s a RuntimeException or Error ; or wrapped into a RuntimeException ) .
* Note that since there is no direct way to cancel an Iterator , the stateDisposer is only invoked
* when the nextSupplier calls a terminal method .
* @ param < T > the value type
* @ param < S > the state type supplied to and returned by the nextSupplier function
* @ param stateSupplier the function that returns a state for each invocation of iterator ( )
* @ param nextSupplier the action called with an IxEmitter API to receive value , not null
* @ param stateDisposer the action called when the nextSupplier signals an { @ code onError } or { @ code onCompleted } .
* @ return the new Ix instance
* @ throws NullPointerException if stateSupplier , nextSupplier or stateDisposer is null
* @ since 1.0 */
public static < T , S > Ix < T > generate ( IxSupplier < S > stateSupplier , IxFunction2 < S , IxEmitter < T > , S > nextSupplier , IxConsumer < ? super S > stateDisposer ) { } }
|
return new IxGenerate < T , S > ( nullCheck ( stateSupplier , "stateSupplier is null" ) , nullCheck ( nextSupplier , "nextSupplier is null" ) , nullCheck ( stateDisposer , "stateDisposer is null" ) ) ;
|
public class ThemeManager { /** * Get a specific style of a styleId .
* @ param styleId The styleId .
* @ param theme The theme .
* @ return The specific style . */
public int getStyle ( int styleId , int theme ) { } }
|
int [ ] styles = getStyleList ( styleId ) ; return styles == null ? 0 : styles [ theme ] ;
|
public class ProofObligation { /** * Generate an AEqualsBinaryExp */
protected AEqualsBinaryExp getEqualsExp ( PExp left , PExp right ) { } }
|
return AstExpressionFactory . newAEqualsBinaryExp ( left . clone ( ) , right . clone ( ) ) ;
|
public class SwipeBackLayout { /** * Set a drawable used for edge shadow .
* @ param shadow Drawable to use
* @ param edgeFlags Combination of edge flags describing the edge to set
* @ see # EDGE _ LEFT
* @ see # EDGE _ RIGHT
* @ see # EDGE _ BOTTOM */
public void setShadow ( Drawable shadow , int edgeFlag ) { } }
|
if ( ( edgeFlag & EDGE_LEFT ) != 0 ) { mShadowLeft = shadow ; } else if ( ( edgeFlag & EDGE_RIGHT ) != 0 ) { mShadowRight = shadow ; } else if ( ( edgeFlag & EDGE_BOTTOM ) != 0 ) { mShadowBottom = shadow ; } invalidate ( ) ;
|
public class DefaultGroovyMethods { /** * Returns an iterator equivalent to this iterator with all duplicated
* items removed by using the natural ordering of the items .
* @ param self an Iterator
* @ return an Iterator with no duplicate items
* @ since 2.4.0 */
public static < T > Iterator < T > toUnique ( Iterator < T > self ) { } }
|
return new UniqueIterator < T > ( self , null ) ;
|
public class MessageScreen { /** * This is the application code for handling the message . Once the
* message is received the application can retrieve the soap part , the
* attachment part if there are any , or any other information from the
* message . */
public void processThisMessage ( ) { } }
|
Utility . getLogger ( ) . info ( "On message called in receiving process" ) ; try { BaseMessage messageIn = this . getMessage ( ) ; if ( messageIn != null ) { BaseMessage messageReply = this . createReplyMessage ( messageIn ) ; this . moveScreenParamsToMessage ( messageReply ) ; // Step 2 - Get the body part of the message
this . getTransport ( ) . setupReplyMessage ( messageReply , messageIn , MessageInfoTypeModel . REPLY , MessageTypeModel . MESSAGE_IN ) ; this . getTransport ( ) . processIncomingMessage ( messageReply , null ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; Debug . print ( ex , "Error in processing or replying to a message" ) ; }
|
public class TypeReflector { /** * Creates an instance of an object type .
* @ param type an object type ( factory function ) to create .
* @ param args arguments for the object constructor .
* @ return the created object instance .
* @ throws Exception when constructors with parameters are not supported */
public static Object createInstanceByType ( Class < ? > type , Object ... args ) throws Exception { } }
|
if ( args . length == 0 ) { Constructor < ? > constructor = type . getConstructor ( ) ; return constructor . newInstance ( ) ; } else { throw new UnsupportedException ( null , "NOT_SUPPORTED" , "Constructors with parameters are not supported" ) ; }
|
public class ValidationObjUtil { /** * Gets object size .
* @ param value the value
* @ return the object size */
public static Double getObjectSize ( Object value ) { } }
|
double v = 1 ; if ( value instanceof String ) { v = ( ( String ) value ) . length ( ) ; if ( v < 1 ) { return null ; } } else if ( value instanceof List ) { v = ( ( List ) value ) . size ( ) ; } else if ( ValidationObjUtil . isNumberObj ( value ) ) { v = Double . valueOf ( value + "" ) ; } return v ;
|
public class WhileyFileParser { /** * Parse a " multi - expression " ; that is , a sequence of one or more
* expressions separated by comma ' s
* @ param scope
* The enclosing scope for this statement , which determines the
* set of visible ( i . e . declared ) variables and also the current
* indentation level .
* @ param terminated
* This indicates that the expression is known to be terminated
* ( or not ) . An expression that ' s known to be terminated is one
* which is guaranteed to be followed by something . This is
* important because it means that we can ignore any newline
* characters encountered in parsing this expression , and that
* we ' ll never overrun the end of the expression ( i . e . because
* there ' s guaranteed to be something which terminates this
* expression ) . A classic situation where terminated is true is
* when parsing an expression surrounded in braces . In such case ,
* we know the right - brace will always terminate this expression .
* @ return */
public Tuple < Expr > parseExpressions ( EnclosingScope scope , boolean terminated ) { } }
|
ArrayList < Expr > returns = new ArrayList < > ( ) ; // A return statement may optionally have a return expression .
// Therefore , we first skip all whitespace on the given line .
int next = skipLineSpace ( index ) ; // Then , we check whether or not we reached the end of the line . If not ,
// then we assume what ' s remaining is the returned expression . This
// means expressions must start on the same line as a return . Otherwise ,
// a potentially cryptic error message will be given .
returns . add ( parseExpression ( scope , terminated ) ) ; while ( tryAndMatch ( false , Comma ) != null ) { returns . add ( parseExpression ( scope , terminated ) ) ; } return new Tuple < > ( returns ) ;
|
public class GUIObjectDetails { /** * A overloaded version of transformKeys method which internally specifies { @ link TestPlatform # WEB } as the
* { @ link TestPlatform }
* @ param keys
* keys for which { @ link GUIObjectDetails } is to be created .
* @ return the { @ link List } of { @ link GUIObjectDetails } */
public static List < GUIObjectDetails > transformKeys ( List < String > keys ) { } }
|
return transformKeys ( keys , TestPlatform . WEB ) ;
|
public class SimpleBase { /** * Sets the elements in this matrix to be equal to the elements in the passed in matrix .
* Both matrix must have the same dimension .
* @ param a The matrix whose value this matrix is being set to . */
public void set ( T a ) { } }
|
if ( a . getType ( ) == getType ( ) ) mat . set ( a . getMatrix ( ) ) ; else { setMatrix ( a . mat . copy ( ) ) ; }
|
public class Locomotive { /** * / * Window / Frame Switching */
public Locomotive waitForWindow ( String regex ) { } }
|
Set < String > windows = driver . getWindowHandles ( ) ; for ( String window : windows ) { try { driver . switchTo ( ) . window ( window ) ; p = Pattern . compile ( regex ) ; m = p . matcher ( driver . getCurrentUrl ( ) ) ; if ( m . find ( ) ) { attempts = 0 ; return switchToWindow ( regex ) ; } else { // try for title
m = p . matcher ( driver . getTitle ( ) ) ; if ( m . find ( ) ) { attempts = 0 ; return switchToWindow ( regex ) ; } } } catch ( NoSuchWindowException e ) { if ( attempts <= MAX_ATTEMPTS ) { attempts ++ ; try { Thread . sleep ( 1000 ) ; } catch ( Exception x ) { x . printStackTrace ( ) ; } return waitForWindow ( regex ) ; } else { fail ( "Window with url|title: " + regex + " did not appear after " + MAX_ATTEMPTS + " tries. Exiting." ) ; } } } // when we reach this point , that means no window exists with that title . .
if ( attempts == MAX_ATTEMPTS ) { fail ( "Window with title: " + regex + " did not appear after " + MAX_ATTEMPTS + " tries. Exiting." ) ; return this ; } else { System . out . println ( "#waitForWindow() : Window doesn't exist yet. [" + regex + "] Trying again. " + ( attempts + 1 ) + "/" + MAX_ATTEMPTS ) ; attempts ++ ; try { Thread . sleep ( 1000 ) ; } catch ( Exception x ) { x . printStackTrace ( ) ; } return waitForWindow ( regex ) ; }
|
public class FleetCapacityMarshaller { /** * Marshall the given parameter object . */
public void marshall ( FleetCapacity fleetCapacity , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( fleetCapacity == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( fleetCapacity . getFleetId ( ) , FLEETID_BINDING ) ; protocolMarshaller . marshall ( fleetCapacity . getInstanceType ( ) , INSTANCETYPE_BINDING ) ; protocolMarshaller . marshall ( fleetCapacity . getInstanceCounts ( ) , INSTANCECOUNTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class DefaultLoginWebflowConfigurer { /** * Create handle authentication failure action .
* @ param flow the flow */
protected void createHandleAuthenticationFailureAction ( final Flow flow ) { } }
|
val handler = createActionState ( flow , CasWebflowConstants . STATE_ID_HANDLE_AUTHN_FAILURE , CasWebflowConstants . ACTION_ID_AUTHENTICATION_EXCEPTION_HANDLER ) ; createTransitionForState ( handler , AccountDisabledException . class . getSimpleName ( ) , CasWebflowConstants . VIEW_ID_ACCOUNT_DISABLED ) ; createTransitionForState ( handler , AccountLockedException . class . getSimpleName ( ) , CasWebflowConstants . VIEW_ID_ACCOUNT_LOCKED ) ; createTransitionForState ( handler , AccountPasswordMustChangeException . class . getSimpleName ( ) , CasWebflowConstants . VIEW_ID_MUST_CHANGE_PASSWORD ) ; createTransitionForState ( handler , CredentialExpiredException . class . getSimpleName ( ) , CasWebflowConstants . VIEW_ID_EXPIRED_PASSWORD ) ; createTransitionForState ( handler , InvalidLoginLocationException . class . getSimpleName ( ) , CasWebflowConstants . VIEW_ID_INVALID_WORKSTATION ) ; createTransitionForState ( handler , InvalidLoginTimeException . class . getSimpleName ( ) , CasWebflowConstants . VIEW_ID_INVALID_AUTHENTICATION_HOURS ) ; createTransitionForState ( handler , FailedLoginException . class . getSimpleName ( ) , CasWebflowConstants . STATE_ID_INIT_LOGIN_FORM ) ; createTransitionForState ( handler , AccountNotFoundException . class . getSimpleName ( ) , CasWebflowConstants . STATE_ID_INIT_LOGIN_FORM ) ; createTransitionForState ( handler , UnauthorizedServiceForPrincipalException . class . getSimpleName ( ) , CasWebflowConstants . STATE_ID_INIT_LOGIN_FORM ) ; createTransitionForState ( handler , PrincipalException . class . getSimpleName ( ) , CasWebflowConstants . STATE_ID_INIT_LOGIN_FORM ) ; createTransitionForState ( handler , UnsatisfiedAuthenticationPolicyException . class . getSimpleName ( ) , CasWebflowConstants . STATE_ID_INIT_LOGIN_FORM ) ; createTransitionForState ( handler , UnauthorizedAuthenticationException . class . getSimpleName ( ) , CasWebflowConstants . VIEW_ID_AUTHENTICATION_BLOCKED ) ; createTransitionForState ( handler , CasWebflowConstants . STATE_ID_SERVICE_UNAUTHZ_CHECK , CasWebflowConstants . STATE_ID_SERVICE_UNAUTHZ_CHECK ) ; createStateDefaultTransition ( handler , CasWebflowConstants . STATE_ID_INIT_LOGIN_FORM ) ;
|
public class WhileyFileParser { /** * Parse a fail statement , which is of the form :
* < pre >
* FailStmt : : = " fail "
* < / pre >
* @ param scope
* The enclosing scope for this statement , which determines the
* set of visible ( i . e . declared ) variables and also the current
* indentation level .
* @ see wyc . lang . Stmt . Fail
* @ return */
private Stmt . Fail parseFailStatement ( EnclosingScope scope ) { } }
|
int start = index ; // Match the fail keyword
match ( Fail ) ; int end = index ; matchEndLine ( ) ; // Done .
return annotateSourceLocation ( new Stmt . Fail ( ) , start , end - 1 ) ;
|
public class DatatypeConverter { /** * Print priority .
* @ param priority Priority instance
* @ return priority value */
public static final BigInteger printPriority ( Priority priority ) { } }
|
int result = Priority . MEDIUM ; if ( priority != null ) { result = priority . getValue ( ) ; } return ( BigInteger . valueOf ( result ) ) ;
|
public class FormatterUtils { /** * This method maps a formatter name to a < code > Formatter < / code > instance .
* If the formatter name is unknown , then null will be returned . The name
* comparison ignores the case of the given name .
* @ param name
* name of the formatter
* @ return < code > Formatter < / code > instance corresponding to the name or null
* if the formatter name is unknown */
public static Formatter getFormatterInstance ( String name ) { } }
|
String key = ( name != null ) ? name . toLowerCase ( ) : "" ; return formatters . get ( key ) ;
|
public class AWSAppSyncClient { /** * Lists the resolvers for a given API and type .
* @ param listResolversRequest
* @ return Result of the ListResolvers operation returned by the service .
* @ throws BadRequestException
* The request is not well formed . For example , a value is invalid or a required field is missing . Check the
* field values , and then try again .
* @ throws NotFoundException
* The resource specified in the request was not found . Check the resource , and then try again .
* @ throws UnauthorizedException
* You are not authorized to perform this operation .
* @ throws InternalFailureException
* An internal AWS AppSync error occurred . Try your request again .
* @ sample AWSAppSync . ListResolvers
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / appsync - 2017-07-25 / ListResolvers " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListResolversResult listResolvers ( ListResolversRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeListResolvers ( request ) ;
|
public class TraderSteps { /** * Method used as dynamical parameter converter */
@ AsParameterConverter public Trader retrieveTrader ( String name ) { } }
|
for ( Trader trader : traders ) { if ( trader . getName ( ) . equals ( name ) ) { return trader ; } } return mockTradePersister ( ) . retrieveTrader ( name ) ;
|
public class ArrayUtil { /** * Copies some elements of row into newRow by using columnMap as
* the list of indexes into row . That is , newRow [ i ] = row [ columnMap [ i ] ]
* for each i .
* columnMap and newRow are of equal length and are normally
* shorter than row .
* @ param row the source array
* @ param columnMap the list of indexes into row
* @ param newRow the destination array */
public static void projectRow ( Object [ ] row , int [ ] columnMap , Object [ ] newRow ) { } }
|
for ( int i = 0 ; i < columnMap . length ; i ++ ) { newRow [ i ] = row [ columnMap [ i ] ] ; }
|
public class IfixParser { /** * { @ inheritDoc } */
@ Override public IfixResourceWritable parseFileToResource ( File assetFile , File metadataFile , String contentUrl ) throws RepositoryException { } }
|
ArtifactMetadata artifactMetadata = explodeArtifact ( assetFile , metadataFile ) ; // Throw an exception if there is no metadata and properties , we get the name and readme from it
if ( artifactMetadata == null ) { throw new RepositoryArchiveException ( "Unable to find sibling metadata zip for " + assetFile . getName ( ) + " so do not have the required information" , assetFile ) ; } extractFiles ( artifactMetadata ) ; _jarPayload = assetFile ; // Extract iFix xml file from iFix jar file
ParserBase . ExtractedFileInformation xmlFileInfo = extractFileFromArchive ( _jarPayload . getAbsolutePath ( ) , ".*lib\\/fixes.*\\.xml" ) ; IFixInfo ifixInfo ; try { DocumentBuilder docBuilder = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; Document doc = docBuilder . parse ( xmlFileInfo . getExtractedFile ( ) ) ; ifixInfo = IFixInfo . fromDocument ( doc ) ; } catch ( Exception e ) { throw new RepositoryArchiveInvalidEntryException ( "Parse failure" , xmlFileInfo . getSourceArchive ( ) , xmlFileInfo . getSelectedPathFromArchive ( ) , e ) ; } // create asset and update with info from iFix jar file
IfixResourceWritable resource = WritableResourceFactory . createIfix ( null ) ; resource . setName ( getFixId ( ifixInfo , xmlFileInfo ) ) ; resource . setDisplayPolicy ( DisplayPolicy . HIDDEN ) ; resource . setWebDisplayPolicy ( DisplayPolicy . HIDDEN ) ; // create the provider info and store in local asset
resource . setProviderName ( "IBM" ) ; // parse the jar manifest
String appliesTo = parseManifestForAppliesTo ( _jarPayload ) ; // set the local extension information
resource . setAppliesTo ( appliesTo ) ; resource . setProvideFix ( getProvides ( ifixInfo , xmlFileInfo ) ) ; // a list of fixed APARs
// add the readme as an attachment
resource . addAttachment ( _readmePayload , AttachmentType . DOCUMENTATION ) ; // Find the date with the most recent update date
resource . setDate ( getLatestDateOfAnyFile ( ifixInfo , xmlFileInfo ) ) ; // add content and upload
addContent ( resource , _jarPayload , _jarPayload . getName ( ) , artifactMetadata , contentUrl ) ; return resource ;
|
public class CmsResourceFilter { /** * Returns an extended filter to restrict the results to resources that expire in the given timerange . < p >
* @ param time the required time
* @ return a filter to restrict the results to resources that expire in the given timerange */
public CmsResourceFilter addRequireExpireBefore ( long time ) { } }
|
CmsResourceFilter extendedFilter = ( CmsResourceFilter ) clone ( ) ; extendedFilter . m_filterExpire = true ; extendedFilter . m_expireBefore = time ; extendedFilter . updateCacheId ( ) ; return extendedFilter ;
|
public class CleverTapAPI { /** * Launches an asynchronous task to download the notification icon from CleverTap ,
* and create the Android notification .
* Use this method when implementing your own FCM / GCM handling mechanism . Refer to the
* SDK documentation for usage scenarios and examples .
* @ param context A reference to an Android context
* @ param extras The { @ link Bundle } object received by the broadcast receiver */
@ SuppressWarnings ( { } }
|
"WeakerAccess" } ) public static void createNotification ( final Context context , final Bundle extras ) { createNotification ( context , extras , Constants . EMPTY_NOTIFICATION_ID ) ;
|
public class PlaceObject { /** * documentation inherited */
public void applyToListeners ( ListenerOp op ) { } }
|
for ( int ii = 0 , ll = occupants . size ( ) ; ii < ll ; ii ++ ) { op . apply ( this , occupants . get ( ii ) ) ; }
|
public class SecurityContextImpl { /** * Get the WSPrincipal from the subject
* @ param subject
* @ return the WSPrincipal of the subject
* @ throws IOException if there is more than one WSPrincipal in the subject */
protected WSPrincipal getWSPrincipal ( Subject subject ) throws IOException { } }
|
WSPrincipal wsPrincipal = null ; Set < WSPrincipal > principals = ( subject != null ) ? subject . getPrincipals ( WSPrincipal . class ) : null ; if ( principals != null && ! principals . isEmpty ( ) ) { if ( principals . size ( ) > 1 ) { // Error - too many principals
String principalNames = null ; for ( WSPrincipal principal : principals ) { if ( principalNames == null ) principalNames = principal . getName ( ) ; else principalNames = principalNames + ", " + principal . getName ( ) ; } throw new IOException ( Tr . formatMessage ( tc , "SEC_CONTEXT_DESERIALIZE_TOO_MANY_PRINCIPALS" , principalNames ) ) ; } else { wsPrincipal = principals . iterator ( ) . next ( ) ; } } return wsPrincipal ;
|
public class ValidationException { /** * Creates a ValidationException which contains a ValidationMessage info .
* @ param messageKey a message key
* @ param params message parameters
* @ return a validation exception with a ValidationMessage info */
public static ValidationException info ( String messageKey , Object ... params ) { } }
|
return new ValidationException ( ValidationMessage . info ( messageKey , params ) ) ;
|
public class AmortizedSparseVector { /** * { @ inheritDoc }
* Note that any values which are 0 are left out of the vector . */
public void set ( double [ ] value ) { } }
|
checkIndex ( value . length ) ; for ( int i = 0 ; i < value . length ; ++ i ) { if ( value [ i ] != 0d ) set ( i , value [ i ] ) ; }
|
public class DatabaseDAODefaultImpl { public String getDeviceFromAlias ( Database database , String alias ) throws DevFailed { } }
|
DeviceData argIn = new DeviceData ( ) ; argIn . insert ( alias ) ; DeviceData argOut = command_inout ( database , "DbGetAliasDevice" , argIn ) ; return argOut . extractString ( ) ;
|
public class DMatrixSparseCSC { /** * Returns the index in nz _ rows for the element at ( row , col ) if it already exists in the matrix . If not then - 1
* is returned .
* @ param row row coordinate
* @ param col column coordinate
* @ return nz _ row index or - 1 if the element does not exist */
public int nz_index ( int row , int col ) { } }
|
int col0 = col_idx [ col ] ; int col1 = col_idx [ col + 1 ] ; for ( int i = col0 ; i < col1 ; i ++ ) { if ( nz_rows [ i ] == row ) { return i ; } } return - 1 ;
|
public class PMContext { /** * Return the selected item of the container
* @ return The EntityInstanceWrapper
* @ throws PMException */
public EntityInstanceWrapper getSelected ( ) throws PMException { } }
|
final EntityContainer container = getEntityContainer ( true ) ; if ( container == null ) { return null ; } return container . getSelected ( ) ;
|
public class AssertKripton { /** * Assert true or invalid global type apdater exception .
* @ param expression
* the expression
* @ param sqLiteDatabaseSchema
* the sq lite database schema
* @ param typeAdapter
* the type adapter
* @ param typeAdapter2
* the type adapter 2 */
public static void assertTrueOrInvalidGlobalTypeApdaterException ( boolean expression , SQLiteDatabaseSchema sqLiteDatabaseSchema , String typeAdapter , String typeAdapter2 ) { } }
|
if ( ! expression ) { String msg = String . format ( "In data source '%s', there are two or more global type adapter that cover type '%s': '%s' and '%s'" , sqLiteDatabaseSchema . getElement ( ) . getQualifiedName ( ) , TypeAdapterHelper . detectSourceType ( typeAdapter ) , typeAdapter , typeAdapter2 ) ; throw ( new InvalidDefinition ( msg ) ) ; }
|
public class ByteBufferInputStream { /** * Get a buffer to write to this InputStream .
* The buffer wll either be a new direct buffer or a recycled buffer . */
public synchronized ByteBuffer getBuffer ( ) { } }
|
ByteBuffer buf = null ; int s = LazyList . size ( _recycle ) ; if ( s > 0 ) { s -- ; buf = ( ByteBuffer ) LazyList . get ( _recycle , s ) ; _recycle = LazyList . remove ( _recycle , s ) ; buf . clear ( ) ; } else { buf = ByteBuffer . allocateDirect ( _bufferSize ) ; } return buf ;
|
public class JmsBytesMessageImpl { /** * Read a Unicode character value from the stream message .
* @ return the next two bytes from the stream message as a Unicode
* character .
* @ exception MessageNotReadableException if message in write - only mode .
* @ exception MessageEOFException if end of message stream
* @ exception JMSException if JMS fails to read message due to
* some internal JMS error . */
@ Override public char readChar ( ) throws JMSException { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "readChar" ) ; try { // Check that we are in read mode
checkBodyReadable ( "readChar" ) ; if ( requiresInit ) lazyInitForReading ( ) ; // Mark the current position , so we can return to it if there ' s an error
readStream . mark ( 2 ) ; char result = readStream . readChar ( ) ; // Byte swap the character if required
if ( integerEncoding == ApiJmsConstants . ENC_INTEGER_REVERSED ) { result = Character . reverseBytes ( result ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "readChar" , result ) ; return result ; } catch ( IOException e ) { try { readStream . reset ( ) ; // return to the marked position
} catch ( IOException e2 ) { } JMSException jmse = ( JMSException ) JmsErrorUtils . newThrowable ( MessageEOFException . class , "END_BYTESMESSAGE_CWSIA0183" , null , tc ) ; jmse . initCause ( e ) ; throw jmse ; }
|
public class Db { /** * Execute sql query and return the first result . I recommend add " limit 1 " in your sql .
* @ param sql an SQL statement that may contain one or more ' ? ' IN parameter placeholders
* @ param paras the parameters of sql
* @ return Object [ ] if your sql has select more than one column ,
* and it return Object if your sql has select only one column . */
public static < T > T queryFirst ( String sql , Object ... paras ) { } }
|
return MAIN . queryFirst ( sql , paras ) ;
|
public class PipelineExecutionSummary { /** * A list of the source artifact revisions that initiated a pipeline execution .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setSourceRevisions ( java . util . Collection ) } or { @ link # withSourceRevisions ( java . util . Collection ) } if you
* want to override the existing values .
* @ param sourceRevisions
* A list of the source artifact revisions that initiated a pipeline execution .
* @ return Returns a reference to this object so that method calls can be chained together . */
public PipelineExecutionSummary withSourceRevisions ( SourceRevision ... sourceRevisions ) { } }
|
if ( this . sourceRevisions == null ) { setSourceRevisions ( new java . util . ArrayList < SourceRevision > ( sourceRevisions . length ) ) ; } for ( SourceRevision ele : sourceRevisions ) { this . sourceRevisions . add ( ele ) ; } return this ;
|
public class TemplateVars { /** * system does run it using a jar , so we do have coverage . */
private static InputStream inputStreamFromFile ( URL resourceUrl ) throws IOException , URISyntaxException { } }
|
File resourceFile = new File ( resourceUrl . toURI ( ) ) ; return new FileInputStream ( resourceFile ) ;
|
public class InodeLockManager { /** * Acquires an edge lock .
* @ param edge the edge to lock
* @ param mode the mode to lock in
* @ return a lock resource which must be closed to release the lock */
public LockResource lockEdge ( Edge edge , LockMode mode ) { } }
|
return mEdgeLocks . get ( edge , mode ) ;
|
public class AccountsInner { /** * Lists the Data Lake Store firewall rules within the specified Data Lake Store account .
* ServiceResponse < PageImpl < FirewallRuleInner > > * @ param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account .
* ServiceResponse < PageImpl < FirewallRuleInner > > * @ param accountName The name of the Data Lake Store account from which to get the firewall rules .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; FirewallRuleInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < FirewallRuleInner > > > listFirewallRulesSinglePageAsync ( final String resourceGroupName , final String accountName ) { } }
|
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( accountName == null ) { throw new IllegalArgumentException ( "Parameter accountName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . listFirewallRules ( resourceGroupName , accountName , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < FirewallRuleInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < FirewallRuleInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < FirewallRuleInner > > result = listFirewallRulesDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < FirewallRuleInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
|
public class CmsSetupBean { /** * Restores the opencms . xml either to or from a backup file , depending
* whether the setup wizard is executed the first time ( the backup
* does not exist ) or not ( the backup exists ) .
* @ param filename something like e . g . " opencms . xml "
* @ param originalFilename the configurations real file name , e . g . " opencms . xml . ori " */
public void backupConfiguration ( String filename , String originalFilename ) { } }
|
// ensure backup folder exists
File backupFolder = new File ( m_configRfsPath + FOLDER_BACKUP ) ; if ( ! backupFolder . exists ( ) ) { backupFolder . mkdirs ( ) ; } // copy file to ( or from ) backup folder
originalFilename = FOLDER_BACKUP + originalFilename ; File file = new File ( m_configRfsPath + originalFilename ) ; if ( file . exists ( ) ) { copyFile ( originalFilename , filename ) ; } else { copyFile ( filename , originalFilename ) ; }
|
public class SSLConfiguration { /** * Creates the key managers required to initiate the { @ link SSLContext } , using a JKS keystore as an input .
* @ param filepath - the path to the JKS keystore .
* @ param keystorePassword - the keystore ' s password .
* @ param keyPassword - the key ' s passsword .
* @ return { @ link KeyManager } array that will be used to initiate the { @ link SSLContext } .
* @ throws Exception */
private static KeyManagerFactory createKeyManagers ( String filepath , String keystorePassword , String keyPassword ) throws FileNotFoundException , KeyStoreException , IOException , NoSuchAlgorithmException , CertificateException , UnrecoverableKeyException { } }
|
KeyStore keyStore = KeyStore . getInstance ( "JKS" ) ; try ( InputStream keyStoreIS = new FileInputStream ( filepath ) ) { keyStore . load ( keyStoreIS , keystorePassword . toCharArray ( ) ) ; } KeyManagerFactory kmf = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; kmf . init ( keyStore , keyPassword . toCharArray ( ) ) ; return kmf ;
|
public class AbstractApacheHttpClient { /** * Creates asynchronous Apache HTTP client .
* @ param settings
* settings to use to create client .
* @ param conf
* configuration related to async connection .
* @ return Instance of { @ link CloseableHttpAsyncClient } . */
private CloseableHttpAsyncClient createClient ( HttpSettings settings , ApacheHttpClientConfiguration conf ) { } }
|
IOReactorConfig ioReactor = IOReactorConfig . custom ( ) . setIoThreadCount ( conf . getMaxThreadCount ( ) ) . build ( ) ; HttpAsyncClientBuilder httpClientBuilder = HttpAsyncClients . custom ( ) . useSystemProperties ( ) // allow POST redirects
. setRedirectStrategy ( new LaxRedirectStrategy ( ) ) . setMaxConnTotal ( conf . getMaxTotalConnectionCount ( ) ) . setMaxConnPerRoute ( conf . getMaxRouteConnectionCount ( ) ) . setDefaultIOReactorConfig ( ioReactor ) . setKeepAliveStrategy ( new DefaultConnectionKeepAliveStrategy ( ) ) . setDefaultRequestConfig ( createDefaultRequestConfig ( settings ) ) ; if ( settings . getProxyUrl ( ) != null ) { DefaultProxyRoutePlanner routePlanner = createProxyRoutePlanner ( settings , httpClientBuilder ) ; httpClientBuilder . setRoutePlanner ( routePlanner ) ; } CloseableHttpAsyncClient httpClient = httpClientBuilder . build ( ) ; httpClient . start ( ) ; return httpClient ;
|
public class ProtocolService { /** * This will add a new endpoint service to the list . Once added , the new service
* will immediately be started .
* @ param newEndpointService the new service to add and start */
public void add ( EndpointService < L , S > newEndpointService ) { } }
|
if ( newEndpointService == null ) { throw new IllegalArgumentException ( "New endpoint service must not be null" ) ; } synchronized ( this . inventoryListeners ) { for ( InventoryListener listener : this . inventoryListeners ) { newEndpointService . addInventoryListener ( listener ) ; } } endpointServices . put ( newEndpointService . getMonitoredEndpoint ( ) . getName ( ) , newEndpointService ) ; newEndpointService . start ( ) ; log . infoAddedEndpointService ( newEndpointService . toString ( ) ) ; newEndpointService . discoverAll ( ) ;
|
public class DataFrames { /** * Convert a list of string names
* to columns
* @ param columns the columns to convert
* @ return the resulting column list */
public static List < Column > toColumn ( List < String > columns ) { } }
|
List < Column > ret = new ArrayList < > ( ) ; for ( String s : columns ) ret . add ( col ( s ) ) ; return ret ;
|
public class StrBuilder { /** * Searches the string builder to find the first reference to the specified
* string starting searching from the given index .
* Note that a null input string will return - 1 , whereas the JDK throws an exception .
* @ param str the string to find , null returns - 1
* @ param startIndex the index to start at , invalid index rounded to edge
* @ return the first index of the string , or - 1 if not found */
public int indexOf ( final String str , int startIndex ) { } }
|
startIndex = ( startIndex < 0 ? 0 : startIndex ) ; if ( str == null || startIndex >= size ) { return - 1 ; } final int strLen = str . length ( ) ; if ( strLen == 1 ) { return indexOf ( str . charAt ( 0 ) , startIndex ) ; } if ( strLen == 0 ) { return startIndex ; } if ( strLen > size ) { return - 1 ; } final char [ ] thisBuf = buffer ; final int len = size - strLen + 1 ; outer : for ( int i = startIndex ; i < len ; i ++ ) { for ( int j = 0 ; j < strLen ; j ++ ) { if ( str . charAt ( j ) != thisBuf [ i + j ] ) { continue outer ; } } return i ; } return - 1 ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.