signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TemplateHandler3D { /** * Returns the largest ( number of atoms ) ring set in a molecule .
* @ param ringSystems RingSystems of a molecule
* @ return The largestRingSet */
public IRingSet getLargestRingSet ( List < IRingSet > ringSystems ) { } } | IRingSet largestRingSet = null ; int atomNumber = 0 ; IAtomContainer container = null ; for ( int i = 0 ; i < ringSystems . size ( ) ; i ++ ) { container = getAllInOneContainer ( ringSystems . get ( i ) ) ; if ( atomNumber < container . getAtomCount ( ) ) { atomNumber = container . getAtomCount ( ) ; largestRingSet = ringSystems . get ( i ) ; } } return largestRingSet ; |
public class VariableDef { /** * < pre >
* Support for saving variables as slices of a larger variable .
* < / pre >
* < code > optional . tensorflow . SaveSliceInfoDef save _ slice _ info _ def = 4 ; < / code > */
public org . tensorflow . framework . SaveSliceInfoDef getSaveSliceInfoDef ( ) { } } | return saveSliceInfoDef_ == null ? org . tensorflow . framework . SaveSliceInfoDef . getDefaultInstance ( ) : saveSliceInfoDef_ ; |
public class MethodPermissionTypeImpl { /** * If not already created , a new < code > method < / code > element will be created and returned .
* Otherwise , the first existing < code > method < / code > element will be returned .
* @ return the instance defined for the element < code > method < / code > */
public MethodType < MethodPermissionType < T > > getOrCreateMethod ( ) { } } | List < Node > nodeList = childNode . get ( "method" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new MethodTypeImpl < MethodPermissionType < T > > ( this , "method" , childNode , nodeList . get ( 0 ) ) ; } return createMethod ( ) ; |
public class CmsUserEditDialog { /** * A initialization method . < p >
* @ param window to be closed
* @ param app
* @ param settings user settings , null if new user */
private void init ( final Window window , final CmsAccountsApp app , final CmsUserSettings settings , boolean enabled ) { } } | m_userdata . initFields ( m_user , enabled ? EditLevel . all : EditLevel . none ) ; if ( m_user != null ) { if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( m_user . getFirstname ( ) ) | CmsStringUtil . isEmptyOrWhitespaceOnly ( m_user . getLastname ( ) ) | CmsStringUtil . isEmptyOrWhitespaceOnly ( m_user . getEmail ( ) ) ) { m_name_was_empty = true ; } } iniLanguage ( settings ) ; iniProject ( settings ) ; iniSite ( settings ) ; iniStartView ( settings ) ; m_site . addValueChangeListener ( new ValueChangeListener ( ) { private static final long serialVersionUID = 5111762655156037899L ; public void valueChange ( ValueChangeEvent event ) { setupStartFolder ( null ) ; } } ) ; m_ok . addClickListener ( new ClickListener ( ) { private static final long serialVersionUID = - 2579639520410382246L ; public void buttonClick ( ClickEvent event ) { setupValidators ( ) ; if ( isValid ( ) ) { save ( ) ; window . close ( ) ; app . reload ( ) ; } } } ) ; m_next . addClickListener ( new ClickListener ( ) { private static final long serialVersionUID = - 8584899970290349959L ; public void buttonClick ( ClickEvent event ) { setupValidators ( ) ; switchTab ( ) ; } } ) ; m_cancel . addClickListener ( new ClickListener ( ) { private static final long serialVersionUID = 5803825104722705175L ; public void buttonClick ( ClickEvent event ) { window . close ( ) ; } } ) ; if ( m_user == null ) { m_role . addValueChangeListener ( new ValueChangeListener ( ) { private static final long serialVersionUID = 5697126133686172725L ; public void valueChange ( ValueChangeEvent event ) { iniSite ( settings ) ; iniStartView ( settings ) ; } } ) ; m_group . addValueChangeListener ( new ValueChangeListener ( ) { private static final long serialVersionUID = 1512940002751242094L ; public void valueChange ( ValueChangeEvent event ) { iniStartView ( settings ) ; iniSite ( settings ) ; } } ) ; } m_site . addValueChangeListener ( new ValueChangeListener ( ) { private static final long serialVersionUID = - 169973382455098800L ; public void valueChange ( ValueChangeEvent event ) { m_startfolder . setCmsObject ( getCmsObjectWithSite ( ( String ) m_site . getValue ( ) ) ) ; } } ) ; m_generateButton . addClickListener ( new Button . ClickListener ( ) { private static final long serialVersionUID = 4128513094772586752L ; public void buttonClick ( ClickEvent event ) { final Window windowDialog = CmsBasicDialog . prepareWindow ( CmsBasicDialog . DialogWidth . content ) ; windowDialog . setCaption ( CmsVaadinUtils . getMessageText ( Messages . GUI_USERMANAGEMENT_GEN_PASSWORD_CAPTION_0 ) ) ; CmsGeneratePasswordDialog dialog = new CmsGeneratePasswordDialog ( CmsUserEditDialog . this , new Runnable ( ) { public void run ( ) { windowDialog . close ( ) ; } } ) ; windowDialog . setContent ( dialog ) ; A_CmsUI . get ( ) . addWindow ( windowDialog ) ; } } ) ; |
public class RTPDataChannel { /** * Closes this socket . */
public void close ( ) { } } | if ( rtpChannel != null ) { if ( rtpChannel . isConnected ( ) ) { try { rtpChannel . disconnect ( ) ; } catch ( IOException e ) { logger . error ( e ) ; } try { rtpChannel . socket ( ) . close ( ) ; rtpChannel . close ( ) ; } catch ( IOException e ) { logger . error ( e ) ; } } } if ( rtcpChannel != null ) { rtcpChannel . socket ( ) . close ( ) ; } // System . out . println ( " RX COUNT : " + rxCount + " , TX COUNT : " + txCount ) ;
rxCount = 0 ; txCount = 0 ; input . deactivate ( ) ; dtmfInput . deactivate ( ) ; dtmfInput . reset ( ) ; output . deactivate ( ) ; dtmfOutput . deactivate ( ) ; this . tx . clear ( ) ; heartBeat . cancel ( ) ; sendDtmf = false ; |
public class SyncGroupsInner { /** * Refreshes a hub database schema .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param databaseName The name of the database on which the sync group is hosted .
* @ param syncGroupName The name of the sync group .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < Void > refreshHubSchemaAsync ( String resourceGroupName , String serverName , String databaseName , String syncGroupName ) { } } | return refreshHubSchemaWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , syncGroupName ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class DownloadDispatcher { /** * Called just before the thread finishes , regardless of status , to take any necessary action on
* the downloaded file with mDownloadedCacheSize file .
* @ param forceClean - It will delete downloaded cache , Even streaming is enabled , If user intentionally cancelled . */
private void cleanupDestination ( DownloadRequest request , boolean forceClean ) { } } | if ( ! request . isResumable ( ) || forceClean ) { Log . d ( "cleanupDestination() deleting " + request . getDestinationURI ( ) . getPath ( ) ) ; File destinationFile = new File ( request . getDestinationURI ( ) . getPath ( ) ) ; if ( destinationFile . exists ( ) ) { destinationFile . delete ( ) ; } } |
public class ValueNumberFactory { /** * Get the ValueNumber for given class ' s Class object .
* @ param className
* the class */
public ValueNumber getClassObjectValue ( @ DottedClassName String className ) { } } | // assert className . indexOf ( ' . ' ) = = - 1;
// TODO : Check to see if we need to do this
className = className . replace ( '/' , '.' ) ; ValueNumber value = classObjectValueMap . get ( className ) ; if ( value == null ) { value = createFreshValue ( ValueNumber . CONSTANT_CLASS_OBJECT ) ; classObjectValueMap . put ( className , value ) ; } return value ; |
public class JcCollection { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > add a value to a collection , return a < b > JcCollection < / b > . < / i > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > The value can be a simple value or being derived via an expression < / i > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > like . . . < b > add ( a . property ( " value " ) ) ; < / b > . < / i > < / div >
* < br / > */
public JcCollection < JcValue > add ( Object value ) { } } | JcCollection < JcValue > ret = new JcCollection < JcValue > ( null , value , this , OPERATOR . Collection . ADD ) ; QueryRecorder . recordInvocationConditional ( this , "add" , ret , QueryRecorder . placeHolder ( value ) ) ; return ret ; |
public class hqlParser { /** * hql . g : 453:1 : relationalExpression : concatenation ( ( ( ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression ) * ) | ( n = NOT ! ) ? ( ( i = IN ^ inList ) | ( b = BETWEEN ^ betweenList ) | ( l = LIKE ^ concatenation likeEscape ) | ( MEMBER ! ( OF ! ) ? p = path ! ) ) ) ; */
public final hqlParser . relationalExpression_return relationalExpression ( ) throws RecognitionException { } } | hqlParser . relationalExpression_return retval = new hqlParser . relationalExpression_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; Token n = null ; Token i = null ; Token b = null ; Token l = null ; Token LT167 = null ; Token GT168 = null ; Token LE169 = null ; Token GE170 = null ; Token MEMBER176 = null ; Token OF177 = null ; ParserRuleReturnScope p = null ; ParserRuleReturnScope concatenation166 = null ; ParserRuleReturnScope bitwiseNotExpression171 = null ; ParserRuleReturnScope inList172 = null ; ParserRuleReturnScope betweenList173 = null ; ParserRuleReturnScope concatenation174 = null ; ParserRuleReturnScope likeEscape175 = null ; CommonTree n_tree = null ; CommonTree i_tree = null ; CommonTree b_tree = null ; CommonTree l_tree = null ; CommonTree LT167_tree = null ; CommonTree GT168_tree = null ; CommonTree LE169_tree = null ; CommonTree GE170_tree = null ; CommonTree MEMBER176_tree = null ; CommonTree OF177_tree = null ; try { // hql . g : 454:2 : ( concatenation ( ( ( ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression ) * ) | ( n = NOT ! ) ? ( ( i = IN ^ inList ) | ( b = BETWEEN ^ betweenList ) | ( l = LIKE ^ concatenation likeEscape ) | ( MEMBER ! ( OF ! ) ? p = path ! ) ) ) )
// hql . g : 454:4 : concatenation ( ( ( ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression ) * ) | ( n = NOT ! ) ? ( ( i = IN ^ inList ) | ( b = BETWEEN ^ betweenList ) | ( l = LIKE ^ concatenation likeEscape ) | ( MEMBER ! ( OF ! ) ? p = path ! ) ) )
{ root_0 = ( CommonTree ) adaptor . nil ( ) ; pushFollow ( FOLLOW_concatenation_in_relationalExpression2059 ) ; concatenation166 = concatenation ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , concatenation166 . getTree ( ) ) ; // hql . g : 454:18 : ( ( ( ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression ) * ) | ( n = NOT ! ) ? ( ( i = IN ^ inList ) | ( b = BETWEEN ^ betweenList ) | ( l = LIKE ^ concatenation likeEscape ) | ( MEMBER ! ( OF ! ) ? p = path ! ) ) )
int alt62 = 2 ; int LA62_0 = input . LA ( 1 ) ; if ( ( LA62_0 == EOF || LA62_0 == AND || ( LA62_0 >= AS && LA62_0 <= ASCENDING ) || ( LA62_0 >= CLOSE && LA62_0 <= CLOSE_BRACKET ) || LA62_0 == COMMA || LA62_0 == DESCENDING || LA62_0 == ELSE || ( LA62_0 >= END && LA62_0 <= EQ ) || ( LA62_0 >= FROM && LA62_0 <= HAVING ) || LA62_0 == INNER || LA62_0 == IS || ( LA62_0 >= JOIN && LA62_0 <= LE ) || LA62_0 == LEFT || LA62_0 == LT || LA62_0 == NE || ( LA62_0 >= OR && LA62_0 <= ORDER ) || LA62_0 == RIGHT || LA62_0 == SKIP || LA62_0 == SQL_NE || ( LA62_0 >= TAKE && LA62_0 <= THEN ) || LA62_0 == UNION || ( LA62_0 >= WHEN && LA62_0 <= WHERE ) || ( LA62_0 >= 133 && LA62_0 <= 134 ) ) ) { alt62 = 1 ; } else if ( ( LA62_0 == BETWEEN || LA62_0 == IN || LA62_0 == LIKE || LA62_0 == MEMBER || LA62_0 == NOT ) ) { alt62 = 2 ; } else { NoViableAltException nvae = new NoViableAltException ( "" , 62 , 0 , input ) ; throw nvae ; } switch ( alt62 ) { case 1 : // hql . g : 455:3 : ( ( ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression ) * )
{ // hql . g : 455:3 : ( ( ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression ) * )
// hql . g : 455:5 : ( ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression ) *
{ // hql . g : 455:5 : ( ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression ) *
loop58 : while ( true ) { int alt58 = 2 ; int LA58_0 = input . LA ( 1 ) ; if ( ( LA58_0 == GE || LA58_0 == GT || LA58_0 == LE || LA58_0 == LT ) ) { alt58 = 1 ; } switch ( alt58 ) { case 1 : // hql . g : 455:7 : ( LT ^ | GT ^ | LE ^ | GE ^ ) bitwiseNotExpression
{ // hql . g : 455:7 : ( LT ^ | GT ^ | LE ^ | GE ^ )
int alt57 = 4 ; switch ( input . LA ( 1 ) ) { case LT : { alt57 = 1 ; } break ; case GT : { alt57 = 2 ; } break ; case LE : { alt57 = 3 ; } break ; case GE : { alt57 = 4 ; } break ; default : NoViableAltException nvae = new NoViableAltException ( "" , 57 , 0 , input ) ; throw nvae ; } switch ( alt57 ) { case 1 : // hql . g : 455:9 : LT ^
{ LT167 = ( Token ) match ( input , LT , FOLLOW_LT_in_relationalExpression2071 ) ; LT167_tree = ( CommonTree ) adaptor . create ( LT167 ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( LT167_tree , root_0 ) ; } break ; case 2 : // hql . g : 455:15 : GT ^
{ GT168 = ( Token ) match ( input , GT , FOLLOW_GT_in_relationalExpression2076 ) ; GT168_tree = ( CommonTree ) adaptor . create ( GT168 ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( GT168_tree , root_0 ) ; } break ; case 3 : // hql . g : 455:21 : LE ^
{ LE169 = ( Token ) match ( input , LE , FOLLOW_LE_in_relationalExpression2081 ) ; LE169_tree = ( CommonTree ) adaptor . create ( LE169 ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( LE169_tree , root_0 ) ; } break ; case 4 : // hql . g : 455:27 : GE ^
{ GE170 = ( Token ) match ( input , GE , FOLLOW_GE_in_relationalExpression2086 ) ; GE170_tree = ( CommonTree ) adaptor . create ( GE170 ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( GE170_tree , root_0 ) ; } break ; } pushFollow ( FOLLOW_bitwiseNotExpression_in_relationalExpression2091 ) ; bitwiseNotExpression171 = bitwiseNotExpression ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , bitwiseNotExpression171 . getTree ( ) ) ; } break ; default : break loop58 ; } } } } break ; case 2 : // hql . g : 457:5 : ( n = NOT ! ) ? ( ( i = IN ^ inList ) | ( b = BETWEEN ^ betweenList ) | ( l = LIKE ^ concatenation likeEscape ) | ( MEMBER ! ( OF ! ) ? p = path ! ) )
{ // hql . g : 457:5 : ( n = NOT ! ) ?
int alt59 = 2 ; int LA59_0 = input . LA ( 1 ) ; if ( ( LA59_0 == NOT ) ) { alt59 = 1 ; } switch ( alt59 ) { case 1 : // hql . g : 457:6 : n = NOT !
{ n = ( Token ) match ( input , NOT , FOLLOW_NOT_in_relationalExpression2108 ) ; } break ; } // hql . g : 457:15 : ( ( i = IN ^ inList ) | ( b = BETWEEN ^ betweenList ) | ( l = LIKE ^ concatenation likeEscape ) | ( MEMBER ! ( OF ! ) ? p = path ! ) )
int alt61 = 4 ; switch ( input . LA ( 1 ) ) { case IN : { alt61 = 1 ; } break ; case BETWEEN : { alt61 = 2 ; } break ; case LIKE : { alt61 = 3 ; } break ; case MEMBER : { alt61 = 4 ; } break ; default : NoViableAltException nvae = new NoViableAltException ( "" , 61 , 0 , input ) ; throw nvae ; } switch ( alt61 ) { case 1 : // hql . g : 460:4 : ( i = IN ^ inList )
{ // hql . g : 460:4 : ( i = IN ^ inList )
// hql . g : 460:5 : i = IN ^ inList
{ i = ( Token ) match ( input , IN , FOLLOW_IN_in_relationalExpression2129 ) ; i_tree = ( CommonTree ) adaptor . create ( i ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( i_tree , root_0 ) ; i . setType ( ( n == null ) ? IN : NOT_IN ) ; i . setText ( ( n == null ) ? "in" : "not in" ) ; pushFollow ( FOLLOW_inList_in_relationalExpression2138 ) ; inList172 = inList ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , inList172 . getTree ( ) ) ; } } break ; case 2 : // hql . g : 465:6 : ( b = BETWEEN ^ betweenList )
{ // hql . g : 465:6 : ( b = BETWEEN ^ betweenList )
// hql . g : 465:7 : b = BETWEEN ^ betweenList
{ b = ( Token ) match ( input , BETWEEN , FOLLOW_BETWEEN_in_relationalExpression2149 ) ; b_tree = ( CommonTree ) adaptor . create ( b ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( b_tree , root_0 ) ; b . setType ( ( n == null ) ? BETWEEN : NOT_BETWEEN ) ; b . setText ( ( n == null ) ? "between" : "not between" ) ; pushFollow ( FOLLOW_betweenList_in_relationalExpression2158 ) ; betweenList173 = betweenList ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , betweenList173 . getTree ( ) ) ; } } break ; case 3 : // hql . g : 470:6 : ( l = LIKE ^ concatenation likeEscape )
{ // hql . g : 470:6 : ( l = LIKE ^ concatenation likeEscape )
// hql . g : 470:7 : l = LIKE ^ concatenation likeEscape
{ l = ( Token ) match ( input , LIKE , FOLLOW_LIKE_in_relationalExpression2170 ) ; l_tree = ( CommonTree ) adaptor . create ( l ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( l_tree , root_0 ) ; l . setType ( ( n == null ) ? LIKE : NOT_LIKE ) ; l . setText ( ( n == null ) ? "like" : "not like" ) ; pushFollow ( FOLLOW_concatenation_in_relationalExpression2179 ) ; concatenation174 = concatenation ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , concatenation174 . getTree ( ) ) ; pushFollow ( FOLLOW_likeEscape_in_relationalExpression2181 ) ; likeEscape175 = likeEscape ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , likeEscape175 . getTree ( ) ) ; } } break ; case 4 : // hql . g : 475:6 : ( MEMBER ! ( OF ! ) ? p = path ! )
{ // hql . g : 475:6 : ( MEMBER ! ( OF ! ) ? p = path ! )
// hql . g : 475:7 : MEMBER ! ( OF ! ) ? p = path !
{ MEMBER176 = ( Token ) match ( input , MEMBER , FOLLOW_MEMBER_in_relationalExpression2190 ) ; // hql . g : 475:15 : ( OF ! ) ?
int alt60 = 2 ; int LA60_0 = input . LA ( 1 ) ; if ( ( LA60_0 == OF ) ) { alt60 = 1 ; } switch ( alt60 ) { case 1 : // hql . g : 475:16 : OF !
{ OF177 = ( Token ) match ( input , OF , FOLLOW_OF_in_relationalExpression2194 ) ; } break ; } pushFollow ( FOLLOW_path_in_relationalExpression2201 ) ; p = path ( ) ; state . _fsp -- ; root_0 = ProcessMemberOf ( n , ( p != null ? ( ( CommonTree ) p . getTree ( ) ) : null ) , root_0 ) ; } } break ; } } break ; } } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving
} return retval ; |
public class CmsToolBar { /** * Creates the app select drop down . < p >
* @ return the drop down component */
private Component createQuickLaunchDropDown ( ) { } } | PopupView pv = new PopupView ( new PopupView . Content ( ) { private static final long serialVersionUID = 1L ; public String getMinimizedValueAsHTML ( ) { return getDropDownButtonHtml ( FontOpenCms . APPS ) ; } public Component getPopupComponent ( ) { CmsObject cms = A_CmsUI . getCmsObject ( ) ; Locale locale = UI . getCurrent ( ) . getLocale ( ) ; HorizontalLayout layout = new HorizontalLayout ( ) ; layout . addStyleName ( ValoTheme . LAYOUT_HORIZONTAL_WRAPPING ) ; layout . addStyleName ( OpenCmsTheme . QUICK_LAUNCH ) ; layout . setSpacing ( false ) ; layout . setMargin ( true ) ; for ( I_CmsWorkplaceAppConfiguration config : OpenCms . getWorkplaceAppManager ( ) . getQuickLaunchConfigurations ( cms ) ) { layout . addComponent ( CmsDefaultAppButtonProvider . createAppButton ( cms , config , locale ) ) ; } return layout ; } } ) ; pv . setDescription ( CmsVaadinUtils . getMessageText ( Messages . GUI_QUICK_LAUNCH_TITLE_0 ) ) ; pv . addStyleName ( OpenCmsTheme . NAVIGATOR_DROPDOWN ) ; pv . setHideOnMouseOut ( false ) ; return pv ; |
public class AbstractPlugin { /** * Generate an alert when a security issue ( risk / info ) is found . Custom
* alert name , description and solution will be used .
* @ param risk the risk of the new alert
* @ param confidence the confidence of the new alert
* @ param name the name of the new alert
* @ param description the description of the new alert
* @ param uri the affected URI
* @ param param the name / ID of the affected parameter
* @ param attack the attack that shows the issue
* @ param otherInfo other information about the issue
* @ param solution the solution for the issue
* @ param evidence the evidence ( in the response ) that shows the issue
* @ param msg the message that shows the issue */
protected void bingo ( int risk , int confidence , String name , String description , String uri , String param , String attack , String otherInfo , String solution , String evidence , HttpMessage msg ) { } } | log . debug ( "New alert pluginid=" + + this . getId ( ) + " " + name + " uri=" + uri ) ; Alert alert = new Alert ( this . getId ( ) , risk , confidence , name ) ; if ( uri == null || uri . equals ( "" ) ) { uri = msg . getRequestHeader ( ) . getURI ( ) . toString ( ) ; } if ( param == null ) { param = "" ; } alert . setDetail ( description , uri , param , attack , otherInfo , solution , this . getReference ( ) , evidence , this . getCweId ( ) , this . getWascId ( ) , msg ) ; parent . alertFound ( alert ) ; |
public class VicariousThreadLocal { /** * Returns a unique object representing the current thread . Although we use a weak - reference to the thread , we could
* use practically anything that does not reference our class - loader . */
static WeakReference < Thread > currentThreadRef ( ) { } } | WeakReference < Thread > ref = weakThread . get ( ) ; if ( ref == null ) { ref = new WeakReference < > ( Thread . currentThread ( ) ) ; weakThread . set ( ref ) ; } return ref ; |
public class ManagedProcess { /** * Like { @ link # waitForExit ( ) } , but waits max . maxWaitUntilReturning , then destroys if still
* running , and returns .
* @ param maxWaitUntilDestroyTimeout Time to wait
* @ throws ManagedProcessException see above */
@ Override public ManagedProcess waitForExitMaxMsOrDestroy ( long maxWaitUntilDestroyTimeout ) throws ManagedProcessException { } } | waitForExitMaxMs ( maxWaitUntilDestroyTimeout ) ; if ( isAlive ( ) ) { logger . info ( "Process didn't exit within max. {}ms, so going to destroy it now: {}" , maxWaitUntilDestroyTimeout , getProcLongName ( ) ) ; destroy ( ) ; } return this ; |
public class LogisticsCenter { /** * method for arouter - auto - register plugin to register Routers
* @ param routeRoot IRouteRoot implementation class in the package : com . alibaba . android . arouter . core . routers
* @ author billy . qi < a href = " mailto : qiyilike @ 163 . com " > Contact me . < / a >
* @ since 2017-12-06 */
private static void registerRouteRoot ( IRouteRoot routeRoot ) { } } | markRegisteredByPlugin ( ) ; if ( routeRoot != null ) { routeRoot . loadInto ( Warehouse . groupsIndex ) ; } |
public class DocBookBuilder { /** * Validates the XML after the first set of injections have been processed .
* @ param buildData Information and data structures for the build .
* @ param topicNode The topic that is being validated .
* @ param topicDoc A Document object that holds the Topic ' s XML
* @ return The validate document or a template if it failed validation .
* @ throws BuildProcessingException Thrown if an unexpected error occurs during building . */
@ SuppressWarnings ( "unchecked" ) private boolean validateTopicXML ( final BuildData buildData , final ITopicNode topicNode , final Document topicDoc ) throws BuildProcessingException { } } | final XMLValidator validator = new XMLValidator ( ) ; final ContentSpec contentSpec = buildData . getContentSpec ( ) ; final BaseTopicWrapper < ? > topic = topicNode . getTopic ( ) ; final StringBuilder entity = new StringBuilder ( CSConstants . DUMMY_CS_NAME_ENT_FILE ) ; // Add any custom entities
if ( ! isNullOrEmpty ( contentSpec . getEntities ( ) ) ) { entity . append ( contentSpec . getEntities ( ) ) ; } // Wrap the document so it can be validated .
final String xml = XMLUtilities . convertDocumentToString ( topicDoc , ENCODING ) ; final Pair < String , String > wrappedTopic = DocBookUtilities . wrapForValidation ( buildData . getDocBookVersion ( ) , xml ) ; final String fixedTopicXml = wrappedTopic . getSecond ( ) ; final String rootElementName = wrappedTopic . getFirst ( ) ; // Get the schema / dtd as well as any additional content required for validation
final String titleXML ; final String docbookFileName ; final XMLValidator . ValidationMethod validationMethod ; final byte [ ] docbookSchema ; if ( buildData . getDocBookVersion ( ) == DocBookVersion . DOCBOOK_50 ) { docbookFileName = BuilderConstants . DOCBOOK_50_RNG ; validationMethod = XMLValidator . ValidationMethod . RELAXNG ; docbookSchema = docbookRng . getValue ( ) ; titleXML = DocBookUtilities . addDocBook50Namespace ( "<section><title>" + topic . getTitle ( ) + "</title><para /></section>" , "section" ) ; entity . append ( docbook45Entities ) ; } else { docbookFileName = BuilderConstants . ROCBOOK_45_DTD ; validationMethod = XMLValidator . ValidationMethod . DTD ; docbookSchema = rocbookDtd . getValue ( ) ; titleXML = "<section><title>" + topic . getTitle ( ) + "</title><para /></section>" ; } final String entityData = entity . toString ( ) ; // First check to see if the title is valid XML
if ( ! validator . validate ( validationMethod , titleXML , docbookFileName , docbookSchema , entityData , "section" ) ) { // The title is invalid so replace it with something that is valid
topic . setTitle ( "Invalid Topic" ) ; DocBookUtilities . setSectionTitle ( buildData . getDocBookVersion ( ) , topic . getTitle ( ) , topicDoc ) ; } // Validate the topic against its DTD / Schema
if ( ! validator . validate ( validationMethod , fixedTopicXml , docbookFileName , docbookSchema , entityData , rootElementName ) ) { // Store the error message
final String errorMsg = validator . getErrorText ( ) ; final String cleanedErrorMsg = errorMsg . replace ( "|" , " | " ) . replace ( "," , ", " ) . replaceFirst ( "\\.$" , "" ) ; final String xmlStringInCDATA = DocBookBuildUtilities . convertDocumentToCDATAFormattedString ( topicDoc , getXMLFormatProperties ( ) ) ; buildData . getErrorDatabase ( ) . addError ( topic , ErrorType . INVALID_CONTENT , BuilderConstants . ERROR_INVALID_TOPIC_XML + " The error is <emphasis>" + StringEscapeUtils . escapeXml ( cleanedErrorMsg ) + "</emphasis>. The processed XML is <programlisting>" + xmlStringInCDATA + "</programlisting>" ) ; DocBookBuildUtilities . setTopicNodeXMLForError ( buildData , topicNode , getErrorInvalidValidationTopicTemplate ( ) . getValue ( ) ) ; return false ; } // Check the content of the XML for things not picked up by DTD validation
final List < String > xmlErrors = DocBookBuildUtilities . checkTopicForInvalidContent ( topicNode , topic , topicDoc , buildData ) ; if ( xmlErrors . size ( ) > 0 ) { final String xmlStringInCDATA = DocBookBuildUtilities . convertDocumentToCDATAFormattedString ( topicDoc , getXMLFormatProperties ( ) ) ; // Escape the XML Errors as they will currently be in plain text
final List < String > escapedXmlErrors = new ArrayList < String > ( ) ; for ( final String xmlError : xmlErrors ) { escapedXmlErrors . add ( StringEscapeUtils . escapeXml ( xmlError ) ) ; } // Add the error and processed XML to the error message
final String errorMessage ; if ( escapedXmlErrors . size ( ) > 1 ) { errorMessage = "<itemizedlist><listitem><para>" + CollectionUtilities . toSeperatedString ( escapedXmlErrors , "</para></listitem><listitem><para>" ) + "</para></listitem></itemizedlist>" ; } else { errorMessage = escapedXmlErrors . get ( 0 ) ; } buildData . getErrorDatabase ( ) . addError ( topic , ErrorType . INVALID_CONTENT , BuilderConstants . ERROR_INVALID_TOPIC_XML + " " + errorMessage + "</para><para>The processed XML is <programlisting>" + xmlStringInCDATA + "</programlisting>" ) ; DocBookBuildUtilities . setTopicNodeXMLForError ( buildData , topicNode , getErrorInvalidValidationTopicTemplate ( ) . getValue ( ) ) ; return false ; } return true ; |
public class TileTable { /** * { @ inheritDoc } */
@ Override protected void validateContents ( Contents contents ) { } } | // Verify the Contents have a tiles data type
ContentsDataType dataType = contents . getDataType ( ) ; if ( dataType == null || ( dataType != ContentsDataType . TILES && dataType != ContentsDataType . GRIDDED_COVERAGE ) ) { throw new GeoPackageException ( "The " + Contents . class . getSimpleName ( ) + " of a " + TileTable . class . getSimpleName ( ) + " must have a data type of " + ContentsDataType . TILES . getName ( ) + " or " + ContentsDataType . GRIDDED_COVERAGE . getName ( ) ) ; } |
public class ClassWriterImpl { /** * { @ inheritDoc } */
@ Override public void addNestedClassInfo ( final Content classInfoTree ) { } } | Element outerClass = typeElement . getEnclosingElement ( ) ; if ( outerClass == null ) return ; new SimpleElementVisitor8 < Void , Void > ( ) { @ Override public Void visitType ( TypeElement e , Void p ) { Content label = utils . isInterface ( e ) ? contents . enclosingInterfaceLabel : contents . enclosingClassLabel ; Content dt = HtmlTree . DT ( label ) ; Content dl = HtmlTree . DL ( dt ) ; Content dd = new HtmlTree ( HtmlTag . DD ) ; dd . addContent ( getLink ( new LinkInfoImpl ( configuration , LinkInfoImpl . Kind . CLASS , e ) ) ) ; dl . addContent ( dd ) ; classInfoTree . addContent ( dl ) ; return null ; } } . visit ( outerClass ) ; |
public class PickerSpinnerAdapter { /** * { @ inheritDoc } */
@ Override public TwinTextItem getItem ( int position ) { } } | if ( temporarySelection != null && position == getCount ( ) ) return temporarySelection ; else if ( footer != null && position == getCount ( ) - 1 ) return footer ; else return super . getItem ( position ) ; |
public class CompletableFutures { /** * Asynchronously accumulate the results only from the provided Futures ,
* reducing them using the supplied Monoid ( a combining BiFunction / BinaryOperator and identity element that takes two
* input values of the same type and returns the combined result ) { @ see cyclops2 . Monoids } .
* A single Failure results in a Failed Future .
* < pre >
* { @ code
* CompletableFuture < Integer > just = CompletableFuture . completedFuture ( 10 ) ;
* CompletableFuture < Integer > future = CompletableFutures . accumulate ( Monoids . intSum , Seq . of ( just , CompletableFuture . completableFuture ( 1 ) ) ) ;
* CompletableFuture [ 11]
* < / pre >
* @ param fts Collection of Futures to accumulate successes
* @ param reducer Monoid to combine values from each Future
* @ return CompletableFuture asynchronously populated with the accumulate operation */
public static < T > CompletableFuture < T > accumulate ( final Monoid < T > reducer , final IterableX < CompletableFuture < T > > fts ) { } } | return sequence ( fts ) . thenApply ( s -> s . reduce ( reducer ) ) ; |
public class ClassDescriptor { /** * Add a { @ link ObjectReferenceDescriptor } . */
public void addObjectReferenceDescriptor ( ObjectReferenceDescriptor ord ) { } } | m_ObjectReferenceDescriptors . add ( ord ) ; ord . setClassDescriptor ( this ) ; // BRJ
m_objectReferenceDescriptorsNameMap = null ; |
public class RingBuffer { /** * Allows one user supplied argument .
* @ see # tryPublishEvent ( EventTranslator )
* @ param translator The user specified translation for the event
* @ param arg0 A user supplied argument .
* @ return true if the value was published , false if there was insufficient capacity . */
public < A > boolean tryPublishEvent ( EventTranslatorOneArg < E , A > translator , A arg0 ) { } } | try { final long sequence = sequencer . tryNext ( ) ; translateAndPublish ( translator , sequence , arg0 ) ; return true ; } catch ( InsufficientCapacityException e ) { return false ; } |
public class TopicDistribution { /** * setter for probability - sets
* @ generated
* @ param v value to set into the feature */
public void setProbability ( DoubleArray v ) { } } | if ( TopicDistribution_Type . featOkTst && ( ( TopicDistribution_Type ) jcasType ) . casFeat_probability == null ) jcasType . jcas . throwFeatMissing ( "probability" , "ch.epfl.bbp.uima.types.TopicDistribution" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( TopicDistribution_Type ) jcasType ) . casFeatCode_probability , jcasType . ll_cas . ll_getFSRef ( v ) ) ; |
public class FormulaReader { /** * Reads a given file and returns the contained propositional formula .
* @ param fileName the file name
* @ param f the formula factory
* @ return the parsed formula
* @ throws IOException if there was a problem reading the file
* @ throws ParserException if there was a problem parsing the formula */
public static Formula readPropositionalFormula ( final String fileName , final FormulaFactory f ) throws IOException , ParserException { } } | return read ( new File ( fileName ) , new PropositionalParser ( f ) ) ; |
public class JRebirthThread { /** * Attach the first view and run pre and post command .
* @ throws JRebirthThreadException if a problem occurred while calling the command */
public void bootUp ( ) throws JRebirthThreadException { } } | final List < Wave > chainedWaveList = new ArrayList < > ( ) ; // Manage waves to run before the First node creation
final List < Wave > preBootList = getApplication ( ) . preBootWaveList ( ) ; if ( preBootList != null && ! preBootList . isEmpty ( ) ) { chainedWaveList . addAll ( preBootList ) ; } // Manage the creation of the first node and show it !
final Wave firstViewWave = getLaunchFirstViewWave ( ) ; if ( firstViewWave != null ) { chainedWaveList . add ( firstViewWave ) ; } // Manage waves to run after the First node creation
final List < Wave > postBootList = getApplication ( ) . postBootWaveList ( ) ; if ( postBootList != null && ! postBootList . isEmpty ( ) ) { chainedWaveList . addAll ( postBootList ) ; } if ( ! chainedWaveList . isEmpty ( ) ) { getFacade ( ) . notifier ( ) . sendWave ( WBuilder . chainWaveCommand ( chainedWaveList ) ) ; } |
public class AllInvocationsFinder { /** * gets all invocations from mocks . Invocations are ordered earlier first .
* @ param mocks mocks
* @ return invocations */
public static List < Invocation > find ( Iterable < ? > mocks ) { } } | Set < Invocation > invocationsInOrder = new TreeSet < Invocation > ( new InvocationComparator ( ) ) ; for ( Object mock : mocks ) { Collection < Invocation > fromSingleMock = new DefaultMockingDetails ( mock ) . getInvocations ( ) ; invocationsInOrder . addAll ( fromSingleMock ) ; } return new LinkedList < Invocation > ( invocationsInOrder ) ; |
public class BatchProcessor { /** * Put a single BatchEntry to the cache for later processing .
* @ param batchEntry
* the batchEntry to write to the cache . */
void put ( final AbstractBatchEntry batchEntry ) { } } | try { this . queue . put ( batchEntry ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } if ( this . queue . size ( ) >= this . actions ) { this . scheduler . submit ( new Runnable ( ) { @ Override public void run ( ) { write ( ) ; } } ) ; } |
public class MRCompactor { /** * When completion file strategy is used , a compaction completion means there is a file named
* { @ link MRCompactor # COMPACTION _ COMPLETE _ FILE _ NAME } in its { @ link Dataset # outputPath ( ) } . */
private static boolean checkAlreadyCompactedBasedOnCompletionFile ( FileSystem fs , Dataset dataset ) { } } | Path filePath = new Path ( dataset . outputPath ( ) , MRCompactor . COMPACTION_COMPLETE_FILE_NAME ) ; try { return fs . exists ( filePath ) ; } catch ( IOException e ) { LOG . error ( "Failed to verify the existence of file " + filePath , e ) ; return false ; } |
public class Types { /** * Returns whether the given object is an instance of a superclass of the
* given class , that is if it can be cast to the given class .
* @ param object
* the object being tested .
* @ param clazz
* the class to check .
* @ return
* whether the object under inspection can be cast to the given class . */
public static boolean isOfSuperClassOf ( Object object , Class < ? > clazz ) { } } | if ( object == null || clazz == null ) { return false ; } return object . getClass ( ) . isAssignableFrom ( clazz ) ; |
public class WsqHandler { /** * decodes the given WSQ file and returns a < code > BitmapHandler < / code > containing the decoded info .
* @ param file the WSQ image file , not null
* @ return a BitmapHandler containing the decoded info , not null
* @ see BitmapHandler */
public BitmapHandler decode ( File file ) { } } | try { return decode ( new FileInputStream ( file ) ) ; } catch ( FileNotFoundException e ) { throw new RuntimeException ( "unexpected error." , e ) ; } |
public class JsonOutput { /** * Adds a list .
* @ param writer
* used writer .
* @ param field
* field to write .
* @ param items
* used items .
* @ param objWriter
* single object writer . */
public static < T > void addArrayIfNotNull ( JSONWriter writer , String field , Collection < T > items , JsonObjectWriter < T > objWriter ) throws JSONException { } } | if ( items == null ) return ; addCollection ( writer , field , items , objWriter ) ; |
public class Snappy { /** * Compress the input buffer content in [ inputOffset ,
* . . . inputOffset + inputLength ) then output to the specified output buffer .
* @ param input
* @ param inputOffset
* @ param inputLength
* @ param output
* @ param outputOffset
* @ return byte size of the compressed data
* @ throws IOException when failed to access the input / output buffer */
public static int compress ( byte [ ] input , int inputOffset , int inputLength , byte [ ] output , int outputOffset ) throws IOException { } } | return rawCompress ( input , inputOffset , inputLength , output , outputOffset ) ; |
public class UpdatableSketch { /** * Updates this sketch with a byte [ ] key and U value .
* The value is passed to update ( ) method of the Summary object associated with the key
* @ param key The given byte [ ] key
* @ param value The given U value */
public void update ( final byte [ ] key , final U value ) { } } | if ( ( key == null ) || ( key . length == 0 ) ) { return ; } insertOrIgnore ( MurmurHash3 . hash ( key , DEFAULT_UPDATE_SEED ) [ 0 ] >>> 1 , value ) ; |
public class NumberUtil { /** * 将16进制的String转化为Integer , 出错时返回默认值 . */
public static Integer hexToIntObject ( @ Nullable String str , Integer defaultValue ) { } } | if ( StringUtils . isEmpty ( str ) ) { return defaultValue ; } try { return Integer . decode ( str ) ; } catch ( final NumberFormatException nfe ) { return defaultValue ; } |
public class ICUHumanize { /** * Same as { @ link # messageFormatInstance ( String ) messageFormatInstance } for
* the specified locale .
* @ param locale
* Target locale
* @ param pattern
* Format pattern that follows the conventions of
* { @ link com . ibm . icu . text . MessageFormat MessageFormat }
* @ return a MessageFormat instance for the current thread */
public static MessageFormat messageFormatInstance ( final String pattern , final Locale locale ) { } } | return withinLocale ( new Callable < MessageFormat > ( ) { public MessageFormat call ( ) throws Exception { return messageFormatInstance ( pattern ) ; } } , locale ) ; |
public class AbstractAttributeDefinitionBuilder { /** * Marks the attribute as deprecated since the given API version , with the ability to configure that
* notifications to the user ( e . g . via a log message ) about deprecation of the attribute should not be emitted .
* Notifying the user should only be done if the user can take some action in response . Advising that
* something will be removed in a later release is not useful if there is no alternative in the
* current release . If the { @ code notificationUseful } param is { @ code true } the text
* description of the attribute deprecation available from the { @ code read - resource - description }
* management operation should provide useful information about how the user can avoid using
* the attribute .
* @ param since the API version , with the API being the one ( core or a subsystem ) in which the attribute is used
* @ param notificationUseful whether actively advising the user about the deprecation is useful
* @ return a builder that can be used to continue building the attribute definition */
public BUILDER setDeprecated ( ModelVersion since , boolean notificationUseful ) { } } | // noinspection deprecation
this . deprecated = new DeprecationData ( since , notificationUseful ) ; return ( BUILDER ) this ; |
public class IntListUtil { /** * Creates a new list that will accomodate the specified index and
* copies the contents of the old list to the first . */
protected static int [ ] accomodate ( int [ ] list , int index ) { } } | int size = list . length ; // expand size by powers of two until we ' re big enough
while ( size <= index ) { size = Math . max ( size * 2 , DEFAULT_LIST_SIZE ) ; } // create a new list and copy the contents
int [ ] newlist = new int [ size ] ; System . arraycopy ( list , 0 , newlist , 0 , list . length ) ; return newlist ; |
public class JsMsgPart { /** * Get the estimated size of the fluffed = up value of the field */
int estimateFieldValueSize ( int accessor ) { } } | int size = 0 ; try { if ( jmfPart . isPresent ( accessor ) ) { size = jmfPart . estimateUnassembledValueSize ( accessor ) ; } } catch ( JMFException e ) { FFDCFilter . processException ( e , "estimateFieldValueSize" , "221" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "estimateFieldValueSize failed: " + e ) ; } return size ; |
public class Filter { /** * Append two SQL select .
* @ param _ sqlSelect the sql select */
public void append2SQLSelect ( final SQLSelect _sqlSelect ) { } } | if ( iWhere != null ) { final SQLWhere sqlWhere = _sqlSelect . getWhere ( ) ; for ( final IWhereTerm < ? > term : iWhere . getTerms ( ) ) { if ( term instanceof IWhereElementTerm ) { final IWhereElement element = ( ( IWhereElementTerm ) term ) . getElement ( ) ; if ( element . getAttribute ( ) != null ) { final String attrName = element . getAttribute ( ) ; for ( final Type type : types ) { final Attribute attr = type . getAttribute ( attrName ) ; if ( attr != null ) { addAttr ( _sqlSelect , sqlWhere , attr , term , element ) ; break ; } } } else if ( element . getSelect ( ) != null ) { final IWhereSelect select = element . getSelect ( ) ; for ( final ISelectElement ele : select . getElements ( ) ) { if ( ele instanceof IBaseSelectElement ) { switch ( ( ( IBaseSelectElement ) ele ) . getElement ( ) ) { case STATUS : for ( final Type type : types ) { final Attribute attr = type . getStatusAttribute ( ) ; if ( attr != null ) { addAttr ( _sqlSelect , sqlWhere , attr , term , element ) ; break ; } } break ; default : break ; } } else if ( ele instanceof IAttributeSelectElement ) { final String attrName = ( ( IAttributeSelectElement ) ele ) . getName ( ) ; for ( final Type type : types ) { addAttr ( _sqlSelect , sqlWhere , type . getAttribute ( attrName ) , term , element ) ; } } } } } } } if ( iOrder != null ) { final SQLOrder sqlOrder = _sqlSelect . getOrder ( ) ; for ( final IOrderElement element : iOrder . getElements ( ) ) { for ( final Type type : types ) { final Attribute attr = type . getAttribute ( element . getKey ( ) ) ; if ( attr != null ) { final SQLTable table = attr . getTable ( ) ; final String tableName = table . getSqlTable ( ) ; final TableIdx tableidx = _sqlSelect . getIndexer ( ) . getTableIdx ( tableName ) ; sqlOrder . addElement ( tableidx . getIdx ( ) , attr . getSqlColNames ( ) , element . isDesc ( ) ) ; break ; } } } } |
public class PluginXmlParser { /** * Parse the resource list .
* @ param element Root resource tag .
* @ param builder Bean definition builder .
* @ param resourceList List of resources to build . */
private void parseResources ( Element element , BeanDefinitionBuilder builder , ManagedList < AbstractBeanDefinition > resourceList ) { } } | NodeList resources = element . getChildNodes ( ) ; for ( int i = 0 ; i < resources . getLength ( ) ; i ++ ) { Node node = resources . item ( i ) ; if ( ! ( node instanceof Element ) ) { continue ; } Element resource = ( Element ) resources . item ( i ) ; Class < ? extends IPluginResource > resourceClass = null ; switch ( getResourceType ( getNodeName ( resource ) ) ) { case button : resourceClass = PluginResourceButton . class ; break ; case help : resourceClass = PluginResourceHelp . class ; break ; case menu : resourceClass = PluginResourceMenu . class ; break ; case property : resourceClass = PluginResourcePropertyGroup . class ; break ; case css : resourceClass = PluginResourceCSS . class ; break ; case bean : resourceClass = PluginResourceBean . class ; break ; case command : resourceClass = PluginResourceCommand . class ; break ; case action : resourceClass = PluginResourceAction . class ; break ; } if ( resourceClass != null ) { BeanDefinitionBuilder resourceBuilder = BeanDefinitionBuilder . genericBeanDefinition ( resourceClass ) ; addProperties ( resource , resourceBuilder ) ; resourceList . add ( resourceBuilder . getBeanDefinition ( ) ) ; } } |
public class RotationGestureDetector { /** * Accepts MotionEvents and dispatches events to a { @ link OnRotationGestureListener }
* when appropriate .
* Applications should pass a complete and consistent event stream to this method .
* A complete and consistent event stream involves all MotionEvents from the initial
* ACTION _ DOWN to the final ACTION _ UP or ACTION _ CANCEL .
* @ param event The event to process
* @ return true if the event was processed and the detector wants to receive the
* rest of the MotionEvents in this event stream . */
public boolean onTouchEvent ( MotionEvent event ) { } } | switch ( event . getActionMasked ( ) ) { case MotionEvent . ACTION_DOWN : case MotionEvent . ACTION_CANCEL : case MotionEvent . ACTION_UP : cancelRotation ( ) ; break ; case MotionEvent . ACTION_POINTER_DOWN : if ( event . getPointerCount ( ) == 2 ) { // Second finger is placed
initialAngle = prevAngle = currAngle = computeRotation ( event ) ; } break ; case MotionEvent . ACTION_MOVE : if ( event . getPointerCount ( ) >= 2 && ( ! isInProgress || isGestureAccepted ) ) { // Moving 2 or more fingers on the screen
currAngle = computeRotation ( event ) ; focusX = 0.5f * ( event . getX ( 1 ) + event . getX ( 0 ) ) ; focusY = 0.5f * ( event . getY ( 1 ) + event . getY ( 0 ) ) ; boolean isAlreadyStarted = isInProgress ; tryStartRotation ( ) ; boolean isAccepted = ! isAlreadyStarted || processRotation ( ) ; if ( isAccepted ) { prevAngle = currAngle ; } } break ; case MotionEvent . ACTION_POINTER_UP : if ( event . getPointerCount ( ) == 2 ) { // Only one finger is left
cancelRotation ( ) ; } break ; default : } return true ; |
public class SparseBaseLevel1 { /** * Find the index of the element with maximum absolute value
* @ param arr a vector
* @ return the index of the element with minimum absolute value */
@ Override public int iamin ( INDArray arr ) { } } | switch ( arr . data ( ) . dataType ( ) ) { case DOUBLE : DefaultOpExecutioner . validateDataType ( DataType . DOUBLE , arr ) ; return idamin ( arr . length ( ) , arr , 1 ) ; case FLOAT : DefaultOpExecutioner . validateDataType ( DataType . FLOAT , arr ) ; return isamin ( arr . length ( ) , arr , 1 ) ; case HALF : DefaultOpExecutioner . validateDataType ( DataType . HALF , arr ) ; return ihamin ( arr . length ( ) , arr , 1 ) ; default : } throw new UnsupportedOperationException ( ) ; |
public class BugInstance { /** * Add a source line annotation describing the source line numbers for a
* range of instructions in the method being visited by the given visitor .
* Note that if the method does not have line number information , then no
* source line annotation will be added .
* @ param visitor
* a BetterVisitor which is visiting the method
* @ param startPC
* the bytecode offset of the start instruction in the range
* @ param endPC
* the bytecode offset of the end instruction in the range
* @ return this object */
@ Nonnull public BugInstance addSourceLineRange ( BytecodeScanningDetector visitor , int startPC , int endPC ) { } } | SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation . fromVisitedInstructionRange ( visitor . getClassContext ( ) , visitor , startPC , endPC ) ; requireNonNull ( sourceLineAnnotation ) ; add ( sourceLineAnnotation ) ; return this ; |
public class Base64 { /** * Low - level access to decoding ASCII characters in the form of a byte array . < strong > Ignores GUNZIP option , if it ' s
* set . < / strong > This is not generally a recommended method , although it is used internally as part of the decoding process .
* Special case : if len = 0 , an empty array is returned . Still , if you need more speed and reduced memory footprint ( and
* aren ' t gzipping ) , consider this method .
* @ param source The Base64 encoded data
* @ param off The offset of where to begin decoding
* @ param len The length of characters to decode
* @ param options Can specify options such as alphabet type to use
* @ return decoded data
* @ throws java . io . IOException If bogus characters exist in source data
* @ since 1.3 */
public static byte [ ] decode ( byte [ ] source , int off , int len , int options ) throws java . io . IOException { } } | // Lots of error checking and exception throwing
if ( source == null ) { throw new NullPointerException ( "Cannot decode null source array." ) ; } // end if
if ( off < 0 || off + len > source . length ) { throw new IllegalArgumentException ( String . format ( "Source array with length %d cannot have offset of %d and process %d bytes." , source . length , off , len ) ) ; } // end if
if ( len == 0 ) { return new byte [ 0 ] ; } else if ( len < 4 ) { throw new IllegalArgumentException ( "Base64-encoded string must have at least four characters, but length specified was " + len ) ; } // end if
byte [ ] DECODABET = getDecodabet ( options ) ; int len34 = len * 3 / 4 ; // Estimate on array size
byte [ ] outBuff = new byte [ len34 ] ; // Upper limit on size of output
int outBuffPosn = 0 ; // Keep track of where we ' re writing
byte [ ] b4 = new byte [ 4 ] ; // Four byte buffer from source , eliminating white space
int b4Posn = 0 ; // Keep track of four byte input buffer
int i = 0 ; // Source array counter
byte sbiDecode = 0 ; // Special value from DECODABET
for ( i = off ; i < off + len ; i ++ ) { // Loop through source
sbiDecode = DECODABET [ source [ i ] & 0xFF ] ; // White space , Equals sign , or legit Base64 character
// Note the values such as - 5 and - 9 in the
// DECODABETs at the top of the file .
if ( sbiDecode >= WHITE_SPACE_ENC ) { if ( sbiDecode >= EQUALS_SIGN_ENC ) { b4 [ b4Posn ++ ] = source [ i ] ; // Save non - whitespace
if ( b4Posn > 3 ) { // Time to decode ?
outBuffPosn += decode4to3 ( b4 , 0 , outBuff , outBuffPosn , options ) ; b4Posn = 0 ; // If that was the equals sign , break out of ' for ' loop
if ( source [ i ] == EQUALS_SIGN ) { break ; } // end if : equals sign
} // end if : quartet built
} // end if : equals sign or better
} // end if : white space , equals sign or better
else { // There ' s a bad input character in the Base64 stream .
throw new java . io . IOException ( String . format ( "Bad Base64 input character decimal %d in array position %d" , ( ( int ) source [ i ] ) & 0xFF , i ) ) ; } // end else :
} // each input character
byte [ ] out = new byte [ outBuffPosn ] ; System . arraycopy ( outBuff , 0 , out , 0 , outBuffPosn ) ; return out ; |
public class DetectStackDriftRequest { /** * The logical names of any resources you want to use as filters .
* @ param logicalResourceIds
* The logical names of any resources you want to use as filters . */
public void setLogicalResourceIds ( java . util . Collection < String > logicalResourceIds ) { } } | if ( logicalResourceIds == null ) { this . logicalResourceIds = null ; return ; } this . logicalResourceIds = new com . amazonaws . internal . SdkInternalList < String > ( logicalResourceIds ) ; |
public class ISUPMessageFactoryImpl { /** * ( non - Javadoc )
* @ see org . restcomm . protocols . ss7 . isup . ISUPMessageFactory # createSUS ( int cic ) */
public SuspendMessage createSUS ( int cic ) { } } | SuspendMessage msg = createSUS ( ) ; CircuitIdentificationCode code = this . parameterFactory . createCircuitIdentificationCode ( ) ; code . setCIC ( cic ) ; msg . setCircuitIdentificationCode ( code ) ; return msg ; |
public class ReloadableType { /** * Go through proxies we know about in this registry and see if any of them are for the type we have just reloaded .
* If they are , regenerate them and reload them .
* @ param versionsuffix the suffix to use when reloading the proxies ( it matches what is being used to reload the
* type ) */
private void reloadProxiesIfNecessary ( String versionsuffix ) { } } | ReloadableType proxy = typeRegistry . cglibProxies . get ( this . slashedtypename ) ; if ( proxy != null ) { if ( GlobalConfiguration . isRuntimeLogging && log . isLoggable ( Level . INFO ) ) { log . log ( Level . INFO , "Attempting reload of cglib proxy for type " + this . slashedtypename ) ; } Object [ ] strategyAndGeneratorPair = CglibPluginCapturing . clazzToGeneratorStrategyAndClassGeneratorMap . get ( getClazz ( ) ) ; if ( strategyAndGeneratorPair == null ) { if ( log . isLoggable ( Level . SEVERE ) ) { log . severe ( "Unable to find regeneration methods for cglib proxies - proxies will be out of date for type: " + getClazz ( ) ) ; } return ; } Object a = strategyAndGeneratorPair [ 0 ] ; Object b = strategyAndGeneratorPair [ 1 ] ; // want to call a . generate ( b )
try { Method [ ] ms = a . getClass ( ) . getMethods ( ) ; Method found = null ; for ( Method m : ms ) { if ( m . getName ( ) . equals ( "generate" ) ) { found = m ; // TODO cache
break ; } } found . setAccessible ( true ) ; byte [ ] bs = ( byte [ ] ) found . invoke ( a , b ) ; if ( GlobalConfiguration . isRuntimeLogging && log . isLoggable ( Level . INFO ) ) { log . log ( Level . INFO , "Proxy regenerate successful for " + this . slashedtypename ) ; } proxy . loadNewVersion ( versionsuffix , bs ) ; proxy . runStaticInitializer ( ) ; } catch ( Throwable t ) { t . printStackTrace ( ) ; } } proxy = typeRegistry . cglibProxiesFastClass . get ( this . slashedtypename ) ; if ( proxy != null ) { Object [ ] strategyAndFCGeneratorPair = CglibPluginCapturing . clazzToGeneratorStrategyAndFastClassGeneratorMap . get ( getClazz ( ) ) ; strategyAndFCGeneratorPair = CglibPluginCapturing . clazzToGeneratorStrategyAndFastClassGeneratorMap . get ( getClazz ( ) ) ; // System . out . println ( " need to reload fastclass " + proxy + " os = " + os ) ;
if ( strategyAndFCGeneratorPair != null ) { Object a = strategyAndFCGeneratorPair [ 0 ] ; Object b = strategyAndFCGeneratorPair [ 1 ] ; // want to call a . generate ( b )
try { Method [ ] ms = a . getClass ( ) . getMethods ( ) ; Method found = null ; for ( Method m : ms ) { if ( m . getName ( ) . equals ( "generate" ) ) { found = m ; break ; } } byte [ ] bs = ( byte [ ] ) found . invoke ( a , b ) ; if ( GlobalConfiguration . isRuntimeLogging && log . isLoggable ( Level . INFO ) ) { log . log ( Level . INFO , "Proxy (fastclass) regenerate successful for " + this . slashedtypename ) ; } proxy . loadNewVersion ( versionsuffix , bs ) ; proxy . runStaticInitializer ( ) ; } catch ( Throwable t ) { t . printStackTrace ( ) ; } } } try { if ( this . clazz . isInterface ( ) ) { // JDK Proxy reloading
Set < ReloadableType > relevantProxies = typeRegistry . jdkProxiesForInterface . get ( this . slashedtypename ) ; if ( relevantProxies != null ) { for ( ReloadableType relevantProxy : relevantProxies ) { Class < ? > [ ] interfacesImplementedByProxy = relevantProxy . getClazz ( ) . getInterfaces ( ) ; // TODO confirm slashedname correct
byte [ ] newProxyBytes = Utils . generateProxyClass ( relevantProxy . getSlashedName ( ) , interfacesImplementedByProxy ) ; relevantProxy . loadNewVersion ( versionsuffix , newProxyBytes , true ) ; } } } } catch ( Throwable t ) { new RuntimeException ( "Unexpected problem trying to reload proxy for interface " + this . dottedtypename , t ) . printStackTrace ( ) ; } |
public class DatatypeConverter { /** * Print duration time units .
* @ param duration Duration value
* @ param estimated is this an estimated duration
* @ return time units value */
public static final BigInteger printDurationTimeUnits ( Duration duration , boolean estimated ) { } } | // SF - 329 : null default required to keep Powerproject happy when importing MSPDI files
TimeUnit units = duration == null ? PARENT_FILE . get ( ) . getProjectProperties ( ) . getDefaultDurationUnits ( ) : duration . getUnits ( ) ; return printDurationTimeUnits ( units , estimated ) ; |
public class SplitCamelCaseIdentifier { /** * Split the identifier into words .
* @ return Collection of words in the identifier */
public Collection < String > split ( ) { } } | String s = ident ; Set < String > result = new HashSet < > ( ) ; while ( s . length ( ) > 0 ) { StringBuilder buf = new StringBuilder ( ) ; char first = s . charAt ( 0 ) ; buf . append ( first ) ; int i = 1 ; if ( s . length ( ) > 1 ) { boolean camelWord ; if ( Character . isLowerCase ( first ) ) { camelWord = true ; } else { char next = s . charAt ( i ++ ) ; buf . append ( next ) ; camelWord = Character . isLowerCase ( next ) ; } while ( i < s . length ( ) ) { char c = s . charAt ( i ) ; if ( Character . isUpperCase ( c ) ) { if ( camelWord ) { break ; } } else if ( ! camelWord ) { break ; } buf . append ( c ) ; ++ i ; } if ( ! camelWord && i < s . length ( ) ) { buf . deleteCharAt ( buf . length ( ) - 1 ) ; -- i ; } } result . add ( buf . toString ( ) . toLowerCase ( Locale . US ) ) ; s = s . substring ( i ) ; } return result ; |
public class DetectorFactoryCollection { /** * Get a description for given " bug type " . FIXME : this is referred to
* elsewhere as the " bug code " or " bug abbrev " . Should make the terminology
* consistent everywhere . In this case , the bug type refers to the short
* prefix code prepended to the long and short bug messages .
* @ param shortBugType
* the short bug type code
* @ return the description of that short bug type code means */
public @ Nonnull BugCode getBugCode ( String shortBugType ) { } } | BugCode bugCode = lookupBugCode ( shortBugType ) ; if ( bugCode == null ) { throw new IllegalArgumentException ( "Error: missing bug code for key" + shortBugType ) ; } return bugCode ; |
public class StatisticsApi { /** * Get statistic definitions .
* Returns statistic definitions records .
* @ return ApiResponse & lt ; GetStatisticDefinitionsResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < GetStatisticDefinitionsResponse > getStatisticDefinitionsWithHttpInfo ( ) throws ApiException { } } | com . squareup . okhttp . Call call = getStatisticDefinitionsValidateBeforeCall ( null , null ) ; Type localVarReturnType = new TypeToken < GetStatisticDefinitionsResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class Maybe { /** * Subscribes to a Maybe and provides callbacks to handle the items it emits and any error or
* completion notification it issues .
* < dl >
* < dt > < b > Scheduler : < / b > < / dt >
* < dd > { @ code subscribe } does not operate by default on a particular { @ link Scheduler } . < / dd >
* < / dl >
* @ param onSuccess
* the { @ code Consumer < T > } you have designed to accept a success value from the Maybe
* @ param onError
* the { @ code Consumer < Throwable > } you have designed to accept any error notification from the
* Maybe
* @ param onComplete
* the { @ code Action } you have designed to accept a completion notification from the
* Maybe
* @ return a { @ link Disposable } reference with which the caller can stop receiving items before
* the Maybe has finished sending them
* @ throws NullPointerException
* if { @ code onSuccess } is null , or
* if { @ code onError } is null , or
* if { @ code onComplete } is null
* @ see < a href = " http : / / reactivex . io / documentation / operators / subscribe . html " > ReactiveX operators documentation : Subscribe < / a > */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( Consumer < ? super T > onSuccess , Consumer < ? super Throwable > onError , Action onComplete ) { } } | ObjectHelper . requireNonNull ( onSuccess , "onSuccess is null" ) ; ObjectHelper . requireNonNull ( onError , "onError is null" ) ; ObjectHelper . requireNonNull ( onComplete , "onComplete is null" ) ; return subscribeWith ( new MaybeCallbackObserver < T > ( onSuccess , onError , onComplete ) ) ; |
public class FluentValidator { /** * 将闭包注入上下文
* @ param key 键
* @ param value 闭包
* @ return FluentValidator */
public FluentValidator putClosure2Context ( String key , Closure value ) { } } | if ( context == null ) { context = new ValidatorContext ( ) ; } context . setClosure ( key , value ) ; return this ; |
public class EBSOptionsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( EBSOptions eBSOptions , ProtocolMarshaller protocolMarshaller ) { } } | if ( eBSOptions == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( eBSOptions . getEBSEnabled ( ) , EBSENABLED_BINDING ) ; protocolMarshaller . marshall ( eBSOptions . getVolumeType ( ) , VOLUMETYPE_BINDING ) ; protocolMarshaller . marshall ( eBSOptions . getVolumeSize ( ) , VOLUMESIZE_BINDING ) ; protocolMarshaller . marshall ( eBSOptions . getIops ( ) , IOPS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MemoryRemoteTable { /** * Move the current position and read the record ( optionally read several records ) .
* @ param iRelPosition relative Position to read the next record .
* @ param iRecordCount Records to read .
* @ return If I read 1 record , this is the record ' s data .
* @ return If I read several records , this is a vector of the returned records .
* @ return If at EOF , or error , returns the error code as a Integer .
* @ exception Exception File exception . */
public Object doMove ( int iRelPosition , int iRecordCount ) throws DBException , RemoteException { } } | int iRowIndex = m_iCurrentRecord + iRelPosition ; // Calculate absolute position
if ( ( m_iCurrentRecord == - 1 ) && ( iRelPosition == - 1 ) ) iRowIndex = m_mDataMap . size ( ) - 1 ; // Special case - pos - 1 after open - > pos last .
return this . get ( iRowIndex , iRecordCount ) ; |
public class JSONUtils { /** * Return true for classes that can be equal to a basic value type ( types that can be converted directly to and
* from string representation ) .
* @ param cls
* the class
* @ return true , if the class is a basic value type */
static boolean isBasicValueType ( final Class < ? > cls ) { } } | return cls == String . class || cls == Integer . class || cls == Integer . TYPE || cls == Long . class || cls == Long . TYPE || cls == Short . class || cls == Short . TYPE || cls == Float . class || cls == Float . TYPE || cls == Double . class || cls == Double . TYPE || cls == Byte . class || cls == Byte . TYPE || cls == Character . class || cls == Character . TYPE || cls == Boolean . class || cls == Boolean . TYPE || cls . isEnum ( ) ; |
public class NodePod { /** * Return the current server owner . */
public ServerBartender owner ( ) { } } | for ( int i = 0 ; i < _owners . length ; i ++ ) { ServerBartender serverBar = server ( i ) ; if ( serverBar != null && serverBar . isUp ( ) ) { return serverBar ; } } return null ; |
public class PangoolMultipleOutputs { /** * Returns the DEFAULT key class for a named output . */
private static Class < ? > getDefaultNamedOutputKeyClass ( JobContext job ) { } } | return job . getConfiguration ( ) . getClass ( DEFAULT_MO_PREFIX + KEY , null , Object . class ) ; |
public class KeyPointsCircleHexagonalGrid { /** * Finds the intersection of all the tangent lines with each other the computes the average of those points .
* That location is where the center is set to . Each intersection of lines is weighted by the acute angle .
* lines which are 90 degrees to each other are less sensitive to noise */
boolean computeEllipseCenters ( ) { } } | keypoints . reset ( ) ; for ( int tangentIdx = 0 ; tangentIdx < tangents . size ( ) ; tangentIdx ++ ) { // System . out . println ( " tangent id " + tangentIdx ) ;
Tangents t = tangents . get ( tangentIdx ) ; Point2D_F64 center = keypoints . grow ( ) ; center . set ( 0 , 0 ) ; double totalWeight = 0 ; for ( int i = 0 ; i < t . size ( ) ; i += 2 ) { UtilLine2D_F64 . convert ( t . get ( i ) , t . get ( i + 1 ) , lineA ) ; for ( int j = i + 2 ; j < t . size ( ) ; j += 2 ) { UtilLine2D_F64 . convert ( t . get ( j ) , t . get ( j + 1 ) , lineB ) ; // way each intersection based on the acute angle . lines which are nearly parallel will
// be unstable estimates
double w = UtilVector2D_F64 . acute ( lineA . A , lineA . B , lineB . A , lineB . B ) ; if ( w > Math . PI / 2.0 ) w = Math . PI - w ; // If there is perfect data and no noise there will be duplicated lines . With noise there will
// be very similar lines
if ( w <= 0.02 ) continue ; if ( null == Intersection2D_F64 . intersection ( lineA , lineB , location ) ) { return false ; } // System . out . printf ( " % 4.2f loc % 6.2f % 6.2f \ n " , w , location . x , location . y ) ;
center . x += location . x * w ; center . y += location . y * w ; totalWeight += w ; } } if ( totalWeight == 0 ) return false ; center . x /= totalWeight ; center . y /= totalWeight ; } return true ; |
public class AlluxioURI { /** * Gets the first n components of the { @ link AlluxioURI } path . There is no trailing separator as
* the path will be normalized by normalizePath ( ) .
* < pre >
* / a / b / c , 0 = /
* / a / b / c , 1 = / a
* / a / b / c , 2 = / a / b
* / a / b / c , 3 = / a / b / c
* / a / b / c , 4 = null
* < / pre >
* @ param n identifies the number of path components to get
* @ return the first n path components , null if the path has less than n components */
@ Nullable public String getLeadingPath ( int n ) { } } | String path = mUri . getPath ( ) ; if ( n == 0 && path . indexOf ( AlluxioURI . SEPARATOR ) == 0 ) { // the special case
return AlluxioURI . SEPARATOR ; } int depth = getDepth ( ) ; if ( depth < n ) { return null ; } else if ( depth == n ) { return path ; } else { String [ ] comp = path . split ( SEPARATOR ) ; return StringUtils . join ( Arrays . asList ( comp ) . subList ( 0 , n + 1 ) , SEPARATOR ) ; } |
public class VisualContext { /** * Converts an angle from a CSS angle to ' rad ' .
* @ param spec the CSS angle specification
* @ return the corresponding angle in radians */
public double radAngle ( TermAngle spec ) { } } | float nval = spec . getValue ( ) ; final TermLength . Unit unit = spec . getUnit ( ) ; if ( spec instanceof TermCalcAngleImpl ) { final CalcArgs args = ( ( TermCalc ) spec ) . getArgs ( ) ; return args . evaluate ( getRadEval ( ) ) ; } else { if ( unit == null ) return 0 ; switch ( unit ) { case deg : return ( nval * Math . PI ) / 180.0 ; case grad : return ( nval * Math . PI ) / 200.0 ; case rad : return nval ; case turn : return nval * 2 * Math . PI ; default : return 0 ; } } |
public class WSConnectionRequestInfoImpl { /** * Initialize default values that are used for unspecified properties .
* This allows us to match unspecified values with specified values in another CRI .
* @ param catalog the default catalog value , or NULL if not supported .
* @ param holdability the default holdability value , or 0 if not supported .
* @ param readOnly the default read - only value , or NULL if not supported .
* @ param typeMap the default type map value , or NULL if not supported .
* @ param schema the default schema value , or NULL if not supported .
* @ param networkTimeout the default network timeout . */
public void setDefaultValues ( String catalog , int holdability , Boolean readOnly , Map < String , Class < ? > > typeMap , String schema , int networkTimeout ) { } } | defaultCatalog = catalog ; defaultHoldability = holdability ; defaultReadOnly = readOnly ; defaultTypeMap = typeMap ; defaultSchema = schema ; defaultNetworkTimeout = networkTimeout ; |
public class ODataLocal { /** * Set the record content in file .
* @ param iPosition
* The previous record ' s offset
* @ param iContent
* The content to write
* @ return The new record offset or the same received as parameter is the old space was reused .
* @ throws IOException */
public long setRecord ( final long iPosition , final ORecordId iRid , final byte [ ] iContent ) throws IOException { } } | acquireExclusiveLock ( ) ; try { long [ ] pos = getRelativePosition ( iPosition ) ; final OFile file = files [ ( int ) pos [ 0 ] ] ; final int recordSize = file . readInt ( pos [ 1 ] ) ; final int contentLength = iContent != null ? iContent . length : 0 ; if ( contentLength == recordSize ) { // USE THE OLD SPACE SINCE SIZE ISN ' T CHANGED
file . write ( pos [ 1 ] + RECORD_FIX_SIZE , iContent ) ; OProfiler . getInstance ( ) . updateCounter ( PROFILER_UPDATE_REUSED_ALL , + 1 ) ; return iPosition ; } else if ( recordSize - contentLength > RECORD_FIX_SIZE + 50 ) { // USE THE OLD SPACE BUT UPDATE THE CURRENT SIZE . IT ' S PREFEREABLE TO USE THE SAME INSTEAD FINDING A BEST SUITED FOR IT TO
// AVOID CHANGES TO REF FILE AS WELL .
writeRecord ( pos , iRid . clusterId , iRid . clusterPosition , iContent ) ; // CREATE A HOLE WITH THE DIFFERENCE OF SPACE
handleHole ( iPosition + RECORD_FIX_SIZE + contentLength , recordSize - contentLength - RECORD_FIX_SIZE ) ; OProfiler . getInstance ( ) . updateCounter ( PROFILER_UPDATE_REUSED_PARTIAL , + 1 ) ; } else { // CREATE A HOLE FOR THE ENTIRE OLD RECORD
handleHole ( iPosition , recordSize ) ; // USE A NEW SPACE
pos = getFreeSpace ( contentLength + RECORD_FIX_SIZE ) ; writeRecord ( pos , iRid . clusterId , iRid . clusterPosition , iContent ) ; OProfiler . getInstance ( ) . updateCounter ( PROFILER_UPDATE_NOT_REUSED , + 1 ) ; } return getAbsolutePosition ( pos ) ; } finally { releaseExclusiveLock ( ) ; } |
public class AdaptedIterator { /** * / * ( non - Javadoc )
* @ see java . util . Iterator # hasNext ( ) */
public boolean hasNext ( ) { } } | if ( cachedNext != null ) return true ; while ( itr . hasNext ( ) ) { S o = itr . next ( ) ; T adapted = adapter . adapt ( o ) ; if ( adapted != null ) { cachedNext = adapted ; return true ; } } return false ; |
public class RLSUtils { /** * Converts a byte array into a printable hex string .
* @ param byteSource The byte array source .
* @ param bytes The number of bytes to display .
* @ return String printable hex string or " null " */
public static String toHexString ( byte [ ] byteSource , int bytes ) { } } | StringBuffer result = null ; boolean truncated = false ; if ( byteSource != null ) { if ( bytes > byteSource . length ) { // If the number of bytes to display is larger than the available number of
// bytes , then reset the number of bytes to display to be the available
// number of bytes .
bytes = byteSource . length ; } else if ( bytes < byteSource . length ) { // If we are displaying less bytes than are available then detect this
// ' truncation ' condition .
truncated = true ; } result = new StringBuffer ( bytes * 2 ) ; for ( int i = 0 ; i < bytes ; i ++ ) { result . append ( _digits . charAt ( ( byteSource [ i ] >> 4 ) & 0xf ) ) ; result . append ( _digits . charAt ( byteSource [ i ] & 0xf ) ) ; } if ( truncated ) { result . append ( "... (" + bytes + "/" + byteSource . length + ")" ) ; } else { result . append ( "(" + bytes + ")" ) ; } } else { result = new StringBuffer ( "null" ) ; } return ( result . toString ( ) ) ; |
public class XmlParser { /** * Return true if we can read the expected character .
* Note that the character will be removed from the input stream on success ,
* but will be put back on failure . Do not attempt to read the character
* again if the method succeeds .
* @ param delim
* The character that should appear next . For a insensitive
* match , you must supply this in upper - case .
* @ return true if the character was successfully read , or false if it was
* not .
* @ see # tryRead ( String ) */
private boolean tryRead ( char delim ) throws SAXException , IOException { } } | char c ; // Read the character
c = readCh ( ) ; // Test for a match , and push the character
// back if the match fails .
if ( c == delim ) { return true ; } else { unread ( c ) ; return false ; } |
public class TracerFactory { /** * Opens all pooled tracers . */
public void openPoolTracer ( ) { } } | this . poolWriteLock . lock ( ) ; try { for ( AbstractTracer tracer : this . tracerPool . values ( ) ) { tracer . open ( ) ; } } finally { this . poolWriteLock . unlock ( ) ; } |
public class VersionRegEx { /** * Compares two versions , following the < em > semantic version < / em > specification . Here
* is a quote from < a href = " http : / / semver . org / " > semantic version 2.0.0
* specification < / a > :
* < em > Precedence refers to how versions are compared to each other when ordered .
* Precedence MUST be calculated by separating the version into major , minor , patch
* and pre - release identifiers in that order ( Build metadata does not figure into
* precedence ) . Precedence is determined by the first difference when comparing each
* of these identifiers from left to right as follows : Major , minor , and patch
* versions are always compared numerically . Example : 1.0.0 & lt ; 2.0.0 & lt ; 2.1.0 & lt ;
* 2.1.1 . When major , minor , and patch are equal , a pre - release version has lower
* precedence than a normal version . Example : 1.0.0 - alpha & lt ; 1.0.0 . Precedence for
* two pre - release versions with the same major , minor , and patch version MUST be
* determined by comparing each dot separated identifier from left to right until a
* difference is found as follows : identifiers consisting of only digits are compared
* numerically and identifiers with letters or hyphens are compared lexically in ASCII
* sort order . Numeric identifiers always have lower precedence than non - numeric
* identifiers . A larger set of pre - release fields has a higher precedence than a
* smaller set , if all of the preceding identifiers are equal . Example : 1.0.0 - alpha
* & lt ; 1.0.0 - alpha . 1 & lt ; 1.0.0 - alpha . beta & lt ; 1.0.0 - beta & lt ; 1.0.0 - beta . 2 & lt ;
* 1.0.0 - beta . 11 & lt ; 1.0.0 - rc . 1 & lt ; 1.0.0 . < / em >
* This method fulfills the general contract for Java ' s { @ link Comparator Comparators }
* and { @ link Comparable Comparables } .
* @ param v1 The first version for comparison .
* @ param v2 The second version for comparison .
* @ return A value below 0 iff { @ code v1 & lt ; v2 } , a value above 0 iff
* { @ code v1 & gt ; v2 < / tt > and 0 iff < tt > v1 = v2 } .
* @ throws NullPointerException If either parameter is null .
* @ since 0.2.0 */
public static int compare ( VersionRegEx v1 , VersionRegEx v2 ) { } } | // throw NPE to comply with Comparable specification
if ( v1 == null ) { throw new NullPointerException ( "v1 is null" ) ; } else if ( v2 == null ) { throw new NullPointerException ( "v2 is null" ) ; } return compare ( v1 , v2 , false ) ; |
public class OptimizeParameters { /** * Eliminates the parameter from a function call .
* @ param definitionFinder The definition and use sites index .
* @ param p
* @ param call The function call node
* @ param argIndex The index of the argument to remove . */
private void eliminateCallTargetArgAt ( Node ref , int argIndex ) { } } | Node callArgNode = ReferenceMap . getArgumentForCallOrNewOrDotCall ( ref , argIndex ) ; if ( callArgNode != null ) { NodeUtil . deleteNode ( callArgNode , compiler ) ; } |
public class BaseSparseNDArrayCOO { /** * Count the number of value that are included in the ndarray ( view ) according to the sparse offsets and the shape
* @ return nnz */
public long countNNZ ( ) { } } | long count = 0 ; for ( int i = 0 ; i < values . length ( ) ; i ++ ) { int [ ] idx = getUnderlyingIndicesOf ( i ) . asInt ( ) ; boolean isIn = true ; int idxNotFixed = 0 ; for ( int dim = 0 ; dim < idx . length ; dim ++ ) { if ( flags ( ) [ dim ] == 1 ) { if ( sparseOffsets ( ) [ dim ] != idx [ dim ] ) { isIn = false ; break ; } } else { int lowerBound = sparseOffsets ( ) [ dim ] ; long upperBound = sparseOffsets ( ) [ dim ] + shape ( ) [ idxNotFixed ] ; if ( ! ( idx [ dim ] >= lowerBound && idx [ dim ] < upperBound ) ) { isIn = false ; break ; } idxNotFixed ++ ; } } count = isIn ? count + 1 : count ; } return count ; |
public class X509CertificateListFromDirectoryFactoryBean { /** * { @ inheritDoc } */
@ Override protected List < X509Certificate > createInstance ( ) throws Exception { } } | if ( this . directory == null ) { logger . info ( "Directory {} does not exist - returning empty list" ) ; return Collections . emptyList ( ) ; } Resource [ ] resources = ResourcePatternUtils . getResourcePatternResolver ( resourceLoader ) . getResources ( "file:" + this . directory . getAbsolutePath ( ) + "/*" ) ; List < X509Certificate > list = new ArrayList < > ( ) ; for ( Resource resource : resources ) { if ( resource . getFile ( ) . isDirectory ( ) ) { continue ; } try { X509Certificate cert = X509CertificateUtils . decodeCertificate ( resource . getFile ( ) ) ; list . add ( cert ) ; } catch ( Exception e ) { logger . info ( "While scanning directory {} for certificates - failed to decode file '{}' - {}" , this . directory , resource . getFilename ( ) , e . getMessage ( ) ) ; } } return list ; |
public class TopicPattern { /** * Parse a string topic pattern into a TopicPattern object
* @ param pattern the string pattern to be parsed
* @ return an object representing the result , as follows .
* < ul >
* < li > the pattern as a string if the pattern contains no wildcards
* and hence is better treated as an equality test .
* < li > the pattern as a TopicPattern object otherwise .
* < / ul >
* < p > Unlike Pattern . parsePattern , this parser does not detect syntax errors but
* does something " logical " with every pattern it is given . Topic strings and topic
* patterns should be validated by the Matching . validateTopic method first .
* < p > Unlike Pattern . parsePattern , this parser will not turn a single matchMany
* wildcard into a NOT NULL test . Such a transformation is invalid with topic patterns
* because a special test for the matchNothing character is always required . */
public static Object parsePattern ( String pattern ) { } } | // Unfortunately , this method shares a fair amount of logic with Topic . parsePattern
// but it is hard to figure out how to factor them .
char [ ] accum = new char [ pattern . length ( ) ] ; int finger = 0 ; List tokens = new ArrayList ( ) ; boolean trivial = true ; for ( int i = 0 ; i < pattern . length ( ) ; i ++ ) { char c = pattern . charAt ( i ) ; if ( c == '*' ) { finger = flush ( accum , finger , tokens ) ; tokens . add ( matchOne ) ; trivial = false ; } else if ( c == MatchSpace . SUBTOPIC_SEPARATOR_CHAR ) { // It ' s a normal character unless followed by another separator
// or a " . "
if ( i == pattern . length ( ) - 1 ) { accum [ finger ++ ] = c ; } else { // Check to see if we have a double slash
if ( pattern . charAt ( i + 1 ) == MatchSpace . SUBTOPIC_SEPARATOR_CHAR ) { // Double slash
finger = flush ( accum , finger , tokens ) ; tokens . add ( matchMany ) ; trivial = false ; // Skip the second slash
i ++ ; // If the next char is a ' . ' , then we skip that too
if ( pattern . charAt ( i + 1 ) == '.' ) { // Skip the dot
i ++ ; // Defect 307231 , handle the allowable " / / . / " case
if ( ( i + 1 ) < pattern . length ( ) && pattern . charAt ( i + 1 ) == MatchSpace . SUBTOPIC_SEPARATOR_CHAR ) { // Skip a subsequent slash
i ++ ; } } } // Check for special " / . " case which we jump over . Note that topic syntax
// checking will already have disallowed invalid expressions such as " a / . b "
// so if a " . " follows a slash then it must be the final character , or it
// must be followed by a separator .
else if ( pattern . charAt ( i + 1 ) == '.' ) { // skip the slash and the dot
i ++ ; } else { accum [ finger ++ ] = c ; } } } else accum [ finger ++ ] = c ; } if ( trivial ) return new String ( accum , 0 , finger ) ; flush ( accum , finger , tokens ) ; return new TopicPattern ( tokens . iterator ( ) ) ; |
public class TriggersInner { /** * Creates or updates a trigger .
* @ param deviceName Creates or updates a trigger
* @ param name The trigger name .
* @ param resourceGroupName The resource group name .
* @ param trigger The trigger .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < TriggerInner > createOrUpdateAsync ( String deviceName , String name , String resourceGroupName , TriggerInner trigger ) { } } | return createOrUpdateWithServiceResponseAsync ( deviceName , name , resourceGroupName , trigger ) . map ( new Func1 < ServiceResponse < TriggerInner > , TriggerInner > ( ) { @ Override public TriggerInner call ( ServiceResponse < TriggerInner > response ) { return response . body ( ) ; } } ) ; |
public class Regex { /** * Matches the start of text and returns the matched string
* @ param text
* @ return
* @ throws SyntaxErrorException */
public String lookingAt ( CharSequence text ) { } } | try { if ( text . length ( ) == 0 ) { if ( acceptEmpty ) { return "" ; } else { throw new SyntaxErrorException ( "empty string not accepted" ) ; } } InputReader reader = Input . getInstance ( text ) ; return lookingAt ( reader ) ; } catch ( IOException ex ) { throw new IllegalArgumentException ( "can't happen" ) ; } |
public class BinaryHeapPriorityQueue { /** * Searches for the object in the queue and returns it . May be useful if
* you can create a new object that is . equals ( ) to an object in the queue
* but is not actually identical , or if you want to modify an object that is
* in the queue .
* @ return null if the object is not in the queue , otherwise returns the
* object . */
public E getObject ( E key ) { } } | if ( ! contains ( key ) ) return null ; Entry < E > e = getEntry ( key ) ; return e . key ; |
public class ResourcePoolsBuilder { /** * Convenience method to add a { @ link org . ehcache . config . ResourceType . Core # HEAP heap } pool .
* @ param size the pool size
* @ param unit the pool size unit
* @ return a new builder with the added pool
* @ throws IllegalArgumentException if the set of resource pools already contains a heap resource */
public ResourcePoolsBuilder heap ( long size , ResourceUnit unit ) { } } | return with ( ResourceType . Core . HEAP , size , unit , false ) ; |
public class BlockPosUtils { /** * Gets an iterable iterating through all the { @ link BlockPos } intersecting the passed { @ link AxisAlignedBB } .
* @ param aabb the aabb
* @ return the all in box */
public static Iterable < BlockPos > getAllInBox ( AxisAlignedBB aabb ) { } } | return BlockPos . getAllInBox ( new BlockPos ( aabb . minX , aabb . minY , aabb . minZ ) , new BlockPos ( Math . ceil ( aabb . maxX ) - 1 , Math . ceil ( aabb . maxY ) - 1 , Math . ceil ( aabb . maxZ ) - 1 ) ) ; |
public class KeyManagementServiceClient { /** * Returns metadata for a given [ CryptoKeyVersion ] [ google . cloud . kms . v1 . CryptoKeyVersion ] .
* < p > Sample code :
* < pre > < code >
* try ( KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient . create ( ) ) {
* CryptoKeyVersionName name = CryptoKeyVersionName . of ( " [ PROJECT ] " , " [ LOCATION ] " , " [ KEY _ RING ] " , " [ CRYPTO _ KEY ] " , " [ CRYPTO _ KEY _ VERSION ] " ) ;
* CryptoKeyVersion response = keyManagementServiceClient . getCryptoKeyVersion ( name ) ;
* < / code > < / pre >
* @ param name The [ name ] [ google . cloud . kms . v1 . CryptoKeyVersion . name ] of the
* [ CryptoKeyVersion ] [ google . cloud . kms . v1 . CryptoKeyVersion ] to get .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final CryptoKeyVersion getCryptoKeyVersion ( CryptoKeyVersionName name ) { } } | GetCryptoKeyVersionRequest request = GetCryptoKeyVersionRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . build ( ) ; return getCryptoKeyVersion ( request ) ; |
public class Op { /** * Creates an < i > operation expression < / i > on the specified target object .
* @ param target the target object on which the expression will execute
* @ return an operator , ready for chaining */
public static < T > Level0ArrayOperator < BigDecimal [ ] , BigDecimal > onArray ( final BigDecimal [ ] target ) { } } | return onArrayOf ( Types . BIG_DECIMAL , target ) ; |
public class ProxyStatement { /** * { @ inheritDoc } */
@ Override public long executeLargeUpdate ( String sql , int [ ] columnIndexes ) throws SQLException { } } | connection . markCommitStateDirty ( ) ; return delegate . executeLargeUpdate ( sql , columnIndexes ) ; |
public class HyperDepParser { /** * Gets the edge marginals in the real semiring from an all - grandparents hypergraph and its marginals in scores . */
public static EdgeScores getEdgeMarginalsRealSemiring ( O2AllGraDpHypergraph graph , Scores sc ) { } } | Algebra s = graph . getAlgebra ( ) ; int nplus = graph . getNumTokens ( ) + 1 ; Hypernode [ ] [ ] [ ] [ ] c = graph . getChart ( ) ; EdgeScores marg = new EdgeScores ( graph . getNumTokens ( ) , 0.0 ) ; for ( int width = 1 ; width < nplus ; width ++ ) { for ( int i = 0 ; i < nplus - width ; i ++ ) { int j = i + width ; for ( int g = 0 ; g < nplus ; g ++ ) { if ( i <= g && g <= j && ! ( i == 0 && g == O2AllGraDpHypergraph . NIL ) ) { continue ; } if ( j > 0 ) { marg . incrScore ( i - 1 , j - 1 , s . toReal ( sc . marginal [ c [ i ] [ j ] [ g ] [ O2AllGraDpHypergraph . INCOMPLETE ] . getId ( ) ] ) ) ; } if ( i > 0 ) { marg . incrScore ( j - 1 , i - 1 , s . toReal ( sc . marginal [ c [ j ] [ i ] [ g ] [ O2AllGraDpHypergraph . INCOMPLETE ] . getId ( ) ] ) ) ; } } } } return marg ; |
public class AbstractAmazonSQSAsync { /** * Simplified method form for invoking the CreateQueue operation with an AsyncHandler .
* @ see # createQueueAsync ( CreateQueueRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < CreateQueueResult > createQueueAsync ( String queueName , com . amazonaws . handlers . AsyncHandler < CreateQueueRequest , CreateQueueResult > asyncHandler ) { } } | return createQueueAsync ( new CreateQueueRequest ( ) . withQueueName ( queueName ) , asyncHandler ) ; |
public class ContextSelectComboBox { /** * Reloads / refreshes the list of { @ link Context Contexts } from the { @ link Session } .
* @ param keepSelected whether the previously selected context is tried to be restored . If
* { @ code false } , defaults to no selection . */
public void reloadContexts ( boolean keepSelected ) { } } | Context selected = null ; if ( keepSelected ) selected = ( Context ) getSelectedItem ( ) ; List < Context > contexts = Model . getSingleton ( ) . getSession ( ) . getContexts ( ) ; Context [ ] contextsArray = contexts . toArray ( new Context [ contexts . size ( ) ] ) ; ComboBoxModel < Context > model = new DefaultComboBoxModel < > ( contextsArray ) ; // No matter what , set selected item , so it either defaults to ' nothing selected ' or
// restores the previously selected item
model . setSelectedItem ( selected ) ; this . setModel ( model ) ; |
public class CRMServiceImpl { private CustomerDetailsType getCustomerData ( LoginUserType login ) { } } | // TODO Auto - generated method stub
CustomerDetailsType customer = factory . createCustomerDetailsType ( ) ; // Defaults
customer . setId ( 0 ) ; customer . setGender ( "M" ) ; customer . setCity ( "Bonn" ) ; customer . setStreet ( "Straessensweg 10" ) ; customer . setZip ( "53113" ) ; customer . setEmail ( "info@talend.de" ) ; customer . setStatus ( CRMStatusType . NONE ) ; String user = login . getUsername ( ) ; if ( user != null ) { if ( user . contains ( "jdoe" ) ) { customer . setId ( 92301 ) ; customer . setStatus ( CRMStatusType . NORMAL ) ; customer . setName ( "John Doe" ) ; } else if ( user . contains ( "bbrindle" ) ) { customer . setId ( 50010 ) ; customer . setStatus ( CRMStatusType . GOLD ) ; customer . setName ( "Bernardo Brindle" ) ; } else if ( user . contains ( "rlambert" ) ) { customer . setId ( 41250 ) ; customer . setStatus ( CRMStatusType . PLATINUM ) ; customer . setName ( "Ricardo Lambert" ) ; } else if ( user . contains ( "aebert" ) ) { customer . setId ( 45229 ) ; customer . setStatus ( CRMStatusType . PLATINUM ) ; customer . setName ( "Andrea Ebert" ) ; customer . setGender ( "F" ) ; customer . setCity ( "Munich" ) ; customer . setStreet ( "Hohenlindnerstrasse 11b" ) ; customer . setZip ( "85622" ) ; customer . setEmail ( "info@talend.de" ) ; } customer . setUsername ( user ) ; } // Overwrite Email & Name
if ( ( login . getEmail ( ) != null ) && ( login . getEmail ( ) . length ( ) > 0 ) ) { customer . setEmail ( login . getEmail ( ) ) ; } if ( ( login . getName ( ) != null ) && ( login . getName ( ) . length ( ) > 0 ) ) { customer . setName ( login . getName ( ) ) ; } return customer ; |
public class SimonConsolePluginManager { /** * Register a plugin
* @ param plugin Plugin */
public void addPlugin ( SimonConsolePlugin plugin ) { } } | SimonConsolePlugin existingPlugin = getPluginById ( plugin . getId ( ) ) ; if ( existingPlugin != null ) { throw new IllegalArgumentException ( "Plugin " + plugin . getId ( ) + " already registered" ) ; } plugins . add ( plugin ) ; |
public class ControlsStateChangeDetailedMiner { /** * Writes the result as " A modifications - of - A B gains - of - B loss - of - B " , where A and B are gene
* symbols , and whitespace is tab . Modifications are comma separated .
* @ param matches pattern search result
* @ param out output stream */
public void writeResult ( Map < BioPAXElement , List < Match > > matches , OutputStream out ) throws IOException { } } | writeResultDetailed ( matches , out , 5 ) ; |
public class BaseCudaDataBuffer { /** * Set an individual element
* @ param index the index of the element
* @ param from the element to get data from */
@ Deprecated protected void set ( long index , long length , Pointer from , long inc ) { } } | long offset = getElementSize ( ) * index ; if ( offset >= length ( ) * getElementSize ( ) ) throw new IllegalArgumentException ( "Illegal offset " + offset + " with index of " + index + " and length " + length ( ) ) ; // TODO : fix this
throw new UnsupportedOperationException ( "Deprecated set() call" ) ; |
public class TransientObject { /** * Retrieve a specific element from this object .
* @ param clazz type of object to be retrieved . If type given does not match a classcast exception will be thrown .
* @ param key key of object to be retrieved .
* @ param deserialize specify of whether or not this object needs to be manually deserialized ( stored as a json string ) .
* @ return element of type specified corrosponding to the given key . */
public < O > O get ( Class < O > clazz , String key , boolean deserialize ) { } } | if ( deserialize ) return gson . fromJson ( get ( String . class , key ) , clazz ) ; else return get ( clazz , key ) ; |
public class FullMappingPropertiesBasedBundlesHandlerFactory { /** * Returns a bundle using the bundle name from a list of bundles
* @ param bundleName
* the bundle name
* @ param bundles
* the list of bundle
* @ return a bundle */
private JoinableResourceBundle getBundleFromName ( String bundleName , List < JoinableResourceBundle > bundles ) { } } | JoinableResourceBundle bundle = null ; List < String > names = new ArrayList < > ( ) ; names . add ( bundleName ) ; List < JoinableResourceBundle > result = getBundlesFromName ( names , bundles ) ; if ( ! result . isEmpty ( ) ) { bundle = result . get ( 0 ) ; } return bundle ; |
public class Search { /** * Checks whether a new best solution has been found and updates it accordingly ,
* given that the solution has already been evaluated and validated . The best
* solution is updated only if the presented solution is valid and
* < ul >
* < li > no best solution had been set before , or < / li >
* < li > the new solution has a better evaluation < / li >
* < / ul >
* If the new solution is invalid or has a worse evaluation than the current best
* solution , calling this method has no effect . Note that the best solution is
* < b > retained < / b > across subsequent runs of the same search .
* @ param newSolution newly presented solution
* @ param newSolutionEvaluation evaluation of given solution
* @ param newSolutionValidation validation of given solution
* @ return < code > true < / code > if the given solution is accepted as the new best solution */
protected boolean updateBestSolution ( SolutionType newSolution , Evaluation newSolutionEvaluation , Validation newSolutionValidation ) { } } | // check : valid solution
if ( newSolutionValidation . passed ( ) ) { // check : improvement or no best solution set
Double delta = null ; if ( bestSolution == null || ( delta = computeDelta ( newSolutionEvaluation , getBestSolutionEvaluation ( ) ) ) > 0 ) { // flag improvement
improvementDuringCurrentStep = true ; // store last improvement time
lastImprovementTime = System . currentTimeMillis ( ) ; // update minimum delta if applicable ( only if first delta or smaller than current minimum delta )
if ( delta != null && ( minDelta == JamesConstants . INVALID_DELTA || delta < minDelta ) ) { minDelta = delta ; } // update best solution ( create copy ! )
bestSolution = Solution . checkedCopy ( newSolution ) ; bestSolutionEvaluation = newSolutionEvaluation ; bestSolutionValidation = newSolutionValidation ; // fire callback
fireNewBestSolution ( bestSolution , bestSolutionEvaluation , bestSolutionValidation ) ; // found improvement
return true ; } else { // no improvement
return false ; } } else { // invalid solution
return false ; } |
public class UtilCache { /** * Sets the maximum number of elements in the cache . If 0 , there is no
* maximum .
* @ param maxSize
* The maximum number of elements in the cache */
public void setMaxSize ( long maxSize ) { } } | // if the new maxSize is < = 0 , clear keyLRUList
if ( maxSize <= 0 ) { keyLRUList . clear ( ) ; } else if ( maxSize > 0 && this . maxSize <= 0 ) { // if the new maxSize > 0 and the old is < = 0 , fill in LRU list -
// order will be meaningless for now
Iterator keys = cacheLineTable . keySet ( ) . iterator ( ) ; while ( keys . hasNext ( ) ) { keyLRUList . add ( keys . next ( ) ) ; } } // if the new maxSize is less than the current cache size , shrink the
// cache .
if ( maxSize > 0 && cacheLineTable . size ( ) > maxSize ) { while ( cacheLineTable . size ( ) > maxSize ) { Object lastKey = keyLRUList . getLast ( ) ; removeObject ( lastKey ) ; } } this . maxSize = maxSize ; |
public class ComputeExample { /** * Use an callable object to make an addresses . insert method call . */
private static void insertAddressUsingCallable ( AddressClient client , String newAddressName ) throws InterruptedException , ExecutionException { } } | // Begin samplegen code for insertAddress ( ) .
ProjectRegionName region = ProjectRegionName . of ( PROJECT_NAME , REGION ) ; Address address = Address . newBuilder ( ) . build ( ) ; InsertAddressHttpRequest request = InsertAddressHttpRequest . newBuilder ( ) . setRegion ( region . toString ( ) ) . setAddressResource ( address ) . build ( ) ; ApiFuture < Operation > future = client . insertAddressCallable ( ) . futureCall ( request ) ; // Do something
Operation response = future . get ( ) ; // End samplegen code for insertAddress ( ) .
System . out . format ( "Result of insert: %s\n" , response . toString ( ) ) ; |
public class SVD { /** * Returns U , S , V < sup > T < / sup > matrices for the SVD of the matrix file in
* { @ link Format # MATLAB _ SPARSE Matlab sparse } format using the specified SVD
* algorithm to generate the specified number of singular values .
* Use a { @ link MatrixFactorization } implementation instead .
* @ param matrix a file containing a matrix
* @ param dimensions the number of singular values to calculate
* @ return an array of { @ code Matrix } objects for the U , S , and
* V < sup > T < / sup > matrices in that order
* @ throws UnsupportedOperationException if no SVD algorithm is available */
@ Deprecated public static Matrix [ ] svd ( File matrix , int dimensions ) { } } | return svd ( matrix , Algorithm . ANY , Format . MATLAB_SPARSE , dimensions ) ; |
public class RegularPactTask { protected void initialize ( ) throws Exception { } } | // create the operator
try { this . driver . setup ( this ) ; } catch ( Throwable t ) { throw new Exception ( "The driver setup for '" + this . getEnvironment ( ) . getTaskName ( ) + "' , caused an error: " + t . getMessage ( ) , t ) ; } this . runtimeUdfContext = createRuntimeContext ( getEnvironment ( ) . getTaskName ( ) ) ; // instantiate the UDF
try { final Class < ? super S > userCodeFunctionType = this . driver . getStubType ( ) ; // if the class is null , the driver has no user code
if ( userCodeFunctionType != null ) { this . stub = initStub ( userCodeFunctionType ) ; } } catch ( Exception e ) { throw new RuntimeException ( "Initializing the UDF" + e . getMessage ( ) == null ? "." : ": " + e . getMessage ( ) , e ) ; } |
public class JsonConverter { /** * Converts JSON string into map object or returns default value when conversion
* is not possible .
* @ param value the JSON string to convert .
* @ param defaultValue the default value .
* @ return Map object value or default when conversion is not supported .
* @ see JsonConverter # toNullableMap ( String ) */
public static Map < String , Object > toMapWithDefault ( String value , Map < String , Object > defaultValue ) { } } | Map < String , Object > result = toNullableMap ( value ) ; return result != null ? result : defaultValue ; |
public class BooleanCliParam { /** * Construct a CLI boolean parameter from a { @ link BooleanParamDef } .
* @ param def BooleanParamDef to construct a CLI boolean parameter from .
* @ return A CLI boolean parameter constructed from the BooleanParamDef . */
public static BooleanCliParam fromDef ( BooleanParamDef def ) { } } | return new BooleanCliParam ( def . getIdentifier ( ) , def . getDefaultValueSupplier ( ) , def . isNullable ( ) ) ; |
public class MCAAuthorizationManager { /** * Clear the local stored authorization data */
public void clearAuthorizationData ( ) { } } | preferences . accessToken . clear ( ) ; preferences . idToken . clear ( ) ; preferences . userIdentity . clear ( ) ; if ( BMSClient . getInstance ( ) != null && BMSClient . getInstance ( ) . getCookieManager ( ) != null ) { CookieStore cookieStore = BMSClient . getInstance ( ) . getCookieManager ( ) . getCookieStore ( ) ; if ( cookieStore != null ) { for ( URI uri : cookieStore . getURIs ( ) ) { for ( HttpCookie cookie : cookieStore . get ( uri ) ) { if ( cookie . getName ( ) . equals ( TAI_COOKIE_NAME ) ) { cookieStore . remove ( uri , cookie ) ; } } } } } |
public class AbstractRouter { /** * Returns the last error message set by Nalu or application .
* In case a error message is set by Nalu and by the application ,
* this method will return the error message set by Nalu .
* Once the error message is consumed , it should be reseted by the developer .
* ( after displayed on the error site ! )
* @ return the last set error message set by thel application
* or null , if there is none */
public NaluErrorMessage getErrorMessageByPriority ( ) { } } | if ( ! Objects . isNull ( this . naluErrorMessage ) ) { return this . naluErrorMessage ; } else if ( ! Objects . isNull ( this . applicationErrorMessage ) ) { return this . applicationErrorMessage ; } else { return null ; } |
public class PluginLoader { /** * Returns in iterator over all available implementations of the given service interface ( SPI ) for the plugin .
* @ param service the service interface ( SPI ) for which implementations are requested .
* @ param < P > Type of the requested plugin service .
* @ return An iterator of all implementations of the given service interface that could be loaded from the plugin . */
public < P extends Plugin > Iterator < P > load ( Class < P > service ) { } } | try ( TemporaryClassLoaderContext classLoaderContext = new TemporaryClassLoaderContext ( pluginClassLoader ) ) { return new ContextClassLoaderSettingIterator < > ( ServiceLoader . load ( service , pluginClassLoader ) . iterator ( ) , pluginClassLoader ) ; } |
public class ParameterUtil { /** * Init parameter values map with all the values
* @ param param parameter
* @ param values all parameter values
* @ param parameterValues map of parameter values
* @ throws QueryException if could not get parameter values */
public static void initAllRuntimeParameterValues ( QueryParameter param , List < IdName > values , Map < String , Object > parameterValues ) throws QueryException { } } | if ( param . getSelection ( ) . equals ( QueryParameter . SINGLE_SELECTION ) ) { parameterValues . put ( param . getName ( ) , values . get ( 0 ) ) ; } else { Object [ ] val = new Object [ values . size ( ) ] ; for ( int k = 0 , size = values . size ( ) ; k < size ; k ++ ) { val [ k ] = values . get ( k ) ; } parameterValues . put ( param . getName ( ) , val ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.