signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class AccountManager { /** * < p > Getter for the field < code > allUsers < / code > . < / p >
* @ return an array of { @ link java . lang . String } objects . */
public String [ ] getAllUsers ( ) { } } | String [ ] users = new String [ allUsers . size ( ) ] ; allUsers . toArray ( users ) ; return users ; |
public class TemplateHelper { /** * Extract { @ link org . glassfish . jersey . server . mvc . Template template } annotation from given list .
* @ param annotations list of annotations .
* @ return { @ link org . glassfish . jersey . server . mvc . Template template } annotation or { @ code null } if this annotation is not present . */
public static Template getTemplateAnnotation ( final Annotation [ ] annotations ) { } } | if ( annotations != null && annotations . length > 0 ) { for ( Annotation annotation : annotations ) { if ( annotation instanceof Template ) { return ( Template ) annotation ; } } } return null ; |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public IfcCoveringTypeEnum createIfcCoveringTypeEnumFromString ( EDataType eDataType , String initialValue ) { } } | IfcCoveringTypeEnum result = IfcCoveringTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class SockJSSession { /** * Yes , I know it ' s weird but that ' s the way SockJS likes it . */
private void doClose ( ) { } } | super . close ( ) ; // We must call this or handlers don ' t get unregistered and we get a leak
if ( heartbeatID != - 1 ) { vertx . cancelTimer ( heartbeatID ) ; } if ( timeoutTimerID != - 1 ) { vertx . cancelTimer ( timeoutTimerID ) ; } if ( id != null ) { // Can be null if websocket session
sessions . remove ( id ) ; } if ( ! closed ) { closed = true ; if ( endHandler != null ) { endHandler . handle ( null ) ; } } |
public class CPDefinitionSpecificationOptionValuePersistenceImpl { /** * Returns the cp definition specification option value where CPDefinitionId = & # 63 ; and CPDefinitionSpecificationOptionValueId = & # 63 ; or throws a { @ link NoSuchCPDefinitionSpecificationOptionValueException } if it could not be found .
* @ param CPDefinitionId the cp definition ID
* @ param CPDefinitionSpecificationOptionValueId the cp definition specification option value ID
* @ return the matching cp definition specification option value
* @ throws NoSuchCPDefinitionSpecificationOptionValueException if a matching cp definition specification option value could not be found */
@ Override public CPDefinitionSpecificationOptionValue findByC_CSOVI ( long CPDefinitionId , long CPDefinitionSpecificationOptionValueId ) throws NoSuchCPDefinitionSpecificationOptionValueException { } } | CPDefinitionSpecificationOptionValue cpDefinitionSpecificationOptionValue = fetchByC_CSOVI ( CPDefinitionId , CPDefinitionSpecificationOptionValueId ) ; if ( cpDefinitionSpecificationOptionValue == null ) { StringBundler msg = new StringBundler ( 6 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "CPDefinitionId=" ) ; msg . append ( CPDefinitionId ) ; msg . append ( ", CPDefinitionSpecificationOptionValueId=" ) ; msg . append ( CPDefinitionSpecificationOptionValueId ) ; msg . append ( "}" ) ; if ( _log . isDebugEnabled ( ) ) { _log . debug ( msg . toString ( ) ) ; } throw new NoSuchCPDefinitionSpecificationOptionValueException ( msg . toString ( ) ) ; } return cpDefinitionSpecificationOptionValue ; |
public class UnrecognizedExtraField { /** * Create a copy of the given array - or return null if the
* argument is null . */
private static byte [ ] copy ( byte [ ] from ) { } } | if ( from != null ) { byte [ ] to = new byte [ from . length ] ; System . arraycopy ( from , 0 , to , 0 , to . length ) ; return to ; } return null ; |
public class TimeUtils { /** * Calculates the number of days between two dates .
* @ param year1 the year of the first date
* @ param month1 the month of the first date
* @ param day1 the day of the first date
* @ param year2 the year of the second date
* @ param month2 the month of the second date
* @ param day2 the day of the second date
* @ return the number of days */
public static int daysBetween ( int year1 , int month1 , int day1 , int year2 , int month2 , int day2 ) { } } | return fixedFromGregorian ( year1 , month1 , day1 ) - fixedFromGregorian ( year2 , month2 , day2 ) ; |
public class IosHttpURLConnection { /** * Add any cookies for this URI to the request headers . */
private void loadRequestCookies ( ) throws IOException { } } | CookieHandler cookieHandler = CookieHandler . getDefault ( ) ; if ( cookieHandler != null ) { try { URI uri = getURL ( ) . toURI ( ) ; Map < String , List < String > > cookieHeaders = cookieHandler . get ( uri , getHeaderFieldsDoNotForceResponse ( ) ) ; for ( Map . Entry < String , List < String > > entry : cookieHeaders . entrySet ( ) ) { String key = entry . getKey ( ) ; if ( ( "Cookie" . equalsIgnoreCase ( key ) || "Cookie2" . equalsIgnoreCase ( key ) ) && ! entry . getValue ( ) . isEmpty ( ) ) { List < String > cookies = entry . getValue ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 , size = cookies . size ( ) ; i < size ; i ++ ) { if ( i > 0 ) { sb . append ( "; " ) ; } sb . append ( cookies . get ( i ) ) ; } setHeader ( key , sb . toString ( ) ) ; } } } catch ( URISyntaxException e ) { throw new IOException ( e ) ; } } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < }
* { @ link EnumRelationshipDirection } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "relationshipDirection" , scope = GetObjectRelationships . class ) public JAXBElement < EnumRelationshipDirection > createGetObjectRelationshipsRelationshipDirection ( EnumRelationshipDirection value ) { } } | return new JAXBElement < EnumRelationshipDirection > ( _GetObjectRelationshipsRelationshipDirection_QNAME , EnumRelationshipDirection . class , GetObjectRelationships . class , value ) ; |
public class LBiObjCharFunctionBuilder { /** * One of ways of creating builder . In most cases ( considering all _ functional _ builders ) it requires to provide generic parameters ( in most cases redundantly ) */
@ Nonnull public static < T1 , T2 , R > LBiObjCharFunctionBuilder < T1 , T2 , R > biObjCharFunction ( ) { } } | return new LBiObjCharFunctionBuilder ( ) ; |
public class ManagementClientAsync { /** * Deletes the queue described by the path relative to the service namespace base address .
* @ param path - The name of the entity relative to the service namespace base address .
* @ return A completable future that completes when the queue is deleted .
* @ throws IllegalArgumentException - path is not null / empty / too long / invalid . */
public CompletableFuture < Void > deleteQueueAsync ( String path ) { } } | EntityNameHelper . checkValidQueueName ( path ) ; return deleteEntityAsync ( path ) ; |
public class TransliterationRuleSet { /** * Add a rule to this set . Rules are added in order , and order is
* significant .
* @ param rule the rule to add */
public void addRule ( TransliterationRule rule ) { } } | ruleVector . add ( rule ) ; int len ; if ( ( len = rule . getAnteContextLength ( ) ) > maxContextLength ) { maxContextLength = len ; } rules = null ; |
public class AbstractArrayFieldValidator { /** * エラー情報を追加します 。
* < p > エラーメッセージのキーは 、 { @ link # getMessageKey ( ) } の値を使用するため 、 必ず空以外の値を返す必要があります 。 < / p >
* < p > エラーメッセージ中の変数は 、 { @ link # getMessageVariables ( ArrayCellField ) } の値を使用します 。 < / p >
* @ param cellField フィールド情報 */
public void error ( final ArrayCellField < E > cellField ) { } } | ArgUtils . notNull ( cellField , "cellField" ) ; error ( cellField , getMessageKey ( ) , getMessageVariables ( cellField ) ) ; |
public class FileGetFromTaskOptions { /** * Set a timestamp indicating the last modified time of the resource known to the client . The operation will be performed only if the resource on the service has not been modified since the specified time .
* @ param ifUnmodifiedSince the ifUnmodifiedSince value to set
* @ return the FileGetFromTaskOptions object itself . */
public FileGetFromTaskOptions withIfUnmodifiedSince ( DateTime ifUnmodifiedSince ) { } } | if ( ifUnmodifiedSince == null ) { this . ifUnmodifiedSince = null ; } else { this . ifUnmodifiedSince = new DateTimeRfc1123 ( ifUnmodifiedSince ) ; } return this ; |
public class OQLQueryImpl { /** * Execute the query .
* After executing a query , the parameter list is reset .
* Some implementations may throw additional exceptions that are also derived
* from < code > ODMGException < / code > .
* @ returnThe object that represents the result of the query .
* The returned data , whatever its OQL type , is encapsulated into an object .
* For instance , when OQL returns an integer , the result is put into an
* < code > Integer < / code > object . When OQL returns a collection ( literal or object ) ,
* the result is always a Java collection object of the same kind
* ( for instance , a < code > DList < / code > ) .
* @ exceptionorg . odmg . QueryExceptionAn exception has occurred while executing the query . */
public Object execute ( ) throws org . odmg . QueryException { } } | if ( log . isDebugEnabled ( ) ) log . debug ( "Start execute query" ) ; // obtain current ODMG transaction
TransactionImpl tx = odmg . getTxManager ( ) . getTransaction ( ) ; // create PBCapsule
PBCapsule capsule = null ; ManageableCollection result = null ; try { capsule = new PBCapsule ( odmg . getCurrentPBKey ( ) , tx ) ; PersistenceBroker broker = capsule . getBroker ( ) ; // ask the broker to perfom the query .
// the concrete result type is configurable
if ( ! ( query instanceof ReportQuery ) ) { result = broker . getCollectionByQuery ( this . getCollectionClass ( ) , query ) ; performLockingIfRequired ( tx , broker , result ) ; } else { Iterator iter = null ; result = new ManageableArrayList ( ) ; iter = broker . getReportQueryIteratorByQuery ( query ) ; try { while ( iter . hasNext ( ) ) { Object [ ] res = ( Object [ ] ) iter . next ( ) ; if ( res . length == 1 ) { if ( res [ 0 ] != null ) // skip null values
{ result . ojbAdd ( res [ 0 ] ) ; } } else { // skip null tuples
for ( int i = 0 ; i < res . length ; i ++ ) { if ( res [ i ] != null ) { result . ojbAdd ( res ) ; break ; } } } } } finally { if ( iter instanceof OJBIterator ) { ( ( OJBIterator ) iter ) . releaseDbResources ( ) ; } } } // reset iterator to start of list so we can reuse this query
ListIterator it = getBindIterator ( ) ; while ( it . hasPrevious ( ) ) { it . previous ( ) ; } } finally { if ( capsule != null ) capsule . destroy ( ) ; } return result ; |
public class ImagePipelineFactory { /** * Defines the correct { @ link ImageTranscoder } . If a custom { @ link ImageTranscoder } was define in
* the config , it will be used whenever possible . Else , if the native code is disabled it uses
* { @ link SimpleImageTranscoderFactory } . Otherwise { @ link MultiImageTranscoderFactory } determines
* the { @ link ImageTranscoder } to use based on the image format .
* @ return The { @ link ImageTranscoderFactory } */
private ImageTranscoderFactory getImageTranscoderFactory ( ) { } } | if ( mImageTranscoderFactory == null ) { if ( mConfig . getImageTranscoderFactory ( ) == null && mConfig . getImageTranscoderType ( ) == null && mConfig . getExperiments ( ) . isNativeCodeDisabled ( ) ) { mImageTranscoderFactory = new SimpleImageTranscoderFactory ( mConfig . getExperiments ( ) . getMaxBitmapSize ( ) ) ; } else { mImageTranscoderFactory = new MultiImageTranscoderFactory ( mConfig . getExperiments ( ) . getMaxBitmapSize ( ) , mConfig . getExperiments ( ) . getUseDownsamplingRatioForResizing ( ) , mConfig . getImageTranscoderFactory ( ) , mConfig . getImageTranscoderType ( ) ) ; } } return mImageTranscoderFactory ; |
public class ModelGuesser { /** * Load the model from the given file path
* @ param path the path of the file to " guess "
* @ return the loaded model
* @ throws Exception */
public static Object loadConfigGuess ( String path ) throws Exception { } } | String input = FileUtils . readFileToString ( new File ( path ) ) ; // note here that we load json BEFORE YAML . YAML
// turns out to load just fine * accidentally *
try { return MultiLayerConfiguration . fromJson ( input ) ; } catch ( Exception e ) { log . warn ( "Tried multi layer config from json" , e ) ; try { return KerasModelImport . importKerasModelConfiguration ( path ) ; } catch ( Exception e1 ) { log . warn ( "Tried keras model config" , e ) ; try { return KerasModelImport . importKerasSequentialConfiguration ( path ) ; } catch ( Exception e2 ) { log . warn ( "Tried keras sequence config" , e ) ; try { return ComputationGraphConfiguration . fromJson ( input ) ; } catch ( Exception e3 ) { log . warn ( "Tried computation graph from json" ) ; try { return MultiLayerConfiguration . fromYaml ( input ) ; } catch ( Exception e4 ) { log . warn ( "Tried multi layer configuration from yaml" ) ; try { return ComputationGraphConfiguration . fromYaml ( input ) ; } catch ( Exception e5 ) { throw new ModelGuesserException ( "Unable to load configuration from path " + path + " (invalid config file or not a known config type)" ) ; } } } } } } |
public class ServersInner { /** * Gets information about a server .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ServerInner object */
public Observable < ServerInner > getByResourceGroupAsync ( String resourceGroupName , String serverName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , serverName ) . map ( new Func1 < ServiceResponse < ServerInner > , ServerInner > ( ) { @ Override public ServerInner call ( ServiceResponse < ServerInner > response ) { return response . body ( ) ; } } ) ; |
public class Schema { /** * Store given Keyspace instance to the schema
* @ param keyspace The Keyspace instance to store
* @ throws IllegalArgumentException if Keyspace is already stored */
public void storeKeyspaceInstance ( Keyspace keyspace ) { } } | if ( keyspaceInstances . containsKey ( keyspace . getName ( ) ) ) throw new IllegalArgumentException ( String . format ( "Keyspace %s was already initialized." , keyspace . getName ( ) ) ) ; keyspaceInstances . put ( keyspace . getName ( ) , keyspace ) ; |
public class NodeHealthCheckerService { /** * Method to populate the fields for the { @ link TaskTrackerHealthStatus }
* @ param healthStatus */
synchronized void setHealthStatus ( TaskTrackerHealthStatus healthStatus ) { } } | healthStatus . setNodeHealthy ( this . isHealthy ( ) ) ; healthStatus . setHealthReport ( this . getHealthReport ( ) ) ; healthStatus . setLastReported ( this . getLastReportedTime ( ) ) ; |
public class MinerAdapter { /** * Searches for the gene symbol of the given EntityReference .
* @ param m current match
* @ param label label of the related EntityReference in the pattern
* @ return symbol */
protected String getGeneSymbol ( Match m , String label ) { } } | ProteinReference pr = ( ProteinReference ) m . get ( label , getPattern ( ) ) ; return getGeneSymbol ( pr ) ; |
public class JobConfig { /** * Option to override the minimum period and minimum flex for periodic jobs . This is useful for testing
* purposes . This method only works for Android M and earlier . Later versions throw an exception .
* @ param allowSmallerIntervals Whether a smaller interval and flex than the minimum values are allowed
* for periodic jobs are allowed . The default value is { @ code false } . */
public static void setAllowSmallerIntervalsForMarshmallow ( boolean allowSmallerIntervals ) { } } | if ( allowSmallerIntervals && Build . VERSION . SDK_INT >= Build . VERSION_CODES . N ) { throw new IllegalStateException ( "This method is only allowed to call on Android M or earlier" ) ; } JobConfig . allowSmallerIntervals = allowSmallerIntervals ; |
public class BeanProperty { /** * Gets the property value on the object . Attempts to first get the
* property via its getter method such as " getFirstName ( ) " . If a getter
* method doesn ' t exist , this will then attempt to get the property value
* directly from the underlying field within the class .
* < br >
* NOTE : If the getter method throws an exception during execution , the
* exception will be accessible in the getCause ( ) method of the
* InvocationTargetException .
* @ param obj The object to get the property from
* @ return The value of the property
* @ throws java . lang . IllegalAccessException Thrown if an access exception
* occurs while attempting to get the property value .
* @ throws java . lang . IllegalArgumentException Thrown if an illegal argument
* is used while attempting to get the property value .
* @ throws java . lang . reflect . InvocationTargetException Thrown if there
* is an exception thrown while calling the underlying method . */
public Object get ( Object obj ) throws IllegalAccessException , InvocationTargetException { } } | // always try the " getMethod " first
if ( getMethod != null ) { return getMethod . invoke ( obj ) ; // fall back to getting the field directly
} else if ( field != null ) { return field . get ( obj ) ; } else { throw new IllegalAccessException ( "Cannot get property value" ) ; } |
public class CouchDbConnectorFactory { /** * Create { @ link CouchDbConnector } instance .
* @ return CouchDbConnector instance from db properties . */
public CouchDbConnector createConnector ( ) { } } | val connector = new StdCouchDbConnector ( couchDbProperties . getDbName ( ) , getCouchDbInstance ( ) , objectMapperFactory ) ; LOGGER . debug ( "Connector created: [{}]" , connector ) ; return connector ; |
public class GImageBandMath { /** * Computes the minimum for each pixel across all bands in the { @ link Planar } image .
* @ param input Planar image
* @ param output Gray scale image containing minimum pixel values */
public static < T extends ImageGray < T > > void minimum ( Planar < T > input , T output ) { } } | minimum ( input , output , 0 , input . getNumBands ( ) - 1 ) ; |
public class Version { /** * Get the string representation of the version number .
* @ param bPrintZeroElements
* If < code > true < / code > than trailing zeroes are printed , otherwise
* printed zeroes are not printed .
* @ param bPrintAtLeastMajorAndMinor
* < code > true < / code > if major and minor part should always be printed ,
* independent of their value
* @ return Never < code > null < / code > . */
@ Nonnull public String getAsString ( final boolean bPrintZeroElements , final boolean bPrintAtLeastMajorAndMinor ) { } } | // Build from back to front
final StringBuilder aSB = new StringBuilder ( m_sQualifier != null ? m_sQualifier : "" ) ; if ( m_nMicro > 0 || aSB . length ( ) > 0 || bPrintZeroElements ) { // Micro version
if ( aSB . length ( ) > 0 ) aSB . insert ( 0 , '.' ) ; aSB . insert ( 0 , m_nMicro ) ; } if ( bPrintAtLeastMajorAndMinor || m_nMinor > 0 || aSB . length ( ) > 0 || bPrintZeroElements ) { // Minor version
if ( aSB . length ( ) > 0 ) aSB . insert ( 0 , '.' ) ; aSB . insert ( 0 , m_nMinor ) ; } if ( bPrintAtLeastMajorAndMinor || m_nMajor > 0 || aSB . length ( ) > 0 || bPrintZeroElements ) { // Major version
if ( aSB . length ( ) > 0 ) aSB . insert ( 0 , '.' ) ; aSB . insert ( 0 , m_nMajor ) ; } return aSB . length ( ) > 0 ? aSB . toString ( ) : DEFAULT_VERSION_STRING ; |
public class TextUtils { /** * Compares two texts lexicographically .
* The comparison is based on the Unicode value of each character in the CharSequences . The character sequence
* represented by the first text object is compared lexicographically to the character sequence represented
* by the second text .
* The result is a negative integer if the first text lexicographically precedes the second text . The
* result is a positive integer if the first text lexicographically follows the second text . The result
* is zero if the texts are equal .
* This method works in a way equivalent to that of the { @ link java . lang . String # compareTo ( String ) }
* and { @ link java . lang . String # compareToIgnoreCase ( String ) } methods .
* @ param caseSensitive whether the comparison must be done in a case - sensitive or case - insensitive way .
* @ param text1 the first text to be compared .
* @ param text1Offset the offset of the first text .
* @ param text1Len the length of the first text .
* @ param text2 the second text to be compared .
* @ param text2Offset the offset of the second text .
* @ param text2Len the length of the second text .
* @ return the value { @ code 0 } if both texts are equal ; a value less than { @ code 0 } if the first text
* is lexicographically less than the second text ; and a value greater than { @ code 0 } if the
* first text is lexicographically greater than the second text . */
public static int compareTo ( final boolean caseSensitive , final char [ ] text1 , final int text1Offset , final int text1Len , final char [ ] text2 , final int text2Offset , final int text2Len ) { } } | if ( text1 == null ) { throw new IllegalArgumentException ( "First text buffer being compared cannot be null" ) ; } if ( text2 == null ) { throw new IllegalArgumentException ( "Second text buffer being compared cannot be null" ) ; } if ( text1 == text2 && text1Offset == text2Offset && text1Len == text2Len ) { return 0 ; } char c1 , c2 ; int n = Math . min ( text1Len , text2Len ) ; int i = 0 ; while ( n -- != 0 ) { c1 = text1 [ text1Offset + i ] ; c2 = text2 [ text2Offset + i ] ; if ( c1 != c2 ) { if ( caseSensitive ) { return c1 - c2 ; } c1 = Character . toUpperCase ( c1 ) ; c2 = Character . toUpperCase ( c2 ) ; if ( c1 != c2 ) { // We check both upper and lower case because that is how String # compareToIgnoreCase ( ) is defined .
c1 = Character . toLowerCase ( c1 ) ; c2 = Character . toLowerCase ( c2 ) ; if ( c1 != c2 ) { return c1 - c2 ; } } } i ++ ; } return text1Len - text2Len ; |
public class Response { /** * Get the value of a specific property .
* @ param descriptor
* The { @ link XmlElementDescriptor } of the property to return .
* @ return The property value , may be < code > null < / code > if the property was not present or didn ' t contain any value ( because it had a non -
* { @ link HttpStatus # OK } status ) . */
public < T > T getPropertyValue ( ElementDescriptor < T > descriptor ) { } } | PropStat propStat = mPropStatByProperty . get ( descriptor ) ; if ( propStat == null ) { return null ; } return propStat . getPropertyValue ( descriptor ) ; |
public class FSABuilder { /** * Returns the address of an arc . */
private int getArcTarget ( int arc ) { } } | arc += ADDRESS_OFFSET ; return ( serialized [ arc ] ) << 24 | ( serialized [ arc + 1 ] & 0xff ) << 16 | ( serialized [ arc + 2 ] & 0xff ) << 8 | ( serialized [ arc + 3 ] & 0xff ) ; |
public class CommerceAddressUtil { /** * Returns the first commerce address in the ordered set where groupId = & # 63 ; and classNameId = & # 63 ; and classPK = & # 63 ; .
* @ param groupId the group ID
* @ param classNameId the class name ID
* @ param classPK the class pk
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce address , or < code > null < / code > if a matching commerce address could not be found */
public static CommerceAddress fetchByG_C_C_First ( long groupId , long classNameId , long classPK , OrderByComparator < CommerceAddress > orderByComparator ) { } } | return getPersistence ( ) . fetchByG_C_C_First ( groupId , classNameId , classPK , orderByComparator ) ; |
public class ContextAuthorizationPanel { /** * Initialize the panel . */
private void initialize ( ) { } } | this . setLayout ( new CardLayout ( ) ) ; this . setName ( getContextIndex ( ) + ": " + PANEL_NAME ) ; this . setLayout ( new GridBagLayout ( ) ) ; this . setBorder ( new EmptyBorder ( 2 , 2 , 2 , 2 ) ) ; this . add ( new JLabel ( LABEL_DESCRIPTION ) , LayoutHelper . getGBC ( 0 , 0 , 2 , 0.0D , new Insets ( 0 , 0 , 20 , 0 ) ) ) ; // Basic Authorization detection
Insets insets = new Insets ( 2 , 5 , 2 , 5 ) ; this . add ( new JLabel ( FIELD_LABEL_INTRO ) , LayoutHelper . getGBC ( 0 , 1 , 2 , 0.0D , new Insets ( 0 , 0 , 5 , 0 ) ) ) ; JPanel configContainerPanel = new JPanel ( new GridBagLayout ( ) ) ; configContainerPanel . setBorder ( javax . swing . BorderFactory . createTitledBorder ( null , "" , javax . swing . border . TitledBorder . DEFAULT_JUSTIFICATION , javax . swing . border . TitledBorder . DEFAULT_POSITION , FontUtils . getFont ( FontUtils . Size . standard ) , java . awt . Color . black ) ) ; this . add ( configContainerPanel , LayoutHelper . getGBC ( 0 , 2 , 2 , 0.0D ) ) ; configContainerPanel . add ( new JLabel ( FIELD_LABEL_STATUS_CODE ) , LayoutHelper . getGBC ( 0 , 2 , 1 , 0.0D ) ) ; statusCodeComboBox = new JComboBox < > ( STATUS_CODES ) ; configContainerPanel . add ( statusCodeComboBox , LayoutHelper . getGBC ( 1 , 2 , 1 , 1.0D , insets ) ) ; configContainerPanel . add ( new JLabel ( FIELD_LABEL_HEADER_PATTERN ) , LayoutHelper . getGBC ( 0 , 3 , 1 , 0.0D ) ) ; headerPatternText = new JTextField ( ) ; configContainerPanel . add ( headerPatternText , LayoutHelper . getGBC ( 1 , 3 , 1 , 1.0D , insets ) ) ; configContainerPanel . add ( new JLabel ( FIELD_LABEL_BODY_PATTERN ) , LayoutHelper . getGBC ( 0 , 4 , 1 , 0.0D ) ) ; bodyPatternText = new JTextField ( ) ; configContainerPanel . add ( bodyPatternText , LayoutHelper . getGBC ( 1 , 4 , 1 , 1.0D , insets ) ) ; logicalOperatorComboBox = new JComboBox < > ( new String [ ] { FIELD_VALUE_AND_COMPOSITION , FIELD_VALUE_OR_COMPOSITION } ) ; configContainerPanel . add ( logicalOperatorComboBox , LayoutHelper . getGBC ( 0 , 5 , 2 , 0.0D , new Insets ( 2 , 0 , 2 , 5 ) ) ) ; // Padding
this . add ( new JLabel ( ) , LayoutHelper . getGBC ( 0 , 99 , 2 , 1.0D , 1.0D ) ) ; |
public class JavaGenerator { /** * Returns the Java type for { @ code protoType } .
* @ throws IllegalArgumentException if there is no known Java type for { @ code protoType } , such as
* if that type wasn ' t in this generator ' s schema . */
public TypeName typeName ( ProtoType protoType ) { } } | TypeName profileJavaName = profile . getTarget ( protoType ) ; if ( profileJavaName != null ) return profileJavaName ; TypeName candidate = nameToJavaName . get ( protoType ) ; checkArgument ( candidate != null , "unexpected type %s" , protoType ) ; return candidate ; |
public class ArgumentParser { /** * Handle the - - logger argument . */
private void handleArgLogger ( final Deque < String > args ) { } } | if ( loggerClassname != null ) { throw new BuildException ( "Only one logger class may be specified." ) ; } loggerClassname = args . pop ( ) ; if ( loggerClassname == null ) { throw new BuildException ( "You must specify a classname when using the -logger argument" ) ; } |
public class RedundantSelfJoinExecutor { /** * Assumes that the data atoms are leafs . */
private NodeCentricOptimizationResults < InnerJoinNode > applyOptimization ( IntermediateQuery query , QueryTreeComponent treeComponent , InnerJoinNode topJoinNode , ConcreteProposal proposal ) throws EmptyQueryException { } } | /* * First , add and remove non - top nodes */
proposal . getDataNodesToRemove ( ) . forEach ( treeComponent :: removeSubTree ) ; return updateJoinNodeAndPropagateSubstitution ( query , treeComponent , topJoinNode , proposal ) ; |
public class CompositeBinaryStore { /** * Select a named binary store for the given hint
* @ param hint a hint to a binary store ; possibly null
* @ return a named BinaryStore from the hint , or the default store */
private BinaryStore selectBinaryStore ( String hint ) { } } | BinaryStore namedBinaryStore = null ; if ( hint != null ) { logger . trace ( "Selecting named binary store for hint: " + hint ) ; namedBinaryStore = namedStores . get ( hint ) ; } if ( namedBinaryStore == null ) { namedBinaryStore = getDefaultBinaryStore ( ) ; } logger . trace ( "Selected binary store: " + namedBinaryStore . toString ( ) ) ; return namedBinaryStore ; |
public class ArrayFunctions { /** * Returned expression results in new array with all occurrences of value removed . */
public static Expression arrayRemove ( JsonArray array , Expression value ) { } } | return arrayRemove ( x ( array ) , value ) ; |
public class IndexRangeComparator { /** * { @ inheritDoc } */
@ Override public int compare ( IndexRange o1 , IndexRange o2 ) { } } | return ComparisonChain . start ( ) . compare ( o1 . end ( ) , o2 . end ( ) ) . compare ( o1 . begin ( ) , o2 . begin ( ) ) . compare ( o1 . indexName ( ) , o2 . indexName ( ) ) . result ( ) ; |
public class TextFormat { /** * Outputs a textual representation of the value of an unknown field .
* @ param tag the field ' s tag number
* @ param value the value of the field
* @ param output the output to which to append the formatted value
* @ throws ClassCastException if the value is not appropriate for the
* given field descriptor
* @ throws IOException if there is an exception writing to the output */
public static void printUnknownFieldValue ( final int tag , final Object value , final Appendable output ) throws IOException { } } | printUnknownFieldValue ( tag , value , new TextGenerator ( output ) ) ; |
public class ItemLevelRecoveryConnectionsInner { /** * Provisions a script which invokes an iSCSI connection to the backup data . Executing this script opens a file explorer displaying all the recoverable files and folders . This is an asynchronous operation . To know the status of provisioning , call GetProtectedItemOperationResult API .
* @ param vaultName The name of the recovery services vault .
* @ param resourceGroupName The name of the resource group where the recovery services vault is present .
* @ param fabricName Fabric name associated with the backed up items .
* @ param containerName Container name associated with the backed up items .
* @ param protectedItemName Backed up item name whose files / folders are to be restored .
* @ param recoveryPointId Recovery point ID which represents backed up data . iSCSI connection will be provisioned for this backed up data .
* @ param parameters resource ILR request
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void provision ( String vaultName , String resourceGroupName , String fabricName , String containerName , String protectedItemName , String recoveryPointId , ILRRequestResource parameters ) { } } | provisionWithServiceResponseAsync ( vaultName , resourceGroupName , fabricName , containerName , protectedItemName , recoveryPointId , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class CmsJspImageBean { /** * Initializes this new image bean based on a VFS resource and optional scaler parameters . < p >
* @ param cms the current OpenCms user context
* @ param imageRes the VFS resource to read the image from
* @ param scaleParams optional scaler parameters to apply to the VFS resource */
protected void init ( CmsObject cms , CmsResource imageRes , String scaleParams ) { } } | setCmsObject ( cms ) ; // set VFS URI without scaling parameters
setResource ( cms , imageRes ) ; setVfsUri ( cms . getRequestContext ( ) . getSitePath ( imageRes ) ) ; // the originalScaler reads the image dimensions from the VFS properties
CmsImageScaler originalScaler = new CmsImageScaler ( cms , getResource ( ) ) ; // set original scaler
setOriginalScaler ( originalScaler ) ; // set base scaler
CmsImageScaler baseScaler = originalScaler ; if ( scaleParams != null ) { // scale parameters have been set
baseScaler = new CmsImageScaler ( scaleParams ) ; baseScaler . setFocalPoint ( originalScaler . getFocalPoint ( ) ) ; } setBaseScaler ( baseScaler ) ; // set the current scaler to the base scaler
setScaler ( baseScaler ) ; |
public class GreenMailService { /** * { @ inheritDoc } */
@ Override public void setUsers ( final String [ ] theUsers ) { } } | mUsers = theUsers ; // Cleanup new line and ws
for ( int i = 0 ; i < theUsers . length ; i ++ ) { mUsers [ i ] = mUsers [ i ] . trim ( ) ; } |
public class CFMLTransformer { /** * Liest einen Kommentar ein , Kommentare werden nicht in die CFXD uebertragen sondern verworfen .
* Komentare koennen auch Kommentare enthalten . < br / >
* EBNF : < br / >
* < code > " < ! - - - " { ? - " - - - > " } " - - - > " ; < / code >
* @ throws TemplateException */
private static void comment ( SourceCode cfml , boolean removeSpace ) throws TemplateException { } } | if ( ! removeSpace ) { comment ( cfml ) ; } else { cfml . removeSpace ( ) ; if ( comment ( cfml ) ) cfml . removeSpace ( ) ; } |
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public String convertIfcSlabTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } } | return instanceValue == null ? null : instanceValue . toString ( ) ; |
public class FreePool { /** * This method is only called from code synched on the < code > freeLockObject < / code > ,
* so we do not have to worry about synchronizing access to
* < code > waiterCount < / code > . */
private void queueRequest ( ManagedConnectionFactory managedConnectionFactory , long waitTimeout ) throws ResourceAllocationException , ConnectionWaitTimeoutException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "queueRequest" , waitTimeout ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Current connection pool" , pm . toString ( ) ) ; if ( waitTimeout == 0 ) { -- pm . waiterCount ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Timeout. Decremented waiterCount, which is now " + pm . waiterCount + " on datasource " + gConfigProps . cfName ) ; } Object [ ] connWaitTimeoutparms = new Object [ ] { "queueRequest" , gConfigProps . cfName , 0 , pm . waiterCount , pm . totalConnectionCount . get ( ) } ; Tr . error ( tc , "POOL_MANAGER_EXCP_CCF2_0001_J2CA0045" , connWaitTimeoutparms ) ; String connWaitTimeoutMessage = Tr . formatMessage ( tc , "POOL_MANAGER_EXCP_CCF2_0001_J2CA0045" , connWaitTimeoutparms ) ; ConnectionWaitTimeoutException cwte = new ConnectionWaitTimeoutException ( connWaitTimeoutMessage ) ; com . ibm . ws . ffdc . FFDCFilter . processException ( cwte , J2CConstants . DMSID_MAX_CONNECTIONS_REACHED , "192" , this . pm ) ; pm . activeRequest . decrementAndGet ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "queueRequest" , cwte ) ; throw cwte ; } if ( ( tc . isDebugEnabled ( ) ) ) { ++ freePoolQueuedRequests ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { String poolStats = pm . gatherPoolStatisticalData ( ) ; Tr . debug ( this , tc , "Queueing Waiter for pool <" + gConfigProps . getXpathId ( ) + ">. Current Pool Stats are:" ) ; Tr . debug ( this , tc , poolStats ) ; } } try { if ( pm . displayInfiniteWaitMessage ) { Tr . info ( tc , "INFINITE_CONNECTION_WAIT_TIMEOUT_J2CA0127" , gConfigProps . getXpathId ( ) ) ; pm . displayInfiniteWaitMessage = false ; // only display this message once per PM .
} pm . activeRequest . decrementAndGet ( ) ; if ( waitTimeout < 0 ) { pm . waiterFreePoolLock . wait ( 0 ) ; // wait an infinite amount of time
} else { pm . waiterFreePoolLock . wait ( waitTimeout ) ; // wait the specified amount of time
} pm . requestingAccessToPool ( ) ; } catch ( InterruptedException ie ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Interupted waiting for a connection" ) ; } synchronized ( pm . waiterFreePoolLock ) { -- pm . waiterCount ; } if ( tc . isDebugEnabled ( ) ) { if ( pm . waiterCount == 0 ) { pm . waitersEndedTime = System . currentTimeMillis ( ) ; Tr . debug ( this , tc , "Waiters: requests for connections are no longer being queued. End Time:" + pm . waitersEndedTime ) ; Tr . debug ( this , tc , "Waiters: total time waiter were in queue: " + ( pm . waitersEndedTime - pm . waitersStartedTime ) ) ; } } ResourceAllocationException throwMe = new ResourceAllocationException ( ie . getMessage ( ) ) ; throwMe . initCause ( ie ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "queueRequest" , throwMe ) ; throw throwMe ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "queueRequest" ) ; } |
public class MessageEndpointFactoryImpl { /** * Perform the actual endpoint activation for the MDB using the provided endpoint
* activation service . < p >
* The method is provided for use by the MDBRuntime , to be called after the
* server has reached the ' started ' state and the activation specification
* is available . < p >
* This method relies on the caller for proper synchronization . This method
* should not be called concurrently or concurrently with deactivateEndpoint .
* Nor should this method be called while the provided endpoint activation
* service is being removed . < p >
* @ param eas endpoint activation service configured for the message endpoint
* @ param maxEndpoints maximum number of concurrently active endpoints
* @ param adminObjSvc admin object service located by the mdb runtime
* @ throws ResourceException if a failure occurs activating the endpoint */
@ Trivial @ FFDCIgnore ( { } } | ResourceException . class , Throwable . class } ) protected void activateEndpointInternal ( EndpointActivationService eas , int maxEndpoints , AdminObjectService adminObjSvc ) throws ResourceException { boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "MEF.activateEndpointInternal for MDB " + beanMetaData . enterpriseBeanName + "(" + eas + ", " + maxEndpoints + ")" ) ; boolean activate ; Object asInstance = null ; ResourceException rex = null ; EJBThreadData threadData = EJSContainer . getThreadData ( ) ; threadData . pushMetaDataContexts ( beanMetaData ) ; try { synchronized ( ivStateLock ) { if ( ivState == INACTIVE_STATE ) { activate = true ; ivState = ACTIVATING_STATE ; ivActivatingThread = Thread . currentThread ( ) ; } else if ( ivState == ACTIVE_STATE ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "endpoint already active" ) ; activate = false ; } else { activate = false ; rex = new ResourceException ( "can not activate until deactivate completes" ) ; } } if ( activate ) { asInstance = eas . activateEndpoint ( this , beanMetaData . ivActivationConfig , beanMetaData . ivActivationSpecAuthAlias , beanMetaData . ivMessageDestinationJndiName , adminObjSvc , adminObjectServiceInfo == null ? null : adminObjectServiceInfo . id ) ; // Save key required to deactivate endpoint and change to the ACTIVE
// state . Note that traditional WAS defers the move to ACTIVE until the application
// has started to block createEndpoint calls , but that doesn ' t work well
// with dynamic configuration updates . Instead of blocking on state ,
// Liberty blocks on checkIfEJBWorkAllowed .
synchronized ( ivStateLock ) { activationSpec = asInstance ; // Set the state and notify waiting threads .
ivState = ACTIVE_STATE ; ivStateLock . notifyAll ( ) ; } setRRSTransactional ( ) ; setMaxEndpoints ( maxEndpoints ) ; // TODO : enable this info message in the future when the text can be improved
// the endpoint wont truly be active until the jms connection is obtained
// Tr . info ( tc , " MDB _ ENDPOINT _ ACTIVATED _ CNTR4013I " , beanMetaData . enterpriseBeanName ) ;
} } catch ( ResourceException ex ) { synchronized ( ivStateLock ) { ivState = INACTIVE_STATE ; activationSpec = null ; unsetRecoveryID ( ) ; } rex = ex ; } catch ( Throwable ex ) { synchronized ( ivStateLock ) { ivState = INACTIVE_STATE ; activationSpec = null ; unsetRecoveryID ( ) ; } rex = new ResourceException ( ex ) ; } finally { threadData . popMetaDataContexts ( ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "MEF.activateEndpointInternal for MDB " + beanMetaData . enterpriseBeanName , rex ) ; if ( rex != null ) { throw rex ; } |
public class FieldInfo { /** * Display this field .
* Go through the sFieldList and setText for JTextComponents and setControlValue for
* FieldComponents .
* @ see org . jbundle . model . screen . FieldComponent */
public void displayField ( ) // init this field override for other value
{ } } | if ( m_vScreenField == null ) return ; for ( int i = 0 ; i < m_vScreenField . size ( ) ; i ++ ) { Object component = m_vScreenField . elementAt ( i ) ; Convert converter = null ; if ( component instanceof ScreenComponent ) converter = ( ( ScreenComponent ) component ) . getConverter ( ) ; if ( converter == null ) converter = this ; if ( ( this . getFieldName ( ) . equals ( this . getNameByReflection ( component ) ) ) || ( converter . getField ( ) == this ) ) { if ( component instanceof FieldComponent ) ( ( FieldComponent ) component ) . setControlValue ( converter . getData ( ) ) ; else if ( component . getClass ( ) . getName ( ) . contains ( "ext" ) ) // JTextComponent / JTextArea - TODO FIX This lame code !
this . setTextByReflection ( component , converter . getString ( ) ) ; // else if ( component instanceof JTextComponent )
// ( ( JTextComponent ) component ) . setText ( converter . getString ( ) ) ;
} } |
public class Encounter { /** * syntactic sugar */
public EncounterStatusHistoryComponent addStatusHistory ( ) { } } | EncounterStatusHistoryComponent t = new EncounterStatusHistoryComponent ( ) ; if ( this . statusHistory == null ) this . statusHistory = new ArrayList < EncounterStatusHistoryComponent > ( ) ; this . statusHistory . add ( t ) ; return t ; |
public class NotificationDispatcherMetadata { /** * Sets a property on this metadata object . */
public NotificationDispatcherMetadata setProperty ( String key , String value ) { } } | properties . put ( key , value ) ; return this ; |
public class DiscussionResourcesImpl { /** * Add a comment to a discussion .
* It mirrors to the following Smartsheet REST API method : POST / discussion / { discussionId } / comments
* Exceptions :
* IllegalArgumentException : if any argument is null
* InvalidRequestException : if there is any problem with the REST API request
* AuthorizationException : if there is any problem with the REST API authorization ( access token )
* ServiceUnavailableException : if the REST API service is not available ( possibly due to rate limiting )
* SmartsheetRestException : if there is any other REST API related error occurred during the operation
* SmartsheetException : if there is any other error occurred during the operation
* @ param id the discussion ID
* @ param comment the comment to add , limited to the following required attributes : text
* @ return the created comment
* @ throws SmartsheetException the smartsheet exception */
public Comment addDiscussionComment ( long id , Comment comment ) throws SmartsheetException { } } | return this . createResource ( "discussion/" + id + "/comments" , Comment . class , comment ) ; |
public class FactoryConverter { /** * { @ inheritDoc } */
@ SuppressWarnings ( "unchecked" ) public Object convert ( String value ) throws Exception { } } | List < String > parameters = toList ( escapeValues ( value . split ( ";" ) ) ) ; Class < ? > klass = ClassUtils . loadClass ( shift ( parameters ) ) ; if ( expectedType != null && ! expectedType . isAssignableFrom ( klass ) ) { throw new IllegalArgumentException ( "Class " + expectedType . getName ( ) + " is not assignable from" + klass . getName ( ) ) ; } if ( parameters . size ( ) == 0 ) return klass . newInstance ( ) ; String [ ] args = parameters . toArray ( new String [ parameters . size ( ) ] ) ; Constructor < ? > constructor = klass . getConstructor ( args . getClass ( ) ) ; return constructor . newInstance ( new Object [ ] { args } ) ; |
public class BackendServiceClient { /** * Sets the security policy for the specified backend service .
* < p > Sample code :
* < pre > < code >
* try ( BackendServiceClient backendServiceClient = BackendServiceClient . create ( ) ) {
* ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName . of ( " [ PROJECT ] " , " [ BACKEND _ SERVICE ] " ) ;
* SecurityPolicyReference securityPolicyReferenceResource = SecurityPolicyReference . newBuilder ( ) . build ( ) ;
* Operation response = backendServiceClient . setSecurityPolicyBackendService ( backendService , securityPolicyReferenceResource ) ;
* < / code > < / pre >
* @ param backendService Name of the BackendService resource to which the security policy should
* be set . The name should conform to RFC1035.
* @ param securityPolicyReferenceResource
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation setSecurityPolicyBackendService ( ProjectGlobalBackendServiceName backendService , SecurityPolicyReference securityPolicyReferenceResource ) { } } | SetSecurityPolicyBackendServiceHttpRequest request = SetSecurityPolicyBackendServiceHttpRequest . newBuilder ( ) . setBackendService ( backendService == null ? null : backendService . toString ( ) ) . setSecurityPolicyReferenceResource ( securityPolicyReferenceResource ) . build ( ) ; return setSecurityPolicyBackendService ( request ) ; |
public class Participant { /** * Waits getting synchronizated from peer .
* @ param peer the id of the expected peer that synchronization message will
* come from .
* @ throws InterruptedException in case of interruption .
* @ throws TimeoutException in case of timeout .
* @ throws IOException in case of IO failure . */
protected void waitForSync ( String peer ) throws InterruptedException , TimeoutException , IOException { } } | LOG . debug ( "Waiting sync from {}." , peer ) ; Log log = this . persistence . getLog ( ) ; Zxid lastZxid = persistence . getLatestZxid ( ) ; // The last zxid of peer .
Zxid lastZxidPeer = null ; Message msg = null ; String source = null ; // Expects getting message of DIFF or TRUNCATE or SNAPSHOT from peer or
// PULL _ TXN _ REQ from leader .
while ( true ) { MessageTuple tuple = filter . getMessage ( getSyncTimeoutMs ( ) ) ; source = tuple . getServerId ( ) ; msg = tuple . getMessage ( ) ; if ( ( msg . getType ( ) != MessageType . DIFF && msg . getType ( ) != MessageType . TRUNCATE && msg . getType ( ) != MessageType . SNAPSHOT && msg . getType ( ) != MessageType . PULL_TXN_REQ ) || ! source . equals ( peer ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Got unexpected message {} from {}." , TextFormat . shortDebugString ( msg ) , source ) ; } continue ; } else { break ; } } if ( msg . getType ( ) == MessageType . PULL_TXN_REQ ) { // PULL _ TXN _ REQ message . This message is only received at FOLLOWER side .
LOG . debug ( "Got pull transaction request from {}" , source ) ; ZabMessage . Zxid z = msg . getPullTxnReq ( ) . getLastZxid ( ) ; lastZxidPeer = MessageBuilder . fromProtoZxid ( z ) ; // Synchronize its history to leader .
SyncPeerTask syncTask = new SyncPeerTask ( source , lastZxidPeer , lastZxid , this . persistence . getLastSeenConfig ( ) ) ; syncTask . run ( ) ; // After synchronization , leader should have same history as this
// server , so next message should be an empty DIFF .
MessageTuple tuple = filter . getExpectedMessage ( MessageType . DIFF , peer , getSyncTimeoutMs ( ) ) ; msg = tuple . getMessage ( ) ; ZabMessage . Diff diff = msg . getDiff ( ) ; lastZxidPeer = MessageBuilder . fromProtoZxid ( diff . getLastZxid ( ) ) ; // Check if they match .
if ( lastZxidPeer . compareTo ( lastZxid ) != 0 ) { LOG . error ( "The history of leader and follower are not same." ) ; throw new RuntimeException ( "Expecting leader and follower have same" + "history." ) ; } waitForSyncEnd ( peer ) ; return ; } if ( msg . getType ( ) == MessageType . DIFF ) { // DIFF message .
if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Got message {}" , TextFormat . shortDebugString ( msg ) ) ; } ZabMessage . Diff diff = msg . getDiff ( ) ; // Remember last zxid of the peer .
lastZxidPeer = MessageBuilder . fromProtoZxid ( diff . getLastZxid ( ) ) ; if ( lastZxid . compareTo ( lastZxidPeer ) == 0 ) { // Means the two nodes have exact same history .
waitForSyncEnd ( peer ) ; return ; } } else if ( msg . getType ( ) == MessageType . TRUNCATE ) { // TRUNCATE message .
if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Got message {}" , TextFormat . shortDebugString ( msg ) ) ; } ZabMessage . Truncate trunc = msg . getTruncate ( ) ; Zxid lastPrefixZxid = MessageBuilder . fromProtoZxid ( trunc . getLastPrefixZxid ( ) ) ; lastZxidPeer = MessageBuilder . fromProtoZxid ( trunc . getLastZxid ( ) ) ; if ( lastZxidPeer . equals ( Zxid . ZXID_NOT_EXIST ) ) { // When the truncate zxid is < 0 , - 1 > , we treat this as a state
// transfer even it might not be .
persistence . beginStateTransfer ( ) ; } else { log . truncate ( lastPrefixZxid ) ; } if ( lastZxidPeer . compareTo ( lastPrefixZxid ) == 0 ) { waitForSyncEnd ( peer ) ; return ; } } else { // SNAPSHOT message .
if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Got message {}" , TextFormat . shortDebugString ( msg ) ) ; } ZabMessage . Snapshot snap = msg . getSnapshot ( ) ; lastZxidPeer = MessageBuilder . fromProtoZxid ( snap . getLastZxid ( ) ) ; Zxid snapZxid = MessageBuilder . fromProtoZxid ( snap . getSnapZxid ( ) ) ; // Waiting for snapshot file to be received .
msg = filter . getExpectedMessage ( MessageType . FILE_RECEIVED , peer , getSyncTimeoutMs ( ) ) . getMessage ( ) ; // Turns the temp file to snapshot file .
File file = new File ( msg . getFileReceived ( ) . getFullPath ( ) ) ; // If the message is SNAPSHOT , it ' s state transferring .
persistence . beginStateTransfer ( ) ; persistence . setSnapshotFile ( file , snapZxid ) ; // Truncates the whole log .
log . truncate ( Zxid . ZXID_NOT_EXIST ) ; // Checks if there ' s any proposals after snapshot .
if ( lastZxidPeer . compareTo ( snapZxid ) == 0 ) { // If no , done with synchronization .
waitForSyncEnd ( peer ) ; return ; } } log = persistence . getLog ( ) ; // Get subsequent proposals .
while ( true ) { MessageTuple tuple = filter . getExpectedMessage ( MessageType . PROPOSAL , peer , getSyncTimeoutMs ( ) ) ; msg = tuple . getMessage ( ) ; source = tuple . getServerId ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Got message {} from {}" , TextFormat . shortDebugString ( msg ) , source ) ; } ZabMessage . Proposal prop = msg . getProposal ( ) ; Zxid zxid = MessageBuilder . fromProtoZxid ( prop . getZxid ( ) ) ; // Accept the proposal .
log . append ( MessageBuilder . fromProposal ( prop ) ) ; // Check if this is the last proposal .
if ( zxid . compareTo ( lastZxidPeer ) == 0 ) { waitForSyncEnd ( peer ) ; return ; } } |
public class SICoreUtils { /** * Determines whether a destination prefix is valid or not .
* < p > If the destination prefix has more than { @ link # DESTINATION _ PREFIX _ MAX _ LENGTH } characters , then it is invalid .
* < p > The destination prefix is invalid if it contains any characters not in the following
* list :
* < ul >
* < li > a - z ( lower - case alphas ) < / li >
* < li > A - Z ( upper - case alphas ) < / li >
* < li > 0-9 ( numerics ) < / li >
* < li > . ( period ) < / li >
* < li > / ( slash ) < / li >
* < li > % ( percent ) < / li >
* < / ul >
* < p > null and empty string values for a destination prefix are valid , and
* simply indicate an empty prefix .
* @ param destinationPrefix The destination prefix to which the validity
* check is applied .
* @ return String VALID if the prefix is valid or
* MAX _ LENGTH _ EXCEEDED if prefix has more than { @ link # DESTINATION _ PREFIX _ MAX _ LENGTH } characters or
* The Invalid character in the prefix */
public static final String isDestinationPrefixValid ( String destinationPrefix ) { } } | String result = VALID ; // Assume the prefix is valid until we know otherwise .
boolean isValid = true ; // null indicates that no destination prefix is being used .
if ( null != destinationPrefix ) { // Check for the length first .
int len = destinationPrefix . length ( ) ; if ( len > DESTINATION_PREFIX_MAX_LENGTH ) { isValid = false ; result = MAX_LENGTH_EXCEEDED ; } else { // Cycle through each character in the prefix until we find an invalid character ,
// or until we come to the end of the string .
int along = 0 ; while ( ( along < len ) && isValid ) { char c = destinationPrefix . charAt ( along ) ; if ( ! ( ( 'A' <= c ) && ( 'Z' >= c ) ) ) { if ( ! ( ( 'a' <= c ) && ( 'z' >= c ) ) ) { if ( ! ( ( '0' <= c ) && ( '9' >= c ) ) ) { if ( '.' != c && '/' != c && '%' != c ) { // This character isn ' t a valid one . . .
isValid = false ; result = String . valueOf ( c ) ; } } } } // Move along to the next character in the string .
along += 1 ; } } } return result ; |
public class MultiListener { /** * httl . properties : listeners = httl . spi . listeners . ExtendsListener */
public void setListeners ( Listener [ ] listeners ) { } } | if ( listeners != null && listeners . length > 0 && this . listeners != null && this . listeners . length > 0 ) { Listener [ ] oldListeners = this . listeners ; this . listeners = new Listener [ oldListeners . length + listeners . length ] ; System . arraycopy ( oldListeners , 0 , this . listeners , 0 , oldListeners . length ) ; System . arraycopy ( listeners , 0 , this . listeners , oldListeners . length , listeners . length ) ; } else { this . listeners = listeners ; } |
public class FrameOutputWriter { /** * Generate the constants in the " index . html " file . Print the frame details
* as well as warning if browser is not supporting the Html frames . */
protected void generateFrameFile ( ) throws IOException { } } | Content frame = getFrameDetails ( ) ; HtmlTree body = new HtmlTree ( HtmlTag . BODY ) ; body . addAttr ( HtmlAttr . ONLOAD , "loadFrames()" ) ; if ( configuration . allowTag ( HtmlTag . MAIN ) ) { HtmlTree main = HtmlTree . MAIN ( frame ) ; body . addContent ( main ) ; } else { body . addContent ( frame ) ; } if ( configuration . windowtitle . length ( ) > 0 ) { printFramesDocument ( configuration . windowtitle , configuration , body ) ; } else { printFramesDocument ( configuration . getText ( "doclet.Generated_Docs_Untitled" ) , configuration , body ) ; } |
public class ApiClient { /** * Build the Client used to make HTTP requests . */
private Client buildHttpClient ( boolean debugging ) { } } | final ClientConfig conf = new DefaultClientConfig ( ) ; // Add the JSON serialization support to Jersey
JacksonJsonProvider jsonProvider = new JacksonJsonProvider ( mapper ) ; conf . getSingletons ( ) . add ( jsonProvider ) ; // Force TLS v1.2
try { System . setProperty ( "https.protocols" , "TLSv1.2" ) ; } catch ( SecurityException se ) { System . err . println ( "failed to set https.protocols property" ) ; } // Setup the SSLContext object to use for HTTPS connections to the API
if ( sslContext == null ) { try { sslContext = SSLContext . getInstance ( "TLSv1.2" ) ; sslContext . init ( null , new TrustManager [ ] { new SecureTrustManager ( ) } , new SecureRandom ( ) ) ; } catch ( final Exception ex ) { System . err . println ( "failed to initialize SSL context" ) ; } conf . getProperties ( ) . put ( HTTPSProperties . PROPERTY_HTTPS_PROPERTIES , new HTTPSProperties ( new HostnameVerifier ( ) { @ Override public boolean verify ( String hostname , SSLSession session ) { return true ; } } , sslContext ) ) ; HttpsURLConnection . setDefaultSSLSocketFactory ( sslContext . getSocketFactory ( ) ) ; } Client client = new Client ( new URLConnectionClientHandler ( new HttpURLConnectionFactory ( ) { Proxy p = null ; @ Override public HttpURLConnection getHttpURLConnection ( URL url ) throws IOException { // set up the proxy / no - proxy settings
if ( p == null ) { if ( System . getProperties ( ) . containsKey ( "https.proxyHost" ) ) { // set up the proxy host and port
final String host = System . getProperty ( "https.proxyHost" ) ; final Integer port = Integer . getInteger ( "https.proxyPort" ) ; if ( host != null && port != null ) { p = new Proxy ( Proxy . Type . HTTP , new InetSocketAddress ( host , port ) ) ; } // set up optional proxy authentication credentials
final String user = System . getProperty ( "https.proxyUser" ) ; final String password = System . getProperty ( "https.proxyPassword" ) ; if ( user != null && password != null ) { Authenticator . setDefault ( new Authenticator ( ) { @ Override protected PasswordAuthentication getPasswordAuthentication ( ) { if ( getRequestorType ( ) == RequestorType . PROXY && getRequestingHost ( ) . equalsIgnoreCase ( host ) && port == getRequestingPort ( ) ) { return new PasswordAuthentication ( user , password . toCharArray ( ) ) ; } return null ; } } ) ; } } else if ( System . getProperties ( ) . containsKey ( "http.proxyHost" ) ) { // set up the proxy host and port
final String host = System . getProperty ( "http.proxyHost" ) ; final Integer port = Integer . getInteger ( "http.proxyPort" ) ; if ( host != null && port != null ) { p = new Proxy ( Proxy . Type . HTTP , new InetSocketAddress ( host , port ) ) ; } // set up optional proxy authentication credentials
final String user = System . getProperty ( "http.proxyUser" ) ; final String password = System . getProperty ( "http.proxyPassword" ) ; if ( user != null && password != null ) { Authenticator . setDefault ( new Authenticator ( ) { @ Override protected PasswordAuthentication getPasswordAuthentication ( ) { if ( getRequestorType ( ) == RequestorType . PROXY && getRequestingHost ( ) . equalsIgnoreCase ( host ) && port == getRequestingPort ( ) ) { return new PasswordAuthentication ( user , password . toCharArray ( ) ) ; } return null ; } } ) ; } } // no - proxy fallback if the proxy settings are misconfigured in the system properties
if ( p == null ) { p = Proxy . NO_PROXY ; } } HttpsURLConnection connection = ( HttpsURLConnection ) url . openConnection ( p ) ; connection . setSSLSocketFactory ( sslContext . getSocketFactory ( ) ) ; return connection ; } } ) , conf ) ; if ( debugging ) { client . addFilter ( new LoggingFilter ( ) ) ; } return client ; |
public class Heap { private int findcheckchild ( int pos ) { } } | int rlt ; rlt = leftchild ( pos ) ; if ( rlt == size ) return rlt ; if ( isMinRootHeap ? ( scores [ rlt ] > scores [ rlt + 1 ] ) : ( scores [ rlt ] < scores [ rlt + 1 ] ) ) rlt = rlt + 1 ; return rlt ; |
public class JsonStyleParserHelper { /** * Add a polygon symbolizer definition to the rule .
* @ param styleJson The old style . */
@ Nullable @ VisibleForTesting protected PolygonSymbolizer createPolygonSymbolizer ( final PJsonObject styleJson ) { } } | if ( this . allowNullSymbolizer && ! styleJson . has ( JSON_FILL_COLOR ) ) { return null ; } final PolygonSymbolizer symbolizer = this . styleBuilder . createPolygonSymbolizer ( ) ; symbolizer . setFill ( createFill ( styleJson ) ) ; symbolizer . setStroke ( createStroke ( styleJson , false ) ) ; return symbolizer ; |
public class Database { /** * Get information about a partition in this database .
* @ param partitionKey database partition key
* @ return { @ link com . cloudant . client . api . model . PartitionInfo } encapsulating the database partition info .
* @ throws UnsupportedOperationException if called with { @ code null } partition key . */
public PartitionInfo partitionInfo ( String partitionKey ) { } } | if ( partitionKey == null ) { throw new UnsupportedOperationException ( "Cannot get partition information for null partition key." ) ; } URI uri = new DatabaseURIHelper ( db . getDBUri ( ) ) . partition ( partitionKey ) . build ( ) ; return client . couchDbClient . get ( uri , PartitionInfo . class ) ; |
public class AsyncTcpSocketImpl { /** * timeouts management */
private void scheduleReadTimeout ( ) { } } | if ( scheduledReadTimeout == null ) { scheduledReadTimeout = eventloop . delayBackground ( readTimeout , ( ) -> { if ( inspector != null ) inspector . onReadTimeout ( ) ; scheduledReadTimeout = null ; close ( TIMEOUT_EXCEPTION ) ; } ) ; } |
public class FSSpecStore { /** * Returns all versions of the spec defined by specUri .
* Currently , multiple versions are not supported , so this should return exactly one spec .
* @ param specUri URI for the { @ link Spec } to be retrieved .
* @ return all versions of the spec . */
@ Override public Collection < Spec > getAllVersionsOfSpec ( URI specUri ) { } } | Preconditions . checkArgument ( null != specUri , "Spec URI should not be null" ) ; Path specPath = getPathForURI ( this . fsSpecStoreDirPath , specUri , FlowSpec . Builder . DEFAULT_VERSION ) ; return getAllVersionsOfSpec ( specPath ) ; |
public class SearchFilter { /** * Change the search filter to one that specifies an element to
* match or not match one of a list of values .
* The old search filter is deleted .
* @ param ElementName is the name of the element to be matched
* @ param values is a vector of possible matches
* @ param oper is the IN or NOT _ IN operator to indicate how to matche */
public void matchList ( String ElementName , Vector values , int oper ) { } } | // Delete the old search filter
m_filter = null ; // If not NOT _ IN , assume IN
// ( Since ints are passed by value , it is OK to change it )
if ( oper != NOT_IN ) { oper = IN ; // Convert the vector of match strings to an array of strings
} String [ ] value_string_array = new String [ values . size ( ) ] ; values . copyInto ( value_string_array ) ; // Create a leaf node for this list and store it as the filter
m_filter = new SearchBaseLeaf ( ElementName , oper , value_string_array ) ; |
public class ContainerDefinition { /** * The command that is passed to the container . This parameter maps to < code > Cmd < / code > in the < a
* href = " https : / / docs . docker . com / engine / api / v1.35 / # operation / ContainerCreate " > Create a container < / a > section of the
* < a href = " https : / / docs . docker . com / engine / api / v1.35 / " > Docker Remote API < / a > and the < code > COMMAND < / code > parameter
* to < a href = " https : / / docs . docker . com / engine / reference / run / " > docker run < / a > . For more information , see < a
* href = " https : / / docs . docker . com / engine / reference / builder / # cmd "
* > https : / / docs . docker . com / engine / reference / builder / # cmd < / a > . If there are multiple arguments , each argument should
* be a separated string in the array .
* @ param command
* The command that is passed to the container . This parameter maps to < code > Cmd < / code > in the < a
* href = " https : / / docs . docker . com / engine / api / v1.35 / # operation / ContainerCreate " > Create a container < / a > section
* of the < a href = " https : / / docs . docker . com / engine / api / v1.35 / " > Docker Remote API < / a > and the
* < code > COMMAND < / code > parameter to < a href = " https : / / docs . docker . com / engine / reference / run / " > docker run < / a > .
* For more information , see < a
* href = " https : / / docs . docker . com / engine / reference / builder / # cmd " > https : / / docs . docker
* . com / engine / reference / builder / # cmd < / a > . If there are multiple arguments , each argument should be a
* separated string in the array . */
public void setCommand ( java . util . Collection < String > command ) { } } | if ( command == null ) { this . command = null ; return ; } this . command = new com . amazonaws . internal . SdkInternalList < String > ( command ) ; |
public class GeneratorRunScript { public static final void writeScript ( Writer writer ) throws IOException { } } | String newline = IO . newline ( ) ; boolean isWindows = System . getProperty ( "os.name" ) . startsWith ( "Windows" ) ; String variablePrefix = "$C" ; String variableSuffix = File . pathSeparator ; if ( isWindows ) { variablePrefix = "%C" ; variableSuffix = "%" + File . pathSeparator ; } String setSyntax = isWindows ? "@set " : "export " ; String classpath = System . getProperty ( CLASSPATH_PROP ) ; String cpath = null ; HashMap < String , HashSet < Object > > map = new HashMap < String , HashSet < Object > > ( ) ; String folderPath = null ; HashSet < Object > folderPathClassPaths = null ; for ( StringTokenizer tok = new StringTokenizer ( classpath , File . pathSeparator ) ; tok . hasMoreTokens ( ) ; ) { cpath = tok . nextToken ( ) ; // get path
folderPath = IO . parseFolderPath ( cpath ) ; // System . out . println ( " folderPath = " + folderPath ) ;
// get list for folder path
folderPathClassPaths = ( HashSet < Object > ) map . get ( folderPath ) ; // create if needed
if ( folderPathClassPaths == null ) { folderPathClassPaths = new HashSet < Object > ( ) ; } folderPathClassPaths . add ( cpath ) ; // put in map
map . put ( folderPath , folderPathClassPaths ) ; } // loop thru keys in map
int cnt = 0 ; for ( Map . Entry < String , HashSet < Object > > entry : map . entrySet ( ) ) { folderPath = entry . getKey ( ) ; // get list of classpaths
folderPathClassPaths = entry . getValue ( ) ; // write variable
writer . write ( IO . newline ( ) ) ; writer . write ( setSyntax ) ; writer . write ( new StringBuilder ( " C" ) . append ( cnt ) . append ( "=" ) . toString ( ) ) ; // loop thru paths
int printedCnt = 0 ; String line = null ; for ( Iterator < Object > pathI = folderPathClassPaths . iterator ( ) ; pathI . hasNext ( ) ; ) { // limit number of entries per path
if ( printedCnt > limitPerPath ) { // increment
cnt ++ ; writer . write ( newline ) ; writer . write ( new StringBuilder ( setSyntax ) . append ( " C" ) . append ( cnt ) . append ( "=" ) . toString ( ) ) ; printedCnt = 0 ; } line = pathI . next ( ) . toString ( ) ; writer . write ( line ) ; printedCnt += line . length ( ) ; writer . write ( File . pathSeparator ) ; } writer . write ( newline ) ; writer . write ( newline ) ; writer . flush ( ) ; } // print classpath
writer . write ( setSyntax ) ; writer . write ( " CLASSPATH=" ) ; for ( int i = 0 ; i < cnt ; i ++ ) { writer . write ( variablePrefix + i ) ; writer . write ( variableSuffix ) ; } writer . write ( newline ) ; writer . write ( newline ) ; writer . write ( "java <CLASS> <ARG>" ) ; writer . flush ( ) ; writer . write ( newline ) ; writer . write ( "java junit.textui.TestRunner <CLASS> <ARG>" ) ; writer . write ( newline ) ; writer . flush ( ) ; // System . out . println ( " File . pathSeparator = " + File . pathSeparator ) ;
// System . out . println ( " File . separator = " + File . separator ) ; |
public class DynamicTaskMapper { /** * This method maps a dynamic task to a { @ link Task } based on the input params
* @ param taskMapperContext : A wrapper class containing the { @ link WorkflowTask } , { @ link WorkflowDef } , { @ link Workflow } and a string representation of the TaskId
* @ return A { @ link List } that contains a single { @ link Task } with a { @ link Task . Status # SCHEDULED } */
@ Override public List < Task > getMappedTasks ( TaskMapperContext taskMapperContext ) throws TerminateWorkflowException { } } | logger . debug ( "TaskMapperContext {} in DynamicTaskMapper" , taskMapperContext ) ; WorkflowTask taskToSchedule = taskMapperContext . getTaskToSchedule ( ) ; Map < String , Object > taskInput = taskMapperContext . getTaskInput ( ) ; Workflow workflowInstance = taskMapperContext . getWorkflowInstance ( ) ; int retryCount = taskMapperContext . getRetryCount ( ) ; String retriedTaskId = taskMapperContext . getRetryTaskId ( ) ; String taskNameParam = taskToSchedule . getDynamicTaskNameParam ( ) ; String taskName = getDynamicTaskName ( taskInput , taskNameParam ) ; taskToSchedule . setName ( taskName ) ; TaskDef taskDefinition = getDynamicTaskDefinition ( taskToSchedule ) ; taskToSchedule . setTaskDefinition ( taskDefinition ) ; Map < String , Object > input = parametersUtils . getTaskInput ( taskToSchedule . getInputParameters ( ) , workflowInstance , taskDefinition , taskMapperContext . getTaskId ( ) ) ; Task dynamicTask = new Task ( ) ; dynamicTask . setStartDelayInSeconds ( taskToSchedule . getStartDelay ( ) ) ; dynamicTask . setTaskId ( taskMapperContext . getTaskId ( ) ) ; dynamicTask . setReferenceTaskName ( taskToSchedule . getTaskReferenceName ( ) ) ; dynamicTask . setInputData ( input ) ; dynamicTask . setWorkflowInstanceId ( workflowInstance . getWorkflowId ( ) ) ; dynamicTask . setWorkflowType ( workflowInstance . getWorkflowName ( ) ) ; dynamicTask . setStatus ( Task . Status . SCHEDULED ) ; dynamicTask . setTaskType ( taskToSchedule . getType ( ) ) ; dynamicTask . setTaskDefName ( taskToSchedule . getName ( ) ) ; dynamicTask . setCorrelationId ( workflowInstance . getCorrelationId ( ) ) ; dynamicTask . setScheduledTime ( System . currentTimeMillis ( ) ) ; dynamicTask . setRetryCount ( retryCount ) ; dynamicTask . setCallbackAfterSeconds ( taskToSchedule . getStartDelay ( ) ) ; dynamicTask . setResponseTimeoutSeconds ( taskDefinition . getResponseTimeoutSeconds ( ) ) ; dynamicTask . setWorkflowTask ( taskToSchedule ) ; dynamicTask . setTaskType ( taskName ) ; dynamicTask . setRetriedTaskId ( retriedTaskId ) ; return Collections . singletonList ( dynamicTask ) ; |
public class Readability { /** * Get the article title as an H1 . Currently just uses document . title , we
* might want to be smarter in the future .
* @ return */
protected Element getArticleTitle ( ) { } } | Element articleTitle = mDocument . createElement ( "h1" ) ; articleTitle . html ( mDocument . title ( ) ) ; return articleTitle ; |
public class CouchDatabaseBase { /** * Finds an Object of the specified type .
* @ param < T > Object type .
* @ param classType The class of type T .
* @ param id The document _ id field .
* @ param rev The document _ rev field .
* @ return An object of type T .
* @ throws NoDocumentException If the document is not found in the database . */
public < T > T find ( Class < T > classType , String id , String rev ) { } } | assertNotEmpty ( classType , "Class" ) ; assertNotEmpty ( id , "id" ) ; assertNotEmpty ( id , "rev" ) ; final URI uri = new DatabaseURIHelper ( dbUri ) . documentUri ( id , "rev" , rev ) ; return couchDbClient . get ( uri , classType ) ; |
public class PortUtils { /** * Replaces any port tokens in the specified string .
* NOTE : Tokens can be in the following forms :
* 1 . $ { PORT _ 123}
* 2 . $ { PORT _ ? 123}
* 3 . $ { PORT _ 123 ? }
* 4 . $ { PORT _ ? }
* @ param value The string in which to replace port tokens .
* @ return The replaced string . */
public String replacePortTokens ( String value ) { } } | BiMap < String , Optional < Integer > > portMappings = HashBiMap . create ( ) ; Matcher regexMatcher = PORT_REGEX . matcher ( value ) ; while ( regexMatcher . find ( ) ) { String token = regexMatcher . group ( 0 ) ; if ( ! portMappings . containsKey ( token ) ) { Optional < Integer > portStart = Optional . absent ( ) ; Optional < Integer > portEnd = Optional . absent ( ) ; String unboundedStart = regexMatcher . group ( 1 ) ; if ( unboundedStart != null ) { int requestedEndPort = Integer . parseInt ( unboundedStart ) ; Preconditions . checkArgument ( requestedEndPort <= PortUtils . MAXIMUM_PORT ) ; portEnd = Optional . of ( requestedEndPort ) ; } else { String unboundedEnd = regexMatcher . group ( 2 ) ; if ( unboundedEnd != null ) { int requestedStartPort = Integer . parseInt ( unboundedEnd ) ; Preconditions . checkArgument ( requestedStartPort >= PortUtils . MINIMUM_PORT ) ; portStart = Optional . of ( requestedStartPort ) ; } else { String absolute = regexMatcher . group ( 3 ) ; if ( ! "?" . equals ( absolute ) ) { int requestedPort = Integer . parseInt ( absolute ) ; Preconditions . checkArgument ( requestedPort >= PortUtils . MINIMUM_PORT && requestedPort <= PortUtils . MAXIMUM_PORT ) ; portStart = Optional . of ( requestedPort ) ; portEnd = Optional . of ( requestedPort ) ; } } } Optional < Integer > port = takePort ( portStart , portEnd ) ; portMappings . put ( token , port ) ; } } for ( Map . Entry < String , Optional < Integer > > port : portMappings . entrySet ( ) ) { if ( port . getValue ( ) . isPresent ( ) ) { value = value . replace ( port . getKey ( ) , port . getValue ( ) . get ( ) . toString ( ) ) ; } } return value ; |
public class Kryo { /** * Writes a class and returns its registration .
* @ param type May be null .
* @ return Will be null if type is null .
* @ see ClassResolver # writeClass ( Output , Class ) */
public Registration writeClass ( Output output , Class type ) { } } | if ( output == null ) throw new IllegalArgumentException ( "output cannot be null." ) ; try { return classResolver . writeClass ( output , type ) ; } finally { if ( depth == 0 && autoReset ) reset ( ) ; } |
public class WSJdbcDataSource { /** * Determine the default isolation level for this data source .
* @ return the default isolation level for this data source . */
private final int getDefaultIsolationLevel ( ) { } } | int defaultIsolationLevel = resRefInfo == null ? Connection . TRANSACTION_NONE : resRefInfo . getIsolationLevel ( ) ; if ( defaultIsolationLevel == Connection . TRANSACTION_NONE ) defaultIsolationLevel = dsConfig . get ( ) . isolationLevel ; if ( defaultIsolationLevel == - 1 ) defaultIsolationLevel = mcf . getHelper ( ) . getDefaultIsolationLevel ( ) ; return defaultIsolationLevel ; |
public class SpoofChecker { /** * Computes the resolved script set for a string , omitting characters having the specified script . If
* UScript . CODE _ LIMIT is passed as the second argument , all characters are included . */
private void getResolvedScriptSetWithout ( CharSequence input , int script , ScriptSet result ) { } } | result . setAll ( ) ; ScriptSet temp = new ScriptSet ( ) ; for ( int utf16Offset = 0 ; utf16Offset < input . length ( ) ; ) { int codePoint = Character . codePointAt ( input , utf16Offset ) ; utf16Offset += Character . charCount ( codePoint ) ; // Compute the augmented script set for the character
getAugmentedScriptSet ( codePoint , temp ) ; // Intersect the augmented script set with the resolved script set , but only if the character doesn ' t
// have the script specified in the function call
if ( script == UScript . CODE_LIMIT || ! temp . get ( script ) ) { result . and ( temp ) ; } } |
public class SimpleCache { /** * 放入缓存
* @ param key 键
* @ param value 值
* @ return 值 */
public V put ( K key , V value ) { } } | writeLock . lock ( ) ; try { cache . put ( key , value ) ; } finally { writeLock . unlock ( ) ; } return value ; |
public class Eval { /** * Eval locale from language , region and variant
* @ param language
* @ param region
* @ param variant
* @ return the new Locale constructed */
public static Locale locale ( String language , String region , String variant ) { } } | return new Locale ( language , region , variant ) ; |
public class MolecularFormulaManipulator { /** * Returns the string representation of the molecular formula .
* @ param formula The IMolecularFormula Object
* @ param orderElements The order of Elements
* @ param setOne True , when must be set the value 1 for elements with
* one atom
* @ return A String containing the molecular formula
* @ see # getHTML ( IMolecularFormula )
* @ see # generateOrderEle ( )
* @ see # generateOrderEle _ Hill _ NoCarbons ( )
* @ see # generateOrderEle _ Hill _ WithCarbons ( ) */
public static String getString ( IMolecularFormula formula , String [ ] orderElements , boolean setOne ) { } } | return getString ( formula , orderElements , setOne , true ) ; |
public class AbstractDialect { /** * Get < tt > java . sql . Types < / tt > typecode of the column database associated
* with the given sql type , precision and scale .
* @ param type sql type
* @ param precision the precision of the column
* @ param scale the scale of the column
* @ return the column typecode
* @ throws DialectException */
public final int getJdbcType ( String type , int precision , int scale ) throws DialectException { } } | // TODO ? !
// SQLite returns " null " for type if we use rsmd . getColumnTypeName
if ( ( type == null ) || "null" . equals ( type ) ) { return Types . OTHER ; } List < ColumnTypeMatcher > typeMatchers = matchType ( type , columnTypeMatchers ) ; if ( typeMatchers . size ( ) == 0 ) { throw new DialectException ( "Cannot match the type '" + type + "' to a jdbc type" ) ; } if ( typeMatchers . size ( ) == 1 ) { return jdbcTypes . get ( typeMatchers . get ( 0 ) . getColumnType ( ) ) ; } List < ColumnTypeMatcher > precisionMatchers = matchPrecision ( precision , typeMatchers ) ; if ( precisionMatchers . size ( ) == 0 ) { throw new DialectException ( "Cannot match the precision '" + precision + "' to a jdbc type" ) ; } if ( precisionMatchers . size ( ) == 1 ) { return jdbcTypes . get ( precisionMatchers . get ( 0 ) . getColumnType ( ) ) ; } List < ColumnTypeMatcher > scaleMatchers = matchScale ( scale , typeMatchers ) ; if ( scaleMatchers . size ( ) == 0 ) { throw new DialectException ( "Cannot match the scale '" + scale + "' to a jdbc type" ) ; } if ( scaleMatchers . size ( ) == 1 ) { return jdbcTypes . get ( scaleMatchers . get ( 0 ) . getColumnType ( ) ) ; } return jdbcTypes . get ( chooseOne ( scaleMatchers ) . getColumnType ( ) ) ; |
public class Permutation { /** * An easily - readable version of the permutation as a product of cycles .
* @ return the cycle form of the permutation as a string */
public String toCycleString ( ) { } } | int n = this . values . length ; boolean [ ] p = new boolean [ n ] ; Arrays . fill ( p , true ) ; StringBuilder sb = new StringBuilder ( ) ; int j = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] ) { sb . append ( '(' ) ; sb . append ( i ) ; p [ i ] = false ; j = i ; while ( p [ values [ j ] ] ) { sb . append ( ", " ) ; j = values [ j ] ; sb . append ( j ) ; p [ j ] = false ; } sb . append ( ')' ) ; } } return sb . toString ( ) ; |
public class authorizationpolicy_aaagroup_binding { /** * Use this API to fetch authorizationpolicy _ aaagroup _ binding resources of given name . */
public static authorizationpolicy_aaagroup_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | authorizationpolicy_aaagroup_binding obj = new authorizationpolicy_aaagroup_binding ( ) ; obj . set_name ( name ) ; authorizationpolicy_aaagroup_binding response [ ] = ( authorizationpolicy_aaagroup_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class RecordTypeBuilder { /** * Adds a property with the given name and type to the record type .
* If you add a property that has already been added , then { @ link # build }
* will fail .
* @ param name the name of the new property
* @ param type the JSType of the new property
* @ param propertyNode the node that holds this property definition
* @ return The builder itself for chaining purposes . */
public RecordTypeBuilder addProperty ( String name , JSType type , Node propertyNode ) { } } | isEmpty = false ; properties . put ( name , new RecordProperty ( type , propertyNode ) ) ; return this ; |
public class XMLSerializer { /** * Gets the prefix .
* @ param namespace the namespace
* @ param generatePrefix the generate prefix
* @ param nonEmpty the non empty
* @ return prefix */
protected String getPrefix ( String namespace , boolean generatePrefix , boolean nonEmpty ) { } } | // assert namespace ! = null ;
if ( ! namesInterned ) { // when String is interned we can do much faster namespace stack
// lookups . . .
namespace = namespace . intern ( ) ; } else if ( checkNamesInterned ) { checkInterning ( namespace ) ; // assert namespace ! = namespace . intern ( ) ;
} if ( namespace == null ) { throw new IllegalArgumentException ( "namespace must be not null" + getLocation ( ) ) ; } else if ( namespace . length ( ) == 0 ) { throw new IllegalArgumentException ( "default namespace cannot have prefix" + getLocation ( ) ) ; } // first check if namespace is already in scope
for ( int i = namespaceEnd - 1 ; i >= 0 ; -- i ) { if ( namespace == namespaceUri [ i ] ) { final String prefix = namespacePrefix [ i ] ; if ( nonEmpty && prefix . length ( ) == 0 ) continue ; // now check that prefix is still in scope
for ( int p = namespaceEnd - 1 ; p > i ; -- p ) { if ( prefix == namespacePrefix [ p ] ) continue ; // too bad - prefix is redeclared with
// different namespace
} return prefix ; } } // so not found it . . .
if ( ! generatePrefix ) { return null ; } return generatePrefix ( namespace ) ; |
public class FacebookRestClient { /** * Uploads a photo to Facebook .
* @ param photo an image file
* @ param albumId the album into which the photo should be uploaded
* @ return a T with the standard Facebook photo information
* @ see < a href = " http : / / wiki . developers . facebook . com / index . php / Photos . upload " >
* Developers wiki : Photos . upload < / a > */
public T photos_upload ( File photo , Long albumId ) throws FacebookException , IOException { } } | return photos_upload ( photo , /* caption */
null , albumId ) ; |
public class ParameterObject { /** * The attributes of the parameter object .
* @ param attributes
* The attributes of the parameter object . */
public void setAttributes ( java . util . Collection < ParameterAttribute > attributes ) { } } | if ( attributes == null ) { this . attributes = null ; return ; } this . attributes = new com . amazonaws . internal . SdkInternalList < ParameterAttribute > ( attributes ) ; |
public class ConnectionTypesInner { /** * Retrieve a list of connectiontypes .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ConnectionTypeInner & gt ; object */
public Observable < Page < ConnectionTypeInner > > listByAutomationAccountAsync ( final String resourceGroupName , final String automationAccountName ) { } } | return listByAutomationAccountWithServiceResponseAsync ( resourceGroupName , automationAccountName ) . map ( new Func1 < ServiceResponse < Page < ConnectionTypeInner > > , Page < ConnectionTypeInner > > ( ) { @ Override public Page < ConnectionTypeInner > call ( ServiceResponse < Page < ConnectionTypeInner > > response ) { return response . body ( ) ; } } ) ; |
public class Templates { /** * 获取所属行业 */
public Industry getIndustries ( ) { } } | String url = WxEndpoint . get ( "url.template.industry.get" ) ; logger . debug ( "template message, get industry." ) ; String response = wxClient . get ( url ) ; IndustryWrapper industryWrapper = JsonMapper . defaultMapper ( ) . fromJson ( response , IndustryWrapper . class ) ; return new Industry ( industryWrapper . getPrimary ( ) . toString ( ) , industryWrapper . getSecondary ( ) . toString ( ) ) ; |
public class VariantJSONQuery { /** * Read a JSON array */
private void parseArray ( String fieldName ) { } } | int chr ; int idx = 0 ; while ( true ) { sr . skipWhitespaceRead ( ) ; sr . unreadLastCharacter ( ) ; parseValue ( fieldName + "[" + ( idx ++ ) + "]" ) ; chr = sr . skipWhitespaceRead ( ) ; if ( chr == END_ARRAY ) { break ; } if ( chr != VALUE_SEPARATOR ) { throw new IllegalArgumentException ( "Expected ',' or ']' inside array at position " + sr . getPosition ( ) ) ; } } |
public class PrcAccEntityPbWithSubaccEditDelete { /** * < 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 { } } | pRequestData . setAttribute ( "typeCodeSubaccMap" , this . srvTypeCode . getTypeCodeMap ( ) ) ; return this . prcAccEntityPbEditDelete . process ( pAddParam , pEntity , pRequestData ) ; |
public class Container { /** * Stop the container .
* Generate LifeCycleEvents for stopping and stopped either side of a call to doStop */
public synchronized final void stop ( ) throws InterruptedException { } } | if ( ! _started || _stopping ) return ; _stopping = true ; if ( log . isDebugEnabled ( ) ) log . debug ( "Stopping " + this ) ; LifeCycleEvent event = new LifeCycleEvent ( this ) ; for ( int i = 0 ; i < LazyList . size ( _eventListeners ) ; i ++ ) { EventListener listener = ( EventListener ) LazyList . get ( _eventListeners , i ) ; if ( listener instanceof LifeCycleListener ) ( ( LifeCycleListener ) listener ) . lifeCycleStopping ( event ) ; } try { doStop ( ) ; _started = false ; log . info ( "Stopped " + this ) ; for ( int i = 0 ; i < LazyList . size ( _eventListeners ) ; i ++ ) { EventListener listener = ( EventListener ) LazyList . get ( _eventListeners , i ) ; if ( listener instanceof LifeCycleListener ) ( ( LifeCycleListener ) listener ) . lifeCycleStopped ( event ) ; } } catch ( Throwable e ) { event = new LifeCycleEvent ( this , e ) ; for ( int i = 0 ; i < LazyList . size ( _eventListeners ) ; i ++ ) { EventListener listener = ( EventListener ) LazyList . get ( _eventListeners , i ) ; if ( listener instanceof LifeCycleListener ) ( ( LifeCycleListener ) listener ) . lifeCycleFailure ( event ) ; } if ( e instanceof InterruptedException ) throw ( InterruptedException ) e ; if ( e instanceof RuntimeException ) throw ( RuntimeException ) e ; if ( e instanceof Error ) throw ( Error ) e ; log . warn ( LogSupport . EXCEPTION , e ) ; } finally { _stopping = false ; } |
public class AtomicReferenceFieldUpdater { /** * Atomically updates the field of the given object managed by this
* updater with the results of applying the given function to the
* current and given values , returning the previous value . The
* function should be side - effect - free , since it may be re - applied
* when attempted updates fail due to contention among threads . The
* function is applied with the current value as its first argument ,
* and the given update as the second argument .
* @ param obj An object whose field to get and set
* @ param x the update value
* @ param accumulatorFunction a side - effect - free function of two arguments
* @ return the previous value
* @ since 1.8 */
public final V getAndAccumulate ( T obj , V x , BinaryOperator < V > accumulatorFunction ) { } } | V prev , next ; do { prev = get ( obj ) ; next = accumulatorFunction . apply ( prev , x ) ; } while ( ! compareAndSet ( obj , prev , next ) ) ; return prev ; |
public class MMAXAnnotation { /** * getter for annotationLevel - gets The MMAX annotation level .
* @ generated
* @ return value of the feature */
public String getAnnotationLevel ( ) { } } | if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_annotationLevel == null ) jcasType . jcas . throwFeatMissing ( "annotationLevel" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_annotationLevel ) ; |
public class StringBindings { /** * Creates a string binding that contains the value of the given observable string transformed using the supplied
* function .
* If the given observable string has a value of ` null ` the created binding will contain an empty string .
* If the given function has a value of ` null ` { @ link Function # identity ( ) } will be used instead .
* @ param text
* the source string that will used for the conversion .
* @ param transformer
* a non - interfering , stateless function to apply to the source string .
* @ return a binding containing the transformed string . */
public static StringBinding transforming ( ObservableValue < String > text , Function < String , String > transformer ) { } } | return Bindings . createStringBinding ( ( ) -> { Function < String , String > func = transformer == null ? Function . identity ( ) : transformer ; return text . getValue ( ) == null ? "" : func . apply ( text . getValue ( ) ) ; } , text ) ; |
public class MailInfo { /** * Fill email .
* @ param email the email
* @ throws EmailException the email exception
* @ throws IOException Signals that an I / O exception has occurred . */
public void fillEmail ( final MultiPartEmail email ) throws EmailException , IOException { } } | email . setHostName ( getHost ( ) ) ; email . setSmtpPort ( getSmtpPort ( ) ) ; email . addTo ( getTo ( ) ) ; email . setFrom ( getFrom ( ) ) ; email . setSubject ( getSubject ( ) ) ; email . setMsg ( getMsg ( ) ) ; email . setSSLOnConnect ( isSecured ( ) ) ; if ( this . bcc != null ) { String [ ] bccList = this . bcc . split ( "," ) ; for ( String bcc : bccList ) { email . addBcc ( bcc ) ; } } if ( this . cc != null ) { String [ ] ccList = this . cc . split ( "," ) ; for ( String cc : ccList ) { email . addCc ( cc ) ; } } if ( isRequiresAuthentication ( ) ) { email . setAuthentication ( getUsername ( ) , getPassword ( ) ) ; } for ( int i = 0 ; i < this . attachements . size ( ) ; i ++ ) { final Attachment attachment = this . attachements . get ( i ) ; final ByteArrayDataSource ds = new ByteArrayDataSource ( attachment . getData ( ) , attachment . getMimeType ( ) ) ; email . attach ( ds , attachment . getName ( ) , attachment . getDescription ( ) ) ; } |
public class Semver { /** * Checks if the version equals another version , without taking the build into account .
* @ param version the version to compare
* @ return true if the current version equals the provided version ( build excluded ) */
public boolean isEquivalentTo ( Semver version ) { } } | // Get versions without build
Semver sem1 = this . getBuild ( ) == null ? this : new Semver ( this . getValue ( ) . replace ( "+" + this . getBuild ( ) , "" ) ) ; Semver sem2 = version . getBuild ( ) == null ? version : new Semver ( version . getValue ( ) . replace ( "+" + version . getBuild ( ) , "" ) ) ; // Compare those new versions
return sem1 . isEqualTo ( sem2 ) ; |
public class BindSharedPreferencesSubProcessor { /** * Analyze shared preferences .
* @ param sharedPreference the shared preference
* @ return the string */
private String analyzeSharedPreferences ( final TypeElement sharedPreference ) { } } | Element beanElement = sharedPreference ; String result = beanElement . getSimpleName ( ) . toString ( ) ; // create equivalent entity in the domain of bind processor
final BindEntity bindEntity = BindEntityBuilder . parse ( null , sharedPreference ) ; final PrefsEntity currentEntity = new PrefsEntity ( beanElement . getSimpleName ( ) . toString ( ) , ( TypeElement ) beanElement , AnnotationUtility . buildAnnotationList ( ( TypeElement ) beanElement , classAnnotationFilter ) ) ; final boolean bindAllFields = AnnotationUtility . getAnnotationAttributeAsBoolean ( currentEntity , BindType . class , AnnotationAttributeType . ALL_FIELDS , Boolean . TRUE ) ; PropertyUtility . buildProperties ( elementUtils , currentEntity , new PropertyFactory < PrefsEntity , PrefsProperty > ( ) { @ Override public PrefsProperty createProperty ( PrefsEntity entity , Element propertyElement ) { return new PrefsProperty ( currentEntity , propertyElement , AnnotationUtility . buildAnnotationList ( propertyElement ) ) ; } } , propertyAnnotationFilter , new PropertyCreatedListener < PrefsEntity , PrefsProperty > ( ) { @ Override public boolean onProperty ( PrefsEntity entity , PrefsProperty property ) { // if @ BindDisabled is present , exit immediately
if ( property . hasAnnotation ( BindDisabled . class ) ) { if ( bindAllFields ) { return false ; } else { throw new InvalidDefinition ( String . format ( "@%s can not be used with @%s(allField=false)" , BindDisabled . class . getSimpleName ( ) , BindType . class . getSimpleName ( ) ) ) ; } } if ( property . getPropertyType ( ) . isArray ( ) || property . getPropertyType ( ) . isList ( ) ) { property . setPreferenceType ( PreferenceType . STRING ) ; } else { if ( property . isType ( Boolean . TYPE , Boolean . class ) ) { property . setPreferenceType ( PreferenceType . BOOL ) ; } else if ( property . isType ( Short . TYPE , Short . class ) ) { property . setPreferenceType ( PreferenceType . INT ) ; } else if ( property . isType ( Character . TYPE , Character . class ) ) { property . setPreferenceType ( PreferenceType . STRING ) ; } else if ( property . isType ( Integer . TYPE , Integer . class ) ) { property . setPreferenceType ( PreferenceType . INT ) ; } else if ( property . isType ( Long . TYPE , Long . class ) ) { property . setPreferenceType ( PreferenceType . LONG ) ; } else if ( property . isType ( Float . TYPE , Float . class ) ) { property . setPreferenceType ( PreferenceType . FLOAT ) ; } else if ( property . isType ( Double . TYPE , Double . class ) ) { property . setPreferenceType ( PreferenceType . STRING ) ; } else { property . setPreferenceType ( PreferenceType . STRING ) ; } } if ( ! bindAllFields && ! property . hasAnnotation ( BindPreference . class ) ) { // skip field
return false ; } // if field disable , skip property definition
ModelAnnotation annotation = property . getAnnotation ( BindPreference . class ) ; if ( annotation != null && AnnotationUtility . extractAsBoolean ( property , annotation , AnnotationAttributeType . ENABLED ) == false ) { return false ; } if ( bindEntity . contains ( property . getName ( ) ) ) { BindProperty bindProperty = bindEntity . get ( property . getName ( ) ) ; if ( bindProperty . isBindedArray ( ) || bindProperty . isBindedCollection ( ) || bindProperty . isBindedMap ( ) || bindProperty . isBindedObject ( ) ) { property . bindProperty = bindProperty ; } } else { throw ( new KriptonRuntimeException ( String . format ( "In class '%s' property '%s' has a wrong definition to create SharedPreference" , sharedPreference . asType ( ) , property . getName ( ) ) ) ) ; } return true ; } } ) ; ImmutableUtility . buildConstructors ( elementUtils , currentEntity ) ; model . entityAdd ( currentEntity ) ; return result ; |
public class AtomNumberGenerator { /** * { @ inheritDoc } */
@ Override public List < IGeneratorParameter < ? > > getParameters ( ) { } } | return Arrays . asList ( new IGeneratorParameter < ? > [ ] { textColor , willDrawAtomNumbers , offset , atomColorer , colorByType } ) ; |
public class BasicChecker { /** * Verifies the signature on the certificate using the previous public key .
* @ param cert the X509Certificate
* @ throws CertPathValidatorException if certificate does not verify */
private void verifySignature ( X509Certificate cert ) throws CertPathValidatorException { } } | String msg = "signature" ; if ( debug != null ) debug . println ( "---checking " + msg + "..." ) ; try { if ( sigProvider != null ) { cert . verify ( prevPubKey , sigProvider ) ; } else { cert . verify ( prevPubKey ) ; } } catch ( SignatureException e ) { throw new CertPathValidatorException ( msg + " check failed" , e , null , - 1 , BasicReason . INVALID_SIGNATURE ) ; } catch ( GeneralSecurityException e ) { throw new CertPathValidatorException ( msg + " check failed" , e ) ; } if ( debug != null ) debug . println ( msg + " verified." ) ; |
public class ContentRepositoryCleaner { /** * Invoke with the object monitor held */
private void cancelScan ( ) { } } | if ( cleanTask != null ) { cleanTask . cancel ( true ) ; cleanTask = null ; } client . close ( ) ; |
public class SuffixArrays { /** * Create a suffix array and an LCP array for a given input sequence of symbols and a
* custom suffix array building strategy . */
public static SuffixData createWithLCP ( int [ ] input , int start , int length , ISuffixArrayBuilder builder ) { } } | final int [ ] sa = builder . buildSuffixArray ( input , start , length ) ; final int [ ] lcp = computeLCP ( input , start , length , sa ) ; return new SuffixData ( sa , lcp ) ; |
public class CyclicCarbohydrateRecognition { /** * Obtain the coordinates of atoms in a cycle .
* @ param cycle vertices that form a cycles
* @ param container structure representation
* @ return coordinates of the cycle */
private static Point2d [ ] coordinatesOfCycle ( int [ ] cycle , IAtomContainer container ) { } } | Point2d [ ] points = new Point2d [ cycle . length ] ; for ( int i = 0 ; i < cycle . length ; i ++ ) { points [ i ] = container . getAtom ( cycle [ i ] ) . getPoint2d ( ) ; } return points ; |
public class AbstractHistogram { /** * Add the contents of another histogram to this one , while correcting the incoming data for coordinated omission .
* To compensate for the loss of sampled values when a recorded value is larger than the expected
* interval between value samples , the values added will include an auto - generated additional series of
* decreasingly - smaller ( down to the expectedIntervalBetweenValueSamples ) value records for each count found
* in the current histogram that is larger than the expectedIntervalBetweenValueSamples .
* Note : This is a post - recording correction method , as opposed to the at - recording correction method provided
* by { @ link # recordValueWithExpectedInterval ( long , long ) recordValueWithExpectedInterval } . The two
* methods are mutually exclusive , and only one of the two should be be used on a given data set to correct
* for the same coordinated omission issue .
* by
* See notes in the description of the Histogram calls for an illustration of why this corrective behavior is
* important .
* @ param otherHistogram The other histogram . highestTrackableValue and largestValueWithSingleUnitResolution must match .
* @ param expectedIntervalBetweenValueSamples If expectedIntervalBetweenValueSamples is larger than 0 , add
* auto - generated value records as appropriate if value is larger
* than expectedIntervalBetweenValueSamples
* @ throws ArrayIndexOutOfBoundsException ( may throw ) if values exceed highestTrackableValue */
public void addWhileCorrectingForCoordinatedOmission ( final AbstractHistogram otherHistogram , final long expectedIntervalBetweenValueSamples ) { } } | final AbstractHistogram toHistogram = this ; for ( HistogramIterationValue v : otherHistogram . recordedValues ( ) ) { toHistogram . recordValueWithCountAndExpectedInterval ( v . getValueIteratedTo ( ) , v . getCountAtValueIteratedTo ( ) , expectedIntervalBetweenValueSamples ) ; } |
public class Messenger { /** * Send Markdown Message with mentions
* @ param peer destination peer
* @ param name contact name
* @ param phones contact phones
* @ param emails contact emails
* @ param base64photo contact photo */
@ ObjectiveCName ( "sendContactWithPeer:withName:withPhones:withEmails:withPhoto:" ) public void sendContact ( @ NotNull Peer peer , @ NotNull String name , @ NotNull ArrayList < String > phones , @ NotNull ArrayList < String > emails , @ Nullable String base64photo ) { } } | modules . getMessagesModule ( ) . sendContact ( peer , name , phones , emails , base64photo ) ; |
public class PauseAd { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ param adGroupId the ID of the ad group for the ad .
* @ param adId the ID of the ad to pause .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session , Long adGroupId , Long adId ) throws RemoteException { } } | // Get the AdGroupAdService .
AdGroupAdServiceInterface adGroupAdService = adWordsServices . get ( session , AdGroupAdServiceInterface . class ) ; // Create ad with updated status .
Ad ad = new Ad ( ) ; ad . setId ( adId ) ; AdGroupAd adGroupAd = new AdGroupAd ( ) ; adGroupAd . setAdGroupId ( adGroupId ) ; adGroupAd . setAd ( ad ) ; adGroupAd . setStatus ( AdGroupAdStatus . PAUSED ) ; // Create operations .
AdGroupAdOperation operation = new AdGroupAdOperation ( ) ; operation . setOperand ( adGroupAd ) ; operation . setOperator ( Operator . SET ) ; AdGroupAdOperation [ ] operations = new AdGroupAdOperation [ ] { operation } ; // Update ad .
AdGroupAdReturnValue result = adGroupAdService . mutate ( operations ) ; // Display ads .
for ( AdGroupAd adGroupAdResult : result . getValue ( ) ) { System . out . printf ( "Ad with ID %d, type '%s', and status '%s' was updated.%n" , adGroupAdResult . getAd ( ) . getId ( ) , adGroupAdResult . getAd ( ) . getAdType ( ) , adGroupAdResult . getStatus ( ) ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.