signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class TemporalTextField { /** * Returns the default converter if created without pattern ; otherwise it returns a * pattern - specific converter . * @ param type * The type for which the convertor should work * @ return A pattern - specific converter * @ see org . apache . wicket . markup . html . form . TextField */ @ SuppressWarnings ( "unchecked" ) @ Override public < C > IConverter < C > getConverter ( final Class < C > type ) { } }
if ( Temporal . class . isAssignableFrom ( type ) ) { return ( IConverter < C > ) converter ; } else { return super . getConverter ( type ) ; }
public class DrpcTridentEmitter { /** * トランザクションが成功した際に呼び出される処理 * @ param tx トランザクション管理情報 * @ param requestInfo DRPCリクエスト情報 */ protected void ack ( TransactionAttempt tx , DrpcRequestInfo requestInfo ) { } }
if ( logger . isDebugEnabled ( ) == true ) { String logFormat = "Transaction succeeded. TransactionAttempt={0}, DrpcRequestInfo={1}" ; logger . debug ( MessageFormat . format ( logFormat , tx , requestInfo ) ) ; } try { this . fetchHelper . ack ( requestInfo . getRequestId ( ) , "Succeeded" ) ; } catch ( TException ex ) { String logFormat = "Success notify failed. TransactionAttempt={0}, DrpcRequestInfo={1}" ; logger . warn ( MessageFormat . format ( logFormat , tx , requestInfo ) ) ; }
public class Validation { /** * method to get for one MonomerNotation all valid contained monomers . But * only the Base * @ param not * MonomerNotation * @ return List of all base monomers * @ throws HELM2HandledException * if HELM2 features were there * @ throws MonomerException * if monomer is not valid * @ throws NotationException * if notation is not valid * @ throws ChemistryException * if the Chemistry Engine can not be initialized * @ throws CTKException * general ChemToolKit exception passed to HELMToolKit * @ throws MonomerLoadingException * if monomers can not be loaded */ public static List < Monomer > getAllMonomersOnlyBase ( MonomerNotation not ) throws HELM2HandledException , MonomerException , NotationException , ChemistryException , CTKException , MonomerLoadingException { } }
LOG . debug ( "Get base for " + not ) ; List < Monomer > monomers = new ArrayList < Monomer > ( ) ; MonomerFactory monomerFactory = MonomerFactory . getInstance ( ) ; MonomerStore monomerStore = monomerFactory . getMonomerStore ( ) ; LOG . debug ( "Which MonomerNotationType " + not . getClass ( ) ) ; if ( not instanceof MonomerNotationUnitRNA ) { LOG . debug ( "MonomerNotationUnitRNA" ) ; monomers . addAll ( getMonomersRNAOnlyBase ( ( MonomerNotationUnitRNA ) not , monomerStore ) ) ; } else if ( not instanceof MonomerNotationUnit ) { String id = not . getUnit ( ) ; if ( id . startsWith ( "[" ) && id . endsWith ( "]" ) ) { id = id . substring ( 1 , id . length ( ) - 1 ) ; } monomers . add ( MethodsMonomerUtils . getMonomer ( not . getType ( ) , id , "" ) ) ; } else if ( not instanceof MonomerNotationGroup ) { LOG . debug ( "MonomerNotationGroup" ) ; for ( MonomerNotationGroupElement groupElement : ( ( MonomerNotationGroup ) not ) . getListOfElements ( ) ) { String id = groupElement . getMonomerNotation ( ) . getUnit ( ) ; if ( id . startsWith ( "[" ) && id . endsWith ( "]" ) ) { id = id . substring ( 1 , id . length ( ) - 1 ) ; } monomers . add ( MethodsMonomerUtils . getMonomer ( not . getType ( ) , id , "" ) ) ; } } else if ( not instanceof MonomerNotationList ) { LOG . debug ( "MonomerNotationList" ) ; for ( MonomerNotation listElement : ( ( MonomerNotationList ) not ) . getListofMonomerUnits ( ) ) { if ( listElement instanceof MonomerNotationUnitRNA ) { monomers . addAll ( getMonomersRNAOnlyBase ( ( ( MonomerNotationUnitRNA ) listElement ) , monomerStore ) ) ; } else { String id = listElement . getUnit ( ) ; if ( id . startsWith ( "[" ) && id . endsWith ( "]" ) ) { id = id . substring ( 1 , id . length ( ) - 1 ) ; } monomers . add ( MethodsMonomerUtils . getMonomer ( not . getType ( ) , id , "" ) ) ; } } } return monomers ;
public class ReservoirLongsSketch { /** * Useful during union operations to avoid copying the items array around if only updating a few * points . * @ param pos The position from which to retrieve the element * @ return The value in the reservoir at position < tt > pos < / tt > */ long getValueAtPosition ( final int pos ) { } }
if ( itemsSeen_ == 0 ) { throw new SketchesArgumentException ( "Requested element from empty reservoir." ) ; } else if ( ( pos < 0 ) || ( pos >= getNumSamples ( ) ) ) { throw new SketchesArgumentException ( "Requested position must be between 0 and " + ( getNumSamples ( ) - 1 ) + ", inclusive. Received: " + pos ) ; } return data_ [ pos ] ;
public class LinearSolverQrHouse_ZDRM { /** * Solves for X using the QR decomposition . * @ param B A matrix that is n by m . Not modified . * @ param X An n by m matrix where the solution is writen to . Modified . */ @ Override public void solve ( ZMatrixRMaj B , ZMatrixRMaj X ) { } }
if ( X . numRows != numCols ) throw new IllegalArgumentException ( "Unexpected dimensions for X" ) ; else if ( B . numRows != numRows || B . numCols != X . numCols ) throw new IllegalArgumentException ( "Unexpected dimensions for B" ) ; int BnumCols = B . numCols ; // solve each column one by one for ( int colB = 0 ; colB < BnumCols ; colB ++ ) { // make a copy of this column in the vector for ( int i = 0 ; i < numRows ; i ++ ) { int indexB = ( i * BnumCols + colB ) * 2 ; a [ i * 2 ] = B . data [ indexB ] ; a [ i * 2 + 1 ] = B . data [ indexB + 1 ] ; } // Solve Qa = b // a = Q ' b // a = Q _ { n - 1 } . . . Q _ 2 * Q _ 1 * b // Q _ n * b = ( I - gamma * u * u ^ H ) * b = b - u * ( gamma * U ^ H * b ) for ( int n = 0 ; n < numCols ; n ++ ) { u [ n * 2 ] = 1 ; u [ n * 2 + 1 ] = 0 ; double realUb = a [ 2 * n ] ; double imagUb = a [ 2 * n + 1 ] ; // U ^ H * b for ( int i = n + 1 ; i < numRows ; i ++ ) { int indexQR = ( i * QR . numCols + n ) * 2 ; double realU = u [ i * 2 ] = QR . data [ indexQR ] ; double imagU = u [ i * 2 + 1 ] = QR . data [ indexQR + 1 ] ; double realB = a [ i * 2 ] ; double imagB = a [ i * 2 + 1 ] ; realUb += realU * realB + imagU * imagB ; imagUb += realU * imagB - imagU * realB ; } // gamma * U ^ H * b realUb *= gammas [ n ] ; imagUb *= gammas [ n ] ; for ( int i = n ; i < numRows ; i ++ ) { double realU = u [ i * 2 ] ; double imagU = u [ i * 2 + 1 ] ; a [ i * 2 ] -= realU * realUb - imagU * imagUb ; a [ i * 2 + 1 ] -= realU * imagUb + imagU * realUb ; } } // solve for Rx = b using the standard upper triangular solver TriangularSolver_ZDRM . solveU ( QR . data , a , numCols ) ; // save the results for ( int i = 0 ; i < numCols ; i ++ ) { int indexX = ( i * X . numCols + colB ) * 2 ; X . data [ indexX ] = a [ i * 2 ] ; X . data [ indexX + 1 ] = a [ i * 2 + 1 ] ; } }
public class AbstractVarMeta { /** * { @ inheritDoc } */ @ Override public Set < Integer > getTypes ( Integer id ) { } }
Set < Integer > result ; Map < Integer , Integer > map = m_table . get ( id ) ; if ( map != null ) { result = map . keySet ( ) ; } else { result = new HashSet < Integer > ( ) ; } return ( result ) ;
public class GasteigerPEPEPartialCharges { /** * get the possible structures after hyperconjugation interactions for bonds which * do not belong to any resonance structure . * @ param ac IAtomContainer * @ return IAtomContainerSet * @ throws CDKException * @ throws ClassNotFoundException * @ throws IOException */ private IAtomContainerSet getHyperconjugationInteractions ( IAtomContainer ac , IAtomContainerSet iSet ) throws IOException , ClassNotFoundException , CDKException { } }
IAtomContainerSet set = ac . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; IReactionProcess type = new HeterolyticCleavageSBReaction ( ) ; cleanFlagReactiveCenter ( ac ) ; boolean found = false ; /* control obtained containers */ IAtomContainerSet setOfReactants = ac . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; /* search of reactive center . */ out : for ( int i = 0 ; i < ac . getBondCount ( ) ; i ++ ) { if ( ac . getBond ( i ) . getOrder ( ) != IBond . Order . SINGLE ) { for ( int j = 0 ; j < iSet . getAtomContainerCount ( ) ; j ++ ) { IAtomContainer ati = iSet . getAtomContainer ( j ) ; if ( ! ati . equals ( ac ) ) for ( int k = 0 ; k < ati . getBondCount ( ) ; k ++ ) { IAtom a0 = ati . getBond ( k ) . getBegin ( ) ; IAtom a1 = ati . getBond ( k ) . getEnd ( ) ; if ( ! a0 . getSymbol ( ) . equals ( "H" ) || ! a1 . getSymbol ( ) . equals ( "H" ) ) if ( ( a0 . getID ( ) . equals ( ac . getBond ( i ) . getBegin ( ) . getID ( ) ) && a1 . getID ( ) . equals ( ac . getBond ( i ) . getEnd ( ) . getID ( ) ) ) || ( a1 . getID ( ) . equals ( ac . getBond ( i ) . getBegin ( ) . getID ( ) ) && a0 . getID ( ) . equals ( ac . getBond ( i ) . getEnd ( ) . getID ( ) ) ) ) { if ( a0 . getFormalCharge ( ) != 0 || a1 . getFormalCharge ( ) != 0 ) continue out ; } } } ac . getBond ( i ) . getBegin ( ) . setFlag ( CDKConstants . REACTIVE_CENTER , true ) ; ac . getBond ( i ) . getEnd ( ) . setFlag ( CDKConstants . REACTIVE_CENTER , true ) ; ac . getBond ( i ) . setFlag ( CDKConstants . REACTIVE_CENTER , true ) ; found = true ; } } if ( ! found ) return null ; setOfReactants . addAtomContainer ( ac ) ; List < IParameterReact > paramList = new ArrayList < IParameterReact > ( ) ; IParameterReact param = new SetReactionCenter ( ) ; param . setParameter ( Boolean . TRUE ) ; paramList . add ( param ) ; type . setParameterList ( paramList ) ; IReactionSet setOfReactions = type . initiate ( setOfReactants , null ) ; for ( int i = 0 ; i < setOfReactions . getReactionCount ( ) ; i ++ ) { type = new HyperconjugationReaction ( ) ; IAtomContainerSet setOfM2 = ac . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; IAtomContainer mol = setOfReactions . getReaction ( i ) . getProducts ( ) . getAtomContainer ( 0 ) ; for ( int k = 0 ; k < mol . getBondCount ( ) ; k ++ ) { mol . getBond ( k ) . setFlag ( CDKConstants . REACTIVE_CENTER , false ) ; mol . getBond ( k ) . getBegin ( ) . setFlag ( CDKConstants . REACTIVE_CENTER , false ) ; mol . getBond ( k ) . getEnd ( ) . setFlag ( CDKConstants . REACTIVE_CENTER , false ) ; } setOfM2 . addAtomContainer ( mol ) ; List < IParameterReact > paramList2 = new ArrayList < IParameterReact > ( ) ; IParameterReact param2 = new SetReactionCenter ( ) ; param2 . setParameter ( Boolean . FALSE ) ; paramList2 . add ( param ) ; type . setParameterList ( paramList2 ) ; IReactionSet setOfReactions2 = type . initiate ( setOfM2 , null ) ; if ( setOfReactions2 . getReactionCount ( ) > 0 ) { IAtomContainer react = setOfReactions2 . getReaction ( 0 ) . getReactants ( ) . getAtomContainer ( 0 ) ; set . addAtomContainer ( react ) ; } } return set ;
public class hqlParser { /** * hql . g : 719:1 : identifier : IDENT ; */ public final hqlParser . identifier_return identifier ( ) throws RecognitionException { } }
hqlParser . identifier_return retval = new hqlParser . identifier_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; Token IDENT305 = null ; CommonTree IDENT305_tree = null ; try { // hql . g : 720:2 : ( IDENT ) // hql . g : 720:4 : IDENT { root_0 = ( CommonTree ) adaptor . nil ( ) ; IDENT305 = ( Token ) match ( input , IDENT , FOLLOW_IDENT_in_identifier3634 ) ; IDENT305_tree = ( CommonTree ) adaptor . create ( IDENT305 ) ; adaptor . addChild ( root_0 , IDENT305_tree ) ; } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException ex ) { // retval . Tree = HandleIdentifierError ( input . LT ( 1 ) , ex ) ; retval . tree = HandleIdentifierError ( input . LT ( 1 ) , ex ) ; } finally { // do for sure before leaving } return retval ;
public class KdTreeSearch1Bbf { /** * Checks to see if the current node ' s point is the closet point found so far */ @ Override protected void checkBestDistance ( KdTree . Node node , P target ) { } }
double distanceSq = distance . distance ( ( P ) node . point , target ) ; if ( distanceSq <= bestDistanceSq ) { if ( bestNode == null || distanceSq < bestDistanceSq ) { bestDistanceSq = distanceSq ; bestNode = node ; } }
public class SimpleListViewControl { /** * { @ inheritDoc } */ @ Override public void setupValueChangedListeners ( ) { } }
super . setupValueChangedListeners ( ) ; field . itemsProperty ( ) . addListener ( ( observable , oldValue , newValue ) -> node . setItems ( field . getItems ( ) ) ) ; field . selectionProperty ( ) . addListener ( ( observable , oldValue , newValue ) -> { if ( preventUpdate ) { return ; } preventUpdate = true ; for ( int i = 0 ; i < field . getItems ( ) . size ( ) ; i ++ ) { if ( field . getSelection ( ) . contains ( field . getItems ( ) . get ( i ) ) ) { node . getSelectionModel ( ) . select ( i ) ; } else { node . getSelectionModel ( ) . clearSelection ( i ) ; } } preventUpdate = false ; } ) ; field . errorMessagesProperty ( ) . addListener ( ( observable , oldValue , newValue ) -> toggleTooltip ( node ) ) ; field . tooltipProperty ( ) . addListener ( ( observable , oldValue , newValue ) -> toggleTooltip ( node ) ) ; node . focusedProperty ( ) . addListener ( ( observable , oldValue , newValue ) -> toggleTooltip ( node ) ) ;
public class LogRepositoryManagerImpl { /** * Removes the oldest file from the repository . This method has logic to avoid removing currently active files * This method should be called with a lock on filelist already attained * @ return instance representing the deleted file or < code > null < / code > if * fileList was reinitinialized . */ private FileDetails purgeOldestFile ( ) { } }
debugListLL ( "prepurgeOldestFile" ) ; debugListHM ( "prepurgeOldestFile" ) ; FileDetails returnFD = getOldestInactive ( ) ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "oldestInactive: " + ( ( returnFD == null ) ? "None" : returnFD . file . getPath ( ) ) ) ; } if ( returnFD == null ) return null ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "fileList size before remove: " + fileList . size ( ) ) ; } if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "fileList size after remove: " + fileList . size ( ) ) ; } if ( AccessHelper . deleteFile ( returnFD . file ) ) { fileList . remove ( returnFD ) ; totalSize -= returnFD . size ; if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "delete: " + returnFD . file . getName ( ) ) ; } decrementFileCount ( returnFD . file ) ; notifyOfFileAction ( LogEventListener . EVENTTYPEDELETE ) ; // F004324 } else { // Assume the list is out of sync . if ( debugLogger . isLoggable ( Level . FINE ) && LogRepositoryBaseImpl . isDebugEnabled ( ) ) { debugLogger . logp ( Level . FINE , thisClass , "purgeOldestFile" , "Failed to delete file: " + returnFD . file . getPath ( ) ) ; } initFileList ( true ) ; returnFD = null ; } debugListLL ( "postpurgeOldestFile" ) ; return returnFD ;
public class CmsUnlinkDialog { /** * Called when the OK button is clicked . < p > */ protected void onClickOk ( ) { } }
CmsResource res1 = m_context . getResources ( ) . get ( 0 ) ; CmsResource res2 = m_otherResource ; try { CmsObject cms = A_CmsUI . getCmsObject ( ) ; CmsLocaleGroupService groupService = cms . getLocaleGroupService ( ) ; groupService . detachLocaleGroup ( res1 , res2 ) ; m_context . finish ( Arrays . asList ( m_context . getResources ( ) . get ( 0 ) . getStructureId ( ) ) ) ; } catch ( Exception e ) { LOG . error ( e . getLocalizedMessage ( ) ) ; m_context . error ( e ) ; }
public class Log { /** * / * FATAL */ public static void fatal ( String msg ) { } }
log ( null , LEVEL_FATAL , msg , null , null , null , null , null , null , null , null , null , null , null , null , null , null , 0 ) ;
public class StatefulBeanO { /** * Completes the removal of the bean after a Remove method has been called . */ protected void completeRemoveMethod ( ContainerTx tx ) // d647928 throws RemoteException { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "completeRemoveMethod: " + this ) ; long pmiCookie = 0 ; if ( pmiBean != null ) { pmiCookie = pmiBean . initialTime ( EJBPMICollaborator . REMOVE_RT ) ; } EJBThreadData threadData = EJSContainer . getThreadData ( ) ; // A remove method ( @ Remove ) was called , and now that the method // ( and transaction ) have completed , remove the bean . 390657 threadData . pushContexts ( this ) ; try { remove ( ) ; } catch ( RemoveException rex ) { // This would be an internal EJB Container error , as RemoveException // should only be thrown if the bean is in a global tx , and since // this is afterCompletion , that cannot be true . However , since this // is on the throws clause , it must be handled . . . . just wrap it . throw ExceptionUtil . EJBException ( "Remove Failed" , rex ) ; } finally { if ( tx != null ) { tx . ivRemoveBeanO = null ; } threadData . popContexts ( ) ; if ( pmiBean != null ) { pmiBean . finalTime ( EJBPMICollaborator . REMOVE_RT , pmiCookie ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "completeRemoveMethod" ) ; }
public class FSSpecStore { /** * Recover { @ link Spec } ' s URI from a file path . * Note that there ' s no version awareness of this method , as Spec ' s version is currently not supported . * @ param fsPath The given file path to get URI from . * @ return The exact URI of a Spec . */ protected URI getURIFromPath ( Path fsPath , Path fsSpecStoreDirPath ) { } }
return PathUtils . relativizePath ( fsPath , fsSpecStoreDirPath ) . toUri ( ) ;
public class CollaboratorHelperImpl { /** * Returns a security collaborator for the currently active web application - can be called * while a request is being processed for the application . */ public static IWebAppSecurityCollaborator getCurrentSecurityCollaborator ( ) { } }
IWebAppSecurityCollaborator currentCollab = null ; ICollaboratorHelper instance = getCurrentInstance ( ) ; if ( instance != null ) currentCollab = instance . getSecurityCollaborator ( ) ; return currentCollab ;
public class AbstractGoogleClientRequest { /** * Sends the metadata request using HEAD to the server and returns the raw metadata * { @ link HttpResponse } for the response headers . * Only supported when the original request method is GET . The response content is assumed to be * empty and ignored . Calls { @ link HttpResponse # ignore ( ) } so there is no need to disconnect the * response . Example usage : * < pre > * HttpResponse response = request . executeUsingHead ( ) ; * look at response . getHeaders ( ) * < / pre > * Subclasses may override by calling the super implementation . * @ return the { @ link HttpResponse } */ protected HttpResponse executeUsingHead ( ) throws IOException { } }
Preconditions . checkArgument ( uploader == null ) ; HttpResponse response = executeUnparsed ( true ) ; response . ignore ( ) ; return response ;
public class ConnectionFactoryValidator { /** * Validate a connection factory that implements javax . resource . cci . ConnectionFactory . * @ param cf connection factory instance . * @ param cfSvc connection factory service . * @ param user user name , if any , that is specified in the header of the validation request . * @ param password password , if any , that is specified in the header of the validation request . * @ param result validation result to which this method appends info . * @ throws ResourceException if an error occurs . */ private void validateCCIConnectionFactory ( ConnectionFactory cf , ConnectionFactoryService cfSvc , String user , @ Sensitive String password , LinkedHashMap < String , Object > result ) throws ResourceException { } }
try { ResourceAdapterMetaData adapterData = cf . getMetaData ( ) ; result . put ( "resourceAdapterName" , adapterData . getAdapterName ( ) ) ; result . put ( "resourceAdapterVersion" , adapterData . getAdapterVersion ( ) ) ; String spec = adapterData . getSpecVersion ( ) ; if ( spec != null && spec . length ( ) > 0 ) result . put ( "resourceAdapterJCASupport" , spec ) ; String vendor = adapterData . getAdapterVendorName ( ) ; if ( vendor != null && vendor . length ( ) > 0 ) result . put ( "resourceAdapterVendor" , vendor ) ; String desc = adapterData . getAdapterShortDescription ( ) ; if ( desc != null && desc . length ( ) > 0 ) result . put ( "resourceAdapterDescription" , desc ) ; } catch ( NotSupportedException ignore ) { } catch ( UnsupportedOperationException ignore ) { } ConnectionSpec conSpec = null ; if ( user != null || password != null ) { String conFactoryClassName = cf . getClass ( ) . getName ( ) ; String conSpecClassName = conFactoryClassName . replace ( "ConnectionFactory" , "ConnectionSpec" ) ; if ( ! conFactoryClassName . equals ( conSpecClassName ) ) conSpec = createConnectionSpec ( cf , conSpecClassName , user , password ) ; if ( conSpec == null ) { // TODO find ConnectionSpec impl another way ? throw new RuntimeException ( "Unable to locate javax.resource.cci.ConnectionSpec impl from resource adapter." ) ; } } Connection con ; try { cfSvc . setValidating ( true ) ; // initializes a ThreadLocal that instructs the allocate operation to perform additional validation con = conSpec == null ? cf . getConnection ( ) : cf . getConnection ( conSpec ) ; } finally { cfSvc . setValidating ( false ) ; } try { try { ConnectionMetaData conData = con . getMetaData ( ) ; try { String prodName = conData . getEISProductName ( ) ; if ( prodName != null && prodName . length ( ) > 0 ) result . put ( "eisProductName" , prodName ) ; } catch ( NotSupportedException ignore ) { } catch ( UnsupportedOperationException ignore ) { } try { String prodVersion = conData . getEISProductVersion ( ) ; if ( prodVersion != null && prodVersion . length ( ) > 0 ) result . put ( "eisProductVersion" , prodVersion ) ; } catch ( NotSupportedException ignore ) { } catch ( UnsupportedOperationException ignore ) { } String userName = conData . getUserName ( ) ; if ( userName != null && userName . length ( ) > 0 ) result . put ( "user" , userName ) ; } catch ( NotSupportedException ignore ) { } catch ( UnsupportedOperationException ignore ) { } try { con . createInteraction ( ) . close ( ) ; } catch ( NotSupportedException ignore ) { } catch ( UnsupportedOperationException ignore ) { } } finally { con . close ( ) ; }
public class FileSystemCommandOptions { /** * < code > optional . alluxio . grpc . file . PersistCommandOptions persistOptions = 1 ; < / code > */ public alluxio . grpc . PersistCommandOptions getPersistOptions ( ) { } }
return persistOptions_ == null ? alluxio . grpc . PersistCommandOptions . getDefaultInstance ( ) : persistOptions_ ;
public class GsonJsonEngine { protected void setupYourCollectionSettings ( GsonBuilder builder ) { } }
final List < JsonYourCollectionResource > yourCollections = option . getYourCollections ( ) ; for ( JsonYourCollectionResource resource : yourCollections ) { builder . registerTypeAdapterFactory ( createYourCollectionTypeAdapterFactory ( resource ) ) ; }
public class UpdateableNvdCve { /** * Adds a new entry of updateable information to the contained collection . * @ param id the key for the item to be added * @ param url the URL to download the item * @ param timestamp the last modified date of the downloaded item * @ param needsUpdate whether or not the data needs to be updated */ public void add ( String id , String url , long timestamp , boolean needsUpdate ) { } }
final NvdCveInfo item = new NvdCveInfo ( ) ; item . setNeedsUpdate ( needsUpdate ) ; // the others default to true , to make life easier later this should default to false . item . setId ( id ) ; item . setUrl ( url ) ; item . setTimestamp ( timestamp ) ; collection . put ( id , item ) ;
public class ModifyIdentityIdFormatRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional * parameters to enable operation dry - run . */ @ Override public Request < ModifyIdentityIdFormatRequest > getDryRunRequest ( ) { } }
Request < ModifyIdentityIdFormatRequest > request = new ModifyIdentityIdFormatRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ;
public class XPathQueryBuilder { /** * Creates a function based on < code > node < / code > . * @ param node the function node from the xpath tree . * @ param queryNode the current query node . * @ return the function node */ private QueryNode createFunction ( SimpleNode node , QueryNode queryNode ) { } }
// find out function name String tmp = ( ( SimpleNode ) node . jjtGetChild ( 0 ) ) . getValue ( ) ; String fName = tmp . substring ( 0 , tmp . length ( ) - 1 ) ; try { InternalQName funName = resolver . parseJCRName ( fName ) . getInternalName ( ) ; if ( FN_NOT . equals ( funName ) || FN_NOT_10 . equals ( funName ) ) { if ( queryNode instanceof NAryQueryNode ) { QueryNode not = factory . createNotQueryNode ( queryNode ) ; ( ( NAryQueryNode ) queryNode ) . addOperand ( not ) ; // @ todo is this needed ? queryNode = not ; // traverse if ( node . jjtGetNumChildren ( ) == 2 ) { node . jjtGetChild ( 1 ) . jjtAccept ( this , queryNode ) ; } else { exceptions . add ( new InvalidQueryException ( "fn:not only supports one expression argument" ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for function fn:not" ) ) ; } } else if ( XS_DATETIME . equals ( funName ) ) { // check arguments if ( node . jjtGetNumChildren ( ) == 2 ) { if ( queryNode instanceof RelationQueryNode ) { RelationQueryNode rel = ( RelationQueryNode ) queryNode ; SimpleNode literal = ( SimpleNode ) node . jjtGetChild ( 1 ) . jjtGetChild ( 0 ) ; if ( literal . getId ( ) == JJTSTRINGLITERAL ) { String value = literal . getValue ( ) ; // strip quotes value = value . substring ( 1 , value . length ( ) - 1 ) ; Calendar c = ISO8601 . parse ( value ) ; if ( c == null ) { exceptions . add ( new InvalidQueryException ( "Unable to parse string literal for xs:dateTime: " + value ) ) ; } else { rel . setDateValue ( c . getTime ( ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Wrong argument type for xs:dateTime" ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for function xs:dateTime" ) ) ; } } else { // wrong number of arguments exceptions . add ( new InvalidQueryException ( "Wrong number of arguments for xs:dateTime" ) ) ; } } else if ( JCR_CONTAINS . equals ( funName ) ) { // check number of arguments if ( node . jjtGetNumChildren ( ) == 3 ) { if ( queryNode instanceof NAryQueryNode ) { SimpleNode literal = ( SimpleNode ) node . jjtGetChild ( 2 ) . jjtGetChild ( 0 ) ; if ( literal . getId ( ) == JJTSTRINGLITERAL ) { TextsearchQueryNode contains = factory . createTextsearchQueryNode ( queryNode , unescapeQuotes ( literal . getValue ( ) ) ) ; // assign property name SimpleNode path = ( SimpleNode ) node . jjtGetChild ( 1 ) ; path . jjtAccept ( this , contains ) ; ( ( NAryQueryNode ) queryNode ) . addOperand ( contains ) ; } else { exceptions . add ( new InvalidQueryException ( "Wrong argument type for jcr:contains" ) ) ; } } } else { // wrong number of arguments exceptions . add ( new InvalidQueryException ( "Wrong number of arguments for jcr:contains" ) ) ; } } else if ( JCR_LIKE . equals ( funName ) ) { // check number of arguments if ( node . jjtGetNumChildren ( ) == 3 ) { if ( queryNode instanceof NAryQueryNode ) { RelationQueryNode like = factory . createRelationQueryNode ( queryNode , RelationQueryNode . OPERATION_LIKE ) ; ( ( NAryQueryNode ) queryNode ) . addOperand ( like ) ; // assign property name node . jjtGetChild ( 1 ) . jjtAccept ( this , like ) ; // check property name if ( like . getRelativePath ( ) == null ) { exceptions . add ( new InvalidQueryException ( "Wrong first argument type for jcr:like" ) ) ; } SimpleNode literal = ( SimpleNode ) node . jjtGetChild ( 2 ) . jjtGetChild ( 0 ) ; if ( literal . getId ( ) == JJTSTRINGLITERAL ) { like . setStringValue ( unescapeQuotes ( literal . getValue ( ) ) ) ; } else { exceptions . add ( new InvalidQueryException ( "Wrong second argument type for jcr:like" ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for function jcr:like" ) ) ; } } else { // wrong number of arguments exceptions . add ( new InvalidQueryException ( "Wrong number of arguments for jcr:like" ) ) ; } } else if ( FN_TRUE . equals ( funName ) ) { if ( queryNode . getType ( ) == QueryNode . TYPE_RELATION ) { RelationQueryNode rel = ( RelationQueryNode ) queryNode ; rel . setStringValue ( "true" ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for true()" ) ) ; } } else if ( FN_FALSE . equals ( funName ) ) { if ( queryNode . getType ( ) == QueryNode . TYPE_RELATION ) { RelationQueryNode rel = ( RelationQueryNode ) queryNode ; rel . setStringValue ( "false" ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for false()" ) ) ; } } else if ( FN_POSITION . equals ( funName ) ) { if ( queryNode . getType ( ) == QueryNode . TYPE_RELATION ) { RelationQueryNode rel = ( RelationQueryNode ) queryNode ; if ( rel . getOperation ( ) == RelationQueryNode . OPERATION_EQ_GENERAL ) { // set dummy value to set type of relation query node // will be overwritten when the tree is furhter parsed . rel . setPositionValue ( 1 ) ; rel . addPathElement ( new QPathEntry ( FN_POSITION_FULL , 0 ) ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported expression with position(). Only = is supported." ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for position()" ) ) ; } } else if ( FN_FIRST . equals ( funName ) ) { if ( queryNode . getType ( ) == QueryNode . TYPE_RELATION ) { ( ( RelationQueryNode ) queryNode ) . setPositionValue ( 1 ) ; } else if ( queryNode . getType ( ) == QueryNode . TYPE_LOCATION ) { ( ( LocationStepQueryNode ) queryNode ) . setIndex ( 1 ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for first()" ) ) ; } } else if ( FN_LAST . equals ( funName ) ) { if ( queryNode . getType ( ) == QueryNode . TYPE_RELATION ) { ( ( RelationQueryNode ) queryNode ) . setPositionValue ( LocationStepQueryNode . LAST ) ; } else if ( queryNode . getType ( ) == QueryNode . TYPE_LOCATION ) { ( ( LocationStepQueryNode ) queryNode ) . setIndex ( LocationStepQueryNode . LAST ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for last()" ) ) ; } } else if ( JCR_DEREF . equals ( funName ) ) { // check number of arguments if ( node . jjtGetNumChildren ( ) == 3 ) { boolean descendant = false ; if ( queryNode . getType ( ) == QueryNode . TYPE_LOCATION ) { LocationStepQueryNode loc = ( LocationStepQueryNode ) queryNode ; // remember if descendant axis descendant = loc . getIncludeDescendants ( ) ; queryNode = loc . getParent ( ) ; ( ( NAryQueryNode ) queryNode ) . removeOperand ( loc ) ; } if ( queryNode . getType ( ) == QueryNode . TYPE_PATH ) { PathQueryNode pathNode = ( PathQueryNode ) queryNode ; DerefQueryNode derefNode = factory . createDerefQueryNode ( pathNode , null , false ) ; // assign property name node . jjtGetChild ( 1 ) . jjtAccept ( this , derefNode ) ; // check property name if ( derefNode . getRefProperty ( ) == null ) { exceptions . add ( new InvalidQueryException ( "Wrong first argument type for jcr:deref" ) ) ; } SimpleNode literal = ( SimpleNode ) node . jjtGetChild ( 2 ) . jjtGetChild ( 0 ) ; if ( literal . getId ( ) == JJTSTRINGLITERAL ) { String value = literal . getValue ( ) ; // strip quotes value = value . substring ( 1 , value . length ( ) - 1 ) ; if ( ! value . equals ( "*" ) ) { InternalQName name = null ; try { name = decode ( resolver . parseJCRName ( value ) . getInternalName ( ) ) ; } catch ( RepositoryException e ) { exceptions . add ( new InvalidQueryException ( "Illegal name: " + value ) ) ; } derefNode . setNameTest ( name ) ; } } else { exceptions . add ( new InvalidQueryException ( "Second argument for jcr:deref must be a String" ) ) ; } // check if descendant if ( ! descendant ) { Node p = node . jjtGetParent ( ) ; for ( int i = 0 ; i < p . jjtGetNumChildren ( ) ; i ++ ) { SimpleNode c = ( SimpleNode ) p . jjtGetChild ( i ) ; if ( c == node ) { // NOSONAR break ; } descendant = ( c . getId ( ) == JJTSLASHSLASH || c . getId ( ) == JJTROOTDESCENDANTS ) ; } } derefNode . setIncludeDescendants ( descendant ) ; pathNode . addPathStep ( derefNode ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for jcr:deref()" ) ) ; } } } else if ( JCR_SCORE . equals ( funName ) ) { if ( queryNode . getType ( ) == QueryNode . TYPE_ORDER ) { createOrderSpec ( node , ( OrderQueryNode ) queryNode ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for jcr:score()" ) ) ; } } else if ( FN_LOWER_CASE . equals ( funName ) ) { if ( node . jjtGetNumChildren ( ) == 2 ) { if ( queryNode . getType ( ) == QueryNode . TYPE_RELATION ) { RelationQueryNode relNode = ( RelationQueryNode ) queryNode ; relNode . addOperand ( factory . createPropertyFunctionQueryNode ( relNode , PropertyFunctionQueryNode . LOWER_CASE ) ) ; // get property name node . jjtGetChild ( 1 ) . jjtAccept ( this , relNode ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for fn:lower-case()" ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Wrong number of argument for fn:lower-case()" ) ) ; } } else if ( FN_UPPER_CASE . equals ( funName ) ) { if ( node . jjtGetNumChildren ( ) == 2 ) { if ( queryNode . getType ( ) == QueryNode . TYPE_RELATION ) { RelationQueryNode relNode = ( RelationQueryNode ) queryNode ; relNode . addOperand ( factory . createPropertyFunctionQueryNode ( relNode , PropertyFunctionQueryNode . UPPER_CASE ) ) ; // get property name node . jjtGetChild ( 1 ) . jjtAccept ( this , relNode ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for fn:upper-case()" ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for fn:upper-case()" ) ) ; } } else if ( REP_SIMILAR . equals ( funName ) ) { if ( node . jjtGetNumChildren ( ) == 3 ) { if ( queryNode instanceof NAryQueryNode ) { NAryQueryNode parent = ( NAryQueryNode ) queryNode ; RelationQueryNode rel = factory . createRelationQueryNode ( parent , RelationQueryNode . OPERATION_SIMILAR ) ; parent . addOperand ( rel ) ; // assign path node . jjtGetChild ( 1 ) . jjtAccept ( this , rel ) ; // get path string node . jjtGetChild ( 2 ) . jjtAccept ( this , rel ) ; // check if string is set if ( rel . getStringValue ( ) == null ) { exceptions . add ( new InvalidQueryException ( "Second argument for rep:similar() must be of type string" ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for rep:similar()" ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Wrong number of arguments for rep:similar()" ) ) ; } } else if ( REP_SPELLCHECK . equals ( funName ) && queryNode . getType ( ) != QueryNode . TYPE_PATH ) { if ( node . jjtGetNumChildren ( ) == 2 ) { if ( queryNode instanceof NAryQueryNode ) { NAryQueryNode parent = ( NAryQueryNode ) queryNode ; RelationQueryNode rel = factory . createRelationQueryNode ( parent , RelationQueryNode . OPERATION_SPELLCHECK ) ; parent . addOperand ( rel ) ; // get string to check node . jjtGetChild ( 1 ) . jjtAccept ( this , rel ) ; // check if string is set if ( rel . getStringValue ( ) == null ) { exceptions . add ( new InvalidQueryException ( "Argument for rep:spellcheck() must be of type string" ) ) ; } // set a dummy property name rel . addPathElement ( new QPathEntry ( Constants . JCR_PRIMARYTYPE , 0 ) ) ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported location for rep:spellcheck()" ) ) ; } } else { exceptions . add ( new InvalidQueryException ( "Wrong number of arguments for rep:spellcheck()" ) ) ; } } else if ( queryNode . getType ( ) == QueryNode . TYPE_RELATION ) { // use function name as name of a pseudo property in a relation try { InternalQName name = resolver . parseJCRName ( fName + "()" ) . getInternalName ( ) ; RelationQueryNode relNode = ( RelationQueryNode ) queryNode ; relNode . addPathElement ( new QPathEntry ( name , 0 ) ) ; } catch ( RepositoryException e ) { exceptions . add ( e ) ; } } else if ( queryNode . getType ( ) == QueryNode . TYPE_PATH ) { // use function name as name of a pseudo property in select clause try { InternalQName name = resolver . parseJCRName ( fName + "()" ) . getInternalName ( ) ; root . addSelectProperty ( name ) ; } catch ( RepositoryException e ) { exceptions . add ( e ) ; } } else { exceptions . add ( new InvalidQueryException ( "Unsupported function: " + fName ) ) ; } } catch ( NamespaceException e ) { exceptions . add ( e ) ; } catch ( RepositoryException e ) { exceptions . add ( e ) ; } return queryNode ;
public class CommitsApi { /** * Get a Stream of repository commits in a project . * < pre > < code > GitLab Endpoint : GET / projects / : id / repository / commits < / code > < / pre > * @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance * @ return a Stream containing the commits for the specified project ID * @ throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Stream < Commit > getCommitStream ( Object projectIdOrPath ) throws GitLabApiException { } }
return ( getCommits ( projectIdOrPath , null , null , null , getDefaultPerPage ( ) ) . stream ( ) ) ;
public class VirtualNetworkGatewaysInner { /** * Gets pre - generated VPN profile for P2S client of the virtual network gateway in the specified resource group . The profile needs to be generated first using generateVpnProfile . * @ param resourceGroupName The name of the resource group . * @ param virtualNetworkGatewayName The name of the virtual network gateway . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the String object */ public Observable < String > beginGetVpnProfilePackageUrlAsync ( String resourceGroupName , String virtualNetworkGatewayName ) { } }
return beginGetVpnProfilePackageUrlWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) . map ( new Func1 < ServiceResponse < String > , String > ( ) { @ Override public String call ( ServiceResponse < String > response ) { return response . body ( ) ; } } ) ;
public class DefaultInternalConfiguration { /** * { @ inheritDoc } */ @ Override public Properties getProperties ( final String key ) { } }
String [ ] keyValuePairs = getStringArray ( key ) ; Properties props = new Properties ( ) ; for ( String pair : keyValuePairs ) { int index = pair . indexOf ( '=' ) ; if ( index < 1 ) { throw new IllegalArgumentException ( "Malformed property: " + pair ) ; } props . put ( pair . substring ( 0 , index ) , pair . substring ( index + 1 , pair . length ( ) ) ) ; } return props ;
public class SourceWriteUtil { /** * Creates a field injecting method and returns a string that invokes the * written method . * @ param field field to be injected * @ param injecteeName variable that references the object into which values * are injected , in the context of the returned call string * @ param nameGenerator NameGenerator to be used for ensuring method name uniqueness * @ return string calling the generated method */ public SourceSnippet createFieldInjection ( final FieldLiteral < ? > field , final String injecteeName , NameGenerator nameGenerator , List < InjectorMethod > methodsOutput ) throws NoSourceNameException { } }
final boolean hasInjectee = injecteeName != null ; final boolean useNativeMethod = field . isPrivate ( ) || ReflectUtil . isPrivate ( field . getDeclaringType ( ) ) || field . isLegacyFinalField ( ) ; // Determine method signature parts . final String injecteeTypeName = ReflectUtil . getSourceName ( field . getRawDeclaringType ( ) ) ; String fieldTypeName = ReflectUtil . getSourceName ( field . getFieldType ( ) ) ; String methodBaseName = nameGenerator . convertToValidMemberName ( injecteeTypeName + "_" + field . getName ( ) + "_fieldInjection" ) ; final String methodName = nameGenerator . createMethodName ( methodBaseName ) ; // Field injections are performed in the package of the class declaring the // field . Any private types referenced by the injection must be visible // from there . final String packageName = ReflectUtil . getUserPackageName ( field . getDeclaringType ( ) ) ; String signatureParams = fieldTypeName + " value" ; boolean isLongAcccess = field . getFieldType ( ) . getRawType ( ) . equals ( Long . TYPE ) ; if ( hasInjectee ) { signatureParams = injecteeTypeName + " injectee, " + signatureParams ; } // Compose method implementation and invocation . String annotation ; if ( isLongAcccess ) { annotation = "@com.google.gwt.core.client.UnsafeNativeLong " ; } else { annotation = "" ; } String header = useNativeMethod ? "public native " : "public " ; String signature = annotation + header + "void " + methodName + "(" + signatureParams + ")" ; InjectorMethod injectionMethod = new AbstractInjectorMethod ( useNativeMethod , signature , packageName ) { public String getMethodBody ( InjectorWriteContext writeContext ) throws NoSourceNameException { if ( ! useNativeMethod ) { return ( hasInjectee ? "injectee." : injecteeTypeName + "." ) + field . getName ( ) + " = value;" ; } else { return ( hasInjectee ? "injectee." : "" ) + getJsniSignature ( field ) + " = value;" ; } } } ; methodsOutput . add ( injectionMethod ) ; return new SourceSnippet ( ) { public String getSource ( InjectorWriteContext writeContext ) { List < String > callParams = new ArrayList < String > ( ) ; if ( hasInjectee ) { callParams . add ( injecteeName ) ; } callParams . add ( writeContext . callGetter ( guiceUtil . getKey ( field ) ) ) ; return writeContext . callMethod ( methodName , packageName , callParams ) + ";\n" ; } } ;
public class CreateEventSubscriptionRequest { /** * A list of one or more identifiers of Amazon Redshift source objects . All of the objects must be of the same type * as was specified in the source type parameter . The event subscription will return only events generated by the * specified objects . If not specified , then events are returned for all objects within the source type specified . * Example : my - cluster - 1 , my - cluster - 2 * Example : my - snapshot - 20131010 * @ return A list of one or more identifiers of Amazon Redshift source objects . All of the objects must be of the * same type as was specified in the source type parameter . The event subscription will return only events * generated by the specified objects . If not specified , then events are returned for all objects within the * source type specified . < / p > * Example : my - cluster - 1 , my - cluster - 2 * Example : my - snapshot - 20131010 */ public java . util . List < String > getSourceIds ( ) { } }
if ( sourceIds == null ) { sourceIds = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return sourceIds ;
public class CDIContainerImpl { public String getCurrentApplicationContextID ( ) { } }
WebSphereCDIDeployment cdiDeployment = getCurrentDeployment ( ) ; if ( cdiDeployment == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getCurrentApplicationContextID returning null. cdiDeployment is null" ) ; } return null ; } String contextID = cdiDeployment . getDeploymentID ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "getCurrentApplicationContextID successfully found a application context ID of: " + contextID ) ; } return contextID ;
public class JSONNavi { /** * Set current value as Json Array You can also skip this call Arrays can be * create automatically . */ @ SuppressWarnings ( "unchecked" ) public JSONNavi < T > array ( ) { } }
if ( failure ) return this ; if ( current == null && readonly ) failure ( "Can not create Array child in readonly" , null ) ; if ( current != null ) { if ( isArray ( ) ) return this ; if ( isObject ( ) ) failure ( "can not use Object feature on Array." , null ) ; failure ( "Can not use current possition as Object" , null ) ; } else { current = mapper . createArray ( ) ; } if ( root == null ) root = ( T ) current ; else store ( ) ; return this ;
public class NetworkUtil { /** * Convert an inet address to an URI . * @ param adr address to convert to URI . * @ return the URI . */ public static URI toURI ( InetAddress adr ) { } }
try { return new URI ( "tcp" , adr . getHostAddress ( ) , null , null ) ; // $ NON - NLS - 1 $ } catch ( URISyntaxException e ) { throw new IOError ( e ) ; }
public class CollectedStatistics { /** * Get the nth percentile . NB : This is also a fairly slow operation . * @ param percentile Percentile to get . * @ return */ public double getPercentile ( double percentile ) { } }
Percentile p = new Percentile ( ) ; return p . evaluate ( m_times . m_values , 0 , m_times . size ( ) , percentile ) ;
public class WikiUser { /** * get input from standard in * @ param name * @ param br * - the buffered reader to read from * @ return the input returned * @ throws IOException */ public static String getInput ( String name , BufferedReader br ) throws IOException { } }
// prompt the user to enter the given name System . out . print ( "Please Enter " + name + ": " ) ; String value = br . readLine ( ) ; return value ;
public class ResourceVisit { /** * Perform the visit using the given { @ link ResourceVisitor } . All { @ link Resource } instances will be recursed , but * only resources matching the given { @ link ResourceFilter } will be visited . */ public void perform ( final ResourceVisitor visitor , final ResourceFilter filter ) { } }
perform ( root , visitor , acceptAll , filter ) ;
public class MultiUserChat { /** * Tries to change the affiliation with an ' muc # admin ' namespace * @ param jid * @ param affiliation * @ param reason the reason for the affiliation change ( optional ) * @ throws XMPPErrorException * @ throws NoResponseException * @ throws NotConnectedException * @ throws InterruptedException */ private void changeAffiliationByAdmin ( Jid jid , MUCAffiliation affiliation , String reason ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } }
MUCAdmin iq = new MUCAdmin ( ) ; iq . setTo ( room ) ; iq . setType ( IQ . Type . set ) ; // Set the new affiliation . MUCItem item = new MUCItem ( affiliation , jid , reason ) ; iq . addItem ( item ) ; connection . createStanzaCollectorAndSend ( iq ) . nextResultOrThrow ( ) ;
public class Encryption { /** * takes in a simple string and performs an sha1 hash * that is 128 bits long . . . we then base64 encode it * and return the char array * @ param key simple inputted string * @ return sha1 base64 encoded representation * @ throws UnsupportedEncodingException if the Builder charset name is not supported * @ throws NoSuchAlgorithmException if the Builder digest algorithm is not available * @ throws NullPointerException if the Builder digest algorithm is { @ code null } */ private char [ ] hashTheKey ( String key ) throws UnsupportedEncodingException , NoSuchAlgorithmException { } }
MessageDigest messageDigest = MessageDigest . getInstance ( mBuilder . getDigestAlgorithm ( ) ) ; messageDigest . update ( key . getBytes ( mBuilder . getCharsetName ( ) ) ) ; return Base64 . encodeToString ( messageDigest . digest ( ) , Base64 . NO_PADDING ) . toCharArray ( ) ;
public class JRLoggerFactory { /** * Return a logger named corresponding to the class passed as parameter , using the statically bound { @ link ILoggerFactory } instance . * @ param clazz the returned logger will be named after clazz * @ return the logger adapter */ public static JRLogger getLogger ( final Class < ? > clazz ) { } }
JRLogger logger = loggerMap . get ( clazz . getName ( ) ) ; if ( logger == null ) { JRLogger newInstance = null ; // Get the logger instance according to slf4j configuration final org . slf4j . Logger innerLogger = LoggerFactory . getLogger ( clazz ) ; if ( "ch.qos.logback.classic.Logger" . equals ( innerLogger . getClass ( ) . getName ( ) ) ) { newInstance = new LogbackAdapter ( ( ch . qos . logback . classic . Logger ) innerLogger ) ; } else { newInstance = new Slf4jAdapter ( innerLogger ) ; } final JRLogger oldInstance = loggerMap . putIfAbsent ( clazz . getName ( ) , newInstance ) ; logger = oldInstance == null ? newInstance : oldInstance ; } return logger ;
public class DefaultDirObjectFactory { /** * Construct a DirContextAdapter given the supplied paramters . The * < code > name < / code > is normally a JNDI < code > CompositeName < / code > , which * needs to be handled with particuclar care . Specifically the escaping of a * < code > CompositeName < / code > destroys proper escaping of Distinguished * Names . Also , the name might contain referral information , in which case * we need to separate the server information from the actual Distinguished * Name so that we can create a representing DirContextAdapter . * @ param attrs the attributes * @ param name the Name , typically a < code > CompositeName < / code > , possibly * including referral information . * @ param nameInNamespace the Name in namespace . * @ return a { @ link DirContextAdapter } representing the specified * information . */ DirContextAdapter constructAdapterFromName ( Attributes attrs , Name name , String nameInNamespace ) { } }
String nameString ; String referralUrl = "" ; if ( name instanceof CompositeName ) { // Which it most certainly will be , and therein lies the // problem . CompositeName . toString ( ) completely screws up the // formatting // in some cases , particularly when backslashes are involved . nameString = LdapUtils . convertCompositeNameToString ( ( CompositeName ) name ) ; } else { LOG . warn ( "Expecting a CompositeName as input to getObjectInstance but received a '" + name . getClass ( ) . toString ( ) + "' - using toString and proceeding with undefined results" ) ; nameString = name . toString ( ) ; } if ( nameString . startsWith ( LDAP_PROTOCOL_PREFIX ) || nameString . startsWith ( LDAPS_PROTOCOL_PREFIX ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Received name '" + nameString + "' contains protocol delimiter; indicating a referral." + "Stripping protocol and address info to enable construction of a proper LdapName" ) ; } try { URI url = new URI ( nameString ) ; String pathString = url . getPath ( ) ; referralUrl = nameString . substring ( 0 , nameString . length ( ) - pathString . length ( ) ) ; if ( StringUtils . hasLength ( pathString ) && pathString . startsWith ( "/" ) ) { // We don ' t want any slash in the beginning of the // Distinguished Name . pathString = pathString . substring ( 1 ) ; } nameString = pathString ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( "Supplied name starts with protocol prefix indicating a referral," + " but is not possible to parse to an URI" , e ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Resulting name after removal of referral information: '" + nameString + "'" ) ; } } DirContextAdapter dirContextAdapter = new DirContextAdapter ( attrs , LdapUtils . newLdapName ( nameString ) , LdapUtils . newLdapName ( nameInNamespace ) , referralUrl ) ; dirContextAdapter . setUpdateMode ( true ) ; return dirContextAdapter ;
public class HashExtensions { /** * Hashes the given { @ link byte [ ] } object with the given parameters . * @ param hashIt * the hash it * @ param salt * the salt * @ param hashAlgorithm * the hash algorithm * @ param charset * the charset * @ return the generated { @ link String } object * @ throws NoSuchAlgorithmException * is thrown if instantiation of the MessageDigest object fails . */ public static byte [ ] hash ( final byte [ ] hashIt , final String salt , final HashAlgorithm hashAlgorithm , final Charset charset ) throws NoSuchAlgorithmException { } }
final MessageDigest messageDigest = MessageDigest . getInstance ( hashAlgorithm . getAlgorithm ( ) ) ; messageDigest . reset ( ) ; if ( salt != null ) { messageDigest . update ( salt . getBytes ( charset ) ) ; } messageDigest . update ( hashIt ) ; byte [ ] digestBytes = messageDigest . digest ( ) ; return digestBytes ;
public class DataTablesInput { /** * Add an order on the given column * @ param columnName the name of the column * @ param ascending whether the sorting is ascending or descending */ public void addOrder ( String columnName , boolean ascending ) { } }
if ( columnName == null ) { return ; } for ( int i = 0 ; i < columns . size ( ) ; i ++ ) { if ( ! columnName . equals ( columns . get ( i ) . getData ( ) ) ) { continue ; } order . add ( new Order ( i , ascending ? "asc" : "desc" ) ) ; }
public class BoundedBuffer { /** * Removes an object from the buffer . If the buffer is * empty , then the call blocks until something becomes * available . * @ return Object the next object from the buffer . */ public Object take ( ) throws InterruptedException { } }
Object old = null ; // D312598 - begin while ( true ) { synchronized ( this ) { if ( numberOfUsedSlots . get ( ) > 0 ) { old = extract ( ) ; numberOfUsedSlots . getAndDecrement ( ) ; } if ( old != null ) { // PK77809 Decrement the number of waiting threads since we will be // returning a work item to a waiting thread to execute . waitingThreads -- ; } } if ( old != null ) { notifyPut_ ( ) ; return old ; } int spinctr = SPINS_TAKE_ ; while ( numberOfUsedSlots . get ( ) <= 0 ) { // busy wait if ( spinctr > 0 ) { if ( YIELD_TAKE_ ) Thread . yield ( ) ; spinctr -- ; } else { // block on lock // D638088 - Allow waitGet _ to determine timeout value by passing // negative value as parameter . waitGet_ ( - 1 ) ; } } } // D312598 - end
public class ExceptionCallbacks { /** * The callback will convert the occurred exception into an * { @ link AbortionException } and then throw it . This stops the delegation * process with delegating the exception to the dispatcher of the event . * @ return The callback . */ public static ExceptionCallback failOnError ( ) { } }
return new ExceptionCallback ( ) { @ Override public void exception ( FailedEventInvocation invocation ) { throw new AbortionException ( invocation . getException ( ) ) ; } } ;
public class ST_RemoveHoles { /** * Create a new multiPolygon without hole . * @ param multiPolygon * @ return */ public static MultiPolygon removeHolesMultiPolygon ( MultiPolygon multiPolygon ) { } }
int num = multiPolygon . getNumGeometries ( ) ; Polygon [ ] polygons = new Polygon [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { polygons [ i ] = removeHolesPolygon ( ( Polygon ) multiPolygon . getGeometryN ( i ) ) ; } return multiPolygon . getFactory ( ) . createMultiPolygon ( polygons ) ;
public class CompoundAwareHunspellRule { /** * As a hunspell - based approach is too slow , we use Morfologik to create suggestions . As this * won ' t work for compounds not in the dictionary , we split the word and also get suggestions * on the compound parts . In the end , all candidates are filtered against Hunspell again ( which * supports compounds ) . */ @ Override public List < String > getSuggestions ( String word ) throws IOException { } }
if ( needsInit ) { init ( ) ; } // System . out . println ( " Computing suggestions for " + word ) ; List < String > candidates = getCandidates ( word ) ; List < String > simpleSuggestions = getCorrectWords ( candidates ) ; // System . out . println ( " simpleSuggestions : " + simpleSuggestions ) ; List < String > noSplitSuggestions = morfoSpeller . getSuggestions ( word ) ; // after getCorrectWords ( ) so spelling . txt is considered handleWordEndPunctuation ( "." , word , noSplitSuggestions ) ; handleWordEndPunctuation ( "..." , word , noSplitSuggestions ) ; List < String > noSplitLowercaseSuggestions = new ArrayList < > ( ) ; if ( StringTools . startsWithUppercase ( word ) && ! StringTools . isAllUppercase ( word ) ) { // almost all words can be uppercase because they can appear at the start of a sentence : noSplitLowercaseSuggestions = morfoSpeller . getSuggestions ( word . toLowerCase ( ) ) ; } // System . out . println ( " noSplitSuggestions : " + noSplitSuggestions ) ; // System . out . println ( " noSplitLcSuggestions : " + noSplitLowercaseSuggestions ) ; // We don ' t know about the quality of the results here , so mix both lists together , // taking elements from both lists on a rotating basis : List < String > suggestions = new ArrayList < > ( ) ; int max = IntStream . of ( simpleSuggestions . size ( ) , noSplitSuggestions . size ( ) , noSplitLowercaseSuggestions . size ( ) ) . max ( ) . orElse ( 0 ) ; for ( int i = 0 ; i < max ; i ++ ) { if ( i < noSplitSuggestions . size ( ) ) { suggestions . add ( noSplitSuggestions . get ( i ) ) ; } if ( i < noSplitLowercaseSuggestions . size ( ) ) { suggestions . add ( StringTools . uppercaseFirstChar ( noSplitLowercaseSuggestions . get ( i ) ) ) ; } // put these behind suggestions by Morfologik , often low - quality / made - up words if ( i < simpleSuggestions . size ( ) ) { suggestions . add ( simpleSuggestions . get ( i ) ) ; } } // System . out . println ( " suggestions ( mixed from simpleSuggestions , noSplitSuggestions , noSplitLowerCaseSuggestions ) : " + suggestions ) ; filterDupes ( suggestions ) ; filterForLanguage ( suggestions ) ; List < String > sortedSuggestions = sortSuggestionByQuality ( word , suggestions ) ; // System . out . println ( " sortSuggestionByQuality ( ) : " + sortedSuggestions ) ; // This is probably be the right place to sort suggestions by probability : // SuggestionSorter sorter = new SuggestionSorter ( new LuceneLanguageModel ( new File ( " / home / dnaber / data / google - ngram - index / de " ) ) ) ; // sortedSuggestions = sorter . sortSuggestions ( sortedSuggestions ) ; // System . out . println ( ) ; return sortedSuggestions . subList ( 0 , Math . min ( MAX_SUGGESTIONS , sortedSuggestions . size ( ) ) ) ;
public class ConversionUtils { /** * Convert map to bean * @ param source * Source map * @ param target * Target class * @ return Bean of that class * @ throws ConversionException * on failure */ public static Object convertMapToBean ( Map < String , ? extends Object > source , Class < ? > target ) throws ConversionException { } }
Object bean = newInstance ( target ) ; if ( bean == null ) { // try with just the target name as specified in Trac # 352 bean = newInstance ( target . getName ( ) ) ; if ( bean == null ) { throw new ConversionException ( "Unable to create bean using empty constructor" ) ; } } try { BeanUtils . populate ( bean , source ) ; } catch ( Exception e ) { throw new ConversionException ( "Error populating bean" , e ) ; } return bean ;
public class GoogleHadoopFileSystemBase { /** * Returns an array of FileStatus objects whose path names match pathPattern and is accepted by * the user - supplied path filter . Results are sorted by their path names . * < p > Return null if pathPattern has no glob and the path does not exist . Return an empty array if * pathPattern has a glob and no path matches it . * @ param pathPattern A regular expression specifying the path pattern . * @ param filter A user - supplied path filter . * @ return An array of FileStatus objects . * @ throws IOException if an error occurs . */ @ Override public FileStatus [ ] globStatus ( Path pathPattern , PathFilter filter ) throws IOException { } }
checkOpen ( ) ; logger . atFine ( ) . log ( "GHFS.globStatus: %s" , pathPattern ) ; // URI does not handle glob expressions nicely , for the purpose of // fully - qualifying a path we can URI - encode them . // Using toString ( ) to avoid Path ( URI ) constructor . Path encodedPath = new Path ( pathPattern . toUri ( ) . toString ( ) ) ; // We convert pathPattern to GCS path and then to Hadoop path to ensure that it ends up in // the correct format . See note in getHadoopPath for more information . Path encodedFixedPath = getHadoopPath ( getGcsPath ( encodedPath ) ) ; // Decode URI - encoded path back into a glob path . Path fixedPath = new Path ( URI . create ( encodedFixedPath . toString ( ) ) ) ; logger . atFine ( ) . log ( "GHFS.globStatus fixedPath: %s => %s" , pathPattern , fixedPath ) ; if ( enableConcurrentGlob && couldUseFlatGlob ( fixedPath ) ) { return concurrentGlobInternal ( fixedPath , filter ) ; } if ( enableFlatGlob && couldUseFlatGlob ( fixedPath ) ) { return flatGlobInternal ( fixedPath , filter ) ; } return super . globStatus ( fixedPath , filter ) ;
public class Utils { /** * Convert a server - side string into either an OctetString ( if the string is non - null ) or Null . instance ( " the value of this * OID is null " ) for transmission . This is so the client side can tell the difference between real nulls and empty values . * @ param s * @ return */ public static AbstractVariable stringToVariable ( String s ) { } }
return s == null ? Null . instance : new OctetString ( s ) ;
public class FileTxnLog { /** * close all the open file handles * @ throws IOException */ public synchronized void close ( ) throws IOException { } }
if ( logStream != null ) { logStream . close ( ) ; } for ( FileOutputStream log : streamsToFlush ) { log . close ( ) ; }
public class JarDiff { /** * Load all the classes from the specified URL and store information * about them in the specified map . * This currently only works for jar files , < b > not < / b > directories * which contain classes in subdirectories or in the current directory . * @ param infoMap the map to store the ClassInfo in . * @ throws DiffException if there is an exception reading info about a * class . */ private void loadClasses ( Map infoMap , URL path ) throws DiffException { } }
try { File jarFile = null ; if ( ! "file" . equals ( path . getProtocol ( ) ) || path . getHost ( ) != null ) { // If it ' s not a local file , store it as a temporary jar file . // java . util . jar . JarFile requires a local file handle . jarFile = File . createTempFile ( "jardiff" , "jar" ) ; // Mark it to be deleted on exit . jarFile . deleteOnExit ( ) ; InputStream in = path . openStream ( ) ; OutputStream out = new FileOutputStream ( jarFile ) ; byte [ ] buffer = new byte [ 4096 ] ; int i ; while ( ( i = in . read ( buffer , 0 , buffer . length ) ) != - 1 ) { out . write ( buffer , 0 , i ) ; } in . close ( ) ; out . close ( ) ; } else { // Else it ' s a local file , nothing special to do . jarFile = new File ( path . getPath ( ) ) ; } loadClasses ( infoMap , jarFile ) ; } catch ( IOException ioe ) { throw new DiffException ( ioe ) ; }
public class ConfluenceDefaultRunnerBuilder { /** * { @ inheritDoc } */ @ Override public void buildAndRegisterRunner ( SystemUnderTestDao systemUnderTestDao , Properties properties ) { } }
String confluenceHome = properties . getProperty ( "confluence.home" , null ) ; if ( confluenceHome != null ) { File pluginsCacheDir = new File ( confluenceHome , "plugins-data" ) ; insertJavaRunnerFromPackagedJar ( pluginsCacheDir , systemUnderTestDao ) ; }
public class JsMainImpl { /** * Return a list of Messaging Engines * @ param busName * @ return Enumeration */ public Enumeration listMessagingEngines ( String busName ) { } }
String thisMethodName = CLASS_NAME + ".listMessagingEngines(String)" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , thisMethodName , busName ) ; } Vector v = new Vector ( ) ; Enumeration e = listMessagingEngines ( ) ; while ( e . hasMoreElements ( ) ) { Object c = e . nextElement ( ) ; if ( ( ( BaseMessagingEngineImpl ) c ) . getBusName ( ) . equals ( busName ) ) v . addElement ( c ) ; } Enumeration elements = v . elements ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , thisMethodName ) ; } return elements ;
public class ByteUtilities { /** * Convert a byte array to an double ( little endian ) . * @ param data the byte array to convert . * @ return the double . */ public static double byteArrayToDoubleLE ( byte [ ] data ) { } }
ByteBuffer buffer = ByteBuffer . wrap ( data ) ; buffer . order ( ByteOrder . LITTLE_ENDIAN ) ; return buffer . getDouble ( ) ;
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public String convertEncodingSchemeIDESidUDToString ( EDataType eDataType , Object instanceValue ) { } }
return instanceValue == null ? null : instanceValue . toString ( ) ;
public class PathParser { /** * Calculate the position of the next comma or space or negative sign * @ param s the string to search * @ param start the position to start searching * @ param result the result of the extraction , including the position of the * the starting position of next number , whether it is ending with a ' - ' . */ private static void extract ( String s , int start , ExtractFloatResult result ) { } }
// Now looking for ' ' , ' , ' , ' . ' or ' - ' from the start . int currentIndex = start ; boolean foundSeparator = false ; result . mEndWithNegOrDot = false ; boolean secondDot = false ; boolean isExponential = false ; for ( ; currentIndex < s . length ( ) ; currentIndex ++ ) { boolean isPrevExponential = isExponential ; isExponential = false ; char currentChar = s . charAt ( currentIndex ) ; switch ( currentChar ) { case ' ' : case ',' : foundSeparator = true ; break ; case '-' : // The negative sign following a ' e ' or ' E ' is not a separator . if ( currentIndex != start && ! isPrevExponential ) { foundSeparator = true ; result . mEndWithNegOrDot = true ; } break ; case '.' : if ( ! secondDot ) { secondDot = true ; } else { // This is the second dot , and it is considered as a separator . foundSeparator = true ; result . mEndWithNegOrDot = true ; } break ; case 'e' : case 'E' : isExponential = true ; break ; } if ( foundSeparator ) { break ; } } // When there is nothing found , then we put the end position to the end // of the string . result . mEndPosition = currentIndex ;
public class CliFrontendParser { private static Options getRunOptionsWithoutDeprecatedOptions ( Options options ) { } }
Options o = getProgramSpecificOptionsWithoutDeprecatedOptions ( options ) ; o . addOption ( SAVEPOINT_PATH_OPTION ) ; return o . addOption ( SAVEPOINT_ALLOW_NON_RESTORED_OPTION ) ;
public class RsIterator { /** * prefetch defined relationships requires JDBC level 2.0 , does not work * with Arrays */ private void prefetchRelationships ( Query query ) { } }
List prefetchedRel ; Collection owners ; String relName ; RelationshipPrefetcher [ ] prefetchers ; if ( query == null || query . getPrefetchedRelationships ( ) == null || query . getPrefetchedRelationships ( ) . isEmpty ( ) ) { return ; } if ( ! supportsAdvancedJDBCCursorControl ( ) ) { logger . info ( "prefetching relationships requires JDBC level 2.0" ) ; return ; } // prevent releasing of DBResources setInBatchedMode ( true ) ; prefetchedRel = query . getPrefetchedRelationships ( ) ; prefetchers = new RelationshipPrefetcher [ prefetchedRel . size ( ) ] ; // disable auto retrieve for all prefetched relationships for ( int i = 0 ; i < prefetchedRel . size ( ) ; i ++ ) { relName = ( String ) prefetchedRel . get ( i ) ; prefetchers [ i ] = getBroker ( ) . getRelationshipPrefetcherFactory ( ) . createRelationshipPrefetcher ( getQueryObject ( ) . getClassDescriptor ( ) , relName ) ; prefetchers [ i ] . prepareRelationshipSettings ( ) ; } // materialize ALL owners of this Iterator owners = getOwnerObjects ( ) ; // prefetch relationships and associate with owners for ( int i = 0 ; i < prefetchedRel . size ( ) ; i ++ ) { prefetchers [ i ] . prefetchRelationship ( owners ) ; } // reset auto retrieve for all prefetched relationships for ( int i = 0 ; i < prefetchedRel . size ( ) ; i ++ ) { prefetchers [ i ] . restoreRelationshipSettings ( ) ; } try { getRsAndStmt ( ) . m_rs . beforeFirst ( ) ; // reposition resultset jdbc 2.0 } catch ( SQLException e ) { logger . error ( "beforeFirst failed !" , e ) ; } setInBatchedMode ( false ) ; setHasCalledCheck ( false ) ;
public class DataTablesPluginSelect { /** * TODO Add DT Select plugin parameters */ @ Nullable public IJSExpression getInitParams ( ) { } }
final JSAssocArray ret = new JSAssocArray ( ) ; if ( ret . isEmpty ( ) ) { // No properties present return JSExpr . TRUE ; } return ret ;
public class JsonObjectSerializer { /** * Method that can be called to ask implementation to serialize * values of type this serializer handles . * @ param value Value to serialize ; can < b > not < / b > be null . * @ param gen Generator used to output resulting Json content * @ param serializers Provider that can be used to get serializers for */ @ Override public void serialize ( JsonObject value , JsonGenerator gen , SerializerProvider serializers ) throws IOException , JsonProcessingException { } }
gen . writeObject ( value . getMap ( ) ) ;
public class ReplicationTrigger { /** * Runs a repair in a background thread . This is done for two reasons : It * allows repair to not be hindered by locks acquired by transactions and * repairs don ' t get rolled back when culprit exception is thrown . Culprit * may be UniqueConstraintException or OptimisticLockException . */ private void repair ( S replica ) throws PersistException { } }
replica = ( S ) replica . copy ( ) ; S master = mMasterStorage . prepare ( ) ; // Must copy more than just primary key properties to master since // replica object might only have alternate keys . replica . copyAllProperties ( master ) ; try { if ( replica . tryLoad ( ) ) { if ( master . tryLoad ( ) ) { if ( replica . equalProperties ( master ) ) { // Both are equal - - no repair needed . return ; } } } else { if ( ! master . tryLoad ( ) ) { // Both are missing - - no repair needed . return ; } } } catch ( IllegalStateException e ) { // Can be caused by not fully defining the primary key on the // replica , but an alternate key is . The insert will fail anyhow , // so don ' t try to repair . return ; } catch ( FetchException e ) { throw e . toPersistException ( ) ; } final S finalReplica = replica ; final S finalMaster = master ; RepairExecutor . execute ( new Runnable ( ) { public void run ( ) { try { Transaction txn = mRepository . enterTransaction ( ) ; try { txn . setForUpdate ( true ) ; if ( finalReplica . tryLoad ( ) ) { if ( finalMaster . tryLoad ( ) ) { resyncEntries ( null , finalReplica , finalMaster , false ) ; } else { resyncEntries ( null , finalReplica , null , false ) ; } } else if ( finalMaster . tryLoad ( ) ) { resyncEntries ( null , null , finalMaster , false ) ; } txn . commit ( ) ; } finally { txn . exit ( ) ; } } catch ( FetchException fe ) { Log log = LogFactory . getLog ( ReplicatedRepository . class ) ; log . warn ( "Unable to check if repair is required for " + finalReplica . toStringKeyOnly ( ) , fe ) ; } catch ( PersistException pe ) { Log log = LogFactory . getLog ( ReplicatedRepository . class ) ; log . error ( "Unable to repair entry " + finalReplica . toStringKeyOnly ( ) , pe ) ; } } } ) ;
public class NaaccrStreamConfiguration { /** * Registers a tag corresponding to a specific class , in the given namespace . * @ param namespacePrefix namespace prefix , required * @ param tagName tag name , required * @ param clazz class corresponding to the tag name , required */ public void registerTag ( String namespacePrefix , String tagName , Class < ? > clazz ) { } }
if ( ! _namespaces . containsKey ( namespacePrefix ) ) throw new RuntimeException ( "Namespace prefix '" + namespacePrefix + "' has not been registered yet" ) ; _xstream . alias ( namespacePrefix + ":" + tagName , clazz ) ; _xstream . addPermission ( new WildcardTypePermission ( new String [ ] { clazz . getName ( ) } ) ) ; _tags . computeIfAbsent ( namespacePrefix , k -> new HashSet < > ( ) ) . add ( tagName ) ;
public class InternalTransaction { /** * Gives the ammount of space this transaction is reserving in the log . * @ return long the number of bytes reserved in the log for this transaction . */ protected long getLogSpaceReserved ( ) { } }
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "getLogSpaceReserved" + ")" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "getLogSpaceReserved" , "returns logSpaceReserved=" + logSpaceReserved + "(long)" ) ; return logSpaceReserved ;
public class SortUtil { /** * Max unsigned byte is - 1. */ public static void maxNormalizedKey ( MemorySegment target , int offset , int numBytes ) { } }
// write max value . for ( int i = 0 ; i < numBytes ; i ++ ) { target . put ( offset + i , ( byte ) - 1 ) ; }
public class StoredProcedureInvocation { /** * Read into an serialized parameter buffer to extract a single parameter */ Object getParameterAtIndex ( int partitionIndex ) { } }
try { if ( serializedParams != null ) { return ParameterSet . getParameterAtIndex ( partitionIndex , serializedParams . duplicate ( ) ) ; } else { return params . get ( ) . getParam ( partitionIndex ) ; } } catch ( Exception ex ) { throw new RuntimeException ( "Invalid partitionIndex: " + partitionIndex , ex ) ; }
public class StringUtils { /** * < p > Gets the substring before the last occurrence of a separator . * The separator is not returned . < / p > * < p > A { @ code null } string input will return { @ code null } . * An empty ( " " ) string input will return the empty string . * An empty or { @ code null } separator will return the input string . < / p > * < p > If nothing is found , the string input is returned . < / p > * < pre > * StringUtils . substringBeforeLast ( null , * ) = null * StringUtils . substringBeforeLast ( " " , * ) = " " * StringUtils . substringBeforeLast ( " abcba " , " b " ) = " abc " * StringUtils . substringBeforeLast ( " abc " , " c " ) = " ab " * StringUtils . substringBeforeLast ( " a " , " a " ) = " " * StringUtils . substringBeforeLast ( " a " , " z " ) = " a " * StringUtils . substringBeforeLast ( " a " , null ) = " a " * StringUtils . substringBeforeLast ( " a " , " " ) = " a " * < / pre > * @ param str the String to get a substring from , may be null * @ param separator the String to search for , may be null * @ return the substring before the last occurrence of the separator , * { @ code null } if null String input * @ since 2.0 */ public static String substringBeforeLast ( final String str , final String separator ) { } }
if ( isEmpty ( str ) || isEmpty ( separator ) ) { return str ; } final int pos = str . lastIndexOf ( separator ) ; if ( pos == INDEX_NOT_FOUND ) { return str ; } return str . substring ( 0 , pos ) ;
public class Sql { /** * Executes the given SQL statement ( typically an INSERT statement ) . * Use this variant when you want to receive the values of any * auto - generated columns , such as an autoincrement ID field . * The query may contain GString expressions . * Generated key values can be accessed using * array notation . For example , to return the second auto - generated * column value of the third row , use < code > keys [ 3 ] [ 1 ] < / code > . The * method is designed to be used with SQL INSERT statements , but is * not limited to them . * The standard use for this method is when a table has an * autoincrement ID column and you want to know what the ID is for * a newly inserted row . In this example , we insert a single row * into a table in which the first column contains the autoincrement ID : * < pre > * def sql = Sql . newInstance ( " jdbc : mysql : / / localhost : 3306 / groovy " , * " user " , * " password " , * " com . mysql . jdbc . Driver " ) * def keys = sql . executeInsert ( " insert into test _ table ( INT _ DATA , STRING _ DATA ) " * + " VALUES ( 1 , ' Key Largo ' ) " ) * def id = keys [ 0 ] [ 0] * / / ' id ' now contains the value of the new row ' s ID column . * / / It can be used to update an object representation ' s * / / id attribute for example . * < / pre > * Resource handling is performed automatically where appropriate . * @ param gstring a GString containing the SQL query with embedded params * @ return A list of the auto - generated column values for each * inserted row ( typically auto - generated keys ) * @ throws SQLException if a database access error occurs * @ see # expand ( Object ) */ public List < List < Object > > executeInsert ( GString gstring ) throws SQLException { } }
List < Object > params = getParameters ( gstring ) ; String sql = asSql ( gstring , params ) ; return executeInsert ( sql , params ) ;
public class AbstractSequence { /** * Added support for the source of this sequence for GFF3 export * If a sub sequence doesn ' t have source then check for parent source * @ return the source */ public String getSource ( ) { } }
if ( source != null ) { return source ; } if ( parentSequence != null ) { return parentSequence . getSource ( ) ; } return null ;
public class SerializingInstantiatorStrategy { /** * Return an { @ link ObjectInstantiator } allowing to create instance following the java * serialization framework specifications . * @ param type Class to instantiate * @ return The ObjectInstantiator for the class */ public < T > ObjectInstantiator < T > newInstantiatorOf ( Class < T > type ) { } }
if ( ! Serializable . class . isAssignableFrom ( type ) ) { throw new ObjenesisException ( new NotSerializableException ( type + " not serializable" ) ) ; } if ( JVM_NAME . startsWith ( HOTSPOT ) || PlatformDescription . isThisJVM ( OPENJDK ) ) { // Java 7 GAE was under a security manager so we use a degraded system if ( isGoogleAppEngine ( ) && PlatformDescription . SPECIFICATION_VERSION . equals ( "1.7" ) ) { return new ObjectInputStreamInstantiator < > ( type ) ; } return new SunReflectionFactorySerializationInstantiator < > ( type ) ; } else if ( JVM_NAME . startsWith ( DALVIK ) ) { if ( PlatformDescription . isAndroidOpenJDK ( ) ) { return new ObjectStreamClassInstantiator < > ( type ) ; } return new AndroidSerializationInstantiator < > ( type ) ; } else if ( JVM_NAME . startsWith ( GNU ) ) { return new GCJSerializationInstantiator < > ( type ) ; } else if ( JVM_NAME . startsWith ( PERC ) ) { return new PercSerializationInstantiator < > ( type ) ; } return new SunReflectionFactorySerializationInstantiator < > ( type ) ;
public class InfluxDBImpl { /** * { @ inheritDoc } */ @ Override public void createRetentionPolicy ( final String rpName , final String database , final String duration , final String shardDuration , final int replicationFactor , final boolean isDefault ) { } }
Preconditions . checkNonEmptyString ( rpName , "retentionPolicyName" ) ; Preconditions . checkNonEmptyString ( database , "database" ) ; Preconditions . checkNonEmptyString ( duration , "retentionDuration" ) ; Preconditions . checkDuration ( duration , "retentionDuration" ) ; if ( shardDuration != null && ! shardDuration . isEmpty ( ) ) { Preconditions . checkDuration ( shardDuration , "shardDuration" ) ; } Preconditions . checkPositiveNumber ( replicationFactor , "replicationFactor" ) ; StringBuilder queryBuilder = new StringBuilder ( "CREATE RETENTION POLICY \"" ) ; queryBuilder . append ( rpName ) . append ( "\" ON \"" ) . append ( database ) . append ( "\" DURATION " ) . append ( duration ) . append ( " REPLICATION " ) . append ( replicationFactor ) ; if ( shardDuration != null && ! shardDuration . isEmpty ( ) ) { queryBuilder . append ( " SHARD DURATION " ) ; queryBuilder . append ( shardDuration ) ; } if ( isDefault ) { queryBuilder . append ( " DEFAULT" ) ; } executeQuery ( this . influxDBService . postQuery ( Query . encode ( queryBuilder . toString ( ) ) ) ) ;
public class Timestamp { /** * Converts a < code > String < / code > object in JDBC timestamp escape format to a * < code > Timestamp < / code > value . * @ param s timestamp in format < code > yyyy - [ m ] m - [ d ] d hh : mm : ss [ . f . . . ] < / code > . The * fractional seconds may be omitted . The leading zero for < code > mm < / code > * and < code > dd < / code > may also be omitted . * @ return corresponding < code > Timestamp < / code > value * @ exception java . lang . IllegalArgumentException if the given argument * does not have the format < code > yyyy - [ m ] m - [ d ] d hh : mm : ss [ . f . . . ] < / code > */ public static Timestamp valueOf ( String s ) { } }
final int YEAR_LENGTH = 4 ; final int MONTH_LENGTH = 2 ; final int DAY_LENGTH = 2 ; final int MAX_MONTH = 12 ; final int MAX_DAY = 31 ; String date_s ; String time_s ; String nanos_s ; int year = 0 ; int month = 0 ; int day = 0 ; int hour ; int minute ; int second ; int a_nanos = 0 ; int firstDash ; int secondDash ; int dividingSpace ; int firstColon = 0 ; int secondColon = 0 ; int period = 0 ; String formatError = "Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]" ; String zeros = "000000000" ; String delimiterDate = "-" ; String delimiterTime = ":" ; if ( s == null ) throw new java . lang . IllegalArgumentException ( "null string" ) ; // Split the string into date and time components s = s . trim ( ) ; dividingSpace = s . indexOf ( ' ' ) ; if ( dividingSpace > 0 ) { date_s = s . substring ( 0 , dividingSpace ) ; time_s = s . substring ( dividingSpace + 1 ) ; } else { throw new java . lang . IllegalArgumentException ( formatError ) ; } // Parse the date firstDash = date_s . indexOf ( '-' ) ; secondDash = date_s . indexOf ( '-' , firstDash + 1 ) ; // Parse the time if ( time_s == null ) throw new java . lang . IllegalArgumentException ( formatError ) ; firstColon = time_s . indexOf ( ':' ) ; secondColon = time_s . indexOf ( ':' , firstColon + 1 ) ; period = time_s . indexOf ( '.' , secondColon + 1 ) ; // Convert the date boolean parsedDate = false ; if ( ( firstDash > 0 ) && ( secondDash > 0 ) && ( secondDash < date_s . length ( ) - 1 ) ) { String yyyy = date_s . substring ( 0 , firstDash ) ; String mm = date_s . substring ( firstDash + 1 , secondDash ) ; String dd = date_s . substring ( secondDash + 1 ) ; if ( yyyy . length ( ) == YEAR_LENGTH && ( mm . length ( ) >= 1 && mm . length ( ) <= MONTH_LENGTH ) && ( dd . length ( ) >= 1 && dd . length ( ) <= DAY_LENGTH ) ) { year = Integer . parseInt ( yyyy ) ; month = Integer . parseInt ( mm ) ; day = Integer . parseInt ( dd ) ; if ( ( month >= 1 && month <= MAX_MONTH ) && ( day >= 1 && day <= MAX_DAY ) ) { parsedDate = true ; } } } if ( ! parsedDate ) { throw new java . lang . IllegalArgumentException ( formatError ) ; } // Convert the time ; default missing nanos if ( ( firstColon > 0 ) & ( secondColon > 0 ) & ( secondColon < time_s . length ( ) - 1 ) ) { hour = Integer . parseInt ( time_s . substring ( 0 , firstColon ) ) ; minute = Integer . parseInt ( time_s . substring ( firstColon + 1 , secondColon ) ) ; if ( ( period > 0 ) & ( period < time_s . length ( ) - 1 ) ) { second = Integer . parseInt ( time_s . substring ( secondColon + 1 , period ) ) ; nanos_s = time_s . substring ( period + 1 ) ; if ( nanos_s . length ( ) > 9 ) throw new java . lang . IllegalArgumentException ( formatError ) ; if ( ! Character . isDigit ( nanos_s . charAt ( 0 ) ) ) throw new java . lang . IllegalArgumentException ( formatError ) ; nanos_s = nanos_s + zeros . substring ( 0 , 9 - nanos_s . length ( ) ) ; a_nanos = Integer . parseInt ( nanos_s ) ; } else if ( period > 0 ) { throw new java . lang . IllegalArgumentException ( formatError ) ; } else { second = Integer . parseInt ( time_s . substring ( secondColon + 1 ) ) ; } } else { throw new java . lang . IllegalArgumentException ( formatError ) ; } return new Timestamp ( year - 1900 , month - 1 , day , hour , minute , second , a_nanos ) ;
public class JspContextWrapper { /** * Saves the values of any NESTED variables that are present in * the invoking JSP context , so they can later be restored . */ private void saveNestedVariables ( ) { } }
if ( nestedVars != null ) { Iterator iter = nestedVars . iterator ( ) ; while ( iter . hasNext ( ) ) { String varName = ( String ) iter . next ( ) ; varName = findAlias ( varName ) ; Object obj = invokingJspCtxt . getAttribute ( varName ) ; if ( obj != null ) { originalNestedVars . put ( varName , obj ) ; } } }
public class AuditorFactory { /** * Get an auditor instance for the specified auditor class , module configuration . Auditor * will use a standalone context if a non - global context is requested . * @ param clazzClass to instantiate * @ param config Auditor configuration to use * @ param useGlobalContext Whether to use the global ( true ) or standalone ( false ) context * @ return Instance of an IHE Auditor */ public static IHEAuditor getAuditor ( Class < ? extends IHEAuditor > clazz , AuditorModuleConfig config , boolean useGlobalContext ) { } }
AuditorModuleContext context ; if ( ! useGlobalContext ) { context = ( AuditorModuleContext ) ContextInitializer . initialize ( config ) ; } else { context = AuditorModuleContext . getContext ( ) ; } return getAuditor ( clazz , config , context ) ;
public class SignalRsInner { /** * Operation to update an exiting SignalR service . * @ 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 resourceName The name of the SignalR resource . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < SignalRResourceInner > updateAsync ( String resourceGroupName , String resourceName ) { } }
return updateWithServiceResponseAsync ( resourceGroupName , resourceName ) . map ( new Func1 < ServiceResponse < SignalRResourceInner > , SignalRResourceInner > ( ) { @ Override public SignalRResourceInner call ( ServiceResponse < SignalRResourceInner > response ) { return response . body ( ) ; } } ) ;
public class SDLoss { /** * Sigmoid cross entropy : applies the sigmoid activation function on the input logits ( input " pre - sigmoid preductions " ) * and implements the binary cross entropy loss function . This implementation is numerically more stable than using * standard ( but separate ) sigmoid activation function and log loss ( binary cross entropy ) loss function . < br > * Implements : * { @ code - 1 / numExamples * sum _ i ( labels [ i ] * log ( sigmoid ( logits [ i ] ) ) + ( 1 - labels [ i ] ) * log ( 1 - sigmoid ( logits [ i ] ) ) ) } * though this is done in a mathematically equivalent but more numerical stable form . < br > * < br > * When label smoothing is > 0 , the following label smoothing is used : < br > * < pre > * { @ code numClasses = labels . size ( 1 ) ; * label = ( 1.0 - labelSmoothing ) * label + 0.5 * labelSmoothing } * < / pre > * @ param name Name of the operation * @ param label Label array * @ param predictionLogits Predictions array * @ param weights Weights array . May be null . If null , a weight of 1.0 is used * @ param lossReduce Reduction type for the loss . See { @ link LossReduce } for more details . Default : { @ link LossReduce # MEAN _ BY _ NONZERO _ WEIGHT _ COUNT } * @ return Loss variable */ public SDVariable sigmoidCrossEntropy ( String name , @ NonNull SDVariable label , @ NonNull SDVariable predictionLogits , SDVariable weights , @ NonNull LossReduce lossReduce , double labelSmoothing ) { } }
validateFloatingPoint ( "sigmoid cross entropy loss" , "predictions" , predictionLogits ) ; validateNumerical ( "sigmoid cross entropy loss" , "labels" , label ) ; if ( weights == null ) weights = sd . scalar ( null , predictionLogits . dataType ( ) , 1.0 ) ; SDVariable result = f ( ) . lossSigmoidCrossEntropy ( label , predictionLogits , weights , lossReduce , labelSmoothing ) ; result = updateVariableNameAndReference ( result , name ) ; result . markAsLoss ( ) ; return result ;
public class SecurityProfileSummaryMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SecurityProfileSummary securityProfileSummary , ProtocolMarshaller protocolMarshaller ) { } }
if ( securityProfileSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( securityProfileSummary . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( securityProfileSummary . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( securityProfileSummary . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DSLMapParser { /** * $ ANTLR start synpred7 _ DSLMap */ public final void synpred7_DSLMap_fragment ( ) throws RecognitionException { } }
ParserRuleReturnScope value2 = null ; // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 133:11 : ( value2 = consequence _ key ) // src / main / resources / org / drools / compiler / lang / dsl / DSLMap . g : 133:11 : value2 = consequence _ key { pushFollow ( FOLLOW_consequence_key_in_synpred7_DSLMap439 ) ; value2 = consequence_key ( ) ; state . _fsp -- ; if ( state . failed ) return ; }
public class CharacterApi { /** * Get character & # 39 ; s public information Public information about a * character - - - This route is cached for up to 3600 seconds * @ param characterId * An EVE character ID ( required ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param ifNoneMatch * ETag from a previous request . A 304 will be returned if this * matches the current ETag ( optional ) * @ return CharacterResponse * @ throws ApiException * If fail to call the API , e . g . server error or cannot * deserialize the response body */ public CharacterResponse getCharactersCharacterId ( Integer characterId , String datasource , String ifNoneMatch ) throws ApiException { } }
ApiResponse < CharacterResponse > resp = getCharactersCharacterIdWithHttpInfo ( characterId , datasource , ifNoneMatch ) ; return resp . getData ( ) ;
public class SimpleRequestFactory { /** * Template method for preparing the given { @ link HttpURLConnection } . * < p > The default implementation prepares the connection for input and output , and sets the HTTP method . * @ param connection the connection to prepare * @ param httpMethod the HTTP request method ( { @ code GET } , { @ code POST } , etc . ) * @ throws IOException in case of I / O errors */ private void prepareConnection ( HttpURLConnection connection , String httpMethod ) throws IOException { } }
if ( this . connectTimeout >= 0 ) { connection . setConnectTimeout ( this . connectTimeout ) ; } if ( this . readTimeout >= 0 ) { connection . setReadTimeout ( this . readTimeout ) ; } connection . setDoInput ( true ) ; if ( "GET" . equals ( httpMethod ) ) { connection . setInstanceFollowRedirects ( true ) ; } else { connection . setInstanceFollowRedirects ( false ) ; } if ( "POST" . equals ( httpMethod ) || "PUT" . equals ( httpMethod ) || "PATCH" . equals ( httpMethod ) || "DELETE" . equals ( httpMethod ) ) { connection . setDoOutput ( true ) ; } else { connection . setDoOutput ( false ) ; } connection . setRequestMethod ( httpMethod ) ;
public class PackageManagerUtils { /** * Checks if the device has at least one camera . * @ param manager the package manager . * @ return { @ code true } if the device has at least one camera . */ @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN_MR1 ) public static boolean hasCameraFeatureAtLeastOne ( PackageManager manager ) { } }
return manager . hasSystemFeature ( PackageManager . FEATURE_CAMERA_ANY ) ;
public class FlowTriggerScheduler { /** * Schedule flows containing flow triggers for this project . */ public void schedule ( final Project project , final String submitUser ) throws ProjectManagerException , IOException , SchedulerException { } }
for ( final Flow flow : project . getFlows ( ) ) { // todo chengren311 : we should validate embedded flow shouldn ' t have flow trigger defined . if ( flow . isEmbeddedFlow ( ) ) { // skip scheduling embedded flow since embedded flow are not allowed to have flow trigger continue ; } final String flowFileName = flow . getId ( ) + ".flow" ; final int latestFlowVersion = this . projectLoader . getLatestFlowVersion ( flow . getProjectId ( ) , flow . getVersion ( ) , flowFileName ) ; if ( latestFlowVersion > 0 ) { final File tempDir = Files . createTempDir ( ) ; final File flowFile ; try { flowFile = this . projectLoader . getUploadedFlowFile ( project . getId ( ) , project . getVersion ( ) , flowFileName , latestFlowVersion , tempDir ) ; final FlowTrigger flowTrigger = FlowLoaderUtils . getFlowTriggerFromYamlFile ( flowFile ) ; if ( flowTrigger != null ) { final Map < String , Object > contextMap = ImmutableMap . of ( FlowTriggerQuartzJob . SUBMIT_USER , submitUser , FlowTriggerQuartzJob . FLOW_TRIGGER , flowTrigger , FlowTriggerQuartzJob . FLOW_ID , flow . getId ( ) , FlowTriggerQuartzJob . FLOW_VERSION , latestFlowVersion , FlowTriggerQuartzJob . PROJECT_ID , project . getId ( ) ) ; final boolean scheduleSuccess = this . scheduler . scheduleJobIfAbsent ( flowTrigger . getSchedule ( ) . getCronExpression ( ) , new QuartzJobDescription ( FlowTriggerQuartzJob . class , FlowTriggerQuartzJob . JOB_NAME , generateGroupName ( flow ) , contextMap ) ) ; if ( scheduleSuccess ) { logger . info ( "Successfully registered flow {}.{} to scheduler" , project . getName ( ) , flow . getId ( ) ) ; } else { logger . info ( "Fail to register a duplicate flow {}.{} to scheduler" , project . getName ( ) , flow . getId ( ) ) ; } } } catch ( final SchedulerException | IOException ex ) { logger . error ( "Error in registering flow {}.{}" , project . getName ( ) , flow . getId ( ) , ex ) ; throw ex ; } finally { FlowLoaderUtils . cleanUpDir ( tempDir ) ; } } }
public class YearMonthDay { /** * Converts this object to a DateMidnight . * @ param zone the zone to get the DateMidnight in , null means default * @ return the DateMidnight instance */ public DateMidnight toDateMidnight ( DateTimeZone zone ) { } }
Chronology chrono = getChronology ( ) . withZone ( zone ) ; return new DateMidnight ( getYear ( ) , getMonthOfYear ( ) , getDayOfMonth ( ) , chrono ) ;
public class JobExecutor { /** * Wait for jobs to terminate . */ public void awaitTermination ( long timeout , TimeUnit unit ) { } }
try { executorService . awaitTermination ( timeout , unit ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( "Job executor was interrupted while waiting" ) ; }
public class RemoteServiceProxy { /** * Configures a RequestBuilder to send an RPC request when the RequestBuilder * is intended to be returned through the asynchronous proxy interface . * @ param < T > return type for the AsyncCallback * @ param responseReader instance used to read the return value of the * invocation * @ param requestData payload that encodes the addressing and arguments of the * RPC call * @ param callback callback handler * @ return a RequestBuilder object that is ready to have its * { @ link RequestBuilder # send ( ) } method invoked . */ protected < T > RequestBuilder doPrepareRequestBuilder ( ResponseReader responseReader , String methodName , RpcStatsContext statsContext , String requestData , AsyncCallback < T > callback ) { } }
RequestBuilder rb = doPrepareRequestBuilderImpl ( responseReader , methodName , statsContext , requestData , callback ) ; return rb ;
public class ST_3DPerimeter { /** * Compute the 3D perimeter * @ param geometry * @ return */ private static double compute3DPerimeter ( Geometry geometry ) { } }
double sum = 0 ; for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry subGeom = geometry . getGeometryN ( i ) ; if ( subGeom instanceof Polygon ) { sum += ST_3DLength . length3D ( ( ( Polygon ) subGeom ) . getExteriorRing ( ) ) ; } } return sum ;
public class LeveledCompactionStrategy { /** * the only difference between background and maximal in LCS is that maximal is still allowed * ( by explicit user request ) even when compaction is disabled . */ public synchronized AbstractCompactionTask getNextBackgroundTask ( int gcBefore ) { } }
if ( ! isEnabled ( ) ) return null ; Collection < AbstractCompactionTask > tasks = getMaximalTask ( gcBefore ) ; if ( tasks == null || tasks . size ( ) == 0 ) return null ; return tasks . iterator ( ) . next ( ) ;
public class Account { /** * Ensures this Account * { @ link fathom . authz . Permission # implies ( fathom . authz . Permission ) implies } all of the * specified permission strings . * If this Account ' s existing associated permissions do not * { @ link fathom . authz . Permission # implies ( fathom . authz . Permission ) imply } all of the given permissions , * an { @ link fathom . authz . AuthorizationException } will be thrown . * This is an overloaded method for the corresponding type - safe { @ link fathom . authz . Permission Permission } variant . * Please see the class - level JavaDoc for more information on these String - based permission methods . * @ param permissions the string representations of Permissions to check . * @ throws AuthorizationException if this Account does not have all of the given permissions . */ public void checkPermissions ( String ... permissions ) throws AuthorizationException { } }
if ( ! isPermittedAll ( permissions ) ) { throw new AuthorizationException ( "'{}' does not have the permissions {}" , toString ( ) , Arrays . toString ( permissions ) ) ; }
public class CharsetUtil { /** * Returns a new { @ link CharsetEncoder } for the { @ link Charset } with specified error actions . * @ param charset The specified charset * @ param malformedInputAction The encoder ' s action for malformed - input errors * @ param unmappableCharacterAction The encoder ' s action for unmappable - character errors * @ return The encoder for the specified { @ code charset } */ public static CharsetEncoder encoder ( Charset charset , CodingErrorAction malformedInputAction , CodingErrorAction unmappableCharacterAction ) { } }
checkNotNull ( charset , "charset" ) ; CharsetEncoder e = charset . newEncoder ( ) ; e . onMalformedInput ( malformedInputAction ) . onUnmappableCharacter ( unmappableCharacterAction ) ; return e ;
public class OrganizationUpdaterImpl { /** * Owners group has an hard coded name , a description based on the organization ' s name and has all global permissions . */ private GroupDto insertOwnersGroup ( DbSession dbSession , OrganizationDto organization ) { } }
GroupDto group = dbClient . groupDao ( ) . insert ( dbSession , new GroupDto ( ) . setOrganizationUuid ( organization . getUuid ( ) ) . setName ( OWNERS_GROUP_NAME ) . setDescription ( format ( OWNERS_GROUP_DESCRIPTION_PATTERN , organization . getName ( ) ) ) ) ; permissionService . getAllOrganizationPermissions ( ) . forEach ( p -> addPermissionToGroup ( dbSession , group , p ) ) ; return group ;
public class KTypeArrayDeque { /** * / * # if ( $ TemplateOptions . KTypeGeneric ) */ @ SafeVarargs /* # end */ public final void addFirst ( KType ... elements ) { } }
ensureBufferSpace ( elements . length ) ; for ( KType k : elements ) { addFirst ( k ) ; }
public class XMLUserLoginModule { /** * Method to authenticate a < code > Subject < / code > ( phase 1 ) . * < p > The implementation of this method authenticates * a < code > Subject < / code > . For example , it may prompt for * < code > Subject < / code > information such * as a username and password and then attempt to verify the password . * This method saves the result of the authentication attempt * as private state within the LoginModule . * @ exception LoginException if the authentication fails * @ return true if the authentication succeeded , or false if this * < code > LoginModule < / code > should be ignored . */ public final boolean login ( ) throws LoginException { } }
boolean ret = false ; final Callback [ ] callbacks = new Callback [ 3 ] ; callbacks [ 0 ] = new ActionCallback ( ) ; callbacks [ 1 ] = new NameCallback ( "Username: " ) ; callbacks [ 2 ] = new PasswordCallback ( "Password: " , false ) ; // Interact with the user to retrieve the username and password String userName = null ; String password = null ; try { this . callbackHandler . handle ( callbacks ) ; this . mode = ( ( ActionCallback ) callbacks [ 0 ] ) . getMode ( ) ; userName = ( ( NameCallback ) callbacks [ 1 ] ) . getName ( ) ; if ( ( ( PasswordCallback ) callbacks [ 2 ] ) . getPassword ( ) != null ) { password = new String ( ( ( PasswordCallback ) callbacks [ 2 ] ) . getPassword ( ) ) ; } } catch ( final IOException e ) { throw new LoginException ( e . toString ( ) ) ; } catch ( final UnsupportedCallbackException e ) { throw new LoginException ( e . toString ( ) ) ; } if ( this . mode == ActionCallback . Mode . ALL_PERSONS ) { ret = true ; } else if ( this . mode == ActionCallback . Mode . PERSON_INFORMATION ) { this . person = this . allPersons . get ( userName ) ; if ( this . person != null ) { if ( XMLUserLoginModule . LOG . isDebugEnabled ( ) ) { XMLUserLoginModule . LOG . debug ( "found '" + this . person + "'" ) ; } ret = true ; } } else { this . person = this . allPersons . get ( userName ) ; if ( this . person != null ) { if ( ( password == null ) || ( ( password != null ) && ! password . equals ( this . person . getPassword ( ) ) ) ) { XMLUserLoginModule . LOG . error ( "person '" + this . person + "' tried to log in with wrong password" ) ; this . person = null ; throw new FailedLoginException ( "Username or password is incorrect" ) ; } if ( XMLUserLoginModule . LOG . isDebugEnabled ( ) ) { XMLUserLoginModule . LOG . debug ( "log in of '" + this . person + "'" ) ; } this . mode = ActionCallback . Mode . LOGIN ; ret = true ; } } return ret ;
public class UriUtils { /** * Returns whether the URI has a secure schema . Secure is defined as being either { @ code wss } or * { @ code https } . * @ param uri the URI to examine * @ return whether the URI has a secure schema * @ throws NullPointerException if { @ code uri } is { @ code null } */ public static boolean isSecure ( URI uri ) { } }
Objects . requireNonNull ( uri , "uri must not be null" ) ; return uri . getScheme ( ) . equals ( "wss" ) || uri . getScheme ( ) . equals ( "https" ) ;
public class SuggestTree { /** * Removes the specified suggestion from this tree , if present . * @ throws NullPointerException if the specified suggestion is { @ code null } */ public void remove ( String suggestion ) { } }
Node n = getNode ( suggestion ) ; if ( n == null ) return ; n . weight = - 1 ; size -- ; Node m = n ; if ( n . mid == null ) { Node replacement = removeNode ( n ) ; if ( replacement != null ) replacement . parent = n . parent ; if ( n == root ) root = replacement ; else if ( n == n . parent . mid ) n . parent . mid = replacement ; else { if ( n == n . parent . left ) n . parent . left = replacement ; else n . parent . right = replacement ; while ( n != root && n != n . parent . mid ) n = n . parent ; } n = n . parent ; if ( n == null ) return ; } if ( n . weight == - 1 && n . mid . left == null && n . mid . right == null ) { n = mergeWithChild ( n ) ; while ( n != root && n != n . parent . mid ) n = n . parent ; n = n . parent ; if ( n == null ) return ; } removeFromLists ( m , n ) ;
public class ModifyFileExtensions { /** * Modifies the input file line by line and writes the modification in the new output file * @ param inFilePath * the in file path * @ param outFilePath * the out file path * @ param modifier * the modifier { @ linkplain BiFunction } * @ throws IOException * Signals that an I / O exception has occurred . */ public static void modifyFile ( Path inFilePath , Path outFilePath , FileChangable modifier ) throws IOException { } }
try ( BufferedReader bufferedReader = new BufferedReader ( new FileReader ( inFilePath . toFile ( ) ) ) ; Writer writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( outFilePath . toFile ( ) ) , "utf-8" ) ) ) { String readLine ; int counter = 0 ; while ( ( readLine = bufferedReader . readLine ( ) ) != null ) { writer . write ( modifier . apply ( counter , readLine ) ) ; counter ++ ; } }
public class QueryParameters { /** * Checks is specified key is IN parameter . * IN and INOUT parameter would be considered as IN parameter * @ param key Key * @ return true - if key is IN parameter */ public boolean isInParameter ( String key ) { } }
boolean isIn = false ; if ( this . getDirection ( processKey ( key ) ) == Direction . INOUT || this . getDirection ( processKey ( key ) ) == Direction . IN ) { isIn = true ; } return isIn ;
public class ApiOvhIpLoadbalancing { /** * Alter this object properties * REST : PUT / ipLoadbalancing / { serviceName } / quota / { zone } * @ param body [ required ] New object properties * @ param serviceName [ required ] The internal name of your IP load balancing * @ param zone [ required ] Zone of your quota */ public void serviceName_quota_zone_PUT ( String serviceName , String zone , OvhQuota body ) throws IOException { } }
String qPath = "/ipLoadbalancing/{serviceName}/quota/{zone}" ; StringBuilder sb = path ( qPath , serviceName , zone ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ;
public class DynamoDbServiceRegistryFacilitator { /** * Delete boolean . * @ param service the service * @ return the boolean */ public boolean delete ( final RegisteredService service ) { } }
val del = new DeleteItemRequest ( ) . withTableName ( dynamoDbProperties . getTableName ( ) ) . withKey ( CollectionUtils . wrap ( ColumnNames . ID . getColumnName ( ) , new AttributeValue ( String . valueOf ( service . getId ( ) ) ) ) ) ; LOGGER . debug ( "Submitting delete request [{}] for service [{}]" , del , service ) ; val res = amazonDynamoDBClient . deleteItem ( del ) ; LOGGER . debug ( "Delete request came back with result [{}]" , res ) ; return res != null ;
public class AmazonLexModelBuildingClient { /** * Returns bot information as follows : * < ul > * < li > * If you provide the < code > nameContains < / code > field , the response includes information for the * < code > $ LATEST < / code > version of all bots whose name contains the specified string . * < / li > * < li > * If you don ' t specify the < code > nameContains < / code > field , the operation returns information about the * < code > $ LATEST < / code > version of all of your bots . * < / li > * < / ul > * This operation requires permission for the < code > lex : GetBots < / code > action . * @ param getBotsRequest * @ return Result of the GetBots operation returned by the service . * @ throws NotFoundException * The resource specified in the request was not found . Check the resource and try again . * @ throws LimitExceededException * The request exceeded a limit . Try your request again . * @ throws InternalFailureException * An internal Amazon Lex error occurred . Try your request again . * @ throws BadRequestException * The request is not well formed . For example , a value is invalid or a required field is missing . Check the * field values , and try again . * @ sample AmazonLexModelBuilding . GetBots * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lex - models - 2017-04-19 / GetBots " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetBotsResult getBots ( GetBotsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetBots ( request ) ;
public class PyramidKltTracker { /** * Finds the feature ' s new location in the image . The feature ' s position can be modified even if * tracking fails . * NOTE : The feature ' s description is not updated and tracking over several frames can break down * if its description is not updated . * @ param feature The feature being tracked . * @ return If tracking failed or not . */ public KltTrackFault track ( PyramidKltFeature feature ) { } }
// this is the first level it was able to track the feature at int firstLevelTracked = - 1 ; float x = feature . x ; float y = feature . y ; // track from the top of the pyramid to the bottom for ( int layer = image . getNumLayers ( ) - 1 ; layer >= 0 ; layer -- ) { float scale = ( float ) image . getScale ( layer ) ; x /= scale ; y /= scale ; // tracking never needs the derivative tracker . unsafe_setImage ( image . getLayer ( layer ) , null , null ) ; KltFeature f = feature . desc [ layer ] ; f . setPosition ( x , y ) ; KltTrackFault ret = tracker . track ( f ) ; if ( ret == KltTrackFault . SUCCESS ) { if ( firstLevelTracked == - 1 ) firstLevelTracked = layer ; // nothing bad happened , save this result x = feature . desc [ layer ] . x ; y = feature . desc [ layer ] . y ; } else { // tracking failed return ret ; } x *= scale ; y *= scale ; } feature . setPosition ( x , y ) ; return KltTrackFault . SUCCESS ;
public class DescribeBrokerEngineTypesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeBrokerEngineTypesRequest describeBrokerEngineTypesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeBrokerEngineTypesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeBrokerEngineTypesRequest . getEngineType ( ) , ENGINETYPE_BINDING ) ; protocolMarshaller . marshall ( describeBrokerEngineTypesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( describeBrokerEngineTypesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ProtobufProxyUtils { /** * Fetch field infos . * @ return the list */ public static List < FieldInfo > fetchFieldInfos ( Class cls , boolean ignoreNoAnnotation ) { } }
// if set ProtobufClass annotation Annotation annotation = cls . getAnnotation ( ProtobufClass . class ) ; Annotation zipZap = cls . getAnnotation ( EnableZigZap . class ) ; boolean isZipZap = false ; if ( zipZap != null ) { isZipZap = true ; } boolean typeDefined = false ; List < Field > fields = null ; if ( annotation == null ) { fields = FieldUtils . findMatchedFields ( cls , Protobuf . class ) ; if ( fields . isEmpty ( ) && ignoreNoAnnotation ) { throw new IllegalArgumentException ( "Invalid class [" + cls . getName ( ) + "] no field use annotation @" + Protobuf . class . getName ( ) + " at class " + cls . getName ( ) ) ; } } else { typeDefined = true ; fields = FieldUtils . findMatchedFields ( cls , null ) ; } List < FieldInfo > fieldInfos = ProtobufProxyUtils . processDefaultValue ( fields , typeDefined , isZipZap ) ; return fieldInfos ;
public class StringUtils { /** * if < code > value < / code > begin with ' ' or ' \ t ' then return * < code > ' ' + value < / code > string , otherwise < code > value < / code > . * @ param value the value * @ return the string */ public static String startWithSpace ( String value ) { } }
if ( value . length ( ) > 0 && ( value . charAt ( 0 ) != ' ' && value . charAt ( 0 ) != '\t' ) ) { return " " + value ; } return value ;