signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SingletonLaContainerFactory { protected static void setupScriptEngine ( ) { } }
new Thread ( ( ) -> { /* first getEngineByName ( ) costs about 0.5 seconds so initialize it background */ final Class < ? > engineType = LastaDiProperties . getInstance ( ) . getDiXmlScriptExpressionEngineType ( ) ; if ( engineType == null ) { /* use default */ new ScriptEngineManager ( ) . getEngineByName ( "javascript" ) ; /* initialize static resources */ } } ) . start ( ) ;
public class ViewState { /** * encode a object to a base64 string * @ param o is a implemented java . io . Serializable object * @ return the encoded object */ public static String encode ( Serializable o ) { } }
ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; try { ObjectOutputStream oos = new ObjectOutputStream ( bos ) ; try { oos . writeObject ( o ) ; oos . flush ( ) ; } finally { oos . close ( ) ; } return Base64 . encodeBytes ( bos . toByteArray ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; }
public class Attachment { /** * Creates a non - binary attachment from the given file . * @ throws IOException if an I / O error occurs * @ throws java . lang . IllegalArgumentException if mediaType is binary * @ deprecated use fromTextInputStream without charSet with a mediaType that has a specified charSet */ @ Deprecated public static Attachment fromTextInputStream ( InputStream inputStream , MediaType mediaType , Charset charset ) throws IOException { } }
return fromText ( CharStreams . toString ( new InputStreamReader ( inputStream , charset ) ) , mediaType ) ;
public class Fragments { /** * Default unlimited - depth sub - edge traversal * @ param traversal * @ param < T > * @ return */ static < T > GraphTraversal < T , Vertex > inSubs ( GraphTraversal < T , Vertex > traversal ) { } }
return inSubs ( traversal , TRAVERSE_ALL_SUB_EDGES ) ;
public class BCrypt { /** * Perform the central password hashing step in the bcrypt scheme * @ param password the password to hash * @ param salt the binary salt to hash with the password * @ param log _ rounds the binary logarithm of the number of rounds of hashing to * apply * @ return an array containing the binary hashed password */ private byte [ ] crypt_raw ( final byte password [ ] , final byte salt [ ] , final int log_rounds ) { } }
int rounds , i , j ; final int cdata [ ] = bf_crypt_ciphertext . clone ( ) ; final int clen = cdata . length ; byte ret [ ] ; if ( ( log_rounds < 4 ) || ( log_rounds > 31 ) ) { throw new IllegalArgumentException ( "Bad number of rounds" ) ; } rounds = 1 << log_rounds ; if ( salt . length != BCRYPT_SALT_LEN ) { throw new IllegalArgumentException ( "Bad salt length" ) ; } init_key ( ) ; ekskey ( salt , password ) ; for ( i = 0 ; i < rounds ; i ++ ) { key ( password ) ; key ( salt ) ; } for ( i = 0 ; i < 64 ; i ++ ) { for ( j = 0 ; j < ( clen >> 1 ) ; j ++ ) { encipher ( cdata , j << 1 ) ; } } ret = new byte [ clen * 4 ] ; for ( i = 0 , j = 0 ; i < clen ; i ++ ) { ret [ j ++ ] = ( byte ) ( ( cdata [ i ] >> 24 ) & 0xff ) ; ret [ j ++ ] = ( byte ) ( ( cdata [ i ] >> 16 ) & 0xff ) ; ret [ j ++ ] = ( byte ) ( ( cdata [ i ] >> 8 ) & 0xff ) ; ret [ j ++ ] = ( byte ) ( cdata [ i ] & 0xff ) ; } return ret ;
public class Enter { /** * Complain about a duplicate class . */ protected void duplicateClass ( DiagnosticPosition pos , ClassSymbol c ) { } }
log . error ( pos , "duplicate.class" , c . fullname ) ;
public class NIOServerCnxn { /** * clean up the socket related to a command and also make sure we flush the * data before we do that * @ param pwriter * the pwriter for a command socket */ private void cleanupWriterSocket ( PrintWriter pwriter ) { } }
try { if ( pwriter != null ) { pwriter . flush ( ) ; pwriter . close ( ) ; } } catch ( Exception e ) { LOG . info ( "Error closing PrintWriter " , e ) ; } finally { try { close ( ) ; } catch ( Exception e ) { LOG . error ( "Error closing a command socket " , e ) ; } }
public class DisruptorFactory { /** * if there are many consumers , execution order will be alphabetical list by * Name of @ Consumer class . * @ param topic * @ return */ protected Collection loadEvenHandler ( String topic ) { } }
Collection ehs = new ArrayList ( ) ; Collection < String > consumers = ( Collection < String > ) containerWrapper . lookup ( ConsumerLoader . TOPICNAME + topic ) ; if ( consumers == null || consumers . size ( ) == 0 ) { Debug . logWarning ( "[Jdonframework]there is no any consumer class annotated with @Consumer(" + topic + ") " , module ) ; return ehs ; } for ( String consumerName : consumers ) { DomainEventHandler eh = ( DomainEventHandler ) containerWrapper . lookup ( consumerName ) ; ehs . add ( eh ) ; } return ehs ;
public class AwsS3ServiceClientImpl { /** * Puts an object . * @ param bucket the bucket to put the object in . * @ param key the key ( or name ) of the object . * @ param acl the ACL to apply to the object ( e . g . private ) . * @ param contentType the content type of the object ( e . g . application / json ) . * @ param body the body of the object . * @ return the result of the put which contains the location of the object . The task will * have an { @ link IOException } in the event the body cannot be read . */ public Task < AwsS3PutObjectResult > putObject ( @ NonNull final String bucket , @ NonNull final String key , @ NonNull final String acl , @ NonNull final String contentType , @ NonNull final InputStream body ) { } }
return dispatcher . dispatchTask ( new Callable < AwsS3PutObjectResult > ( ) { @ Override public AwsS3PutObjectResult call ( ) throws IOException { return proxy . putObject ( bucket , key , acl , contentType , body ) ; } } ) ;
public class MemberSummaryBuilder { /** * Build the inherited member summary for the given methods . * @ param writer the writer for this member summary . * @ param visibleMemberMap the map for the members to document . * @ param summaryTreeList list of content trees to which the documentation will be added */ private void buildInheritedSummary ( MemberSummaryWriter writer , VisibleMemberMap visibleMemberMap , LinkedList < Content > summaryTreeList ) { } }
for ( ClassDoc inhclass : visibleMemberMap . getVisibleClassesList ( ) ) { if ( ! ( inhclass . isPublic ( ) || utils . isLinkable ( inhclass , configuration ) ) ) { continue ; } if ( inhclass == classDoc ) { continue ; } List < ProgramElementDoc > inhmembers = visibleMemberMap . getMembersFor ( inhclass ) ; if ( inhmembers . size ( ) > 0 ) { Collections . sort ( inhmembers ) ; Content inheritedTree = writer . getInheritedSummaryHeader ( inhclass ) ; Content linksTree = writer . getInheritedSummaryLinksTree ( ) ; for ( int j = 0 ; j < inhmembers . size ( ) ; ++ j ) { writer . addInheritedMemberSummary ( inhclass . isPackagePrivate ( ) && ! utils . isLinkable ( inhclass , configuration ) ? classDoc : inhclass , inhmembers . get ( j ) , j == 0 , j == inhmembers . size ( ) - 1 , linksTree ) ; } inheritedTree . addContent ( linksTree ) ; summaryTreeList . add ( writer . getMemberTree ( inheritedTree ) ) ; } }
public class CmsEditableDataJSO { /** * Gets the element view . < p > * @ return the element view */ public CmsUUID getElementView ( ) { } }
String elementViewString = getString ( CmsEditorConstants . ATTR_ELEMENT_VIEW ) ; if ( elementViewString == null ) { return null ; } return new CmsUUID ( elementViewString ) ;
public class Proxy { /** * Marks this proxy object as being open . */ protected void setOpen ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setOpen" ) ; closed = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setOpen" ) ;
public class AbstractInputFlowlet { /** * This process method consumes the records queued in dataManager and invokes the associated " process " methods for * each output query */ @ Tick ( delay = 200L , unit = TimeUnit . MILLISECONDS ) protected void processGDATRecords ( ) throws InvocationTargetException , IllegalAccessException { } }
stopwatch . reset ( ) ; stopwatch . start ( ) ; while ( ! recordQueue . isEmpty ( ) ) { // Time since start of processing in Seconds long elapsedTime = stopwatch . elapsedTime ( TimeUnit . SECONDS ) ; if ( elapsedTime >= Constants . TICKER_TIMEOUT ) { break ; } Map . Entry < String , GDATDecoder > record = recordQueue . getNext ( ) ; methodsDriver . invokeMethods ( record . getKey ( ) , record . getValue ( ) ) ; } stopwatch . stop ( ) ;
public class ObjectType { /** * Determine if { @ code this } is a an implicit subtype of { @ code superType } . */ final boolean isStructuralSubtype ( ObjectType superType , ImplCache implicitImplCache , SubtypingMode subtypingMode ) { } }
// Union types should be handled by isSubtype already checkArgument ( ! this . isUnionType ( ) ) ; checkArgument ( ! superType . isUnionType ( ) ) ; Preconditions . checkArgument ( superType . isStructuralType ( ) , "isStructuralSubtype should be called with structural supertype. Found %s" , superType ) ; MatchStatus cachedResult = implicitImplCache . checkCache ( this , superType ) ; if ( cachedResult != null ) { return cachedResult . subtypeValue ( ) ; } boolean result = isStructuralSubtypeHelper ( this , superType , implicitImplCache , subtypingMode , VOIDABLE_PROPS_ARE_OPTIONAL ) ; return implicitImplCache . updateCache ( this , superType , MatchStatus . valueOf ( result ) ) ;
public class GeneratorConfig { /** * Copy the values of the given generator configuration . */ public GeneratorConfig copy ( final GeneratorConfig other ) { } }
this . generateExpressions = other . generateExpressions ; this . generateSyntheticSuppressWarnings = other . generateSyntheticSuppressWarnings ; this . generateGeneratedAnnotation = other . generateGeneratedAnnotation ; this . includeDateInGeneratedAnnotation = other . includeDateInGeneratedAnnotation ; this . generatedAnnotationComment = other . generatedAnnotationComment ; this . javaSourceVersion = other . javaSourceVersion ; return this ;
public class RecurrencePropertyScribe { /** * Parses an integer string , where the sign is at the end of the string * instead of at the beginning ( for example , " 5 - " ) . * @ param value the string * @ return the value * @ throws NumberFormatException if the string cannot be parsed as an * integer */ private static int parseVCalInt ( String value ) { } }
int negate = 1 ; if ( value . endsWith ( "+" ) ) { value = value . substring ( 0 , value . length ( ) - 1 ) ; } else if ( value . endsWith ( "-" ) ) { value = value . substring ( 0 , value . length ( ) - 1 ) ; negate = - 1 ; } return Integer . parseInt ( value ) * negate ;
public class MemoryLogHandler { /** * Returns LogRecords that are equal or above the severity level . * @ param severity Asciidoctor severity level * @ return list of filtered logRecords */ public List < LogRecord > filter ( Severity severity ) { } }
// FIXME : find better name or replace with stream final List < LogRecord > records = new ArrayList < > ( ) ; for ( LogRecord record : this . records ) { if ( record . getSeverity ( ) . ordinal ( ) >= severity . ordinal ( ) ) records . add ( record ) ; } return records ;
public class SCXMLGapper { /** * Takes a model and an SCXMLFrontier and decomposes the Frontier into a Map of Strings to Strings * These strings can be sent over a network to get a Frontier past a ' gap ' * @ param frontier the Frontier * @ param modelText the model * @ return the map of strings representing a decomposition */ public Map < String , String > decompose ( Frontier frontier , String modelText ) { } }
if ( ! ( frontier instanceof SCXMLFrontier ) ) { return null ; } TransitionTarget target = ( ( SCXMLFrontier ) frontier ) . getRoot ( ) . nextState ; Map < String , String > variables = ( ( SCXMLFrontier ) frontier ) . getRoot ( ) . variables ; Map < String , String > decomposition = new HashMap < String , String > ( ) ; decomposition . put ( "target" , target . getId ( ) ) ; StringBuilder packedVariables = new StringBuilder ( ) ; for ( Map . Entry < String , String > variable : variables . entrySet ( ) ) { packedVariables . append ( variable . getKey ( ) ) ; packedVariables . append ( "::" ) ; packedVariables . append ( variable . getValue ( ) ) ; packedVariables . append ( ";" ) ; } decomposition . put ( "variables" , packedVariables . toString ( ) ) ; decomposition . put ( "model" , modelText ) ; return decomposition ;
public class StorageConnector { /** * The names of the domains for the account . * @ param domains * The names of the domains for the account . */ public void setDomains ( java . util . Collection < String > domains ) { } }
if ( domains == null ) { this . domains = null ; return ; } this . domains = new java . util . ArrayList < String > ( domains ) ;
public class PutDestinationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( PutDestinationRequest putDestinationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( putDestinationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( putDestinationRequest . getDestinationName ( ) , DESTINATIONNAME_BINDING ) ; protocolMarshaller . marshall ( putDestinationRequest . getTargetArn ( ) , TARGETARN_BINDING ) ; protocolMarshaller . marshall ( putDestinationRequest . getRoleArn ( ) , ROLEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CommentProcessor { /** * Produce a copy of a list of JavaDoc comments by pulling specified parameter tags out of an orignal list of comments . * Block and EOL comments are skipped . JavaDoc comments are stripped down to only have the content of the specified * param tag */ public List < JavaComment > paramDoc ( final String paramName , List < JavaComment > originals ) { } }
final List < JavaComment > results = new ArrayList < JavaComment > ( originals . size ( ) ) ; for ( JavaComment original : originals ) { original . _switch ( new JavaComment . SwitchBlock ( ) { @ Override public void _case ( JavaDocComment x ) { paramDocSections ( paramName , x . tagSections , results ) ; } @ Override public void _case ( JavaBlockComment x ) { // skip } @ Override public void _case ( JavaEOLComment x ) { // skip } } ) ; } return results ;
public class PlaceholderSupport { /** * Adds placeholder support to a { @ link DifferenceEngineConfigurer } considering an additional { @ link DifferenceEvaluator } . * @ param configurer the configurer to add support to * @ param evaluator the additional evaluator - placeholder support is * { @ link DifferenceEvaluators # chain chain } ed after the given * evaluator */ public static < D extends DifferenceEngineConfigurer < D > > D withPlaceholderSupportChainedAfter ( D configurer , DifferenceEvaluator evaluator ) { } }
return withPlaceholderSupportUsingDelimitersChainedAfter ( configurer , null , null , evaluator ) ;
public class SocketStream { /** * Writes bytes to the socket . * @ param buf byte buffer containing the bytes * @ param offset offset into the buffer * @ param length number of bytes to read * @ param isEnd if the write is at a close . * @ exception throws ClientDisconnectException if the connection is dropped */ @ Override public void write ( byte [ ] buf , int offset , int length , boolean isEnd ) throws IOException { } }
if ( _os == null ) { if ( _s == null ) { return ; } _os = _s . getOutputStream ( ) ; } try { _needsFlush = true ; _os . write ( buf , offset , length ) ; _totalWriteBytes += length ; } catch ( IOException e ) { IOException exn = ClientDisconnectException . create ( this + ":" + e , e ) ; try { close ( ) ; } catch ( IOException e1 ) { } throw exn ; }
public class BinaryNode { /** * { @ inheritDoc } */ public Node mutate ( Random rng , Probability mutationProbability , TreeFactory treeFactory ) { } }
if ( mutationProbability . nextEvent ( rng ) ) { return treeFactory . generateRandomCandidate ( rng ) ; } else { Node newLeft = left . mutate ( rng , mutationProbability , treeFactory ) ; Node newRight = right . mutate ( rng , mutationProbability , treeFactory ) ; if ( newLeft != left && newRight != right ) { return newInstance ( newLeft , newRight ) ; } else { // Tree has not changed . return this ; } }
public class URLUtils { /** * Use URL context and one or more relocations to build end URL . * @ param context first URL used like a context root for all relocation changes * @ param relocations array of relocation URLs * @ return end url after all changes made on context with relocations * @ throws AssertionError when context or some of relocations are malformed URLs */ public static URL buildUrl ( URL context , String ... relocations ) { } }
URL url = context ; for ( String move : relocations ) { try { url = new URL ( url , move ) ; } catch ( MalformedURLException e ) { throw new AssertionError ( "URL('" + url + "', '" + move + "') isn't valid URL" ) ; } } return url ;
public class BackendBucketClient { /** * Adds a key for validating requests with signed URLs for this backend bucket . * < p > Sample code : * < pre > < code > * try ( BackendBucketClient backendBucketClient = BackendBucketClient . create ( ) ) { * ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName . of ( " [ PROJECT ] " , " [ BACKEND _ BUCKET ] " ) ; * SignedUrlKey signedUrlKeyResource = SignedUrlKey . newBuilder ( ) . build ( ) ; * Operation response = backendBucketClient . addSignedUrlKeyBackendBucket ( backendBucket , signedUrlKeyResource ) ; * < / code > < / pre > * @ param backendBucket Name of the BackendBucket resource to which the Signed URL Key should be * added . The name should conform to RFC1035. * @ param signedUrlKeyResource Represents a customer - supplied Signing Key used by Cloud CDN Signed * URLs * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation addSignedUrlKeyBackendBucket ( ProjectGlobalBackendBucketName backendBucket , SignedUrlKey signedUrlKeyResource ) { } }
AddSignedUrlKeyBackendBucketHttpRequest request = AddSignedUrlKeyBackendBucketHttpRequest . newBuilder ( ) . setBackendBucket ( backendBucket == null ? null : backendBucket . toString ( ) ) . setSignedUrlKeyResource ( signedUrlKeyResource ) . build ( ) ; return addSignedUrlKeyBackendBucket ( request ) ;
public class EnaValidator { /** * Inits the arguments . * @ param args the args * @ param message the message * @ throws SQLException * @ throws IOException */ protected void init ( String [ ] args , String message ) throws SQLException , IOException { } }
Params params = new Params ( ) ; JCommander jc = new JCommander ( params ) ; jc . setProgramName ( "ena_validator <files>" ) ; try { jc . parse ( args ) ; } catch ( Exception e ) { System . err . println ( "Invalid options" ) ; if ( message == null ) { jc . usage ( ) ; writeReturnCodes ( ) ; } else System . out . println ( message ) ; System . exit ( 2 ) ; } if ( args . length == 0 || ( args . length == 1 && params . help ) ) { if ( message == null ) { jc . usage ( ) ; writeReturnCodes ( ) ; } else System . out . println ( message ) ; System . exit ( 2 ) ; } if ( params . version ) { System . out . println ( this . getClass ( ) . getPackage ( ) . getImplementationVersion ( ) ) ; System . exit ( 0 ) ; } if ( params . filenames . isEmpty ( ) ) { System . err . println ( "Please give the filenames (or) directory with files to validate" ) ; jc . usage ( ) ; } fileType = FileType . get ( params . fileFormat ) ; prefix = params . prefixString ; log_level = params . log_level ; remote = params . remote ; lowMemoryMode = params . lowmemory ; min_gap_length = params . min_gap_length ; assembly = params . assembly ; if ( params . wrap ) { wrapType = WrapType . EMBL_WRAP ; } if ( params . skip != null ) { String suppressString = params . skip ; suppressString = suppressString . replaceAll ( "\\(" , "" ) ; suppressString = suppressString . replaceAll ( "\\)" , "" ) ; String [ ] suppressArray = suppressString . split ( "," ) ; suppressedErrorCodes = new ArrayList < String > ( Arrays . asList ( suppressArray ) ) ; } fixMode = params . fix ; writeDeMode = params . fixDe ; fixDiagnoseMode = params . fix_diagnose ; if ( params . filter != null ) { filterMode = true ; filterPrefix = params . filter ; } List < String > fileStrings = params . filenames ; entryFiles = new ArrayList < File > ( ) ; for ( String fileString : fileStrings ) { File fileHandle = new File ( fileString ) ; if ( ! fileHandle . exists ( ) ) { printMessageLine ( "File " + fileHandle . getPath ( ) + " does not exist - exiting" , LOG_LEVEL_QUIET ) ; return ; } if ( fileHandle . isDirectory ( ) ) { printMessageLine ( "Directory found : " + fileHandle . getPath ( ) , LOG_LEVEL_ALL ) ; entryFiles . addAll ( Arrays . asList ( fileHandle . listFiles ( ) ) ) ; } else { printMessageLine ( "File found : " + fileHandle . getPath ( ) , LOG_LEVEL_ALL ) ; entryFiles . add ( fileHandle ) ; } } File formatFile = entryFiles . get ( 0 ) ; FileType fileFormat = FileUtils . getFileType ( formatFile ) ; if ( fileFormat != null ) fileType = fileFormat ;
public class DummyInternalTransaction { /** * ( non - Javadoc ) * @ see com . ibm . ws . objectManager . InternalTransaction # replaceFromCheckpoint ( com . ibm . ws . objectManager . ManagedObject , byte [ ] , com . ibm . ws . objectManager . Transaction ) */ public synchronized void replaceFromCheckpoint ( ManagedObject managedObject , byte [ ] serializedBytes , Transaction transaction ) throws ObjectManagerException { } }
throw new InvalidStateException ( this , InternalTransaction . stateTerminated , InternalTransaction . stateNames [ InternalTransaction . stateTerminated ] ) ;
public class Selectors { /** * Find elements having attribute with given value . * Examples : * { @ code < div binding = " fieldValue " > < / div > } * Find element with attribute ' binding ' EXACTLY containing text ' fieldValue ' , use : * byAttribute ( " binding " , " fieldValue " ) * For finding difficult / generated data attribute which contains some value : * { @ code < div binding = " userName17fk5n6kc2Ds45F40d0fieldValue _ promoLanding word " > < / div > } * Find element with attribute ' binding ' CONTAINING text ' fieldValue ' , use symbol ' * ' with attribute name : * byAttribute ( " binding * " , " fieldValue " ) it same as By . cssSelector ( " [ binding * = ' fieldValue ' ] " ) * Find element whose attribute ' binding ' BEGINS with ' userName ' , use symbol ' ^ ' with attribute name : * byAttribute ( " binding ^ " , " fieldValue " ) * Find element whose attribute ' binding ' ENDS with ' promoLanding ' , use symbol ' $ ' with attribute name : * byAttribute ( " binding $ " , " promoLanding " ) * Find element whose attribute ' binding ' CONTAINING WORD ' word ' : * byAttribute ( " binding ~ " , " word " ) * Seems to work incorrectly if attribute name contains dash , for example : { @ code < option data - mailServerId = " 123 " > < / option > } * @ param attributeName name of attribute , should not be empty or null * @ param attributeValue value of attribute , should not contain both apostrophes and quotes * @ return standard selenium By cssSelector criteria */ public static By byAttribute ( String attributeName , String attributeValue ) { } }
return By . cssSelector ( String . format ( "[%s='%s']" , attributeName , attributeValue ) ) ;
public class FormSpec { /** * Computes the maximum size for the given list of components , using this form spec and the * specified measure . < p > * Invoked by FormLayout to determine the size of one of my elements * @ param container the layout container * @ param components the list of components to measure * @ param minMeasure the measure used to determine the minimum size * @ param prefMeasure the measure used to determine the preferred size * @ param defaultMeasure the measure used to determine the default size * @ return the maximum size in pixels */ final int maximumSize ( Container container , List components , FormLayout . Measure minMeasure , FormLayout . Measure prefMeasure , FormLayout . Measure defaultMeasure ) { } }
return size . maximumSize ( container , components , minMeasure , prefMeasure , defaultMeasure ) ;
public class KamStoreServiceImpl { /** * { @ inheritDoc } */ @ Override public List < Citation > getCitations ( KamHandle kamHandle , CitationType citationType , List < String > valueList , BelDocument belDocument ) throws KamStoreServiceException { } }
List < Citation > list = new ArrayList < Citation > ( ) ; final String handle = kamHandle . getHandle ( ) ; try { org . openbel . framework . api . Kam objKam ; objKam = kamCacheService . getKam ( handle ) ; if ( objKam == null ) { throw new KamStoreServiceException ( format ( KAM_REQUEST_NO_KAM_FOR_HANDLE , kamHandle . getHandle ( ) ) ) ; } org . openbel . framework . common . enums . CitationType citation ; citation = convert ( citationType ) ; KamInfo ki = objKam . getKamInfo ( ) ; List < org . openbel . framework . api . internal . KAMStoreDaoImpl . Citation > citations ; if ( belDocument != null ) { BelDocumentInfo info ; try { info = convert ( belDocument ) ; } catch ( InvalidIdException e ) { throw new KamStoreServiceException ( "Error processing Bel document" , e ) ; } citations = kAMStore . getCitations ( ki , info , citation ) ; } else if ( hasItems ( valueList ) ) { String [ ] valueArr = valueList . toArray ( new String [ 0 ] ) ; citations = kAMStore . getCitations ( ki , citation , valueArr ) ; } else { citations = kAMStore . getCitations ( ki , citation ) ; } for ( org . openbel . framework . api . internal . KAMStoreDaoImpl . Citation c : citations ) { Citation c2 = convert ( c ) ; list . add ( c2 ) ; } } catch ( KAMStoreException e ) { logger . warn ( e . getMessage ( ) ) ; throw new KamStoreServiceException ( e ) ; } return list ;
public class DateTimeExpression { /** * Create an expression representing the current time instant as a DateTimeExpression instance * @ return current timestamp */ public static < T extends Comparable > DateTimeExpression < T > currentTimestamp ( Class < T > cl ) { } }
return Expressions . dateTimeOperation ( cl , Ops . DateTimeOps . CURRENT_TIMESTAMP ) ;
public class Agg { /** * Get a { @ link Collector } that calculates the < code > MODE ( ) < / code > function . */ public static < T , U > Collector < T , ? , Seq < T > > modeAllBy ( Function < ? super T , ? extends U > function ) { } }
return Collector . of ( ( ) -> new LinkedHashMap < U , List < T > > ( ) , ( m , t ) -> m . compute ( function . apply ( t ) , ( k , l ) -> { List < T > result = l != null ? l : new ArrayList < > ( ) ; result . add ( t ) ; return result ; } ) , ( m1 , m2 ) -> { for ( Entry < U , List < T > > e : m2 . entrySet ( ) ) { List < T > l = m1 . get ( e . getKey ( ) ) ; if ( l == null ) m1 . put ( e . getKey ( ) , e . getValue ( ) ) ; else l . addAll ( e . getValue ( ) ) ; } return m1 ; } , m -> Seq . seq ( m ) . maxAllBy ( t -> t . v2 . size ( ) ) . flatMap ( t -> Seq . seq ( t . v2 ) ) ) ;
public class RefersToDaggerCodegen { /** * instead of checking for subtypes of generated code */ private static boolean isGeneratedFactoryType ( ClassSymbol symbol , VisitorState state ) { } }
// TODO ( ronshapiro ) : check annotation creators , inaccessible map key proxies , or inaccessible // module constructor proxies ? return GENERATED_BASE_TYPES . stream ( ) . anyMatch ( baseType -> isGeneratedBaseType ( symbol , state , baseType ) ) ;
public class InternalSimpleExpressionsParser { /** * InternalSimpleExpressions . g : 67:1 : entryRuleIfCondition returns [ EObject current = null ] : iv _ ruleIfCondition = ruleIfCondition EOF ; */ public final EObject entryRuleIfCondition ( ) throws RecognitionException { } }
EObject current = null ; EObject iv_ruleIfCondition = null ; try { // InternalSimpleExpressions . g : 68:2 : ( iv _ ruleIfCondition = ruleIfCondition EOF ) // InternalSimpleExpressions . g : 69:2 : iv _ ruleIfCondition = ruleIfCondition EOF { newCompositeNode ( grammarAccess . getIfConditionRule ( ) ) ; pushFollow ( FOLLOW_1 ) ; iv_ruleIfCondition = ruleIfCondition ( ) ; state . _fsp -- ; current = iv_ruleIfCondition ; match ( input , EOF , FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ;
public class Roster { /** * Changes the presence of available contacts offline by simulating an unavailable * presence sent from the server . */ private void setOfflinePresences ( ) { } }
Presence packetUnavailable ; outerloop : for ( Jid user : presenceMap . keySet ( ) ) { Map < Resourcepart , Presence > resources = presenceMap . get ( user ) ; if ( resources != null ) { for ( Resourcepart resource : resources . keySet ( ) ) { packetUnavailable = new Presence ( Presence . Type . unavailable ) ; EntityBareJid bareUserJid = user . asEntityBareJidIfPossible ( ) ; if ( bareUserJid == null ) { LOGGER . warning ( "Can not transform user JID to bare JID: '" + user + "'" ) ; continue ; } packetUnavailable . setFrom ( JidCreate . fullFrom ( bareUserJid , resource ) ) ; try { presencePacketListener . processStanza ( packetUnavailable ) ; } catch ( NotConnectedException e ) { throw new IllegalStateException ( "presencePacketListener should never throw a NotConnectedException when processStanza is called with a presence of type unavailable" , e ) ; } catch ( InterruptedException e ) { break outerloop ; } } } }
public class MessageBuilder { /** * Appends a sting with or without decoration to the message . * @ param message The string to append . * @ param decorations The decorations of the string . * @ return The current instance in order to chain call methods . */ public MessageBuilder append ( String message , MessageDecoration ... decorations ) { } }
delegate . append ( message , decorations ) ; return this ;
public class TypedLinkAttributeDefinition { /** * Validation rules that are attached to the attribute definition . * @ param rules * Validation rules that are attached to the attribute definition . * @ return Returns a reference to this object so that method calls can be chained together . */ public TypedLinkAttributeDefinition withRules ( java . util . Map < String , Rule > rules ) { } }
setRules ( rules ) ; return this ;
public class CompileStack { /** * Causes the state - stack to add an element and sets * the given scope as new current variable scope . Creates * a element for the state stack so pop has to be called later */ public void pushVariableScope ( VariableScope el ) { } }
pushState ( ) ; scope = el ; superBlockNamedLabels = new HashMap ( superBlockNamedLabels ) ; superBlockNamedLabels . putAll ( currentBlockNamedLabels ) ; currentBlockNamedLabels = new HashMap ( ) ;
public class Checker { /** * 检查Short是否为null * @ param value 值 * @ param elseValue 为null返回的值 * @ return { @ link Short } * @ since 1.0.8 */ public static Short checkNull ( Short value , short elseValue ) { } }
return checkNull ( value , Short . valueOf ( elseValue ) ) ;
public class RevisionApi { /** * Returns the by the article ID and revisionCounter specified revision . Note that this method * returns the revision in chronological order . * @ param articleID * ID of the article * @ param revisionCounter * number of revision * @ return Revision * @ throws WikiApiException * if an error occurs or the revision does not exists . */ public Revision getRevision ( final int articleID , final int revisionCounter ) throws WikiApiException { } }
try { if ( articleID < 1 || revisionCounter < 1 ) { throw new IllegalArgumentException ( ) ; } int revisionIndex = checkMapping ( articleID , revisionCounter ) ; String fullRevisions , revCounters ; PreparedStatement statement = null ; ResultSet result = null ; try { statement = this . connection . prepareStatement ( "SELECT FullRevisionPKs, RevisionCounter FROM index_articleID_rc_ts WHERE ArticleID=? LIMIT 1" ) ; statement . setInt ( 1 , articleID ) ; result = statement . executeQuery ( ) ; if ( result . next ( ) ) { fullRevisions = result . getString ( 1 ) ; revCounters = result . getString ( 2 ) ; } else { throw new WikiPageNotFoundException ( "The article with the ID " + articleID + " was not found." ) ; } } finally { if ( statement != null ) { statement . close ( ) ; } if ( result != null ) { result . close ( ) ; } } return getReferencedRevision ( articleID , revisionIndex , fullRevisions , revCounters ) ; } catch ( WikiPageNotFoundException e ) { throw e ; } catch ( Exception e ) { throw new WikiApiException ( e ) ; }
public class DataSinkTask { /** * Initializes the OutputFormat implementation and configuration . * @ throws RuntimeException * Throws if instance of OutputFormat implementation can not be * obtained . */ private void initOutputFormat ( ) { } }
if ( this . userCodeClassLoader == null ) { try { this . userCodeClassLoader = LibraryCacheManager . getClassLoader ( getEnvironment ( ) . getJobID ( ) ) ; } catch ( IOException ioe ) { throw new RuntimeException ( "Library cache manager could not be instantiated." , ioe ) ; } } // obtain task configuration ( including stub parameters ) Configuration taskConf = getTaskConfiguration ( ) ; taskConf . setClassLoader ( this . userCodeClassLoader ) ; this . config = new TaskConfig ( taskConf ) ; try { this . format = config . < OutputFormat < IT > > getStubWrapper ( this . userCodeClassLoader ) . getUserCodeObject ( OutputFormat . class , this . userCodeClassLoader ) ; // check if the class is a subclass , if the check is required if ( ! OutputFormat . class . isAssignableFrom ( this . format . getClass ( ) ) ) { throw new RuntimeException ( "The class '" + this . format . getClass ( ) . getName ( ) + "' is not a subclass of '" + OutputFormat . class . getName ( ) + "' as is required." ) ; } } catch ( ClassCastException ccex ) { throw new RuntimeException ( "The stub class is not a proper subclass of " + OutputFormat . class . getName ( ) , ccex ) ; } // configure the stub . catch exceptions here extra , to report them as originating from the user code try { this . format . configure ( this . config . getStubParameters ( ) ) ; } catch ( Throwable t ) { throw new RuntimeException ( "The user defined 'configure()' method in the Output Format caused an error: " + t . getMessage ( ) , t ) ; }
public class SBT013Logger { /** * Send a message to the user in the < b > error < / b > error level * if the < b > error < / b > error level is enabled . * @ param msg message */ @ Override public void error ( F0 < String > msg ) { } }
if ( compilerLogger . isErrorEnabled ( ) ) { String msgString = msg . apply ( ) ; errors . append ( msgString ) . append ( '\n' ) ; compilerLogger . error ( msgString ) ; }
public class CookieBasedSessionManagementHelper { /** * Modifies a message so its Request Header / Body matches the web session provided . * @ param message the message * @ param requestCookies a pre - computed list with the request cookies ( for optimization reasons ) * @ param session the session */ public static void processMessageToMatchSession ( HttpMessage message , List < HttpCookie > requestCookies , HttpSession session ) { } }
// Make a copy of the session tokens set , as they will be modified HttpSessionTokensSet tokensSet = session . getTokensNames ( ) ; // If no tokens exists create dummy Object - > NPE if ( tokensSet == null ) { tokensSet = new HttpSessionTokensSet ( ) ; } Set < String > unsetSiteTokens = new LinkedHashSet < > ( tokensSet . getTokensSet ( ) ) ; // Iterate through the cookies in the request Iterator < HttpCookie > it = requestCookies . iterator ( ) ; while ( it . hasNext ( ) ) { HttpCookie cookie = it . next ( ) ; String cookieName = cookie . getName ( ) ; // If the cookie is a token if ( tokensSet . isSessionToken ( cookieName ) ) { String tokenValue = session . getTokenValue ( cookieName ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Changing value of token '" + cookieName + "' to: " + tokenValue ) ; // Change it ' s value to the one in the active session , if any if ( tokenValue != null ) { cookie . setValue ( tokenValue ) ; } // Or delete it , if the active session does not have a token value else { it . remove ( ) ; } // Remove the token from the token set so we know what tokens still have to be // added unsetSiteTokens . remove ( cookieName ) ; } } // Iterate through the tokens that are not present in the request and set the proper // value for ( String token : unsetSiteTokens ) { String tokenValue = session . getTokenValue ( token ) ; // Change it ' s value to the one in the active session , if any if ( tokenValue != null ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Adding token '" + token + " with value: " + tokenValue ) ; HttpCookie cookie = new HttpCookie ( token , tokenValue ) ; requestCookies . add ( cookie ) ; } } // Store the session in the HttpMessage for caching purpose message . setHttpSession ( session ) ; // Update the cookies in the message message . getRequestHeader ( ) . setCookies ( requestCookies ) ;
public class ArgumentProvider { /** * Removes matrix params from path * @ param path to clean up * @ param definition to check if matrix params are present * @ return cleaned up path */ private static String removeMatrixFromPath ( String path , RouteDefinition definition ) { } }
// simple removal . . . we don ' t care what matrix attributes were given if ( definition . hasMatrixParams ( ) ) { int index = path . indexOf ( ";" ) ; if ( index > 0 ) { return path . substring ( 0 , index ) ; } } return path ;
public class Admin { /** * @ throws PageException */ private void doVerifyDatasource ( ) throws PageException { } }
ClassDefinition cd = new ClassDefinitionImpl ( Caster . toString ( attributes . get ( "classname" , null ) , null ) , Caster . toString ( attributes . get ( "bundleName" , null ) , null ) , Caster . toString ( attributes . get ( "bundleVersion" , null ) , null ) , config . getIdentification ( ) ) ; String connStr = ( String ) attributes . get ( "connStr" , null ) ; if ( StringUtil . isEmpty ( connStr ) ) connStr = ( String ) attributes . get ( "dsn" , null ) ; if ( cd . hasClass ( ) && connStr != null ) { _doVerifyDatasource ( cd , connStr , getString ( "admin" , action , "dbusername" ) , getString ( "admin" , action , "dbpassword" ) ) ; } else { _doVerifyDatasource ( getString ( "admin" , action , "name" ) , getString ( "admin" , action , "dbusername" ) , getString ( "admin" , action , "dbpassword" ) ) ; }
public class ObjectSwingRenderer { /** * Calls { @ link Object # toString ( ) } on the specified entity and creates * a { @ link JTextArea } containing that text . * @ param entity The evolved entity to render . * @ return A text area containing the string representation of the entity . */ public JComponent render ( Object entity ) { } }
JTextArea text = new JTextArea ( entity . toString ( ) ) ; text . setEditable ( false ) ; text . setBackground ( null ) ; text . setLineWrap ( true ) ; text . setWrapStyleWord ( true ) ; return text ;
public class Bzip2BlockDecompressor { /** * Decodes a byte from the Burrows - Wheeler Transform stage . If the block has randomisation * applied , reverses the randomisation . * @ return The decoded byte */ private int decodeNextBWTByte ( ) { } }
int mergedPointer = bwtCurrentMergedPointer ; int nextDecodedByte = mergedPointer & 0xff ; bwtCurrentMergedPointer = bwtMergedPointers [ mergedPointer >>> 8 ] ; if ( blockRandomised ) { if ( -- randomCount == 0 ) { nextDecodedByte ^= 1 ; randomIndex = ( randomIndex + 1 ) % 512 ; randomCount = Bzip2Rand . rNums ( randomIndex ) ; } } bwtBytesDecoded ++ ; return nextDecodedByte ;
public class AppcastManager { /** * Fetch an appcast from the given URL * @ param url The update URL * @ param proxy proxy data * @ param connectTimeout the connect timeout in milliseconds * @ param readTimeout the read timeout in milliseconds * @ return The fetched appcast content * @ throws AppcastException in case of an error */ public Appcast fetch ( final URL url , Proxy proxy , int connectTimeout , int readTimeout ) throws AppcastException { } }
return fetch ( url , proxy , connectTimeout , readTimeout , null ) ;
public class QueryCacheUtil { /** * Returns { @ code PartitionAccumulatorRegistry } of a { @ code QueryCache } . * @ see PartitionAccumulatorRegistry */ public static PartitionAccumulatorRegistry getAccumulatorRegistryOrNull ( QueryCacheContext context , String mapName , String cacheId ) { } }
PublisherContext publisherContext = context . getPublisherContext ( ) ; MapPublisherRegistry mapPublisherRegistry = publisherContext . getMapPublisherRegistry ( ) ; PublisherRegistry publisherRegistry = mapPublisherRegistry . getOrNull ( mapName ) ; if ( publisherRegistry == null ) { return null ; } return publisherRegistry . getOrNull ( cacheId ) ;
public class Stream { /** * Terminal operation returning the number of elements in this Stream . Note that only few * elements are materialized at any time , so it is safe to use this method with arbitrarily * large Streams . * @ return the number of elements in this Stream */ public final long count ( ) { } }
final AtomicLong result = new AtomicLong ( ) ; toHandler ( new Handler < T > ( ) { private long count ; @ Override public void handle ( final T element ) { if ( element != null ) { ++ this . count ; } else { result . set ( this . count ) ; } } } ) ; return result . get ( ) ;
public class SyncMembersInner { /** * Lists sync members in the given sync group . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; SyncMemberInner & gt ; object */ public Observable < ServiceResponse < Page < SyncMemberInner > > > listBySyncGroupNextWithServiceResponseAsync ( final String nextPageLink ) { } }
return listBySyncGroupNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < SyncMemberInner > > , Observable < ServiceResponse < Page < SyncMemberInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SyncMemberInner > > > call ( ServiceResponse < Page < SyncMemberInner > > page ) { String nextPageLink = page . body ( ) . nextPageLink ( ) ; if ( nextPageLink == null ) { return Observable . just ( page ) ; } return Observable . just ( page ) . concatWith ( listBySyncGroupNextWithServiceResponseAsync ( nextPageLink ) ) ; } } ) ;
public class QueryUtil { /** * Get a similarity query , automatically choosing a relation . * @ param < O > Object type * @ param database Database * @ param similarityFunction Similarity function * @ param hints Optimizer hints * @ return Similarity Query */ public static < O > SimilarityQuery < O > getSimilarityQuery ( Database database , SimilarityFunction < ? super O > similarityFunction , Object ... hints ) { } }
final Relation < O > objectQuery = database . getRelation ( similarityFunction . getInputTypeRestriction ( ) , hints ) ; return database . getSimilarityQuery ( objectQuery , similarityFunction , hints ) ;
public class ViolationThresholdComparator { /** * Computes the feasibility ratio * Return the ratio of feasible solutions */ public double feasibilityRatio ( List < S > solutionSet ) { } }
double aux = 0.0 ; for ( int i = 0 ; i < solutionSet . size ( ) ; i ++ ) { if ( overallConstraintViolation . getAttribute ( solutionSet . get ( i ) ) < 0 ) { aux = aux + 1.0 ; } } return aux / ( double ) solutionSet . size ( ) ;
public class JOGLTypeConversions { /** * Convert framebuffer status to GL constants . * @ param status The status . * @ return The resulting GL constant . */ public static int framebufferStatusToGL ( final JCGLFramebufferStatus status ) { } }
switch ( status ) { case FRAMEBUFFER_STATUS_COMPLETE : return GL . GL_FRAMEBUFFER_COMPLETE ; case FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_ATTACHMENT : return GL . GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT ; case FRAMEBUFFER_STATUS_ERROR_MISSING_IMAGE_ATTACHMENT : return GL . GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT ; case FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_DRAW_BUFFER : return GL3 . GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER ; case FRAMEBUFFER_STATUS_ERROR_INCOMPLETE_READ_BUFFER : return GL3 . GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER ; case FRAMEBUFFER_STATUS_ERROR_UNSUPPORTED : return GL . GL_FRAMEBUFFER_UNSUPPORTED ; case FRAMEBUFFER_STATUS_ERROR_UNKNOWN : return - 1 ; } throw new UnreachableCodeException ( ) ;
public class CPDefinitionLinkLocalServiceBaseImpl { /** * Performs a dynamic query on the database and returns the matching rows . * @ param dynamicQuery the dynamic query * @ return the matching rows */ @ Override public < T > List < T > dynamicQuery ( DynamicQuery dynamicQuery ) { } }
return cpDefinitionLinkPersistence . findWithDynamicQuery ( dynamicQuery ) ;
public class SafeTypeface { /** * Create a new typeface from the specified font file . * @ param path The full path to the font data . * @ return The new typeface . */ public static Typeface createFromFile ( @ Nullable String path ) { } }
Typeface typeface = TYPEFACES . get ( path ) ; if ( typeface != null ) { return typeface ; } else { typeface = Typeface . createFromFile ( path ) ; TYPEFACES . put ( path , typeface ) ; return typeface ; }
public class LiteralType { /** * Parses the . * @ param input the input * @ return the literal type */ public static LiteralType parse ( String input ) { } }
LiteralType result = new LiteralType ( ) ; parse ( result , input ) ; return result ;
public class LinkedWorkspacesInner { /** * Retrieve the linked workspace for the account id . * @ param resourceGroupName Name of an Azure Resource group . * @ param automationAccountName The name of the automation account . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < LinkedWorkspaceInner > getAsync ( String resourceGroupName , String automationAccountName , final ServiceCallback < LinkedWorkspaceInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , automationAccountName ) , serviceCallback ) ;
public class BinaryTreeAddressableHeap { /** * { @ inheritDoc } */ @ Override @ LogarithmicTime @ SuppressWarnings ( "unchecked" ) public AddressableHeap . Handle < K , V > insert ( K key , V value ) { } }
if ( key == null ) { throw new NullPointerException ( "Null keys not permitted" ) ; } Node n = new Node ( key , value ) ; // easy special cases if ( size == 0 ) { root = n ; size = 1 ; return n ; } else if ( size == 1 ) { int c ; if ( comparator == null ) { c = ( ( Comparable < ? super K > ) key ) . compareTo ( root . key ) ; } else { c = comparator . compare ( key , root . key ) ; } if ( c < 0 ) { n . o_c = root ; root . y_s = n ; root = n ; } else { root . o_c = n ; n . y_s = root ; } size = 2 ; return n ; } // find parent of last node and hang Node p = findParentNode ( size + 1 ) ; if ( p . o_c == null ) { p . o_c = n ; } else { p . o_c . y_s = n ; } n . y_s = p ; // increase size size ++ ; // fix priorities fixup ( n ) ; return n ;
public class IdDt { /** * Returns a view of this ID as a fully qualified URL , given a server base and resource name ( which will only be used if the ID does not already contain those respective parts ) . Essentially , * because IdDt can contain either a complete URL or a partial one ( or even jut a simple ID ) , this method may be used to translate into a complete URL . * @ param theServerBase The server base ( e . g . " http : / / example . com / fhir " ) * @ param theResourceType The resource name ( e . g . " Patient " ) * @ return A fully qualified URL for this ID ( e . g . " http : / / example . com / fhir / Patient / 1 " ) */ @ Override public IdDt withServerBase ( String theServerBase , String theResourceType ) { } }
if ( isLocal ( ) || isUrn ( ) ) { return new IdDt ( getValueAsString ( ) ) ; } return new IdDt ( theServerBase , theResourceType , getIdPart ( ) , getVersionIdPart ( ) ) ;
public class ListJobTemplatesResult { /** * List of Job templates . * @ param jobTemplates * List of Job templates . */ public void setJobTemplates ( java . util . Collection < JobTemplate > jobTemplates ) { } }
if ( jobTemplates == null ) { this . jobTemplates = null ; return ; } this . jobTemplates = new java . util . ArrayList < JobTemplate > ( jobTemplates ) ;
public class VFSUtils { /** * Copy input stream to output stream and close them both * @ param is input stream * @ param os output stream * @ throws IOException for any error */ public static void copyStreamAndClose ( InputStream is , OutputStream os ) throws IOException { } }
copyStreamAndClose ( is , os , DEFAULT_BUFFER_SIZE ) ;
public class DeleteReplicationInstanceRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteReplicationInstanceRequest deleteReplicationInstanceRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteReplicationInstanceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteReplicationInstanceRequest . getReplicationInstanceArn ( ) , REPLICATIONINSTANCEARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AuthorizationPrincipalHelper { /** * Convenience method for converting an IPerson to an IAuthorizationPrincipal . * @ param user a non - null valid IPerson * @ return an IAuthorizationPrincipal representing that user * @ throws IllegalArgumentException if the user object is null or defective . * @ since 4.1 */ public static IAuthorizationPrincipal principalFromUser ( final IPerson user ) { } }
Validate . notNull ( user , "Cannot determine an authorization principal for null user." ) ; final EntityIdentifier userEntityIdentifier = user . getEntityIdentifier ( ) ; Validate . notNull ( user , "The user object is defective: lacks entity identifier." ) ; final String userEntityKey = userEntityIdentifier . getKey ( ) ; Validate . notNull ( userEntityKey , "The user object is defective: lacks entity key." ) ; final Class userEntityType = userEntityIdentifier . getType ( ) ; Validate . notNull ( userEntityType , "The user object is defective: lacks entity type." ) ; final IAuthorizationPrincipal principal = AuthorizationServiceFacade . instance ( ) . newPrincipal ( userEntityKey , userEntityType ) ; return principal ;
public class CircuitBreaker { /** * - - - CALL SERVICE - - - */ @ Override protected Promise call ( String name , Tree params , Options opts , PacketStream stream , Context parent , String targetID , int remaining ) { } }
EndpointKey endpointKey = null ; ErrorCounter errorCounter = null ; try { // Get the first recommended Endpoint and Error Counter ActionEndpoint action = ( ActionEndpoint ) serviceRegistry . getAction ( name , targetID ) ; String nodeID = action . getNodeID ( ) ; endpointKey = new EndpointKey ( nodeID , name ) ; errorCounter = getErrorCounter ( endpointKey ) ; // Check availability of the Endpoint ( if endpoint isn ' t targetted ) if ( targetID == null ) { LinkedHashSet < String > nodeIDs = new LinkedHashSet < > ( maxSameNodes * 2 ) ; int sameNodeCounter = 0 ; long now ; if ( errorCounter == null ) { now = 0 ; } else { now = System . currentTimeMillis ( ) ; } for ( int i = 0 ; i < maxTries ; i ++ ) { if ( errorCounter == null || errorCounter . isAvailable ( now ) ) { // Endpoint is available break ; } // Store nodeID if ( ! nodeIDs . add ( nodeID ) ) { sameNodeCounter ++ ; if ( sameNodeCounter >= maxSameNodes ) { // The " maxSameNodes " limit is reached break ; } } // Try to choose another endpoint action = ( ActionEndpoint ) serviceRegistry . getAction ( name , null ) ; nodeID = action . getNodeID ( ) ; endpointKey = new EndpointKey ( nodeID , name ) ; errorCounter = getErrorCounter ( endpointKey ) ; } } // Create new Context Context ctx = contextFactory . create ( name , params , opts , stream , parent ) ; // Invoke Endpoint final ErrorCounter currentCounter = errorCounter ; final EndpointKey currentKey = endpointKey ; return Promise . resolve ( action . handler ( ctx ) ) . then ( rsp -> { // Reset error counter if ( currentCounter != null ) { currentCounter . reset ( ) ; } // Return response return rsp ; } ) . catchError ( cause -> { // Increment error counter increment ( currentCounter , currentKey , cause , System . currentTimeMillis ( ) ) ; // Retry return retry ( cause , name , params , opts , stream , parent , targetID , remaining ) ; } ) ; } catch ( Throwable cause ) { // Increment error counter increment ( errorCounter , endpointKey , cause , System . currentTimeMillis ( ) ) ; // Retry return retry ( cause , name , params , opts , stream , parent , targetID , remaining ) ; }
public class LocalDeviceResourceDataMarshaller { /** * Marshall the given parameter object . */ public void marshall ( LocalDeviceResourceData localDeviceResourceData , ProtocolMarshaller protocolMarshaller ) { } }
if ( localDeviceResourceData == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( localDeviceResourceData . getGroupOwnerSetting ( ) , GROUPOWNERSETTING_BINDING ) ; protocolMarshaller . marshall ( localDeviceResourceData . getSourcePath ( ) , SOURCEPATH_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DocFinder { /** * Search for the requested comments in the given element . If it does not * have comments , return documentation from the overridden element if possible . * If the overridden element does not exist or does not have documentation to * inherit , search for documentation to inherit from implemented methods . * @ param input the input object used to perform the search . * @ return an Output object representing the documentation that was found . */ public static Output search ( Configuration configuration , Input input ) { } }
Output output = new Output ( ) ; Utils utils = configuration . utils ; if ( input . isInheritDocTag ) { // Do nothing because " element " does not have any documentation . // All it has is { @ inheritDoc } . } else if ( input . taglet == null ) { // We want overall documentation . output . inlineTags = input . isFirstSentence ? utils . getFirstSentenceTrees ( input . element ) : utils . getFullBody ( input . element ) ; output . holder = input . element ; } else { input . taglet . inherit ( input , output ) ; } if ( output . inlineTags != null && ! output . inlineTags . isEmpty ( ) ) { return output ; } output . isValidInheritDocTag = false ; Input inheritedSearchInput = input . copy ( configuration . utils ) ; inheritedSearchInput . isInheritDocTag = false ; if ( utils . isMethod ( input . element ) ) { ExecutableElement overriddenMethod = utils . overriddenMethod ( ( ExecutableElement ) input . element ) ; if ( overriddenMethod != null ) { inheritedSearchInput . element = overriddenMethod ; output = search ( configuration , inheritedSearchInput ) ; output . isValidInheritDocTag = true ; if ( ! output . inlineTags . isEmpty ( ) ) { return output ; } } // NOTE : When we fix the bug where ClassDoc . interfaceTypes ( ) does // not pass all implemented interfaces , we will use the // appropriate element here . ImplementedMethods implMethods = new ImplementedMethods ( ( ExecutableElement ) input . element , configuration ) ; List < ExecutableElement > implementedMethods = implMethods . build ( ) ; for ( ExecutableElement implementedMethod : implementedMethods ) { inheritedSearchInput . element = implementedMethod ; output = search ( configuration , inheritedSearchInput ) ; output . isValidInheritDocTag = true ; if ( ! output . inlineTags . isEmpty ( ) ) { return output ; } } } else if ( utils . isTypeElement ( input . element ) ) { TypeMirror t = ( ( TypeElement ) input . element ) . getSuperclass ( ) ; Element superclass = utils . asTypeElement ( t ) ; if ( superclass != null ) { inheritedSearchInput . element = superclass ; output = search ( configuration , inheritedSearchInput ) ; output . isValidInheritDocTag = true ; if ( ! output . inlineTags . isEmpty ( ) ) { return output ; } } } return output ;
public class PocketKnife { /** * Bind annotated fields in the specified { @ link android . support . v4 . app . Fragment } from its arguments . * @ param fragment fragment to bind the arguments ; */ public static void bindArguments ( android . support . v4 . app . Fragment fragment ) { } }
bindArguments ( fragment , fragment . getArguments ( ) ) ;
public class GetContentModerationResult { /** * The detected moderation labels and the time ( s ) they were detected . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setModerationLabels ( java . util . Collection ) } or { @ link # withModerationLabels ( java . util . Collection ) } if you * want to override the existing values . * @ param moderationLabels * The detected moderation labels and the time ( s ) they were detected . * @ return Returns a reference to this object so that method calls can be chained together . */ public GetContentModerationResult withModerationLabels ( ContentModerationDetection ... moderationLabels ) { } }
if ( this . moderationLabels == null ) { setModerationLabels ( new java . util . ArrayList < ContentModerationDetection > ( moderationLabels . length ) ) ; } for ( ContentModerationDetection ele : moderationLabels ) { this . moderationLabels . add ( ele ) ; } return this ;
public class El { /** * Returns method in text form . Format is * & lt ; canonical name of method class & gt ; ' ' & lt ; method name & gt ; ' ( ' arguments ' ) ' * Arguments is a comma separated list of argument type names . Argument type name * is canonical name of argument class . Arrays however are printed with leading ' [ ' . * Example T0 . class . getDeclaredMethod ( " m1 " , String . class , int . class , long [ ] . class ) * produces " org . vesalainen . bcc . T0 m1 ( java . lang . String , int , [ long ) " * @ param method * @ return */ public static String getExecutableString ( ExecutableElement method ) { } }
if ( method == null ) { return "" ; } StringBuilder sb = new StringBuilder ( ) ; TypeElement te = ( TypeElement ) method . getEnclosingElement ( ) ; sb . append ( te . getQualifiedName ( ) ) ; sb . append ( ' ' ) ; sb . append ( method . getSimpleName ( ) ) ; sb . append ( '(' ) ; boolean f = true ; for ( VariableElement p : method . getParameters ( ) ) { if ( f ) { f = false ; } else { sb . append ( ',' ) ; } addTypeName ( sb , p . asType ( ) ) ; } sb . append ( ')' ) ; return sb . toString ( ) ;
public class AbstractMetricGroup { public void close ( ) { } }
synchronized ( this ) { if ( ! closed ) { closed = true ; // close all subgroups for ( AbstractMetricGroup group : groups . values ( ) ) { group . close ( ) ; } groups . clear ( ) ; // un - register all directly contained metrics for ( Map . Entry < String , Metric > metric : metrics . entrySet ( ) ) { registry . unregister ( metric . getValue ( ) , metric . getKey ( ) , this ) ; } metrics . clear ( ) ; } }
public class PropertiesEscape { /** * Perform a Java Properties Key level 1 ( only basic set ) < strong > escape < / strong > operation * on a < tt > Reader < / tt > input , writing results to a < tt > Writer < / tt > . * < em > Level 1 < / em > means this method will only escape the Java Properties Key basic escape set : * < ul > * < li > The < em > Single Escape Characters < / em > : * < tt > & # 92 ; t < / tt > ( < tt > U + 0009 < / tt > ) , * < tt > & # 92 ; n < / tt > ( < tt > U + 000A < / tt > ) , * < tt > & # 92 ; f < / tt > ( < tt > U + 000C < / tt > ) , * < tt > & # 92 ; r < / tt > ( < tt > U + 000D < / tt > ) , * < tt > & # 92 ; & nbsp ; < / tt > ( < tt > U + 0020 < / tt > ) , * < tt > & # 92 ; : < / tt > ( < tt > U + 003A < / tt > ) , * < tt > & # 92 ; = < / tt > ( < tt > U + 003D < / tt > ) and * < tt > & # 92 ; & # 92 ; < / tt > ( < tt > U + 005C < / tt > ) . * < / li > * < li > * Two ranges of non - displayable , control characters ( some of which are already part of the * < em > single escape characters < / em > list ) : < tt > U + 0000 < / tt > to < tt > U + 001F < / tt > * and < tt > U + 007F < / tt > to < tt > U + 009F < / tt > . * < / li > * < / ul > * This method calls { @ link # escapePropertiesKey ( Reader , Writer , PropertiesKeyEscapeLevel ) } * with the following preconfigured values : * < ul > * < li > < tt > level < / tt > : * { @ link PropertiesKeyEscapeLevel # LEVEL _ 1 _ BASIC _ ESCAPE _ SET } < / li > * < / ul > * This method is < strong > thread - safe < / strong > . * @ param reader the < tt > Reader < / tt > reading the text to be escaped . * @ param writer the < tt > java . io . Writer < / tt > to which the escaped result will be written . Nothing will * be written at all to this writer if input is < tt > null < / tt > . * @ throws IOException if an input / output exception occurs */ public static void escapePropertiesKeyMinimal ( final Reader reader , final Writer writer ) throws IOException { } }
escapePropertiesKey ( reader , writer , PropertiesKeyEscapeLevel . LEVEL_1_BASIC_ESCAPE_SET ) ;
public class GoogleAuthenticatorAccountCouchDbRepository { /** * Delete token without revision checks . * @ param token token to delete */ @ UpdateHandler ( name = "delete_token_account" , file = "CouchDbOneTimeTokenAccount_delete.js" ) public void deleteTokenAccount ( final CouchDbGoogleAuthenticatorAccount token ) { } }
db . callUpdateHandler ( stdDesignDocumentId , "delete_token_account" , token . getCid ( ) , null ) ;
public class SequenceScalePanel { /** * draw the Scale * @ param g2D * @ param y the height on which to draw the scale * @ return the new y position */ protected int drawScale ( Graphics2D g2D , int y ) { } }
// only draw within the ranges of the Clip Rectangle drawHere = g2D . getClipBounds ( ) ; g2D . setColor ( SCALE_COLOR ) ; int aminosize = Math . round ( 1 * scale ) ; if ( aminosize < 1 ) aminosize = 1 ; int startpos = coordManager . getSeqPos ( drawHere . x ) ; int endpos = coordManager . getSeqPos ( drawHere . x + drawHere . width ) ; if ( endpos > apos . size ( ) ) endpos = apos . size ( ) ; int l = endpos - startpos + 1 ; int drawStart = coordManager . getPanelPos ( startpos ) ; int drawEnd = coordManager . getPanelPos ( l ) - DEFAULT_X_START + aminosize ; // System . out . println ( " SeqScalePanel drawing scale s : " + startpos + " e : " + endpos + // " ps : " + drawStart + " pe : " + drawEnd + " draw . x " + drawHere . x + " draw . w " + drawHere . width + // " scale " + scale ) ; // the frame around the sequence box if ( scale < SEQUENCE_SHOW ) { g2D . setColor ( SEQUENCE_COLOR ) ; // g2D . setColor ( Color . blue ) ; Rectangle seqline = new Rectangle ( drawStart , y , drawEnd , LINE_HEIGHT ) ; // g2D = ( Graphics2D ) g ; g2D . fill ( seqline ) ; // g2D . setColor ( Color . blue ) ; // g2D . draw ( seqline ) ; } // the top line for the scale g2D . setColor ( SCALE_COLOR ) ; Rectangle baseline = new Rectangle ( drawStart , y , drawEnd , 2 ) ; g2D . fill ( baseline ) ; // draw the vertical ticks int lineH = 11 ; if ( scale <= 3 ) lineH = 8 ; for ( int gap = startpos ; ( ( gap <= endpos ) && ( gap < apos . size ( ) ) ) ; gap ++ ) { int xpos = coordManager . getPanelPos ( gap ) ; AlignedPosition m = apos . get ( gap ) ; if ( m . getPos ( position ) == - 1 ) { // a gap position g2D . setColor ( GAP_COLOR ) ; g2D . fillRect ( xpos , y + 2 , aminosize + 1 , y + lineH ) ; g2D . setColor ( GAP_COLOR ) ; continue ; } int i = m . getPos ( position ) ; if ( ( ( i + 1 ) % 100 ) == 0 ) { if ( scale > 0.1 ) { g2D . setColor ( TEXT_SCALE_COLOR ) ; g2D . fillRect ( xpos , y + 2 , aminosize , y + lineH ) ; g2D . setColor ( SCALE_COLOR ) ; if ( scale < SEQUENCE_SHOW ) g2D . drawString ( String . valueOf ( i + 1 ) , xpos , y + DEFAULT_Y_STEP ) ; } } else if ( ( ( i + 1 ) % 50 ) == 0 ) { if ( scale > 1.4 ) { g2D . setColor ( TEXT_SCALE_COLOR ) ; g2D . fillRect ( xpos , y + 2 , aminosize , y + lineH ) ; g2D . setColor ( SCALE_COLOR ) ; if ( scale < SEQUENCE_SHOW ) g2D . drawString ( String . valueOf ( i + 1 ) , xpos , y + DEFAULT_Y_STEP ) ; } } else if ( ( ( i + 1 ) % 10 ) == 0 ) { if ( scale > 3 ) { g2D . setColor ( TEXT_SCALE_COLOR ) ; g2D . fillRect ( xpos , y + 2 , aminosize , y + lineH ) ; g2D . setColor ( SCALE_COLOR ) ; if ( scale < SEQUENCE_SHOW ) g2D . drawString ( String . valueOf ( i + 1 ) , xpos , y + DEFAULT_Y_STEP ) ; } } } int length = chainLength ; if ( endpos >= length - 1 ) { int endPanel = coordManager . getPanelPos ( endpos ) ; g2D . drawString ( String . valueOf ( length ) , endPanel + 10 , y + DEFAULT_Y_STEP ) ; } return y ;
public class AcsURLEncoder { /** * used for encoding queries or form data */ public static String encode ( String value ) throws UnsupportedEncodingException { } }
if ( isNullOrEmpty ( value ) ) return value ; return URLEncoder . encode ( value , URL_ENCODING ) ;
public class CompiledTemplate { /** * This method is called by JavaClassGenerator during the compile phase . It overrides the * method in CompilationUnit and returns just the reflected template signature . */ public Template getParseTree ( ) { } }
getTemplateClass ( ) ; if ( findExecuteMethod ( ) == null ) throw new IllegalArgumentException ( "Cannot locate compiled template entry point." ) ; reflectParameters ( ) ; mTree = new Template ( mCallerInfo , new Name ( mCallerInfo , getName ( ) ) , mParameters , mSubParam , null , null ) ; mTree . setReturnType ( new Type ( mExecuteMethod . getReturnType ( ) , mExecuteMethod . getGenericReturnType ( ) ) ) ; return mTree ;
public class TypeSpecificSerializer { /** * / * PRIMITIVES */ @ Override public Void process ( ByteBuffer buf , boolean value ) { } }
buf . put ( Ser . bool2byte ( value ) ) ; return null ;
public class nsip6 { /** * Use this API to unset the properties of nsip6 resources . * Properties that need to be unset are specified in args array . */ public static base_responses unset ( nitro_service client , String ipv6address [ ] , String args [ ] ) throws Exception { } }
base_responses result = null ; if ( ipv6address != null && ipv6address . length > 0 ) { nsip6 unsetresources [ ] = new nsip6 [ ipv6address . length ] ; for ( int i = 0 ; i < ipv6address . length ; i ++ ) { unsetresources [ i ] = new nsip6 ( ) ; unsetresources [ i ] . ipv6address = ipv6address [ i ] ; } result = unset_bulk_request ( client , unsetresources , args ) ; } return result ;
public class FileHandlerUtil { /** * Generate output file path . * @ param path the path * @ param fileName the file name * @ return the string */ public static String generateOutputFilePath ( String path , String fileName ) { } }
String tempPath = separatorsToSystem ( path ) ; tempPath = tempPath + File . separatorChar + fileName ; return tempPath ;
public class VersionsHandler { /** * Find - out the last release version in a list of version ( regarding Axway Conventions ) * @ param versions * @ return String * @ throws IncomparableException */ public String getLastRelease ( final Collection < String > versions ) { } }
final List < Version > sorted = versions . stream ( ) . filter ( Version :: isValid ) // filter invalid input values . map ( Version :: make ) . filter ( Optional :: isPresent ) . map ( Optional :: get ) . filter ( Version :: isRelease ) . sorted ( ( v1 , v2 ) -> { try { return v1 . compare ( v2 ) ; } catch ( IncomparableException e ) { return 0 ; } } ) . collect ( Collectors . toList ( ) ) ; if ( sorted . isEmpty ( ) ) { if ( LOG . isWarnEnabled ( ) ) { LOG . warn ( String . format ( "Cannot obtain last release from collection %s" , versions . toString ( ) ) ) ; } return null ; } return sorted . get ( sorted . size ( ) - 1 ) . toString ( ) ;
public class Math { /** * This method solves the unconstrained minimization problem * < pre > * min f ( x ) , x = ( x1 , x2 , . . . , x _ n ) , * < / pre > * using the BFGS method . * @ param func the function to be minimized . * @ param x on initial entry this must be set by the user to the values * of the initial estimate of the solution vector . On exit , it * contains the values of the variables at the best point found * ( usually a solution ) . * @ param gtol the convergence requirement on zeroing the gradient . * @ param maxIter the maximum allowed number of iterations . * @ return the minimum value of the function . */ public static double min ( DifferentiableMultivariateFunction func , double [ ] x , double gtol , int maxIter ) { } }
// The convergence criterion on x values . final double TOLX = 4 * EPSILON ; // The scaled maximum step length allowed in line searches . final double STPMX = 100.0 ; double den , fac , fad , fae , sumdg , sumxi , temp , test ; int n = x . length ; double [ ] dg = new double [ n ] ; double [ ] g = new double [ n ] ; double [ ] hdg = new double [ n ] ; double [ ] xnew = new double [ n ] ; double [ ] xi = new double [ n ] ; double [ ] [ ] hessin = new double [ n ] [ n ] ; // Calculate starting function value and gradient and initialize the // inverse Hessian to the unit matrix . double f = func . f ( x , g ) ; logger . info ( String . format ( "BFGS: initial function value: %.5g" , f ) ) ; double sum = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { hessin [ i ] [ i ] = 1.0 ; // Initialize line direction . xi [ i ] = - g [ i ] ; sum += x [ i ] * x [ i ] ; } double stpmax = STPMX * max ( sqrt ( sum ) , n ) ; for ( int iter = 1 ; iter <= maxIter ; iter ++ ) { // The new function evaluation occurs in line search . f = linesearch ( func , x , f , g , xi , xnew , stpmax ) ; if ( iter % 10 == 0 ) { logger . info ( String . format ( "BFGS: the function value after %3d iterations: %.5g" , iter , f ) ) ; } // update the line direction and current point . for ( int i = 0 ; i < n ; i ++ ) { xi [ i ] = xnew [ i ] - x [ i ] ; x [ i ] = xnew [ i ] ; } // Test for convergence on x . test = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { temp = abs ( xi [ i ] ) / max ( abs ( x [ i ] ) , 1.0 ) ; if ( temp > test ) { test = temp ; } } if ( test < TOLX ) { logger . info ( String . format ( "BFGS: the function value after %3d iterations: %.5g" , iter , f ) ) ; return f ; } System . arraycopy ( g , 0 , dg , 0 , n ) ; func . f ( x , g ) ; // Test for convergence on zero gradient . den = max ( f , 1.0 ) ; test = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { temp = abs ( g [ i ] ) * max ( abs ( x [ i ] ) , 1.0 ) / den ; if ( temp > test ) { test = temp ; } } if ( test < gtol ) { logger . info ( String . format ( "BFGS: the function value after %3d iterations: %.5g" , iter , f ) ) ; return f ; } for ( int i = 0 ; i < n ; i ++ ) { dg [ i ] = g [ i ] - dg [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { hdg [ i ] = 0.0 ; for ( int j = 0 ; j < n ; j ++ ) { hdg [ i ] += hessin [ i ] [ j ] * dg [ j ] ; } } fac = fae = sumdg = sumxi = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { fac += dg [ i ] * xi [ i ] ; fae += dg [ i ] * hdg [ i ] ; sumdg += dg [ i ] * dg [ i ] ; sumxi += xi [ i ] * xi [ i ] ; } // Skip upudate if fac is not sufficiently positive . if ( fac > sqrt ( EPSILON * sumdg * sumxi ) ) { fac = 1.0 / fac ; fad = 1.0 / fae ; // The vector that makes BFGS different from DFP . for ( int i = 0 ; i < n ; i ++ ) { dg [ i ] = fac * xi [ i ] - fad * hdg [ i ] ; } // BFGS updating formula . for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { hessin [ i ] [ j ] += fac * xi [ i ] * xi [ j ] - fad * hdg [ i ] * hdg [ j ] + fae * dg [ i ] * dg [ j ] ; hessin [ j ] [ i ] = hessin [ i ] [ j ] ; } } } // Calculate the next direction to go . Arrays . fill ( xi , 0.0 ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { xi [ i ] -= hessin [ i ] [ j ] * g [ j ] ; } } } throw new IllegalStateException ( "BFGS: Too many iterations." ) ;
public class AbstractHandlerDefinition { /** * Creates the default { @ linkplain org . jboss . as . controller . SimpleResourceDefinition . Parameters parameters } for * creating the source . * @ param path the resource path * @ param type the known type of the resource or { @ code null } if the type is unknown * @ param propertySorter the property sorter * @ param addAttributes the attributes for the add operation step handler * @ param constructionProperties the construction properties required for the handler * @ return the default parameters */ private static Parameters createParameters ( final PathElement path , final Class < ? extends Handler > type , final PropertySorter propertySorter , final AttributeDefinition [ ] addAttributes , final ConfigurationProperty < ? > ... constructionProperties ) { } }
return new Parameters ( path , LoggingExtension . getResourceDescriptionResolver ( path . getKey ( ) ) ) . setAddHandler ( new HandlerOperations . HandlerAddOperationStepHandler ( propertySorter , type , addAttributes , constructionProperties ) ) . setRemoveHandler ( HandlerOperations . REMOVE_HANDLER ) . setCapabilities ( Capabilities . HANDLER_CAPABILITY ) ;
public class ZaurusTableForm { /** * generate the Where - condition for the words */ private String generateWhere ( String [ ] words , boolean allWords , boolean ignoreCase , boolean noMatchWhole ) { } }
String result = "" ; // if all words must match use AND between the different conditions String join ; if ( allWords ) { join = " AND " ; } else { join = " OR " ; } // end of else for ( int wordInd = 0 ; wordInd < words . length ; wordInd ++ ) { String oneCondition = "" ; for ( int col = 0 ; col < columns . length ; col ++ ) { if ( oneCondition != "" ) { oneCondition += " OR " ; } if ( ignoreCase ) { if ( noMatchWhole ) { oneCondition += "LOWER(" + columns [ col ] + ") LIKE '%" + words [ wordInd ] . toLowerCase ( ) + "%'" ; } else { oneCondition += "LOWER(" + columns [ col ] + ") LIKE '" + words [ wordInd ] . toLowerCase ( ) + "'" ; } } else { if ( noMatchWhole ) { oneCondition += columns [ col ] + " LIKE '%" + words [ wordInd ] + "%'" ; } else { oneCondition += columns [ col ] + " LIKE '" + words [ wordInd ] + "'" ; } } } if ( result != "" ) { result += join ; } result += "(" + oneCondition + ")" ; } if ( result != "" ) { result = " WHERE " + result ; } // end of if ( result ! = " " ) // System . out . println ( " result : " + result ) ; return result ;
public class DITableInfo { /** * Retrieves whether the specified column is nullable . < p > * If the column is nullable , " YES " is retrieved , else " NO " . < p > * @ param i zero - based column index * @ return the nullability of the specified column */ String getColIsNullable ( int i ) { } }
ColumnSchema column = table . getColumn ( i ) ; return ( column . isNullable ( ) && ! column . isPrimaryKey ( ) ) ? "YES" : "NO" ;
public class DefaultComparisonFormatter { /** * Formats a processing instruction for { @ link # getShortString } . * @ param sb the builder to append to * @ param instr the processing instruction * @ since XMLUnit 2.4.0 */ protected void appendProcessingInstruction ( StringBuilder sb , ProcessingInstruction instr ) { } }
sb . append ( "<?" ) . append ( instr . getTarget ( ) ) . append ( ' ' ) . append ( instr . getData ( ) ) . append ( "?>" ) ;
public class CommercePaymentMethodGroupRelPersistenceImpl { /** * Returns the commerce payment method group rel with the primary key or returns < code > null < / code > if it could not be found . * @ param primaryKey the primary key of the commerce payment method group rel * @ return the commerce payment method group rel , or < code > null < / code > if a commerce payment method group rel with the primary key could not be found */ @ Override public CommercePaymentMethodGroupRel fetchByPrimaryKey ( Serializable primaryKey ) { } }
Serializable serializable = entityCache . getResult ( CommercePaymentMethodGroupRelModelImpl . ENTITY_CACHE_ENABLED , CommercePaymentMethodGroupRelImpl . class , primaryKey ) ; if ( serializable == nullModel ) { return null ; } CommercePaymentMethodGroupRel commercePaymentMethodGroupRel = ( CommercePaymentMethodGroupRel ) serializable ; if ( commercePaymentMethodGroupRel == null ) { Session session = null ; try { session = openSession ( ) ; commercePaymentMethodGroupRel = ( CommercePaymentMethodGroupRel ) session . get ( CommercePaymentMethodGroupRelImpl . class , primaryKey ) ; if ( commercePaymentMethodGroupRel != null ) { cacheResult ( commercePaymentMethodGroupRel ) ; } else { entityCache . putResult ( CommercePaymentMethodGroupRelModelImpl . ENTITY_CACHE_ENABLED , CommercePaymentMethodGroupRelImpl . class , primaryKey , nullModel ) ; } } catch ( Exception e ) { entityCache . removeResult ( CommercePaymentMethodGroupRelModelImpl . ENTITY_CACHE_ENABLED , CommercePaymentMethodGroupRelImpl . class , primaryKey ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return commercePaymentMethodGroupRel ;
public class CompilingLoader { /** * Checks that the case is okay for the source . */ boolean checkSource ( PathImpl sourceDir , String javaName ) { } }
try { while ( javaName != null && ! javaName . equals ( "" ) ) { int p = javaName . indexOf ( '/' ) ; String head ; if ( p >= 0 ) { head = javaName . substring ( 0 , p ) ; javaName = javaName . substring ( p + 1 ) ; } else { head = javaName ; javaName = null ; } String [ ] names = sourceDir . list ( ) ; int i ; for ( i = 0 ; i < names . length ; i ++ ) { if ( names [ i ] . equals ( head ) ) break ; } if ( i == names . length ) return false ; sourceDir = sourceDir . lookup ( head ) ; } } catch ( IOException e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; return false ; } return true ;
public class References { /** * do not return full paths - - security ! */ public static String location ( Node node ) { } }
String name ; int idx ; if ( node instanceof ZipNode ) { name = ( ( ZipNode ) node ) . getRoot ( ) . getZip ( ) . getName ( ) ; idx = name . lastIndexOf ( '/' ) ; if ( idx >= 0 ) { name = name . substring ( idx + 1 ) ; } return "zip:" + name + "/" + node . getPath ( ) ; } else if ( node instanceof FileNode ) { return "file:" + node . getRelative ( node . getWorld ( ) . getWorking ( ) ) ; } else if ( node instanceof HttpNode ) { return "http:" + node . getName ( ) + ( ( HttpNode ) node ) . getQuery ( ) ; } else { return node . getName ( ) ; }
public class StepProgress { /** * Do a new step and log it * @ param step Step number * @ param stepTitle Step title * @ param logger Logger to report to . */ public void beginStep ( int step , String stepTitle , Logging logger ) { } }
setProcessed ( step - 1 ) ; this . stepTitle = stepTitle ; logger . progress ( this ) ;
public class CaretSelectionBindImpl { /** * Assumes that { @ code getArea ( ) . getLength ! = 0 } is true and { @ link BreakIterator # setText ( String ) } has been called */ private int calculatePositionViaBreakingForwards ( int numOfBreaks , BreakIterator breakIterator , int position ) { } }
breakIterator . following ( position ) ; for ( int i = 1 ; i < numOfBreaks ; i ++ ) { breakIterator . next ( numOfBreaks ) ; } return breakIterator . current ( ) ;
public class Utils { /** * Strips a string from HTML markup . Elements { @ code < br > } , { @ code < p > } , { @ code < h1 > } , * { @ code < h2 > } and { @ code < h3 > } are replaced with with new line . This produces * a string which is readable as plain text . * Note : The method is simple and crude . It will not work on malformed HTML * or if there are un - escaped { @ code < } or { @ code > } outside of the HTML * tags . However , for all but the most complex use cases , the method will * probably work just fine . * @ param str * @ return */ public static String stripHtml ( String str ) { } }
if ( str == null ) { return null ; } if ( str . isEmpty ( ) ) { return str ; } boolean intag = false ; boolean tagHasEnded = false ; StringBuilder outp = new StringBuilder ( ) ; StringBuilder tagName = new StringBuilder ( ) ; boolean ignoreContents = false ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = str . charAt ( i ) ; if ( ! intag && ch == '<' ) { intag = true ; // Note : In HTML the tag name must follow * immediately * // after the opening ' < ' character . Therefore the tagName starts // now . tagHasEnded = false ; continue ; } if ( intag ) { if ( ch == '/' || ch == ' ' || ch == '>' ) { tagHasEnded = true ; } if ( ! tagHasEnded ) { tagName . append ( ch ) ; } } if ( intag && str . charAt ( i ) == '>' ) { intag = false ; String tName = tagName . toString ( ) ; if ( tName . equalsIgnoreCase ( "br" ) || tName . equalsIgnoreCase ( "p" ) || tName . equalsIgnoreCase ( "h1" ) || tName . equalsIgnoreCase ( "h2" ) || tName . equalsIgnoreCase ( "h3" ) ) { outp . append ( System . lineSeparator ( ) ) ; } ignoreContents = tName . equalsIgnoreCase ( "style" ) ; // contents inside < style > tag is ignored tagName . setLength ( 0 ) ; // clear the contents continue ; } if ( ! intag && ( ! ignoreContents ) ) { outp = outp . append ( ch ) ; } } return outp . toString ( ) ;
public class PluginsAlertConditionCache { /** * Adds the condition list to the conditions for the account . * @ param conditions The conditions to add */ public void add ( Collection < PluginsAlertCondition > conditions ) { } }
for ( PluginsAlertCondition condition : conditions ) this . conditions . put ( condition . getId ( ) , condition ) ;
public class ClassFile { /** * Add a constructor to this class . * @ param params May be null if constructor accepts no parameters . */ public MethodInfo addConstructor ( Modifiers modifiers , TypeDesc ... params ) { } }
String [ ] paramNames = MethodDesc . createGenericParameterNames ( params ) ; return addConstructor ( modifiers , params , paramNames ) ;
public class GetStatusPResponse { /** * < code > optional . alluxio . grpc . file . FileInfo fileInfo = 1 ; < / code > */ public alluxio . grpc . FileInfo getFileInfo ( ) { } }
return fileInfo_ == null ? alluxio . grpc . FileInfo . getDefaultInstance ( ) : fileInfo_ ;
public class MainPartExtracter { /** * 对问题进行分词 如 : APDPlat的发起人是谁 ? 分词之后返回 : apdplat 的 发起人 是 谁 ? * @ param question 问题 * @ return 分词之后的用空格顺序连接的结果 */ private String questionParse ( String question ) { } }
// 分词 LOG . info ( "对问题进行分词:" + question ) ; List < Word > words = WordParser . parse ( question ) ; StringBuilder wordStr = new StringBuilder ( ) ; for ( Word word : words ) { wordStr . append ( word . getText ( ) ) . append ( " " ) ; } LOG . info ( "分词结果为:" + wordStr . toString ( ) . trim ( ) ) ; return wordStr . toString ( ) . trim ( ) ;
public class IncomingDataPoints { /** * Copies the specified byte array at the specified offset in the row key . * @ param row * The row key into which to copy the bytes . * @ param offset * The offset in the row key to start writing at . * @ param bytes * The bytes to copy . */ private static void copyInRowKey ( final byte [ ] row , final short offset , final byte [ ] bytes ) { } }
System . arraycopy ( bytes , 0 , row , offset , bytes . length ) ;
public class EntryInfo { /** * This gets the inactivity timer for this cache entry . * @ return the inactivity timer for this cache entry . * @ ibm - private - in - use */ public int getInactivity ( ) { } }
// CPF - Inactivity if ( com . ibm . ws . cache . TimeLimitDaemon . UNIT_TEST_INACTIVITY ) { System . out . println ( "EntryInfo.getInactivity() " + inactivity ) ; } return inactivity ;
public class XmlInputStream { /** * Reads the next length of bytes from the stream into the given byte array * at the given offset . * @ param data the buffer to store the data read * @ param offset the offset in the buffer to start writing * @ param length the length of data to read * @ return the number of bytes read * @ throws IOException thrown when there is an issue with the underlying * stream */ @ Override public int read ( byte [ ] data , int offset , int length ) throws IOException { } }
final StringBuilder s = read ( length ) ; int n = 0 ; for ( int i = 0 ; i < Math . min ( length , s . length ( ) ) ; i ++ ) { data [ offset + i ] = ( byte ) s . charAt ( i ) ; n += 1 ; } given ( s , length , n ) ; return n > 0 ? n : - 1 ;
public class AlluxioStatusException { /** * Converts a gRPC StatusRuntimeException to an Alluxio status exception . * @ param e a gRPC StatusRuntimeException * @ return the converted { @ link AlluxioStatusException } */ public static AlluxioStatusException fromStatusRuntimeException ( StatusRuntimeException e ) { } }
return AlluxioStatusException . from ( e . getStatus ( ) . withCause ( e ) ) ;