signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SomeCommandAnnotatedObject { /** * region > changeNameImplicitlyInBackground ( action ) */ @ Action ( semantics = SemanticsOf . IDEMPOTENT , command = CommandReification . ENABLED , commandExecuteIn = CommandExecuteIn . BACKGROUND ) @ ActionLayout ( describedAs = "invoke from UI, will create a command implicitly (returned) to change the name in the background" ) public SomeCommandAnnotatedObject changeNameImplicitlyInBackground ( @ ParameterLayout ( named = "New name" ) final String newName ) { } }
setName ( newName ) ; return this ;
public class TextClassifier { /** * It validates the modeler using the provided dataset and it returns the ClassificationMetrics . The testDataset should contain the real target variables . * @ param testDataset * @ return */ public ClassificationMetrics validate ( Dataframe testDataset ) { } }
logger . info ( "validate()" ) ; predict ( testDataset ) ; ClassificationMetrics vm = new ClassificationMetrics ( testDataset ) ; return vm ;
public class LicenseResource { /** * Handle license posts when the server got a request POST < dm _ url > / license & MIME that contains the license . * @ param license The license to add to Grapes database * @ return Response An acknowledgment : < br / > - 400 if the artifact is MIME is malformed < br / > - 500 if internal error < br / > - 201 if ok */ @ POST public Response postLicense ( @ Auth final DbCredential credential , final License license ) { } }
if ( ! credential . getRoles ( ) . contains ( AvailableRoles . DATA_UPDATER ) ) { throw new WebApplicationException ( Response . status ( Response . Status . UNAUTHORIZED ) . build ( ) ) ; } LOG . info ( "Got a post license request." ) ; // Checks if the data is corrupted , pattern can be compiled etc . DataValidator . validate ( license ) ; // Save the license final DbLicense dbLicense = getModelMapper ( ) . getDbLicense ( license ) ; // The store method will deal with making sure there are no pattern conflicts // The reason behind this move is the presence of the instance of RepositoryHandler // and the imposibility to access that handler from here . getLicenseHandler ( ) . store ( dbLicense ) ; cacheUtils . clear ( CacheName . PROMOTION_REPORTS ) ; return Response . ok ( ) . status ( HttpStatus . CREATED_201 ) . build ( ) ;
public class AnyLabelReadPartition { /** * Checks the given label can be added / removed to / from a vertex . * @ param label The label to validate . * @ return < code > true < / code > if the label can be assigned to a vertex , otherwise < code > false < / code > . */ @ Override public boolean validateLabel ( String label ) { } }
Objects . requireNonNull ( label , "label cannot be null" ) ; // check label is in set return ! labels . contains ( label ) ;
public class IndexProvider { /** * Validates that if certain default columns are present in the index definition , they have a required type . * @ param context the execution context in which to perform the validation ; never null * @ param defn the proposed index definition ; never null * @ param problems the component to record any problems , errors , or warnings ; may not be null */ public void validateDefaultColumnTypes ( ExecutionContext context , IndexDefinition defn , Problems problems ) { } }
assert defn != null ; for ( int i = 0 ; i < defn . size ( ) ; i ++ ) { validateDefaultColumnDefinitionType ( context , defn , defn . getColumnDefinition ( i ) , problems ) ; }
public class TransformXMLInterceptor { /** * Override paint to perform XML to HTML transformation . * @ param renderContext the renderContext to send the output to . */ @ Override public void paint ( final RenderContext renderContext ) { } }
if ( ! doTransform ) { super . paint ( renderContext ) ; return ; } if ( ! ( renderContext instanceof WebXmlRenderContext ) ) { LOG . warn ( "Unable to transform a " + renderContext ) ; super . paint ( renderContext ) ; return ; } LOG . debug ( "Transform XML Interceptor: Start" ) ; UIContext uic = UIContextHolder . getCurrent ( ) ; // Set up a render context to buffer the XML payload . StringWriter xmlBuffer = new StringWriter ( ) ; PrintWriter xmlWriter = new PrintWriter ( xmlBuffer ) ; WebXmlRenderContext xmlContext = new WebXmlRenderContext ( xmlWriter , uic . getLocale ( ) ) ; super . paint ( xmlContext ) ; // write the XML to the buffer // Get a handle to the true PrintWriter . WebXmlRenderContext webRenderContext = ( WebXmlRenderContext ) renderContext ; PrintWriter writer = webRenderContext . getWriter ( ) ; /* * Switch the response content - type to HTML . * In theory the transformation could be to ANYTHING ( not just HTML ) so perhaps it would make more sense to * write a new interceptor " ContentTypeInterceptor " which attempts to sniff payloads and choose the correct * content - type . This is exactly the kind of thing IE6 loved to do , so perhaps it ' s a bad idea . */ Response response = getResponse ( ) ; response . setContentType ( WebUtilities . CONTENT_TYPE_HTML ) ; String xml = xmlBuffer . toString ( ) ; if ( isAllowCorruptCharacters ( ) && ! Util . empty ( xml ) ) { // Remove illegal HTML characters from the content before transforming it . xml = removeCorruptCharacters ( xml ) ; } // Double encode template tokens in the XML xml = WebUtilities . doubleEncodeBrackets ( xml ) ; // Setup temp writer StringWriter tempBuffer = new StringWriter ( ) ; PrintWriter tempWriter = new PrintWriter ( tempBuffer ) ; // Perform the transformation and write the result . transform ( xml , uic , tempWriter ) ; // Decode Double Encoded Brackets String tempResp = tempBuffer . toString ( ) ; tempResp = WebUtilities . doubleDecodeBrackets ( tempResp ) ; // Write response writer . write ( tempResp ) ; LOG . debug ( "Transform XML Interceptor: Finished" ) ;
public class FormattableDocument { /** * TODO : use org . eclipse . xtext . formatting2 . TextReplacements */ protected String applyTextReplacements ( Iterable < ITextReplacement > replacements ) { } }
ITextSegment region = getRegion ( ) ; String input = region . getText ( ) ; ArrayList < ITextReplacement > list = Lists . newArrayList ( replacements ) ; Collections . sort ( list ) ; int startOffset = region . getOffset ( ) ; int lastOffset = 0 ; StringBuilder result = new StringBuilder ( ) ; for ( ITextReplacement r : list ) { int offset = r . getOffset ( ) - startOffset ; result . append ( input . subSequence ( lastOffset , offset ) ) ; result . append ( r . getReplacementText ( ) ) ; lastOffset = offset + r . getLength ( ) ; } result . append ( input . subSequence ( lastOffset , input . length ( ) ) ) ; return result . toString ( ) ;
public class ConcurrentCompletable { /** * Attempt to add an event listener to the list of listeners . * This implementation uses a spin - lock , where the loop copies the entire list of listeners . * @ return { @ code true } if a task has been queued up , { @ code false } otherwise . */ boolean add ( Runnable runnable ) { } }
int spins = 0 ; RunnablePair entries ; while ( ( entries = callbacks . get ( ) ) != END ) { if ( callbacks . compareAndSet ( entries , new RunnablePair ( runnable , entries ) ) ) { return true ; } if ( spins ++ > MAX_SPINS ) { Thread . yield ( ) ; spins = 0 ; } } return false ;
public class PoolManager { /** * Remove a job */ public synchronized void removeJob ( JobInProgress job ) { } }
if ( getPool ( getPoolName ( job ) ) . removeJob ( job ) ) { return ; } // Job wasn ' t found in this pool . Search for the job in all the pools // ( the pool may have been created after the job started ) . for ( Pool pool : getPools ( ) ) { if ( pool . removeJob ( job ) ) { LOG . info ( "Removed job " + job . jobId + " from pool " + pool . getName ( ) + " instead of pool " + getPoolName ( job ) ) ; return ; } } LOG . error ( "removeJob: Couldn't find job " + job . jobId + " in any pool, should have been in pool " + getPoolName ( job ) ) ;
public class ReverseBuilder { /** * Verifies a matching certificate . * This method executes any of the validation steps in the PKIX path validation * algorithm which were not satisfied via filtering out non - compliant * certificates with certificate matching rules . * If the last certificate is being verified ( the one whose subject * matches the target subject , then the steps in Section 6.1.4 of the * Certification Path Validation algorithm are NOT executed , * regardless of whether or not the last cert is an end - entity * cert or not . This allows callers to certify CA certs as * well as EE certs . * @ param cert the certificate to be verified * @ param currentState the current state against which the cert is verified * @ param certPathList the certPathList generated thus far */ @ Override void verifyCert ( X509Certificate cert , State currState , List < X509Certificate > certPathList ) throws GeneralSecurityException { } }
if ( debug != null ) { debug . println ( "ReverseBuilder.verifyCert(SN: " + Debug . toHexString ( cert . getSerialNumber ( ) ) + "\n Subject: " + cert . getSubjectX500Principal ( ) + ")" ) ; } ReverseState currentState = ( ReverseState ) currState ; /* we don ' t perform any validation of the trusted cert */ if ( currentState . isInitial ( ) ) { return ; } // Don ' t bother to verify untrusted certificate more . currentState . untrustedChecker . check ( cert , Collections . < String > emptySet ( ) ) ; /* * check for looping - abort a loop if * ( ( we encounter the same certificate twice ) AND * ( ( policyMappingInhibited = true ) OR ( no policy mapping * extensions can be found between the occurrences of the same * certificate ) ) ) * in order to facilitate the check to see if there are * any policy mapping extensions found between the occurrences * of the same certificate , we reverse the certpathlist first */ if ( ( certPathList != null ) && ( ! certPathList . isEmpty ( ) ) ) { List < X509Certificate > reverseCertList = new ArrayList < > ( ) ; for ( X509Certificate c : certPathList ) { reverseCertList . add ( 0 , c ) ; } boolean policyMappingFound = false ; for ( X509Certificate cpListCert : reverseCertList ) { X509CertImpl cpListCertImpl = X509CertImpl . toImpl ( cpListCert ) ; PolicyMappingsExtension policyMappingsExt = cpListCertImpl . getPolicyMappingsExtension ( ) ; if ( policyMappingsExt != null ) { policyMappingFound = true ; } if ( debug != null ) debug . println ( "policyMappingFound = " + policyMappingFound ) ; if ( cert . equals ( cpListCert ) ) { if ( ( buildParams . policyMappingInhibited ( ) ) || ( ! policyMappingFound ) ) { if ( debug != null ) debug . println ( "loop detected!!" ) ; throw new CertPathValidatorException ( "loop detected" ) ; } } } } /* check if target cert */ boolean finalCert = cert . getSubjectX500Principal ( ) . equals ( buildParams . targetSubject ( ) ) ; /* check if CA cert */ boolean caCert = ( cert . getBasicConstraints ( ) != - 1 ? true : false ) ; /* if there are more certs to follow , verify certain constraints */ if ( ! finalCert ) { /* check if CA cert */ if ( ! caCert ) throw new CertPathValidatorException ( "cert is NOT a CA cert" ) ; /* If the certificate was not self - issued , verify that * remainingCerts is greater than zero */ if ( ( currentState . remainingCACerts <= 0 ) && ! X509CertImpl . isSelfIssued ( cert ) ) { throw new CertPathValidatorException ( "pathLenConstraint violated, path too long" , null , null , - 1 , PKIXReason . PATH_TOO_LONG ) ; } /* * Check keyUsage extension ( only if CA cert and not final cert ) */ KeyChecker . verifyCAKeyUsage ( cert ) ; } else { /* * If final cert , check that it satisfies specified target * constraints */ if ( targetCertConstraints . match ( cert ) == false ) { throw new CertPathValidatorException ( "target certificate " + "constraints check failed" ) ; } } /* * Check revocation . */ if ( buildParams . revocationEnabled ( ) && currentState . revChecker != null ) { currentState . revChecker . check ( cert , Collections . < String > emptySet ( ) ) ; } /* Check name constraints if this is not a self - issued cert */ if ( finalCert || ! X509CertImpl . isSelfIssued ( cert ) ) { if ( currentState . nc != null ) { try { if ( ! currentState . nc . verify ( cert ) ) { throw new CertPathValidatorException ( "name constraints check failed" , null , null , - 1 , PKIXReason . INVALID_NAME ) ; } } catch ( IOException ioe ) { throw new CertPathValidatorException ( ioe ) ; } } } /* * Check policy */ X509CertImpl certImpl = X509CertImpl . toImpl ( cert ) ; currentState . rootNode = PolicyChecker . processPolicies ( currentState . certIndex , initPolicies , currentState . explicitPolicy , currentState . policyMapping , currentState . inhibitAnyPolicy , buildParams . policyQualifiersRejected ( ) , currentState . rootNode , certImpl , finalCert ) ; /* * Check CRITICAL private extensions */ Set < String > unresolvedCritExts = cert . getCriticalExtensionOIDs ( ) ; if ( unresolvedCritExts == null ) { unresolvedCritExts = Collections . < String > emptySet ( ) ; } /* * Check that the signature algorithm is not disabled . */ currentState . algorithmChecker . check ( cert , unresolvedCritExts ) ; for ( PKIXCertPathChecker checker : currentState . userCheckers ) { checker . check ( cert , unresolvedCritExts ) ; } /* * Look at the remaining extensions and remove any ones we have * already checked . If there are any left , throw an exception ! */ if ( ! unresolvedCritExts . isEmpty ( ) ) { unresolvedCritExts . remove ( BasicConstraints_Id . toString ( ) ) ; unresolvedCritExts . remove ( NameConstraints_Id . toString ( ) ) ; unresolvedCritExts . remove ( CertificatePolicies_Id . toString ( ) ) ; unresolvedCritExts . remove ( PolicyMappings_Id . toString ( ) ) ; unresolvedCritExts . remove ( PolicyConstraints_Id . toString ( ) ) ; unresolvedCritExts . remove ( InhibitAnyPolicy_Id . toString ( ) ) ; unresolvedCritExts . remove ( SubjectAlternativeName_Id . toString ( ) ) ; unresolvedCritExts . remove ( KeyUsage_Id . toString ( ) ) ; unresolvedCritExts . remove ( ExtendedKeyUsage_Id . toString ( ) ) ; if ( ! unresolvedCritExts . isEmpty ( ) ) throw new CertPathValidatorException ( "Unrecognized critical extension(s)" , null , null , - 1 , PKIXReason . UNRECOGNIZED_CRIT_EXT ) ; } /* * Check signature . */ if ( buildParams . sigProvider ( ) != null ) { cert . verify ( currentState . pubKey , buildParams . sigProvider ( ) ) ; } else { cert . verify ( currentState . pubKey ) ; }
public class WebSockets { /** * Sends a complete pong message using blocking IO * @ param data The data to send * @ param wsChannel The web socket channel */ public static void sendPongBlocking ( final ByteBuffer [ ] data , final WebSocketChannel wsChannel ) throws IOException { } }
sendBlockingInternal ( mergeBuffers ( data ) , WebSocketFrameType . PONG , wsChannel ) ;
public class CalendarPanel { /** * labelIndicatorSetColorsToDefaultState , This event is called to set a label indicator to the * state it should have when there is no mouse hovering over it . */ private void labelIndicatorSetColorsToDefaultState ( JLabel label ) { } }
if ( label == null || settings == null ) { return ; } if ( label == labelMonth || label == labelYear ) { label . setBackground ( settings . getColor ( DateArea . BackgroundMonthAndYearMenuLabels ) ) ; monthAndYearInnerPanel . setBackground ( settings . getColor ( DateArea . BackgroundMonthAndYearMenuLabels ) ) ; } if ( label == labelSetDateToToday ) { label . setBackground ( settings . getColor ( DateArea . BackgroundTodayLabel ) ) ; } if ( label == labelClearDate ) { label . setBackground ( settings . getColor ( DateArea . BackgroundClearLabel ) ) ; } label . setBorder ( new CompoundBorder ( new EmptyBorder ( 1 , 1 , 1 , 1 ) , labelIndicatorEmptyBorder ) ) ;
public class GitlabAPI { /** * Creates a group Project * @ param name The name of the project * @ param group The group for which the project should be crated * @ param description The project description * @ param visibility The project visibility level ( private : 0 , internal : 10 , public : 20) * @ return The GitLab Project * @ throws IOException on gitlab api call error */ public GitlabProject createProjectForGroup ( String name , GitlabGroup group , String description , String visibility ) throws IOException { } }
return createProject ( name , group . getId ( ) , description , null , null , null , null , null , null , visibility , null ) ;
public class Rational { /** * Compute Pochhammer ' s symbol ( this ) _ n . * @ param n The number of product terms in the evaluation . * @ return Gamma ( this + n ) / Gamma ( this ) = this * ( this + 1 ) * . . . * ( this + n - 1 ) . */ public Rational Pochhammer ( final BigInteger n ) { } }
if ( n . compareTo ( BigInteger . ZERO ) < 0 ) { return null ; } else if ( n . compareTo ( BigInteger . ZERO ) == 0 ) { return Rational . ONE ; } else { /* initialize results with the current value */ Rational res = new Rational ( a , b ) ; BigInteger i = BigInteger . ONE ; for ( ; i . compareTo ( n ) < 0 ; i = i . add ( BigInteger . ONE ) ) { res = res . multiply ( add ( i ) ) ; } return res ; }
public class ECKey { /** * Create an encrypted private key with the keyCrypter and the AES key supplied . * This method returns a new encrypted key and leaves the original unchanged . * @ param keyCrypter The keyCrypter that specifies exactly how the encrypted bytes are created . * @ param aesKey The KeyParameter with the AES encryption key ( usually constructed with keyCrypter # deriveKey and cached as it is slow to create ) . * @ return encryptedKey */ public ECKey encrypt ( KeyCrypter keyCrypter , KeyParameter aesKey ) throws KeyCrypterException { } }
checkNotNull ( keyCrypter ) ; final byte [ ] privKeyBytes = getPrivKeyBytes ( ) ; EncryptedData encryptedPrivateKey = keyCrypter . encrypt ( privKeyBytes , aesKey ) ; ECKey result = ECKey . fromEncrypted ( encryptedPrivateKey , keyCrypter , getPubKey ( ) ) ; result . setCreationTimeSeconds ( creationTimeSeconds ) ; return result ;
public class HostCandidateHarvester { /** * Finds available addresses that will be used to gather candidates from . * @ return A list of collected addresses . * @ throws HarvestException * If an error occurs while searching for available addresses */ private List < InetAddress > findAddresses ( ) throws HarvestException { } }
// Stores found addresses List < InetAddress > found = new ArrayList < InetAddress > ( 3 ) ; // Retrieve list of available network interfaces Enumeration < NetworkInterface > interfaces = getNetworkInterfaces ( ) ; while ( interfaces . hasMoreElements ( ) ) { NetworkInterface iface = interfaces . nextElement ( ) ; // Evaluate network interface if ( ! useNetworkInterface ( iface ) ) { continue ; } // Retrieve list of available addresses from the network interface Enumeration < InetAddress > addresses = iface . getInetAddresses ( ) ; while ( addresses . hasMoreElements ( ) ) { InetAddress address = addresses . nextElement ( ) ; // loopback addresses are discarded if ( address . isLoopbackAddress ( ) ) { continue ; } // Ignore IPv6 addresses for now if ( address instanceof Inet4Address ) { found . add ( address ) ; } } } return found ;
public class AbstractSpreadSheetDocumentRecordReader { /** * Read truststore for establishing certificate chain for signature validation * @ param conf * @ throws IOException * @ throws FormatNotUnderstoodException */ private void readTrustStore ( Configuration conf ) throws IOException , FormatNotUnderstoodException { } }
if ( ( ( this . hocr . getSigTruststoreFile ( ) != null ) && ( ! "" . equals ( this . hocr . getSigTruststoreFile ( ) ) ) ) ) { LOG . info ( "Reading truststore to validate certificate chain for signatures" ) ; HadoopKeyStoreManager hksm = new HadoopKeyStoreManager ( conf ) ; try { hksm . openKeyStore ( new Path ( this . hocr . getSigTruststoreFile ( ) ) , this . hocr . getSigTruststoreType ( ) , this . hocr . getSigTruststorePassword ( ) ) ; this . hocr . setX509CertificateChain ( hksm . getAllX509Certificates ( ) ) ; } catch ( NoSuchAlgorithmException | CertificateException | KeyStoreException | IllegalArgumentException e ) { LOG . error ( "Cannopt read truststore. Exception: " , e ) ; throw new FormatNotUnderstoodException ( "Cannot read truststore to establish certificate chain for signature validation " + e ) ; } }
public class WebsocketUtil { /** * generics and Undertow ' s dependence on ParameterizedType */ static public MessageHandler . Whole < String > createTextHandler ( final MessageHandler . Whole proxy ) { } }
return new MessageHandler . Whole < String > ( ) { public void onMessage ( String msg ) { proxy . onMessage ( msg ) ; } } ;
public class DatabaseAdminClient { /** * Creates a new Cloud Spanner database and starts to prepare it for serving . The returned * [ long - running operation ] [ google . longrunning . Operation ] will have a name of the format * ` & lt ; database _ name & gt ; / operations / & lt ; operation _ id & gt ; ` and can be used to track preparation of * the database . The [ metadata ] [ google . longrunning . Operation . metadata ] field type is * [ CreateDatabaseMetadata ] [ google . spanner . admin . database . v1 . CreateDatabaseMetadata ] . The * [ response ] [ google . longrunning . Operation . response ] field type is * [ Database ] [ google . spanner . admin . database . v1 . Database ] , if successful . * < p > Sample code : * < pre > < code > * try ( DatabaseAdminClient databaseAdminClient = DatabaseAdminClient . create ( ) ) { * InstanceName parent = InstanceName . of ( " [ PROJECT ] " , " [ INSTANCE ] " ) ; * String createStatement = " " ; * Database response = databaseAdminClient . createDatabaseAsync ( parent , createStatement ) . get ( ) ; * < / code > < / pre > * @ param parent Required . The name of the instance that will serve the new database . Values are * of the form ` projects / & lt ; project & gt ; / instances / & lt ; instance & gt ; ` . * @ param createStatement Required . A ` CREATE DATABASE ` statement , which specifies the ID of the * new database . The database ID must conform to the regular expression * ` [ a - z ] [ a - z0-9 _ \ - ] & # 42 ; [ a - z0-9 ] ` and be between 2 and 30 characters in length . If the * database ID is a reserved word or if it contains a hyphen , the database ID must be enclosed * in backticks ( ` ` ` ` ` ) . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi ( "The surface for long-running operations is not stable yet and may change in the future." ) public final OperationFuture < Database , CreateDatabaseMetadata > createDatabaseAsync ( InstanceName parent , String createStatement ) { } }
CreateDatabaseRequest request = CreateDatabaseRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setCreateStatement ( createStatement ) . build ( ) ; return createDatabaseAsync ( request ) ;
public class ServletRESTRequestWithParams { /** * ( non - Javadoc ) * @ see com . ibm . wsspi . rest . handler . RESTRequest # getPathVariable ( java . lang . String ) */ @ Override public String getPathVariable ( String variable ) { } }
ServletRESTRequestImpl ret = castRequest ( ) ; if ( ret != null ) return ret . getPathVariable ( variable ) ; return null ;
public class FileSystemTileCache { /** * Determines whether a File instance refers to a valid cache directory . * This method checks that { @ code file } refers to a directory to which the current process has read and write * access . If the directory does not exist , it will be created . * @ param file The File instance to examine . This can be null , which will cause the method to return { @ code false } . */ private static boolean isValidCacheDirectory ( File file ) { } }
return ! ( ( file == null ) || ( ! file . exists ( ) && ! file . mkdirs ( ) ) || ! file . isDirectory ( ) || ! file . canRead ( ) || ! file . canWrite ( ) ) ;
public class Whitebox { /** * Invoke a private or inner class static method without the need to specify * the method name . This is thus a more refactor friendly version of the * { @ link # invokeMethod ( Class , String , Object . . . ) } method and is recommend * over this method for that reason . This method might be useful to test * private methods . */ public static synchronized < T > T invokeMethod ( Class < ? > klass , Object ... arguments ) throws Exception { } }
return WhiteboxImpl . invokeMethod ( klass , arguments ) ;
public class ChainedIoHandler { /** * Handles the specified < tt > messageReceived < / tt > event with the * { @ link IoHandlerCommand } or { @ link IoHandlerChain } you specified * in the constructor . */ @ Override public void messageReceived ( IoSession session , Object message ) throws Exception { } }
chain . execute ( null , session , message ) ;
public class JsonOutput { /** * Format a date that is parseable from JavaScript , according to ISO - 8601. * @ param date the date to format to a JSON string * @ return a formatted date in the form of a string */ public static String toJson ( Date date ) { } }
if ( date == null ) { return NULL_VALUE ; } CharBuf buffer = CharBuf . create ( 26 ) ; writeDate ( date , buffer ) ; return buffer . toString ( ) ;
public class AbstractCache { /** * Returns number of documents ( if applicable ) the label was observed in . * @ param word the number of documents the word appeared in * @ return */ @ Override public int docAppearedIn ( String word ) { } }
T element = extendedVocabulary . get ( word ) ; if ( element != null ) { return ( int ) element . getSequencesCount ( ) ; } else return - 1 ;
public class CommandLine { /** * Equivalent to { @ code new CommandLine ( command ) . usage ( out ) } . See { @ link # usage ( PrintStream ) } for details . * @ param command the object annotated with { @ link Command } , { @ link Option } and { @ link Parameters } * @ param out the print stream to print the help message to * @ throws IllegalArgumentException if the specified command object does not have a { @ link Command } , { @ link Option } or { @ link Parameters } annotation */ public static void usage ( Object command , PrintStream out ) { } }
toCommandLine ( command , new DefaultFactory ( ) ) . usage ( out ) ;
public class CPRulePersistenceImpl { /** * Removes all the cp rules where groupId = & # 63 ; from the database . * @ param groupId the group ID */ @ Override public void removeByGroupId ( long groupId ) { } }
for ( CPRule cpRule : findByGroupId ( groupId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( cpRule ) ; }
public class ComplexNumber { /** * Subtract a complex number . * @ param z1 Complex Number . * @ param scalar Scalar value . * @ return Returns new ComplexNumber instance containing the subtract of specified complex number with a scalar value . */ public static ComplexNumber Subtract ( ComplexNumber z1 , double scalar ) { } }
return new ComplexNumber ( z1 . real - scalar , z1 . imaginary ) ;
public class InviteAccountToOrganizationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( InviteAccountToOrganizationRequest inviteAccountToOrganizationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( inviteAccountToOrganizationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( inviteAccountToOrganizationRequest . getTarget ( ) , TARGET_BINDING ) ; protocolMarshaller . marshall ( inviteAccountToOrganizationRequest . getNotes ( ) , NOTES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class WhileyFileParser { /** * Parse a skip statement , which is of the form : * < pre > * SkipStmt : : = " skip " * < / pre > * @ param scope * The enclosing scope for this statement , which determines the * set of visible ( i . e . declared ) variables and also the current * indentation level . * @ see wyc . lang . Stmt . Skip * @ return */ private Stmt . Skip parseSkipStatement ( EnclosingScope scope ) { } }
int start = index ; // Match the break keyword match ( Skip ) ; int end = index ; matchEndLine ( ) ; // Done . return annotateSourceLocation ( new Stmt . Skip ( ) , start , end - 1 ) ;
public class Parser { /** * syck _ new _ parser */ public static Parser newParser ( ) { } }
Parser p = new Parser ( ) ; p . lvl_capa = YAML . ALLOC_CT ; p . levels = new Level [ p . lvl_capa ] ; p . input_type = ParserInput . YAML_UTF8 ; p . io_type = IOType . Str ; p . io = null ; // p . syms = new HashMap < Integer , Object > ( ) ; p . anchors = null ; p . bad_anchors = null ; p . prepared_anchors = null ; p . implicit_typing = true ; p . taguri_expansion = false ; p . bufsize = YAML . BUFFERSIZE ; p . buffer = null ; p . lvl_idx = 0 ; p . resetLevels ( ) ; return p ;
public class XmlFileService { /** * Loads and parses the provided XML file . This will quietly fail ( not throwing an { @ link Exception } ) and return * null if it is unable to parse the provided { @ link XmlFileModel } . A { @ link ClassificationModel } will be created to * indicate that this file failed to parse . * @ return Returns either the parsed { @ link Document } or null if the { @ link Document } could not be parsed */ public Document loadDocumentQuiet ( GraphRewrite event , EvaluationContext context , XmlFileModel model ) { } }
try { return loadDocument ( event , context , model ) ; } catch ( Exception ex ) { return null ; }
public class ApiOvhStore { /** * List partner ' s products * REST : GET / store / partner / { partnerId } / product * @ param partnerId [ required ] Id of the partner * API beta */ public ArrayList < OvhEditResponse > partner_partnerId_product_GET ( String partnerId ) throws IOException { } }
String qPath = "/store/partner/{partnerId}/product" ; StringBuilder sb = path ( qPath , partnerId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t5 ) ;
public class EditManager { /** * Searches for a dlm : edit command which indicates that a node attribute was reset to the value * in the fragment and if found removes it from the user ' s PLF . */ public static void removeEditDirective ( String elementId , String attributeName , IPerson person ) { } }
removeDirective ( elementId , attributeName , Constants . ELM_EDIT , person ) ;
public class AbstractCoalescingBufferQueue { /** * Remove the first { @ link ByteBuf } from the queue . * @ param aggregatePromise used to aggregate the promises and listeners for the returned buffer . * @ return the first { @ link ByteBuf } from the queue . */ public final ByteBuf removeFirst ( ChannelPromise aggregatePromise ) { } }
Object entry = bufAndListenerPairs . poll ( ) ; if ( entry == null ) { return null ; } assert entry instanceof ByteBuf ; ByteBuf result = ( ByteBuf ) entry ; decrementReadableBytes ( result . readableBytes ( ) ) ; entry = bufAndListenerPairs . peek ( ) ; if ( entry instanceof ChannelFutureListener ) { aggregatePromise . addListener ( ( ChannelFutureListener ) entry ) ; bufAndListenerPairs . poll ( ) ; } return result ;
public class HTTPBatchClientConnectionInterceptor { /** * Returns URI instance which will be used as a connection source * @ param intuitRequest * @ return URI * @ throws FMSException */ private URI extractURI ( RequestElements intuitRequest ) throws FMSException { } }
URI uri = null ; try { uri = new URI ( intuitRequest . getRequestParameters ( ) . get ( RequestElements . REQ_PARAM_RESOURCE_URL ) ) ; } catch ( URISyntaxException e ) { throw new FMSException ( "URISyntaxException" , e ) ; } return uri ;
public class ContentStoreManagerImpl { /** * { @ inheritDoc } */ public Map < String , ContentStore > getContentStores ( int maxRetries ) throws ContentStoreException { } }
log . debug ( "getContentStores()" ) ; StorageAccountManager acctManager = getStorageAccounts ( ) ; Map < String , StorageAccount > accounts = acctManager . getStorageAccounts ( ) ; Map < String , ContentStore > contentStores = new HashMap < String , ContentStore > ( ) ; Iterator < String > acctIDs = accounts . keySet ( ) . iterator ( ) ; while ( acctIDs . hasNext ( ) ) { String acctID = acctIDs . next ( ) ; StorageAccount acct = accounts . get ( acctID ) ; contentStores . put ( acctID , newContentStoreImpl ( acct , maxRetries ) ) ; } return contentStores ;
public class RtfDestinationFontTable { /** * / * ( non - Javadoc ) * @ see com . lowagie . text . rtf . parser . destinations . RtfDestination # setParser ( com . lowagie . text . rtf . parser . RtfParser ) * @ since 2.0.8 */ public void setParser ( RtfParser parser ) { } }
if ( this . rtfParser != null && this . rtfParser . equals ( parser ) ) return ; this . rtfParser = parser ; this . init ( true ) ;
public class WordCluster { /** * 将结果保存到文件 * @ param file * @ throws Exception */ public void saveTxt ( String file ) throws Exception { } }
FileOutputStream fos = new FileOutputStream ( file ) ; BufferedWriter bout = new BufferedWriter ( new OutputStreamWriter ( fos , "UTF8" ) ) ; bout . write ( this . toString ( ) ) ; bout . close ( ) ;
public class FSPermissionChecker { /** * Check whether current user have permissions to access the path . * Traverse is always checked . * Parent path means the parent directory for the path . * Ancestor path means the last ( the closest ) existing ancestor directory * of the path . * Note that if the parent path exists , * then the parent path and the ancestor path are the same . * For example , suppose the path is " / foo / bar / baz " . * No matter baz is a file or a directory , * the parent path is " / foo / bar " . * If bar exists , then the ancestor path is also " / foo / bar " . * If bar does not exist and foo exists , * then the ancestor path is " / foo " . * Further , if both foo and bar do not exist , * then the ancestor path is " / " . * @ param doCheckOwner Require user to be the owner of the path ? * @ param ancestorAccess The access required by the ancestor of the path . * @ param parentAccess The access required by the parent of the path . * @ param access The access required by the path . * @ param subAccess If path is a directory , * it is the access required of the path and all the sub - directories . * If path is not a directory , there is no effect . * @ return a PermissionChecker object which caches data for later use . * @ throws AccessControlException */ void checkPermission ( String path , INode [ ] inodes , boolean doCheckOwner , FsAction ancestorAccess , FsAction parentAccess , FsAction access , FsAction subAccess ) throws AccessControlException { } }
if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "ACCESS CHECK: " + this + ", doCheckOwner=" + doCheckOwner + ", ancestorAccess=" + ancestorAccess + ", parentAccess=" + parentAccess + ", access=" + access + ", subAccess=" + subAccess ) ; } int ancestorIndex = inodes . length - 2 ; for ( ; ancestorIndex >= 0 && inodes [ ancestorIndex ] == null ; ancestorIndex -- ) ; checkTraverse ( inodes , ancestorIndex ) ; if ( ancestorAccess != null && inodes . length > 1 ) { check ( inodes , ancestorIndex , ancestorAccess ) ; } if ( parentAccess != null && inodes . length > 1 ) { check ( inodes , inodes . length - 2 , parentAccess ) ; } if ( access != null ) { check ( inodes [ inodes . length - 1 ] , access ) ; } if ( subAccess != null ) { checkSubAccess ( inodes [ inodes . length - 1 ] , subAccess ) ; } if ( doCheckOwner ) { checkOwner ( inodes [ inodes . length - 1 ] ) ; }
public class ContextMatcher { /** * Can be used to setup a different pattern for this context matcher . * This can be used to speed up subsequent matching with the same global * options , since the class network informations will be reused . * @ param pattern */ public void setContextCenter ( Pattern pattern ) { } }
// build up the classgraph printing the relations for all of the // classes that make up the " center " of this context this . pattern = pattern ; matched = new ArrayList < ClassDoc > ( ) ; for ( ClassDoc cd : root . classes ( ) ) { if ( pattern . matcher ( cd . toString ( ) ) . matches ( ) ) { matched . add ( cd ) ; addToGraph ( cd ) ; } }
public class MtasDataItemBasic { /** * ( non - Javadoc ) * @ see mtas . codec . util . DataCollector . MtasDataItem # rewrite ( ) */ @ Override public Map < String , Object > rewrite ( boolean showDebugInfo ) throws IOException { } }
Map < String , Object > response = new HashMap < > ( ) ; for ( String statsItem : getStatsItems ( ) ) { if ( statsItem . equals ( CodecUtil . STATS_TYPE_SUM ) ) { response . put ( statsItem , valueSum ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_N ) ) { response . put ( statsItem , valueN ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_MEAN ) ) { response . put ( statsItem , getValue ( statsItem ) ) ; } else { response . put ( statsItem , null ) ; } } if ( errorNumber > 0 ) { Map < String , Object > errorResponse = new HashMap < String , Object > ( ) ; for ( Entry < String , Integer > entry : getErrorList ( ) . entrySet ( ) ) { errorResponse . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } response . put ( "errorNumber" , errorNumber ) ; response . put ( "errorList" , errorResponse ) ; } if ( showDebugInfo ) { response . put ( "sourceNumber" , sourceNumber ) ; response . put ( "stats" , "basic" ) ; } return response ;
public class PostalAddress { /** * < pre > * Optional . The name of the organization at the address . * < / pre > * < code > string organization = 11 ; < / code > */ public java . lang . String getOrganization ( ) { } }
java . lang . Object ref = organization_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; organization_ = s ; return s ; }
public class CmsPopup { /** * Returns the maximum available height inside the popup . < p > * @ param fixedContentHeight fixed content height to deduct from the available height * @ return the maximum available height */ public int getAvailableHeight ( int fixedContentHeight ) { } }
if ( m_buttonPanel . isVisible ( ) ) { fixedContentHeight += m_buttonPanel . getOffsetHeight ( ) ; } return Window . getClientHeight ( ) - 150 - fixedContentHeight ;
public class CompositeMappingStrategy { /** * Adds a strategy ( at the end of the list ) . * @ param strategy the strategy to add . */ public void addStrategy ( MappingStrategy strategy ) { } }
if ( strategies == null ) { strategies = new ArrayList < > ( ) ; } strategies . add ( strategy ) ;
public class AppointmentCalendarItem { /** * Change the ending time of this service . */ public Date setEndDate ( Date time ) { } }
try { this . getTable ( ) . edit ( ) ; this . getField ( "EndDateTime" ) . setData ( time ) ; this . getTable ( ) . set ( this ) ; this . getTable ( ) . seek ( null ) ; // Read this record } catch ( Exception ex ) { ex . printStackTrace ( ) ; } return this . getEndDate ( ) ;
public class CmsObject { /** * Returns a list of child resources to the given resource that can not be locked by the current user . < p > * @ param resource the resource * @ return a list of child resources to the given resource that can not be locked by the current user * @ throws CmsException if something goes wrong reading the resources */ public List < CmsResource > getBlockingLockedResources ( CmsResource resource ) throws CmsException { } }
if ( resource . isFolder ( ) ) { CmsLockFilter blockingFilter = CmsLockFilter . FILTER_ALL ; blockingFilter = blockingFilter . filterNotLockableByUser ( getRequestContext ( ) . getCurrentUser ( ) ) ; return getLockedResources ( resource , blockingFilter ) ; } return Collections . < CmsResource > emptyList ( ) ;
public class ModifyBeanHelper { /** * Builds the javadoc . * @ param methodBuilder * the method builder * @ param updateMode * the update mode * @ param method * the method * @ param beanNameParameter * the bean name parameter * @ param whereCondition * the where condition * @ param listUsedProperty * the list used property * @ param attributesUsedInWhereConditions * the attributes used in where conditions * @ return the string */ public String buildJavadoc ( MethodSpec . Builder methodBuilder , boolean updateMode , final SQLiteModelMethod method , String beanNameParameter , String whereCondition , List < SQLProperty > listUsedProperty , List < String > attributesUsedInWhereConditions ) { } }
// SQLDaoDefinition daoDefinition = method . getParent ( ) ; // SQLEntity entity = daoDefinition . getEntity ( ) ; // in this case , only one parameter can exists for method Pair < String , TypeName > beanParameter = method . getParameters ( ) . get ( 0 ) ; String sqlResult ; // generate javadoc StringBuilder buffer = new StringBuilder ( ) ; StringBuilder bufferQuestion = new StringBuilder ( ) ; String separator = "" ; for ( SQLProperty property : listUsedProperty ) { // this line genearate only : { attribute } buffer . append ( String . format ( "%s%s=" + SqlAnalyzer . PARAM_PREFIX + "%s" + SqlAnalyzer . PARAM_SUFFIX , separator , property . columnName , property . getName ( ) ) ) ; bufferQuestion . append ( separator ) ; bufferQuestion . append ( property . columnName + "=" ) ; bufferQuestion . append ( "'\"+StringUtils.checkSize(_contentValues.get(\"" + property . columnName + "\"))+\"'" ) ; separator = ", " ; } String sqlForJavaDoc = extractSQLForJavaDoc ( method ) ; sqlResult = method . jql . value ; if ( updateMode ) { // query methodBuilder . addJavadoc ( "<h2>SQL update</h2>\n" ) ; methodBuilder . addJavadoc ( "<pre>$L</pre>" , sqlForJavaDoc ) ; methodBuilder . addJavadoc ( "\n\n" ) ; // list of updated fields // Set < String > // updateColumns = JQLChecker . getInstance ( ) . extractColumnsToUpdate ( method . jql . value , // entity ) ; methodBuilder . addJavadoc ( "<h2>Updated columns</h2>\n" ) ; methodBuilder . addJavadoc ( "<dl>\n" ) ; for ( SQLProperty property : listUsedProperty ) { String resolvedName = method . findParameterAliasByName ( beanParameter . value0 ) ; methodBuilder . addJavadoc ( "\t<dt>$L</dt><dd>is mapped to <strong>$L</strong></dd>\n" , property . columnName , SqlAnalyzer . PARAM_PREFIX + resolvedName + "." + property . getName ( ) + SqlAnalyzer . PARAM_SUFFIX ) ; } methodBuilder . addJavadoc ( "</dl>" ) ; methodBuilder . addJavadoc ( "\n\n" ) ; } else { // String where = // SqlUtility . replaceParametersWithQuestion ( whereCondition , " % s " ) ; // sqlResult = String . format ( " DELETE % s % s " , // daoDefinition . getEntity ( ) . getTableName ( ) , where ) ; methodBuilder . addJavadoc ( "<h2>SQL delete:</h2>\n" ) ; methodBuilder . addJavadoc ( "<pre>" ) ; // methodBuilder . addJavadoc ( " DELETE $ L $ L " , // daoDefinition . getEntity ( ) . getTableName ( ) , whereCondition ) ; methodBuilder . addJavadoc ( "$L" , sqlForJavaDoc ) ; methodBuilder . addJavadoc ( "</pre>" ) ; methodBuilder . addJavadoc ( "\n\n" ) ; } if ( attributesUsedInWhereConditions . size ( ) > 0 ) { // list of attributes used in where condition methodBuilder . addJavadoc ( "<h2>Parameters used in where conditions:</h2>\n" ) ; methodBuilder . addJavadoc ( "<dl>\n" ) ; for ( String attribute : attributesUsedInWhereConditions ) { methodBuilder . addJavadoc ( "\t<dt>$L</dt>" , SqlAnalyzer . PARAM_PREFIX + method . findParameterAliasByName ( beanParameter . value0 ) + "." + method . findParameterAliasByName ( attribute ) + SqlAnalyzer . PARAM_SUFFIX ) ; methodBuilder . addJavadoc ( "<dd>is mapped to method's parameter <strong>$L.$L</strong></dd>\n" , beanParameter . value0 , attribute ) ; } methodBuilder . addJavadoc ( "</dl>" ) ; methodBuilder . addJavadoc ( "\n\n" ) ; } // dynamic conditions if ( method . hasDynamicWhereConditions ( ) ) { methodBuilder . addJavadoc ( "<h2>Method's parameters and associated dynamic parts:</h2>\n" ) ; methodBuilder . addJavadoc ( "<dl>\n" ) ; if ( method . hasDynamicWhereConditions ( ) ) { methodBuilder . addJavadoc ( "<dt>$L</dt><dd>is part of where conditions resolved at runtime. In above SQL it is displayed as #{$L}</dd>" , method . dynamicWhereParameterName , JQLDynamicStatementType . DYNAMIC_WHERE ) ; } methodBuilder . addJavadoc ( "\n</dl>" ) ; methodBuilder . addJavadoc ( "\n\n" ) ; } // method parameters // update bean have only one parameter : the bean to update for ( Pair < String , TypeName > param : method . getParameters ( ) ) { methodBuilder . addJavadoc ( "@param $L" , param . value0 ) ; if ( method . isThisDynamicWhereConditionsName ( param . value0 ) ) { methodBuilder . addJavadoc ( "\n\tis used as dynamic where conditions\n" ) ; } else { methodBuilder . addJavadoc ( "\n\tis used as <code>$L</code>\n" , SqlAnalyzer . PARAM_PREFIX + method . findParameterAliasByName ( param . value0 ) + SqlAnalyzer . PARAM_SUFFIX ) ; } } return sqlResult ;
public class TcasesOpenApi { /** * Returns a { @ link SystemInputDef system input definition } for the API requests defined by the given * OpenAPI specification . Returns null if the given spec defines no API requests to model . */ public static SystemInputDef getRequestInputModel ( OpenAPI api , ModelOptions options ) { } }
RequestInputModeller inputModeller = new RequestInputModeller ( options ) ; return inputModeller . getRequestInputModel ( api ) ;
public class IntentIntegrator { /** * Shares the given text by encoding it as a barcode , such that another user can * scan the text off the screen of the device . * @ param text the text string to encode as a barcode * @ param type type of data to encode . See { @ code com . google . zxing . client . android . Contents . Type } constants . * @ return the { @ link AlertDialog } that was shown to the user prompting them to download the app * if a prompt was needed , or null otherwise */ public final AlertDialog shareText ( CharSequence text , CharSequence type ) { } }
Intent intent = new Intent ( ) ; intent . addCategory ( Intent . CATEGORY_DEFAULT ) ; intent . setAction ( BS_PACKAGE + ".ENCODE" ) ; intent . putExtra ( "ENCODE_TYPE" , type ) ; intent . putExtra ( "ENCODE_DATA" , text ) ; String targetAppPackage = findTargetAppPackage ( intent ) ; if ( targetAppPackage == null ) { return showDownloadDialog ( ) ; } intent . setPackage ( targetAppPackage ) ; intent . addFlags ( Intent . FLAG_ACTIVITY_CLEAR_TOP ) ; intent . addFlags ( FLAG_NEW_DOC ) ; attachMoreExtras ( intent ) ; if ( fragment == null ) { activity . startActivity ( intent ) ; } else { fragment . startActivity ( intent ) ; } return null ;
public class lbmetrictable { /** * Use this API to fetch lbmetrictable resource of given name . */ public static lbmetrictable get ( nitro_service service , String metrictable ) throws Exception { } }
lbmetrictable obj = new lbmetrictable ( ) ; obj . set_metrictable ( metrictable ) ; lbmetrictable response = ( lbmetrictable ) obj . get_resource ( service ) ; return response ;
public class CmsFlexCacheEntry { /** * Completes this cache entry . < p > * A completed cache entry is made " unmodifiable " , * so that no further data can be added and existing data can not be changed . < p > * This is to prevent the ( unlikely ) case that some user - written class * tries to make changes to a cache entry . < p > */ public void complete ( ) { } }
m_completed = true ; // Prevent changing of the cached lists if ( m_headers != null ) { m_headers = Collections . unmodifiableMap ( m_headers ) ; } if ( m_elements != null ) { m_elements = Collections . unmodifiableList ( m_elements ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_FLEXCACHEENTRY_ENTRY_COMPLETED_1 , toString ( ) ) ) ; }
public class AwsSecurityFindingFilters { /** * This is the identifier for the solution - specific component ( a discrete unit of logic ) that generated a finding . * In various security findings provider ' s solutions , this generator can be called a rule , a check , a detector , a * plug - in , etc . * @ param generatorId * This is the identifier for the solution - specific component ( a discrete unit of logic ) that generated a * finding . In various security findings provider ' s solutions , this generator can be called a rule , a check , * a detector , a plug - in , etc . */ public void setGeneratorId ( java . util . Collection < StringFilter > generatorId ) { } }
if ( generatorId == null ) { this . generatorId = null ; return ; } this . generatorId = new java . util . ArrayList < StringFilter > ( generatorId ) ;
public class IfcPolygonalFaceSetImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcIndexedPolygonalFace > getFaces ( ) { } }
return ( EList < IfcIndexedPolygonalFace > ) eGet ( Ifc4Package . Literals . IFC_POLYGONAL_FACE_SET__FACES , true ) ;
public class Storer { /** * Loads regression data . */ public final Set < RegData > load ( String dirName , String className , String methodName ) { } }
String fullName = className + '.' + methodName ; return load ( openFileRead ( dirName , fullName , className , methodName ) ) ;
public class SessionImpl { /** * { @ inheritDoc } */ public void logout ( ) { } }
for ( int i = 0 , length = lifecycleListeners . size ( ) ; i < length ; i ++ ) { lifecycleListeners . get ( i ) . onCloseSession ( this ) ; } this . sessionRegistry . unregisterSession ( getId ( ) ) ; this . live = false ; if ( ! ALLOW_CLOSED_SESSION_USAGE && PropertyManager . isDevelopping ( ) ) { this . closedByCallStack = new Exception ( "The session has been closed by the following call stack" ) ; }
public class Main { /** * Java function to compute the sum of the cubes of first num odd natural numbers . */ public static int sumOfOddCubes ( int num ) { } public static void main ( String [ ] args ) { System . out . println ( sumOfOddCubes ( 2 ) ) ; // Output : 28 System . out . println ( sumOfOddCubes ( 3 ) ) ; // Output : 153 System . out . println ( sumOfOddCubes ( 4 ) ) ; // Output : 496 } }
int total = 0 ; for ( int index = 0 ; index < num ; index ++ ) { total += Math . pow ( ( 2 * index + 1 ) , 3 ) ; } return total ;
public class TypeMetadata { /** * Return a copy of this TypeMetadata with the metadata entry for { @ code elem . kind ( ) } combined * with { @ code elem } . * @ param elem the new value * @ return a new TypeMetadata updated with { @ code Entry elem } */ public TypeMetadata combine ( Entry elem ) { } }
Assert . checkNonNull ( elem ) ; TypeMetadata out = new TypeMetadata ( this ) ; Entry . Kind key = elem . kind ( ) ; if ( contents . containsKey ( key ) ) { out . add ( key , this . contents . get ( key ) . combine ( elem ) ) ; } else { out . add ( key , elem ) ; } return out ;
public class DelegateView { /** * Gets the name of delegate * @ return the name . It may not be a name of a Class ! */ public String getDelegateName ( ) { } }
javax . swing . text . Element data = getElement ( ) ; if ( data instanceof DelegateElement ) { return ( ( DelegateElement ) data ) . getDelegateName ( ) ; } return null ;
public class WSJobRepositoryImpl { /** * { @ inheritDoc } */ @ Override public WSJobExecution getMostRecentJobExecutionFromInstance ( long instanceId ) throws NoSuchJobInstanceException , JobSecurityException { } }
return persistenceManagerService . getJobExecutionMostRecent ( authorizedInstanceRead ( instanceId ) ) ;
public class SoyNodeCompiler { /** * Given this delcall : { @ code { delcall foo . bar variant = " $ expr " allowemptydefault = " true " } } * < p > Generate code that looks like : * < pre > { @ code * renderContext . getDeltemplate ( " foo . bar " , < variant - expression > , true ) * . create ( < prepareParameters > , ijParams ) * . render ( appendable , renderContext ) * } < / pre > * < p > We share logic with { @ link # visitCallBasicNode ( CallBasicNode ) } around the actual calling * convention ( setting up detaches , storing the template in a field ) . As well as the logic for * preparing the data record . The only interesting part of delcalls is calculating the { @ code * variant } and the fact that we have to invoke the { @ link RenderContext } runtime to do the * deltemplate lookup . */ @ Override protected Statement visitCallDelegateNode ( CallDelegateNode node ) { } }
Label reattachPoint = new Label ( ) ; Expression variantExpr ; if ( node . getDelCalleeVariantExpr ( ) == null ) { variantExpr = constant ( "" ) ; } else { variantExpr = exprCompiler . compile ( node . getDelCalleeVariantExpr ( ) , reattachPoint ) . coerceToString ( ) ; } Expression calleeExpression = parameterLookup . getRenderContext ( ) . getDeltemplate ( node . getDelCalleeName ( ) , variantExpr , node . allowEmptyDefault ( ) , prepareParamsHelper ( node , reattachPoint ) , parameterLookup . getIjRecord ( ) ) ; return renderCallNode ( reattachPoint , node , calleeExpression ) ;
public class SnapshotUtil { /** * Do parameter checking for the pre - JSON version of @ SnapshotRestore old version */ public static ClientResponseImpl transformRestoreParamsToJSON ( StoredProcedureInvocation task ) { } }
Object params [ ] = task . getParams ( ) . toArray ( ) ; if ( params . length == 1 ) { try { JSONObject jsObj = new JSONObject ( ( String ) params [ 0 ] ) ; String path = jsObj . optString ( JSON_PATH ) ; String dupPath = jsObj . optString ( JSON_DUPLICATES_PATH ) ; if ( ! path . isEmpty ( ) && dupPath . isEmpty ( ) ) { jsObj . put ( JSON_DUPLICATES_PATH , path ) ; } task . setParams ( jsObj . toString ( ) ) ; } catch ( JSONException e ) { Throwables . propagate ( e ) ; } return null ; } else if ( params . length == 2 ) { if ( params [ 0 ] == null ) { return new ClientResponseImpl ( ClientResponseImpl . GRACEFUL_FAILURE , new VoltTable [ 0 ] , "@SnapshotRestore parameter 0 was null" , task . getClientHandle ( ) ) ; } if ( params [ 1 ] == null ) { return new ClientResponseImpl ( ClientResponseImpl . GRACEFUL_FAILURE , new VoltTable [ 0 ] , "@SnapshotRestore parameter 1 was null" , task . getClientHandle ( ) ) ; } if ( ! ( params [ 0 ] instanceof String ) ) { return new ClientResponseImpl ( ClientResponseImpl . GRACEFUL_FAILURE , new VoltTable [ 0 ] , "@SnapshotRestore param 0 (path) needs to be a string, but was type " + params [ 0 ] . getClass ( ) . getSimpleName ( ) , task . getClientHandle ( ) ) ; } if ( ! ( params [ 1 ] instanceof String ) ) { return new ClientResponseImpl ( ClientResponseImpl . GRACEFUL_FAILURE , new VoltTable [ 0 ] , "@SnapshotRestore param 1 (nonce) needs to be a string, but was type " + params [ 1 ] . getClass ( ) . getSimpleName ( ) , task . getClientHandle ( ) ) ; } JSONObject jsObj = new JSONObject ( ) ; try { jsObj . put ( SnapshotUtil . JSON_PATH , params [ 0 ] ) ; if ( VoltDB . instance ( ) . isRunningWithOldVerbs ( ) ) { jsObj . put ( SnapshotUtil . JSON_PATH_TYPE , SnapshotPathType . SNAP_PATH ) ; } jsObj . put ( SnapshotUtil . JSON_NONCE , params [ 1 ] ) ; jsObj . put ( SnapshotUtil . JSON_DUPLICATES_PATH , params [ 0 ] ) ; } catch ( JSONException e ) { Throwables . propagate ( e ) ; } task . setParams ( jsObj . toString ( ) ) ; return null ; } else { return new ClientResponseImpl ( ClientResponseImpl . GRACEFUL_FAILURE , new VoltTable [ 0 ] , "@SnapshotRestore supports a single json document parameter or two parameters (path, nonce), " + params . length + " parameters provided" , task . getClientHandle ( ) ) ; }
public class TypeaheadDataset { /** * The key used to access the value of the datum in the datum object . Defaults * to < code > value < / code > . * @ param sValueKey * The name of the value key in the typeahead datum . May neither be * < code > null < / code > nor empty . * @ return this */ @ Nonnull public TypeaheadDataset setValueKey ( @ Nonnull @ Nonempty final String sValueKey ) { } }
ValueEnforcer . notEmpty ( sValueKey , "ValueKey" ) ; m_sValueKey = sValueKey ; return this ;
public class ExpressionParameterTypeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case BpsimPackage . EXPRESSION_PARAMETER_TYPE__VALUE : setValue ( VALUE_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ;
public class PrcEntityFSave { /** * < p > Process entity request . < / p > * @ param pAddParam additional param , e . g . return this line ' s * document in " nextEntity " for farther process * @ param pRequestData Request Data * @ param pEntity Entity to process * @ return Entity processed for farther process or null * @ throws Exception - an exception */ @ Override public final T process ( final Map < String , Object > pAddParam , final T pEntity , final IRequestData pRequestData ) throws Exception { } }
String fileToUploadName = ( String ) pRequestData . getAttribute ( "fileToUploadName" ) ; String fieldNameFilePath = pRequestData . getParameter ( "fieldNameFilePath" ) ; String fieldNameFileName = pRequestData . getParameter ( "fieldNameFileName" ) ; if ( fieldNameFileName != null ) { Method setterFileName = this . settersRapiHolder . getFor ( pEntity . getClass ( ) , fieldNameFileName ) ; if ( fileToUploadName != null ) { setterFileName . invoke ( pEntity , fileToUploadName ) ; } else { // either uploaded path or null Method getFpn = this . gettersRapiHolder . getFor ( pEntity . getClass ( ) , fieldNameFilePath ) ; String pth = ( String ) getFpn . invoke ( pEntity ) ; if ( pth == null || "" . equals ( pth ) ) { setterFileName . invoke ( pEntity , null ) ; } else { // uploaded URL separator is always " / " int idxs = pth . lastIndexOf ( "/" ) ; if ( idxs > 1 ) { setterFileName . invoke ( pEntity , pth . substring ( idxs + 1 ) ) ; } else { setterFileName . invoke ( pEntity , pth ) ; } } } } if ( fileToUploadName != null ) { OutputStream outs = null ; InputStream ins = null ; try { // fill file and filePath field : String ft = String . valueOf ( new Date ( ) . getTime ( ) ) ; String filePath = this . webAppPath + File . separator + this . uploadDirectory + File . separator + ft + fileToUploadName ; ins = ( InputStream ) pRequestData . getAttribute ( "fileToUploadInputStream" ) ; outs = new BufferedOutputStream ( new FileOutputStream ( filePath ) ) ; byte [ ] data = new byte [ 1024 ] ; int count ; while ( ( count = ins . read ( data ) ) != - 1 ) { outs . write ( data , 0 , count ) ; } outs . flush ( ) ; Method setterFieldPath = this . settersRapiHolder . getFor ( pEntity . getClass ( ) , fieldNameFilePath ) ; setterFieldPath . invoke ( pEntity , filePath ) ; String fieldNameFileUrl = pRequestData . getParameter ( "fieldNameFileUrl" ) ; if ( fieldNameFileUrl != null ) { Method setterFileUrl = this . settersRapiHolder . getFor ( pEntity . getClass ( ) , fieldNameFileUrl ) ; setterFileUrl . invoke ( pEntity , this . uploadDirectory + "/" + ft + fileToUploadName ) ; } } finally { if ( ins != null ) { ins . close ( ) ; } if ( outs != null ) { outs . close ( ) ; } } } // else NULL or uploaded if ( pEntity . getIsNew ( ) ) { this . srvOrm . insertEntity ( pAddParam , pEntity ) ; pEntity . setIsNew ( false ) ; } else { this . srvOrm . updateEntity ( pAddParam , pEntity ) ; } return pEntity ;
public class HostStorageSystem { /** * SDK4.0 signature */ public void updateInternetScsiAuthenticationProperties ( String iScsiHbaDevice , HostInternetScsiHbaAuthenticationProperties authenticationProperties , HostInternetScsiHbaTargetSet targetSet ) throws HostConfigFault , NotFound , RuntimeFault , RemoteException { } }
getVimService ( ) . updateInternetScsiAuthenticationProperties ( getMOR ( ) , iScsiHbaDevice , authenticationProperties , targetSet ) ;
public class JSPostProcessorChainFactory { /** * ( non - Javadoc ) * @ see net . jawr . web . resource . bundle . factory . postprocessor . * AbstractPostProcessorChainFactory # getCustomProcessorWrapper ( net . jawr . web . * resource . bundle . postprocess . ResourceBundlePostProcessor , * java . lang . String ) */ @ Override protected ChainedResourceBundlePostProcessor getCustomProcessorWrapper ( ResourceBundlePostProcessor customProcessor , String key , boolean isVariantPostProcessor ) { } }
return new CustomJsPostProcessorChainWrapper ( key , customProcessor , isVariantPostProcessor ) ;
public class HeatChart { /** * Draws the x - axis label string if it is not null . */ private void drawXLabel ( Graphics2D chartGraphics ) { } }
if ( xAxisLabel != null ) { // Strings are drawn from the baseline position of the leftmost char . int yPosXAxisLabel = chartSize . height - ( margin / 2 ) - xAxisLabelDescent ; // TODO This will need to be updated if the y - axis values / label can be moved to the right . int xPosXAxisLabel = heatMapC . x - ( xAxisLabelSize . width / 2 ) ; chartGraphics . setFont ( axisLabelsFont ) ; chartGraphics . setColor ( axisLabelColour ) ; chartGraphics . drawString ( xAxisLabel , xPosXAxisLabel , yPosXAxisLabel ) ; }
public class ExternalContextAccessSkill { /** * Replies the InternalEventBusCapacity skill as fast as possible . * @ return the skill */ protected final InternalEventBusCapacity getInternalEventBusCapacitySkill ( ) { } }
if ( this . skillBufferInternalEventBusCapacity == null || this . skillBufferInternalEventBusCapacity . get ( ) == null ) { this . skillBufferInternalEventBusCapacity = $getSkill ( InternalEventBusCapacity . class ) ; } return $castSkill ( InternalEventBusCapacity . class , this . skillBufferInternalEventBusCapacity ) ;
public class JaxWsHttpServletRequestAdapter { /** * ( non - Javadoc ) * @ see javax . servlet . http . HttpServletRequest # getContextPath ( ) */ @ Override public String getContextPath ( ) { } }
try { collaborator . preInvoke ( componentMetaData ) ; return request . getContextPath ( ) ; } finally { collaborator . postInvoke ( ) ; }
public class GrailsDomainBinder { /** * Binds a simple value to the Hibernate metamodel . A simple value is * any type within the Hibernate type system * @ param property * @ param parentProperty * @ param simpleValue The simple value to bind * @ param path * @ param mappings The Hibernate mappings instance * @ param sessionFactoryBeanName the session factory bean name */ protected void bindSimpleValue ( PersistentProperty property , PersistentProperty parentProperty , SimpleValue simpleValue , String path , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { } }
// set type bindSimpleValue ( property , parentProperty , simpleValue , path , getPropertyConfig ( property ) , sessionFactoryBeanName ) ;
public class Range { /** * Obtains a range using the specified element as both the minimum and maximum in this range . * The range uses the natural ordering of the elements to determine where values lie in the range . * @ param < T > * the type of the elements in this range * @ param element * the value to use for this range , not null * @ return the range object , not null * @ throws IllegalArgumentException if the element is null */ public static < T extends Comparable < T > > Range < T > just ( final T element ) { } }
return closed ( element , element ) ;
public class PrefHelper { /** * < p > Singleton method to return the pre - initialised , or newly initialise and return , a singleton * object of the type { @ link PrefHelper } . < / p > * @ param context The { @ link Context } within which the object should be instantiated ; this * parameter is passed to the private { @ link # PrefHelper ( Context ) } * constructor method . * @ return A { @ link PrefHelper } object instance . */ public static PrefHelper getInstance ( Context context ) { } }
if ( prefHelper_ == null ) { prefHelper_ = new PrefHelper ( context ) ; } return prefHelper_ ;
public class AWSGlueClient { /** * Retrieves the definitions of some or all of the tables in a given < code > Database < / code > . * @ param getTablesRequest * @ return Result of the GetTables operation returned by the service . * @ throws EntityNotFoundException * A specified entity does not exist * @ throws InvalidInputException * The input provided was not valid . * @ throws OperationTimeoutException * The operation timed out . * @ throws InternalServiceException * An internal service error occurred . * @ throws GlueEncryptionException * An encryption operation failed . * @ sample AWSGlue . GetTables * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / glue - 2017-03-31 / GetTables " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetTablesResult getTables ( GetTablesRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetTables ( request ) ;
public class ModelMapper { /** * Maps { @ code source } to { @ code destination } . Mapping is performed according to the corresponding * TypeMap for the { @ code typeMapName } . If no TypeMap exists for the { @ code source . getClass ( ) } , * { @ code destination . getClass ( ) } and { @ code typeMapName } then one is created . * @ param source object to map from * @ param destination object to map to * @ param typeMapName name of existing TypeMap to use mappings from * @ throws IllegalArgumentException if { @ code source } , { @ code destination } or { @ code typeMapName } * are null * @ throws ConfigurationException if the ModelMapper cannot find or create a TypeMap for the * arguments * @ throws MappingException if an error occurs while mapping */ public void map ( Object source , Object destination , String typeMapName ) { } }
Assert . notNull ( source , "source" ) ; Assert . notNull ( destination , "destination" ) ; Assert . notNull ( typeMapName , "typeMapName" ) ; mapInternal ( source , destination , null , typeMapName ) ;
public class QueryWhere { /** * group management */ public void newGroup ( ) { } }
// create parent QueryCriteria newCriteriaGroupParent = new QueryCriteria ( this . union ) ; addCriteria ( newCriteriaGroupParent ) ; // add parent to parent stack ancestry . push ( currentParent ) ; currentParent = newCriteriaGroupParent ; // set group criteria list to new list currentCriteria = newCriteriaGroupParent . getCriteria ( ) ;
public class AsyncCircuitBreaker { /** * Wrap the given service call with the { @ link AsyncCircuitBreaker } protection logic . * @ param callable the { @ link java . util . concurrent . Callable } to attempt * @ param < T > The result of a future call * @ return { @ link ListenableFuture } of whatever callable would return * @ throws org . fishwife . jrugged . CircuitBreakerException if the * breaker was OPEN or HALF _ CLOSED and this attempt wasn ' t the * reset attempt * @ throws Exception if the { @ link org . fishwife . jrugged . CircuitBreaker } is in OPEN state */ public < T > ListenableFuture < T > invokeAsync ( Callable < ListenableFuture < T > > callable ) throws Exception { } }
final SettableListenableFuture < T > response = new SettableListenableFuture < T > ( ) ; ListenableFutureCallback < T > callback = new ListenableFutureCallback < T > ( ) { @ Override public void onSuccess ( T result ) { close ( ) ; response . set ( result ) ; } @ Override public void onFailure ( Throwable ex ) { try { handleFailure ( ex ) ; } catch ( Exception e ) { response . setException ( e ) ; } } } ; if ( ! byPass ) { if ( ! allowRequest ( ) ) { throw mapException ( new CircuitBreakerException ( ) ) ; } try { isAttemptLive = true ; callable . call ( ) . addCallback ( callback ) ; return response ; } catch ( Throwable cause ) { // This shouldn ' t happen because Throwables are handled in the async onFailure callback handleFailure ( cause ) ; } throw new IllegalStateException ( "not possible" ) ; } else { callable . call ( ) . addCallback ( callback ) ; return response ; }
public class SslContext { /** * Creates a new server - side { @ link SslContext } . * @ param certChainFile an X . 509 certificate chain file in PEM format * @ param keyFile a PKCS # 8 private key file in PEM format * @ return a new server - side { @ link SslContext } * @ deprecated Replaced by { @ link SslContextBuilder } */ @ Deprecated public static SslContext newServerContext ( File certChainFile , File keyFile ) throws SSLException { } }
return newServerContext ( certChainFile , keyFile , null ) ;
public class PredictionsImpl { /** * Gets predictions for a given utterance , in the form of intents and entities . The current maximum query size is 500 characters . * @ param appId The LUIS application ID ( Guid ) . * @ param query The utterance to predict . * @ param timezoneOffset The timezone offset for the location of the request . * @ param verbose If true , return all intents instead of just the top scoring intent . * @ param staging Use the staging endpoint slot . * @ param spellCheck Enable spell checking . * @ param bingSpellCheckSubscriptionKey The subscription key to use when enabling bing spell check * @ param log Log query ( default is true ) * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the LuisResult object */ public Observable < ServiceResponse < LuisResult > > resolveWithServiceResponseAsync ( String appId , String query , Double timezoneOffset , Boolean verbose , Boolean staging , Boolean spellCheck , String bingSpellCheckSubscriptionKey , Boolean log ) { } }
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( query == null ) { throw new IllegalArgumentException ( "Parameter query is required and cannot be null." ) ; } String parameterizedHost = Joiner . on ( ", " ) . join ( "{endpoint}" , this . client . endpoint ( ) ) ; return service . resolve ( appId , query , timezoneOffset , verbose , staging , spellCheck , bingSpellCheckSubscriptionKey , log , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < LuisResult > > > ( ) { @ Override public Observable < ServiceResponse < LuisResult > > call ( Response < ResponseBody > response ) { try { ServiceResponse < LuisResult > clientResponse = resolveDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class AllTimeReader { /** * Make the request to the Twilio API to perform the read . * @ param client TwilioRestClient with which to make the request * @ return AllTime ResourceSet */ @ Override public ResourceSet < AllTime > read ( final TwilioRestClient client ) { } }
return new ResourceSet < > ( this , client , firstPage ( client ) ) ;
public class Consumers { /** * Yields element at ( 0 - based ) position of the iterable if found or nothing . * @ param < E > the iterable element type * @ param index the element index * @ param iterable the iterable that will be consumed * @ return just the element or nothing */ public static < E > Optional < E > maybeAt ( long index , Iterable < E > iterable ) { } }
dbc . precondition ( iterable != null , "cannot call maybeAt with a null iterable" ) ; final Iterator < E > filtered = new FilteringIterator < E > ( iterable . iterator ( ) , new AtIndex < E > ( index ) ) ; return new MaybeFirstElement < E > ( ) . apply ( filtered ) ;
public class TracerFactory { /** * Reads the given configuration file , validates it against a XML - Schema and creates the tracer pool , its mappings and the queue accordingly . * This method should normally be invoked once at program start . Multiple calls with the same configuration file leads to instantiations of new tracer objects * and mappings which will replace the old tracers and their mappings . * @ param configFile the configuration file * @ throws TracerFactory . Exception indicates a configuration problem * @ throws FileNotFoundException indicates a missing configuration file */ public void readConfiguration ( File configFile ) throws TracerFactory . Exception , FileNotFoundException { } }
if ( ! configFile . exists ( ) ) throw new FileNotFoundException ( configFile + "doesn't exist." ) ; try ( FileInputStream fileInputStream = new FileInputStream ( configFile ) ) { readConfiguration ( fileInputStream ) ; } catch ( IOException ex ) { ex . printStackTrace ( System . err ) ; }
public class ClientNetworkConfig { /** * required for spring module */ public ClientNetworkConfig setAddresses ( List < String > addresses ) { } }
isNotNull ( addresses , "addresses" ) ; addressList . clear ( ) ; addressList . addAll ( addresses ) ; return this ;
public class NokiaStoreHelper { /** * Initiate the UI flow for an in - app purchase . Call this method to initiate an in - app purchase , * which will involve bringing up the Nokia Store screen . The calling activity will be paused while * the user interacts with Nokia Store , and the result will be delivered via the activity ' s * { @ link android . app . Activity # onActivityResult } method , at which point you must call * this object ' s { @ link # handleActivityResult } method to continue the purchase flow . This method * MUST be called from the UI thread of the Activity . * @ param act The calling activity . * @ param sku The sku of the item to purchase . * @ param itemType indicates if it ' s a product or a subscription ( ITEM _ TYPE _ INAPP or ITEM _ TYPE _ SUBS ) * @ param requestCode A request code ( to differentiate from other responses - - * as in { @ link android . app . Activity # startActivityForResult } ) . * @ param listener The listener to notify when the purchase process finishes * @ param extraData Extra data ( developer payload ) , which will be returned with the purchase data * when the purchase completes . This extra data will be permanently bound to that purchase * and will always be returned when the purchase is queried . */ @ SuppressWarnings ( "MethodWithTooManyParameters" ) @ Override public void launchPurchaseFlow ( @ NotNull final Activity act , final String sku , @ NotNull final String itemType , final int requestCode , @ Nullable final IabHelper . OnIabPurchaseFinishedListener listener , final String extraData ) { } }
Logger . i ( "NokiaStoreHelper.launchPurchaseFlow" ) ; if ( itemType . equals ( IabHelper . ITEM_TYPE_SUBS ) ) { final IabResult result = new IabResult ( IabHelper . IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE , "Subscriptions are not available." ) ; if ( listener != null ) { listener . onIabPurchaseFinished ( result , null ) ; } return ; } try { if ( mService == null ) { if ( listener != null ) { Logger . e ( "Unable to buy item, Error response: service is not connected." ) ; NokiaResult result = new NokiaResult ( RESULT_ERROR , "Unable to buy item" ) ; listener . onIabPurchaseFinished ( result , null ) ; } } else { final Bundle buyIntentBundle = mService . getBuyIntent ( 3 , getPackageName ( ) , sku , IabHelper . ITEM_TYPE_INAPP , extraData ) ; Logger . d ( "buyIntentBundle = " , buyIntentBundle ) ; final int responseCode = buyIntentBundle . getInt ( "RESPONSE_CODE" , 0 ) ; final PendingIntent pendingIntent = buyIntentBundle . getParcelable ( "BUY_INTENT" ) ; if ( responseCode == RESULT_OK ) { mRequestCode = requestCode ; mPurchaseListener = listener ; final IntentSender intentSender = pendingIntent . getIntentSender ( ) ; act . startIntentSenderForResult ( intentSender , requestCode , new Intent ( ) , 0 , 0 , 0 ) ; } else if ( listener != null ) { final IabResult result = new NokiaResult ( responseCode , "Failed to get buy intent." ) ; listener . onIabPurchaseFinished ( result , null ) ; } } } catch ( RemoteException e ) { Logger . e ( e , "RemoteException: " , e ) ; final IabResult result = new NokiaResult ( IabHelper . IABHELPER_SEND_INTENT_FAILED , "Failed to send intent." ) ; if ( listener != null ) { listener . onIabPurchaseFinished ( result , null ) ; } } catch ( IntentSender . SendIntentException e ) { Logger . e ( e , "SendIntentException: " , e ) ; final IabResult result = new NokiaResult ( IabHelper . IABHELPER_REMOTE_EXCEPTION , "Remote exception while starting purchase flow" ) ; if ( listener != null ) { listener . onIabPurchaseFinished ( result , null ) ; } }
public class AjaxBehavior { /** * < p class = " changed _ added _ 2_0 " > Sets the { @ link ValueExpression } * used to calculate the value for the specified property name . < / p > * @ param name Name of the property for which to set a * { @ link ValueExpression } * @ param binding The { @ link ValueExpression } to set , or < code > null < / code > * to remove any currently set { @ link ValueExpression } * @ throws NullPointerException if < code > name < / code > * is < code > null < / code > */ public void setValueExpression ( String name , ValueExpression binding ) { } }
if ( name == null ) { throw new NullPointerException ( ) ; } if ( binding != null ) { if ( binding . isLiteralText ( ) ) { setLiteralValue ( name , binding ) ; } else { if ( bindings == null ) { // We use a very small initial capacity on this HashMap . // The goal is not to reduce collisions , but to keep the // memory footprint small . It is very unlikely that an // an AjaxBehavior would have more than 1 or 2 bound // properties - and even if more are present , it ' s okay // if we have some collisions - will still be fast . bindings = new HashMap < String , ValueExpression > ( 6 , 1.0f ) ; } bindings . put ( name , binding ) ; } } else { if ( bindings != null ) { bindings . remove ( name ) ; if ( bindings . isEmpty ( ) ) { bindings = null ; } } } clearInitialState ( ) ;
public class CommercePriceListAccountRelLocalServiceWrapper { /** * Returns the commerce price list account rel matching the UUID and group . * @ param uuid the commerce price list account rel ' s UUID * @ param groupId the primary key of the group * @ return the matching commerce price list account rel , or < code > null < / code > if a matching commerce price list account rel could not be found */ @ Override public com . liferay . commerce . price . list . model . CommercePriceListAccountRel fetchCommercePriceListAccountRelByUuidAndGroupId ( String uuid , long groupId ) { } }
return _commercePriceListAccountRelLocalService . fetchCommercePriceListAccountRelByUuidAndGroupId ( uuid , groupId ) ;
public class JSONResource { /** * Execute the given path query on the json and GET the returned URI expecting text / * * @ param path path to the URI to follow * @ return a new resource , as a result of getting it from the server in JSON format * @ throws Exception */ public XMLResource xml ( JSONPathQuery path ) throws Exception { } }
Object jsonValue = path . eval ( this ) ; return xml ( jsonValue . toString ( ) ) ;
public class RecordMessageFilter { /** * Get the name / value pairs in an ordered tree . * Note : Replace this with a DOM tree when it is available in the basic SDK . * @ return A matrix with the name , type , etc . */ public Object [ ] [ ] createNameValueTree ( Object mxString [ ] [ ] , Map < String , Object > properties ) { } }
mxString = super . createNameValueTree ( mxString , properties ) ; if ( properties != null ) mxString = this . addNameValue ( mxString , BOOKMARK , properties . get ( BOOKMARK ) ) ; return mxString ;
public class RslAttributes { /** * Adds a simple value to the list of values of a given * attribute . * @ param attribute the attribute to add the value to . * @ param value the value to add . */ public void add ( String attribute , String value ) { } }
NameOpValue nv = getRelation ( attribute ) ; nv . add ( new Value ( value ) ) ;
public class DescriptorFactory { /** * Create a class descriptor from a resource name . * @ param resourceName * the resource name * @ return the class descriptor */ public static ClassDescriptor createClassDescriptorFromResourceName ( String resourceName ) { } }
if ( ! isClassResource ( resourceName ) ) { throw new IllegalArgumentException ( "Resource " + resourceName + " is not a class" ) ; } return createClassDescriptor ( resourceName . substring ( 0 , resourceName . length ( ) - 6 ) ) ;
public class NodeUtil { /** * Creates a new node representing an * existing * name , copying over the source * location information from the basis node . * @ param name The name for the new NAME node . * @ param srcref The node that represents the name as currently found in * the AST . * @ return The node created . */ static Node newName ( AbstractCompiler compiler , String name , Node srcref ) { } }
return newName ( compiler , name ) . srcref ( srcref ) ;
public class DependencyEmbedder { /** * Generates the new set of instruction containing the original set of instructions enhanced with the embed * dependencies results . * @ param instructions the current set of instructions * @ param dependencies the project ' s dependencies * @ return the final set of instructions */ public Properties generate ( Properties instructions , ProjectDependencies dependencies ) { } }
Properties result = new Properties ( ) ; result . putAll ( instructions ) ; StringBuilder include = new StringBuilder ( ) ; if ( instructions . getProperty ( Constants . INCLUDE_RESOURCE ) != null ) { include . append ( instructions . getProperty ( Constants . INCLUDE_RESOURCE ) ) ; } StringBuilder classpath = new StringBuilder ( ) ; final String originalClassPath = instructions . getProperty ( Constants . BUNDLE_CLASSPATH ) ; if ( originalClassPath != null ) { classpath . append ( originalClassPath ) ; } for ( EmbeddedDependency configuration : embedded ) { configuration . addClause ( dependencies , include , classpath , reporter ) ; } if ( include . length ( ) != 0 ) { result . setProperty ( Constants . INCLUDE_RESOURCE , include . toString ( ) ) ; } if ( classpath . length ( ) != 0 ) { if ( originalClassPath != null ) { result . setProperty ( Constants . BUNDLE_CLASSPATH , classpath . toString ( ) ) ; } else { // Prepend . to the classpath . result . setProperty ( Constants . BUNDLE_CLASSPATH , "., " + classpath . toString ( ) ) ; } } return result ;
public class HttpClient { /** * Posts data to stackify * @ param path REST path * @ param jsonBytes JSON bytes * @ return Response string * @ throws IOException * @ throws HttpException */ public String post ( final String path , final byte [ ] jsonBytes ) throws IOException , HttpException { } }
return post ( path , jsonBytes , false ) ;
public class DayCountConventionFactory { /** * Return the number of days between startDate and endDate given the * specific daycount convention . * @ param startDate The start date given as a { @ link org . threeten . bp . LocalDate } . * @ param endDate The end date given as a { @ link org . threeten . bp . LocalDate } . * @ param convention A convention string . * @ return The number of days within the given period . */ public static double getDaycount ( LocalDate startDate , LocalDate endDate , String convention ) { } }
DayCountConventionInterface daycountConvention = getDayCountConvention ( convention ) ; return daycountConvention . getDaycount ( startDate , endDate ) ;
public class JBitMaskField { /** * Get the value ( On , Off or Null ) . * @ return The raw data ( a Short object ) . */ public Object getControlValue ( ) { } }
short iFieldValue = 0 ; for ( int iBitNumber = 0 ; iBitNumber < this . getComponentCount ( ) ; iBitNumber ++ ) { JCheckBox checkBox = ( JCheckBox ) this . getComponent ( iBitNumber ) ; boolean bState = checkBox . isSelected ( ) ; if ( ! m_bCheckedIsOn ) bState = ! bState ; // Do opposite operation if ( bState ) iFieldValue |= ( 1 << iBitNumber ) ; // Set the bit else iFieldValue &= ~ ( 1 << iBitNumber ) ; // Clear the bit } return new Short ( iFieldValue ) ;
public class JsonCodec { /** * Creates a new JSON codec instance for objects of the specified class and the specified Gson * instance . You can use this method if you need to customize the behavior of the Gson * serializer . * @ param clazz the class of the objects the created codec is for . * @ param gson the Gson instance to use for serialization / deserialization . * @ return a newly constructed JSON codec instance for objects of the requested class . */ public static < T > JsonCodec < T > create ( Class < T > clazz , Gson gson ) { } }
return new JsonCodec < T > ( clazz , gson ) ;
public class ConsumerSessionProxy { /** * Actually performs the async register . Registration is mainly left up * to the proxy queues . They will also deal with the situation where we * register a different callback . * @ param callback * @ param maxActiveMessages * @ param messageLockExpiry * @ param maxBatchSize * @ param orderContext * @ param stoppable * @ throws com . ibm . wsspi . sib . core . exception . SISessionUnavailableException * @ throws com . ibm . wsspi . sib . core . exception . SISessionDroppedException * @ throws com . ibm . wsspi . sib . core . exception . SIConnectionUnavailableException * @ throws com . ibm . wsspi . sib . core . exception . SIConnectionDroppedException * @ throws com . ibm . websphere . sib . exception . SIErrorException * @ throws com . ibm . websphere . sib . exception . SIIncorrectCallException */ private void _registerAsynchConsumerCallback ( AsynchConsumerCallback callback , int maxActiveMessages , long messageLockExpiry , int maxBatchSize , OrderingContext orderContext , int maxSequentialFailures , // SIB0115d . comms long hiddenMessageDelay , boolean stoppable ) // 472879 throws SISessionUnavailableException , SISessionDroppedException , SIConnectionUnavailableException , SIConnectionDroppedException , SIErrorException , SIIncorrectCallException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "_registerAsynchConsumerCallback" , new Object [ ] { callback , maxActiveMessages , messageLockExpiry , maxBatchSize , orderContext , maxSequentialFailures , hiddenMessageDelay , stoppable } ) ; boolean completed = false ; if ( callback != null ) { // Before we flow the register , ensure we increment the use count on the order context // if they passed one . This is to ensure one gets created if it does not exist // already . OrderingContextProxy oc = ( OrderingContextProxy ) orderContext ; // Did they supply an ordering context for us to use ? if ( oc == null ) { // If they did not , see if we already have an ordered async consumer registered , If so , // decrement the use count on the old order context and discard it . if ( currentOrderingContext != null ) { currentOrderingContext . decrementUseCount ( ) ; currentOrderingContext = null ; } } // They did supply an ordering context to use else { // Do we already have an un - ordered async consumer registered ? // If so , we should increment the count on the new one . if ( currentOrderingContext == null && asynchConsumerRegistered ) { oc . incrementUseCount ( ) ; } else if ( currentOrderingContext != null && asynchConsumerRegistered ) { // Do we already have an ordered async consumer registered ? if ( oc == currentOrderingContext ) { // Is it the same ? If it is - do nothing . } else { // If it is not the same , decrement the old , and increment the new . currentOrderingContext . decrementUseCount ( ) ; oc . incrementUseCount ( ) ; } } // Otherwise , new registration - so increment the use count else if ( ! asynchConsumerRegistered ) { oc . incrementUseCount ( ) ; } } try { try { if ( isReadAhead ) { if ( ( maxActiveMessages != 0 ) || ( messageLockExpiry != 0 ) || ( stoppable ) ) // 472879 { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) && stoppable ) { // SIB0115d . comms , 472879 SibTr . debug ( this , tc , "Forcing Read Ahead off because callback is Stoppable" ) ; // SIB0115d . comms } // SIB0115d . comms // If we had a read ahead proxy queue and someone has attempted to // register an asynchronous consumer with either maxActiveMessages // or messageLockExpiry - trash the read ahead proxy queue and // substitute it with an asynch proxy queue . This is because we // currently do not support these options on read ahead . Using a s // Stoppable callback also forced read ahead off . short seqNumber = proxyQueue . getCurrentMessageBatchSequenceNumber ( ) ; short id = proxyQueue . getId ( ) ; ProxyQueueConversationGroup pqcg = ( ( ClientConversationState ) getConversation ( ) . getAttachment ( ) ) . getProxyQueueConversationGroup ( ) ; seqNumber ++ ; isReadAhead = false ; proxyQueue = pqcg . createAsynchConsumerProxyQueue ( id , seqNumber , orderContext ) ; proxyQueue . setConsumerSession ( this ) ; proxyQueue . setAsynchCallback ( callback , maxActiveMessages , messageLockExpiry , maxBatchSize , orderContext , maxSequentialFailures , hiddenMessageDelay , stoppable ) ; // SIB0115d . comms , 472879 } else { proxyQueue . setAsynchCallback ( callback , maxActiveMessages , messageLockExpiry , maxBatchSize , null , maxSequentialFailures , // SIB0115d . comms hiddenMessageDelay , stoppable ) ; // 472879 } } // If async proxy queue is not null , then we already have a callback registered // and the caller would like to replace the callback or switch to / from // ordered delivery else if ( proxyQueue != null ) // No readahead { proxyQueue . setAsynchCallback ( callback , maxActiveMessages , messageLockExpiry , maxBatchSize , orderContext , maxSequentialFailures , // SIB0115d . comms hiddenMessageDelay , stoppable ) ; // 472879 } else // Create a new Proxy Queue { ClientConversationState clientConvState = ( ClientConversationState ) getConversation ( ) . getAttachment ( ) ; ProxyQueueConversationGroup pqcg = clientConvState . getProxyQueueConversationGroup ( ) ; if ( pqcg == null ) { ProxyQueueConversationGroupFactory pqFact = ProxyQueueConversationGroupFactory . getRef ( ) ; pqcg = pqFact . create ( getConversation ( ) ) ; clientConvState . setProxyQueueConversationGroup ( pqcg ) ; } proxyQueue = pqcg . createAsynchConsumerProxyQueue ( orderContext ) ; proxyQueue . setConsumerSession ( this ) ; proxyQueue . setAsynchCallback ( callback , maxActiveMessages , messageLockExpiry , maxBatchSize , orderContext , maxSequentialFailures , // SIB0115d . comms hiddenMessageDelay , stoppable ) ; // 472879 } } catch ( SIResourceException e ) { // We failed to re - register the proxy queue . This could be because the call to create // a proxy queue or destroy a proxy queue failed . We must rethrow this as an // SIConnectionLostException as we will be unsure what the state of the system is FFDCFilter . processException ( e , CLASS_NAME + "._registerAsynchConsumerCallback" , CommsConstants . CONSUMERSESSIONPROXY_REGASYNC_01 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Caught a resource exception" , e ) ; // And rethrow throw new SIConnectionDroppedException ( e . getMessage ( ) , e ) ; } completed = true ; // And stash the order context in case we need it later currentOrderingContext = oc ; asynchConsumerRegistered = true ; } finally { // Ensure we decrement again if we failed if ( ! completed && oc != null ) oc . decrementUseCount ( ) ; } } else { // User supplied a null callback - this is the same as a de - reg deregisterAsynchConsumerCallback ( ) ; // Ensure we decrement the count when we de - register if ( currentOrderingContext != null ) { currentOrderingContext . decrementUseCount ( ) ; // And don ' t reference it anymore currentOrderingContext = null ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "_registerAsynchConsumerCallback" ) ;
public class MaterialDatePicker { /** * Set the minimum date limit . */ public void setDateMin ( Date dateMin ) { } }
this . dateMin = dateMin ; if ( isAttached ( ) && dateMin != null ) { getPicker ( ) . set ( "min" , JsDate . create ( ( double ) dateMin . getTime ( ) ) ) ; }
public class UpdatePhoneNumberRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdatePhoneNumberRequest updatePhoneNumberRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updatePhoneNumberRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updatePhoneNumberRequest . getPhoneNumberId ( ) , PHONENUMBERID_BINDING ) ; protocolMarshaller . marshall ( updatePhoneNumberRequest . getProductType ( ) , PRODUCTTYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Line { /** * Get the closest point on the line to a given point * @ param point * The point which we want to project * @ param result * The point on the line closest to the given point */ public void getClosestPoint ( Vector2f point , Vector2f result ) { } }
loc . set ( point ) ; loc . sub ( start ) ; float projDistance = vec . dot ( loc ) ; projDistance /= vec . lengthSquared ( ) ; if ( projDistance < 0 ) { result . set ( start ) ; return ; } if ( projDistance > 1 ) { result . set ( end ) ; return ; } result . x = start . getX ( ) + projDistance * vec . getX ( ) ; result . y = start . getY ( ) + projDistance * vec . getY ( ) ;