signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class PrcEntityPbEditDelete { /** * < 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 { } }
T entity = this . srvOrm . retrieveEntity ( pAddParam , pEntity ) ; if ( entity . getIdDatabaseBirth ( ) != getSrvOrm ( ) . getIdDatabase ( ) ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "can_not_change_foreign_src" ) ; } entity . setIsNew ( false ) ; pRequestData . setAttribute ( "entity" , entity ) ; pRequestData . setAttribute ( "mngUvds" , this . mngUvdSettings ) ; pRequestData . setAttribute ( "srvOrm" , this . srvOrm ) ; pRequestData . setAttribute ( "srvDate" , this . srvDate ) ; pRequestData . setAttribute ( "hldCnvFtfsNames" , this . fieldConverterNamesHolder ) ; pRequestData . setAttribute ( "fctCnvFtfs" , this . convertersFieldsFatory ) ; // owned lists : String ownedLists = mngUvdSettings . lazClsSts ( pEntity . getClass ( ) ) . get ( "ownedLists" ) ; if ( ownedLists != null ) { Map < Class < ? > , List < Object > > ownedListsMap = new LinkedHashMap < Class < ? > , List < Object > > ( ) ; pRequestData . setAttribute ( "ownedListsMap" , ownedListsMap ) ; Set < String > ownedListsSet = utlProperties . evalPropsStringsSet ( ownedLists ) ; for ( String className : ownedListsSet ) { Class < ? > entityFolClass = Class . forName ( className ) ; @ SuppressWarnings ( "unchecked" ) IFillerObjectFields < Object > fillerEfol = ( IFillerObjectFields < Object > ) this . fillersFieldsFactory . lazyGet ( pAddParam , entityFolClass ) ; // find owner field name : String ownerFieldName = null ; TableSql tableSqlEfol = this . srvOrm . getTablesMap ( ) . get ( entityFolClass . getSimpleName ( ) ) ; for ( Map . Entry < String , FieldSql > entry : tableSqlEfol . getFieldsMap ( ) . entrySet ( ) ) { if ( pEntity . getClass ( ) . getSimpleName ( ) . equals ( entry . getValue ( ) . getForeignEntity ( ) ) ) { ownerFieldName = entry . getKey ( ) ; } } if ( ownerFieldName == null ) { throw new ExceptionWithCode ( ExceptionWithCode . SOMETHING_WRONG , "Can't find owner field name for class/class from owned list: " + pEntity . getClass ( ) + "/" + entityFolClass ) ; } @ SuppressWarnings ( "unchecked" ) IFactorySimple < Object > entFolFac = ( IFactorySimple < Object > ) this . entitiesFactoriesFatory . lazyGet ( pAddParam , entityFolClass ) ; Object entityFol = entFolFac . create ( pAddParam ) ; fillerEfol . fill ( pAddParam , entityFol , entity , ownerFieldName ) ; String ooids = entityFolClass . getSimpleName ( ) + ownerFieldName + "deepLevel" ; pAddParam . put ( ooids , 1 ) ; // only ID List < Object > entities = this . srvOrm . retrieveListForField ( pAddParam , entityFol , ownerFieldName ) ; for ( Object efol : entities ) { fillerEfol . fill ( pAddParam , efol , entity , ownerFieldName ) ; } pAddParam . remove ( ooids ) ; ownedListsMap . put ( entityFolClass , entities ) ; } } return entity ;
public class LoadBalancerAttributes { /** * This parameter is reserved . * @ return This parameter is reserved . */ public java . util . List < AdditionalAttribute > getAdditionalAttributes ( ) { } }
if ( additionalAttributes == null ) { additionalAttributes = new com . amazonaws . internal . SdkInternalList < AdditionalAttribute > ( ) ; } return additionalAttributes ;
public class HandlerManager { /** * Removes the given handler from the specified event type . * @ param < H > handler type * @ param type the event type * @ param handler the handler */ public < H extends EventHandler > void removeHandler ( GwtEvent . Type < H > type , final H handler ) { } }
this . eventBus . superDoRemove ( type , null , handler ) ;
public class AptUtil { /** * Tests if the given element has the method with the given name . < br > * NB : This method requires the given element has the kind of { @ link ElementKind # CLASS } . < br > * Also tests the method qualifies all of modifiers if any { @ link Modifier } are also given . * @ param element * @ param methodName * @ param modifiers * @ return true if a match is found , false otherwise * @ author vvakame */ public static boolean isMethodExists ( Element element , String methodName , Modifier ... modifiers ) { } }
if ( element . getKind ( ) != ElementKind . CLASS ) { throw new IllegalStateException ( ) ; } List < Modifier > modifiersList = Arrays . asList ( modifiers ) ; List < ExecutableElement > methods = ElementFilter . methodsIn ( element . getEnclosedElements ( ) ) ; for ( ExecutableElement method : methods ) { if ( method . getSimpleName ( ) . toString ( ) . equals ( methodName ) && method . getModifiers ( ) . containsAll ( modifiersList ) ) { return true ; } } return false ;
public class AnnotatedElements { /** * Find the { @ code \ @ Repeatable } container annotation class for an annotation class , or * { @ code null } . * Given : * < code > * @ Repeatable ( X . class ) * @ interface SomeName { < - - - = annotationClass * < / code > * Returns { @ code X . class } * Otherwise if there was no { @ code \ @ Repeatable } annotation , return { @ code null } . */ private static < T extends Annotation > Class < ? extends Annotation > getRepeatableAnnotationContainerClassFor ( Class < T > annotationClass ) { } }
Repeatable repeatableAnnotation = annotationClass . getDeclaredAnnotation ( Repeatable . class ) ; return ( repeatableAnnotation == null ) ? null : repeatableAnnotation . value ( ) ;
public class ClientService { /** * Create a new client for profile * There is a limit of Constants . CLIENT _ CLIENTS _ PER _ PROFILE _ LIMIT * If this limit is reached an exception is thrown back to the caller * @ param profileId ID of profile to create a new client for * @ return The newly created client * @ throws Exception exception */ public Client add ( int profileId ) throws Exception { } }
Client client = null ; ArrayList < Integer > pathsToCopy = new ArrayList < Integer > ( ) ; String clientUUID = getUniqueClientUUID ( ) ; // get profile for profileId Profile profile = ProfileService . getInstance ( ) . findProfile ( profileId ) ; PreparedStatement statement = null ; ResultSet rs = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { // get the current count of clients statement = sqlConnection . prepareStatement ( "SELECT COUNT(" + Constants . GENERIC_ID + ") FROM " + Constants . DB_TABLE_CLIENT + " WHERE " + Constants . GENERIC_PROFILE_ID + "=?" ) ; statement . setInt ( 1 , profileId ) ; int clientCount = - 1 ; rs = statement . executeQuery ( ) ; if ( rs . next ( ) ) { clientCount = rs . getInt ( 1 ) ; } statement . close ( ) ; rs . close ( ) ; // check count if ( clientCount == - 1 ) { throw new Exception ( "Error querying clients for profileId=" + profileId ) ; } if ( clientCount >= Constants . CLIENT_CLIENTS_PER_PROFILE_LIMIT ) { throw new Exception ( "Profile(" + profileId + ") already contains 50 clients. Please remove clients before adding new ones." ) ; } statement = sqlConnection . prepareStatement ( "INSERT INTO " + Constants . DB_TABLE_CLIENT + " (" + Constants . CLIENT_CLIENT_UUID + ", " + Constants . CLIENT_IS_ACTIVE + ", " + Constants . CLIENT_PROFILE_ID + ")" + " VALUES (?, ?, ?)" , Statement . RETURN_GENERATED_KEYS ) ; statement . setString ( 1 , clientUUID ) ; statement . setBoolean ( 2 , false ) ; statement . setInt ( 3 , profile . getId ( ) ) ; statement . executeUpdate ( ) ; rs = statement . getGeneratedKeys ( ) ; int clientId = - 1 ; if ( rs . next ( ) ) { clientId = rs . getInt ( 1 ) ; } else { // something went wrong throw new Exception ( "Could not add client" ) ; } rs . close ( ) ; statement . close ( ) ; // adding entries into request response table for this new client for every path // basically a copy of what happens when a path gets created statement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_REQUEST_RESPONSE + " WHERE " + Constants . GENERIC_PROFILE_ID + " = ?" + " AND " + Constants . GENERIC_CLIENT_UUID + " = ?" ) ; statement . setInt ( 1 , profile . getId ( ) ) ; statement . setString ( 2 , Constants . PROFILE_CLIENT_DEFAULT_ID ) ; rs = statement . executeQuery ( ) ; while ( rs . next ( ) ) { // collect up the pathIds we need to copy pathsToCopy . add ( rs . getInt ( Constants . REQUEST_RESPONSE_PATH_ID ) ) ; } client = new Client ( ) ; client . setIsActive ( false ) ; client . setUUID ( clientUUID ) ; client . setId ( clientId ) ; client . setProfile ( profile ) ; } catch ( SQLException e ) { throw e ; } finally { try { if ( rs != null ) { rs . close ( ) ; } } catch ( Exception e ) { } try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } // add all of the request response items for ( Integer pathId : pathsToCopy ) { PathOverrideService . getInstance ( ) . addPathToRequestResponseTable ( profile . getId ( ) , client . getUUID ( ) , pathId ) ; } return client ;
public class LdapHelper { /** * Returns a basic LDAP - User - Template for a new LDAP - User . * @ param uid of the new LDAP - User . * @ return the ( prefiled ) User - Template . */ public LdapUser getUserTemplate ( String uid ) { } }
LdapUser user = new LdapUser ( uid , this ) ; user . set ( "dn" , getDNForNode ( user ) ) ; for ( String oc : userObjectClasses ) { user . addObjectClass ( oc . trim ( ) ) ; } user = ( LdapUser ) updateObjectClasses ( user ) ; // TODO this needs to be cleaner : - / . // for inetOrgPerson if ( user . getObjectClasses ( ) . contains ( "inetOrgPerson" ) || user . getObjectClasses ( ) . contains ( "person" ) ) { user . set ( "sn" , uid ) ; } // for JabberAccount if ( user . getObjectClasses ( ) . contains ( "JabberAccount" ) ) { user . set ( "jabberID" , uid + "@" + defaultValues . get ( "jabberServer" ) ) ; user . set ( "jabberAccess" , "TRUE" ) ; } // for posixAccount if ( user . getObjectClasses ( ) . contains ( "posixAccount" ) ) { user . set ( "uidNumber" , "99999" ) ; user . set ( "gidNumber" , "99999" ) ; user . set ( "cn" , uid ) ; user . set ( "homeDirectory" , "/dev/null" ) ; } // for ldapPublicKey if ( user . getObjectClasses ( ) . contains ( "ldapPublicKey" ) ) { user . set ( "sshPublicKey" , defaultValues . get ( "sshKey" ) ) ; } return user ;
public class PriorityQueue { /** * Adds an Object to a PriorityQueue in log ( size ) time . If one tries to add * more objects than maxSize from initialize an * { @ link ArrayIndexOutOfBoundsException } is thrown . * @ return the new ' top ' element in the queue . */ public final T add ( T element ) { } }
size ++ ; heap [ size ] = element ; upHeap ( ) ; return heap [ 1 ] ;
public class StrLookup { /** * Returns a lookup which looks up values using a map . * If the map is null , then null will be returned from every lookup . * The map result object is converted to a string using toString ( ) . * @ param < V > the type of the values supported by the lookup * @ param map the map of keys to values , may be null * @ return a lookup using the map , not null */ public static < V > StrLookup < V > mapLookup ( final Map < String , V > map ) { } }
return new MapStrLookup < > ( map ) ;
public class TextSimilarity { /** * 判断字符是否为汉字 , 数字和字母 , 因为对符号进行相似度比较没有实际意义 , 故符号不加入考虑范围 。 * @ param charValue 字符 * @ return 是否为汉字 , 数字和字母 */ private static boolean charReg ( char charValue ) { } }
return ( charValue >= 0x4E00 && charValue <= 0XFFF ) || ( charValue >= 'a' && charValue <= 'z' ) || ( charValue >= 'A' && charValue <= 'Z' ) || ( charValue >= '0' && charValue <= '9' ) ;
public class DatabaseAdvisorsInner { /** * Returns details of a Database Advisor . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param databaseName The name of the database . * @ param advisorName The name of the Database Advisor . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < AdvisorInner > getAsync ( String resourceGroupName , String serverName , String databaseName , String advisorName , final ServiceCallback < AdvisorInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , advisorName ) , serviceCallback ) ;
public class MetatypeValidator { /** * Validates one or more projects located in the directory specified by * the constructor . * @ param validateRefs * @ return a List of validated projects * @ throws IOException */ public List < Project > validate ( boolean validateRefs ) throws IOException { } }
for ( Project project : projects ) { for ( ValidationEntry validationEntry : project . validationEntries ) { MetatypeRoot metatype = validationEntry . parsedMetatype ; metatype . setMetatypeFileName ( validationEntry . fileName ) ; metatype . setOcdStats ( ocdStats ) ; metatype . setNlsKeys ( validationEntry . nlsKeys ) ; metatype . validate ( validateRefs ) ; validationEntry . validity = metatype . getValidityState ( ) ; File outputFile = new File ( outputPath + "/" + project . name + "/" + validationEntry . fileName + getExtension ( validationEntry . fileName ) ) ; outputFile . getParentFile ( ) . mkdirs ( ) ; int pass = 0 ; int fail = 0 ; if ( ! validationEntry . localizationFound ) { validationEntry . validity = ValidityState . Failure ; fail ++ ; } else { pass ++ ; } fail += metatype . getErrorMessages ( ) . size ( ) ; pass += metatype . getWarningMessages ( ) . size ( ) + metatype . getInfoMessages ( ) . size ( ) ; for ( MetatypeDesignate designate : metatype . getDesignates ( ) ) { fail += designate . getErrorMessages ( ) . size ( ) ; pass += designate . getWarningMessages ( ) . size ( ) + designate . getInfoMessages ( ) . size ( ) ; for ( MetatypeObject object : designate . getObjects ( ) ) { fail += object . getErrorMessages ( ) . size ( ) ; pass += object . getWarningMessages ( ) . size ( ) + object . getInfoMessages ( ) . size ( ) ; MetatypeOcd ocd = object . getMatchingOcd ( ) ; if ( ocd != null ) { fail += ocd . getErrorMessages ( ) . size ( ) ; pass += ocd . getWarningMessages ( ) . size ( ) + ocd . getInfoMessages ( ) . size ( ) ; for ( MetatypeAd ad : ocd . getAds ( ) ) { fail += ad . getErrorMessages ( ) . size ( ) ; pass += ad . getWarningMessages ( ) . size ( ) + ad . getInfoMessages ( ) . size ( ) ; for ( MetatypeAdOption option : ad . getOptions ( ) ) { fail += option . getErrorMessages ( ) . size ( ) ; pass += option . getWarningMessages ( ) . size ( ) + option . getInfoMessages ( ) . size ( ) ; } } } } } PrintStream junit = new PrintStream ( outputFile ) ; junit . printf ( "<testsuite errors=\"%s\" failures=\"%s\" name=\"%s\" tests=\"%s\" time=\"\">%n" , "0" , fail , project . name , fail + pass ) ; if ( ! validationEntry . localizationFound ) { junit . printf ( "<testcase classname=\"%s\" name=\"%s\">%n" , project . name , "localizationFileNotFound" ) ; junit . printf ( "<failure message=\"%s\"><![CDATA[%s]]></failure>%n" , "Could not find file " + metatype . getLocalization ( ) , "" ) ; junit . printf ( "</testcase>%n" ) ; } String fileName = validationEntry . fileName ; processMetatype ( project , metatype , fileName , junit ) ; for ( MetatypeDesignate designate : metatype . getDesignates ( ) ) { String pid = designate . getPid ( ) ; if ( pid == null ) pid = designate . getFactoryPid ( ) ; processMetatype ( project , designate , fileName + "." + pid , junit ) ; for ( MetatypeObject object : designate . getObjects ( ) ) { processMetatype ( project , object , fileName + "." + pid , junit ) ; MetatypeOcd ocd = object . getMatchingOcd ( ) ; if ( ocd != null ) { processMetatype ( project , ocd , fileName + "." + pid , junit ) ; for ( MetatypeAd ad : ocd . getAds ( ) ) { String id = ad . getId ( ) ; processMetatype ( project , ad , fileName + "." + pid + "." + id , junit ) ; for ( MetatypeAdOption option : ad . getOptions ( ) ) { processMetatype ( project , option , fileName + "." + pid + "." + id + "." + option , junit ) ; } } } } } junit . printf ( "</testsuite>%n" ) ; junit . close ( ) ; String failMsg = ( fail > 0 ) ? "**FAILURE**" : "" ; System . out . println ( "Metatype validation " + failMsg + " for " + validationEntry . fileName + " written to " + outputFile . getAbsolutePath ( ) ) ; } } if ( ! errors . isEmpty ( ) ) { throw new IllegalStateException ( "xml parse errors:\n" + errors ) ; } return projects ;
public class TopologyComparators { /** * Sort partitions by RedisURI . * @ param clusterNodes * @ return List containing { @ link RedisClusterNode } s ordered by { @ link RedisURI } */ public static List < RedisClusterNode > sortByUri ( Iterable < RedisClusterNode > clusterNodes ) { } }
LettuceAssert . notNull ( clusterNodes , "Cluster nodes must not be null" ) ; List < RedisClusterNode > ordered = LettuceLists . newList ( clusterNodes ) ; ordered . sort ( ( o1 , o2 ) -> RedisURIComparator . INSTANCE . compare ( o1 . getUri ( ) , o2 . getUri ( ) ) ) ; return ordered ;
public class HFCAAffiliation { /** * gets a specific affiliation * @ param registrar The identity of the registrar * @ return Returns response * @ throws AffiliationException if getting an affiliation fails . * @ throws InvalidArgumentException */ public int read ( User registrar ) throws AffiliationException , InvalidArgumentException { } }
if ( registrar == null ) { throw new InvalidArgumentException ( "Registrar should be a valid member" ) ; } String readAffURL = "" ; try { readAffURL = HFCA_AFFILIATION + "/" + name ; logger . debug ( format ( "affiliation url: %s, registrar: %s" , readAffURL , registrar . getName ( ) ) ) ; JsonObject result = client . httpGet ( readAffURL , registrar ) ; logger . debug ( format ( "affiliation url: %s, registrar: %s done." , readAffURL , registrar ) ) ; HFCAAffiliationResp resp = getResponse ( result ) ; this . childHFCAAffiliations = resp . getChildren ( ) ; this . identities = resp . getIdentities ( ) ; this . deleted = false ; return resp . statusCode ; } catch ( HTTPException e ) { String msg = format ( "[Code: %d] - Error while getting affiliation '%s' from url '%s': %s" , e . getStatusCode ( ) , this . name , readAffURL , e . getMessage ( ) ) ; AffiliationException affiliationException = new AffiliationException ( msg , e ) ; logger . error ( msg ) ; throw affiliationException ; } catch ( Exception e ) { String msg = format ( "Error while getting affiliation %s url: %s %s " , this . name , readAffURL , e . getMessage ( ) ) ; AffiliationException affiliationException = new AffiliationException ( msg , e ) ; logger . error ( msg ) ; throw affiliationException ; }
public class PCA9685GpioProvider { /** * Permanently sets the output to High ( no PWM anymore ) . < br > * The LEDn _ ON _ H output control bit 4 , when set to logic 1 , causes the output to be always ON . * @ param pin represents channel 0 . . 15 */ public void setAlwaysOn ( Pin pin ) { } }
final int pwmOnValue = 0x1000 ; final int pwmOffValue = 0x0000 ; validatePin ( pin , pwmOnValue , pwmOffValue ) ; final int channel = pin . getAddress ( ) ; try { device . write ( PCA9685A_LED0_ON_L + 4 * channel , ( byte ) 0x00 ) ; device . write ( PCA9685A_LED0_ON_H + 4 * channel , ( byte ) 0x10 ) ; // set bit 4 to high device . write ( PCA9685A_LED0_OFF_L + 4 * channel , ( byte ) 0x00 ) ; device . write ( PCA9685A_LED0_OFF_H + 4 * channel , ( byte ) 0x00 ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error while trying to set channel [" + channel + "] always ON." , e ) ; } cachePinValues ( pin , pwmOnValue , pwmOffValue ) ;
public class CompatibilityMatrix { /** * Create a fixed - size 2D array of the matrix ( useful for debug ) . * @ return a fixed version of the matrix */ int [ ] [ ] fix ( ) { } }
int [ ] [ ] m = new int [ nRows ] [ mCols ] ; for ( int i = 0 ; i < nRows ; i ++ ) System . arraycopy ( data , ( i * mCols ) , m [ i ] , 0 , mCols ) ; return m ;
public class ExternalChildResourcesNonCachedImpl { /** * Prepare the given model of an external child resource for inline removal ( along with the definition or update of parent resource ) . * @ param model the model representing child resource to remove */ protected final void prepareInlineRemove ( FluentModelTImpl model ) { } }
FluentModelTImpl childResource = find ( model . childResourceKey ( ) ) ; if ( childResource != null ) { throw new IllegalArgumentException ( pendingOperationMessage ( model . name ( ) , model . childResourceKey ( ) ) ) ; } model . setPendingOperation ( ExternalChildResourceImpl . PendingOperation . ToBeRemoved ) ; this . childCollection . put ( model . childResourceKey ( ) , model ) ; super . prepareForFutureCommitOrPostRun ( model ) ;
public class Version { /** * Returns whether the given String is a valid pre - release identifier . That is , this * method returns < code > true < / code > if , and only if the { @ code preRelease } parameter * is either the empty string or properly formatted as a pre - release identifier * according to the semantic version specification . * Note : this method does not throw an exception upon < code > null < / code > input , but * returns < code > false < / code > instead . * @ param preRelease The String to check . * @ return Whether the given String is a valid pre - release identifier . * @ since 0.5.0 */ public static boolean isValidPreRelease ( String preRelease ) { } }
if ( preRelease == null ) { return false ; } else if ( preRelease . isEmpty ( ) ) { return true ; } return parseID ( preRelease . toCharArray ( ) , preRelease , 0 , true , false , false , null , "" ) != FAILURE ;
public class ContinentHelper { /** * Get all continents for the specified country ID * @ param aLocale * The locale to be used . May be < code > null < / code > . * @ return < code > null < / code > if no continent data is defined . Otherwise a non - * < code > null < / code > Set with all continents , without * < code > null < / code > elements . */ @ Nullable @ ReturnsMutableCopy public static ICommonsNavigableSet < EContinent > getContinentsOfCountry ( @ Nullable final Locale aLocale ) { } }
final Locale aCountry = CountryCache . getInstance ( ) . getCountry ( aLocale ) ; if ( aCountry != null ) { final ICommonsNavigableSet < EContinent > ret = s_aMap . get ( aCountry ) ; if ( ret != null ) return ret . getClone ( ) ; } return null ;
public class AddUniformScale { /** * Add scales to a single vector relation . * @ param rel Relation * @ return Scales */ private ScalesResult run ( Relation < ? extends NumberVector > rel ) { } }
double [ ] [ ] mms = RelationUtil . computeMinMax ( rel ) ; int dim = mms [ 0 ] . length ; double delta = 0. ; for ( int d = 0 ; d < dim ; d ++ ) { double del = mms [ 1 ] [ d ] - mms [ 0 ] [ d ] ; delta = del > delta ? del : delta ; } if ( delta < Double . MIN_NORMAL ) { delta = 1. ; } int log10res = ( int ) Math . ceil ( Math . log10 ( delta / ( LinearScale . MAXTICKS - 1 ) ) ) ; double res = MathUtil . powi ( 10 , log10res ) ; double target = Math . ceil ( delta / res ) * res ; // Target width LinearScale [ ] scales = new LinearScale [ dim ] ; for ( int d = 0 ; d < dim ; d ++ ) { double mid = ( mms [ 0 ] [ d ] + mms [ 1 ] [ d ] - target ) * .5 ; double min = Math . floor ( mid / res ) * res ; double max = Math . ceil ( ( mid + target ) / res ) * res ; scales [ d ] = new LinearScale ( min , max ) ; } return new ScalesResult ( scales ) ;
public class DeploymentExceptionHandler { /** * public void verifyExpectedExceptionDuringUnDeploy ( @ Observes EventContext < UnDeployDeployment > context ) throws Exception * DeploymentDescription deployment = context . getEvent ( ) . getDeployment ( ) ; * try * context . proceed ( ) ; * catch ( Exception e ) * if ( deployment . getExpectedException ( ) = = null ) * throw e ; */ private boolean containsType ( Throwable exception , Class < ? extends Exception > expectedType ) { } }
Throwable transformedException = transform ( exception ) ; if ( transformedException == null ) { return false ; } if ( expectedType . isAssignableFrom ( transformedException . getClass ( ) ) ) { return true ; } return containsType ( transformedException . getCause ( ) , expectedType ) ;
public class Audit { /** * Specifies the created date . * @ param createdDate The created date . */ public void setCreatedDate ( Date createdDate ) { } }
_createdDate = createdDate == null ? null : new Date ( createdDate . getTime ( ) ) ;
public class MultiHopFlowCompiler { /** * @ param spec an instance of { @ link FlowSpec } . * @ return A DAG of { @ link JobExecutionPlan } s , which encapsulates the compiled { @ link org . apache . gobblin . runtime . api . JobSpec } s * together with the { @ link SpecExecutor } where the job can be executed . */ @ Override public Dag < JobExecutionPlan > compileFlow ( Spec spec ) { } }
Preconditions . checkNotNull ( spec ) ; Preconditions . checkArgument ( spec instanceof FlowSpec , "MultiHopFlowCompiler only accepts FlowSpecs" ) ; long startTime = System . nanoTime ( ) ; FlowSpec flowSpec = ( FlowSpec ) spec ; String source = ConfigUtils . getString ( flowSpec . getConfig ( ) , ServiceConfigKeys . FLOW_SOURCE_IDENTIFIER_KEY , "" ) ; String destination = ConfigUtils . getString ( flowSpec . getConfig ( ) , ServiceConfigKeys . FLOW_DESTINATION_IDENTIFIER_KEY , "" ) ; log . info ( String . format ( "Compiling flow for source: %s and destination: %s" , source , destination ) ) ; Dag < JobExecutionPlan > jobExecutionPlanDag ; try { // Compute the path from source to destination . FlowGraphPath flowGraphPath = flowGraph . findPath ( flowSpec ) ; // Convert the path into a Dag of JobExecutionPlans . if ( flowGraphPath != null ) { jobExecutionPlanDag = flowGraphPath . asDag ( this . config ) ; } else { Instrumented . markMeter ( flowCompilationFailedMeter ) ; log . info ( String . format ( "No path found from source: %s and destination: %s" , source , destination ) ) ; return new JobExecutionPlanDagFactory ( ) . createDag ( new ArrayList < > ( ) ) ; } } catch ( PathFinder . PathFinderException | SpecNotFoundException | JobTemplate . TemplateException | URISyntaxException | ReflectiveOperationException e ) { Instrumented . markMeter ( flowCompilationFailedMeter ) ; log . error ( String . format ( "Exception encountered while compiling flow for source: %s and destination: %s" , source , destination ) , e ) ; return null ; } Instrumented . markMeter ( flowCompilationSuccessFulMeter ) ; Instrumented . updateTimer ( flowCompilationTimer , System . nanoTime ( ) - startTime , TimeUnit . NANOSECONDS ) ; return jobExecutionPlanDag ;
public class DefaultGroovyMethods { /** * Transform this Number into a BigInteger . * @ param self a Number * @ return a BigInteger * @ since 1.0 */ public static BigInteger toBigInteger ( Number self ) { } }
if ( self instanceof BigInteger ) { return ( BigInteger ) self ; } else if ( self instanceof BigDecimal ) { return ( ( BigDecimal ) self ) . toBigInteger ( ) ; } else if ( self instanceof Double ) { return new BigDecimal ( ( Double ) self ) . toBigInteger ( ) ; } else if ( self instanceof Float ) { return new BigDecimal ( ( Float ) self ) . toBigInteger ( ) ; } else { return new BigInteger ( Long . toString ( self . longValue ( ) ) ) ; }
public class GreenPepperXmlRpcServerDelegator { /** * { @ inheritDoc } */ public String getRenderedSpecification ( String username , String password , Vector < ? > args ) { } }
return confluenceServiceDelegator . getRenderedSpecification ( username , password , args ) ;
public class WIMUserRegistry { /** * { @ inheritDoc } */ @ Override @ FFDCIgnore ( Exception . class ) public String getUserDisplayName ( final String inputUserSecurityName ) throws EntryNotFoundException , RegistryException { } }
try { // bridge the APIs String returnValue = displayBridge . getUserDisplayName ( inputUserSecurityName ) ; return returnValue ; } catch ( Exception excp ) { if ( excp instanceof EntryNotFoundException ) throw ( EntryNotFoundException ) excp ; else throw new RegistryException ( excp . getMessage ( ) , excp ) ; }
public class Expressions { /** * Create a new Template expression * @ param cl type of expression * @ param template template * @ param args template parameters * @ return template expression */ public static < T > SimpleTemplate < T > template ( Class < ? extends T > cl , String template , Object ... args ) { } }
return simpleTemplate ( cl , template , args ) ;
public class ModelUtils { /** * Gets and splits property values separated by a comma . * @ param holder a property holder ( not null ) * @ return a non - null list of non - null values */ public static List < String > getPropertyValues ( AbstractBlockHolder holder , String propertyName ) { } }
List < String > result = new ArrayList < > ( ) ; for ( BlockProperty p : holder . findPropertiesBlockByName ( propertyName ) ) { result . addAll ( Utils . splitNicely ( p . getValue ( ) , ParsingConstants . PROPERTY_SEPARATOR ) ) ; } return result ;
public class GetResolverRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetResolverRequest getResolverRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getResolverRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getResolverRequest . getApiId ( ) , APIID_BINDING ) ; protocolMarshaller . marshall ( getResolverRequest . getTypeName ( ) , TYPENAME_BINDING ) ; protocolMarshaller . marshall ( getResolverRequest . getFieldName ( ) , FIELDNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CmsPreferences { /** * Returns the preferred editor preselection value either from the request , if not present , from the user settings . < p > * @ param request the current http servlet request * @ param resourceType the preferred editors resource type * @ return the preferred editor preselection value or null , if none found */ private String computeEditorPreselection ( HttpServletRequest request , String resourceType ) { } }
// first check presence of the setting in request parameter String preSelection = request . getParameter ( PARAM_PREFERREDEDITOR_PREFIX + resourceType ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( preSelection ) ) { return CmsEncoder . decode ( preSelection ) ; } else { // no value found in request , check current user settings ( not the member ! ) CmsUserSettings userSettings = new CmsUserSettings ( getSettings ( ) . getUser ( ) ) ; return userSettings . getPreferredEditor ( resourceType ) ; }
public class ASMUtil { /** * Extract all Accessor for the field of the given class . * @ param type * @ return all Accessor available */ static public Accessor [ ] getAccessors ( Class < ? > type , FieldFilter filter ) { } }
Class < ? > nextClass = type ; HashMap < String , Accessor > map = new HashMap < String , Accessor > ( ) ; if ( filter == null ) filter = BasicFiledFilter . SINGLETON ; while ( nextClass != Object . class ) { Field [ ] declaredFields = nextClass . getDeclaredFields ( ) ; for ( Field field : declaredFields ) { String fn = field . getName ( ) ; if ( map . containsKey ( fn ) ) continue ; Accessor acc = new Accessor ( nextClass , field , filter ) ; if ( ! acc . isUsable ( ) ) continue ; map . put ( fn , acc ) ; } nextClass = nextClass . getSuperclass ( ) ; } return map . values ( ) . toArray ( new Accessor [ map . size ( ) ] ) ;
public class MiriamLink { /** * Retrieves the physical locationS ( URLs ) of web pageS providing knowledge about an entity . * @ param datatypeKey name ( can be a synonym ) , ID , or URI of a data type ( examples : " Gene Ontology " , " UniProt " ) * @ param entityId identifier of an entity within the given data type ( examples : " GO : 0045202 " , " P62158 " ) * @ return physical locationS ( URL templates ) of web pageS providing knowledge about the given entity * @ throws IllegalArgumentException when datatype not found */ public static String [ ] getLocations ( String datatypeKey , String entityId ) { } }
Set < String > locations = new HashSet < String > ( ) ; Datatype datatype = getDatatype ( datatypeKey ) ; for ( Resource resource : getResources ( datatype ) ) { String link = resource . getDataEntry ( ) ; try { link = link . replaceFirst ( "\\$id" , URLEncoder . encode ( entityId , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } locations . add ( link ) ; } return locations . toArray ( ARRAY_OF_STRINGS ) ;
public class ClassGenerator { /** * Indent a string to a given level . */ String indent ( String s , int level ) { } }
return Stream . of ( s . split ( "\n" ) ) . map ( sub -> INDENT_STRING . substring ( 0 , level * INDENT_WIDTH ) + sub ) . collect ( Collectors . joining ( "\n" ) ) ;
public class CollectionSchemaUpdate { /** * A method to set a new Operation for a key . It may be of type ADD , RENAME or DELETE . * Only one operation per key can be specified . Attempt to add a second operation for a any key will override the first one . * Attempt to add a ADD operation for a key which already exists will have no effect . * Attempt to add a DELETE operation for akey which does not exist will have no effect . * @ param key ( a . k . a JSON Field name ) for which operation is being added * @ param operation operation to perform * @ return the updated CollectionSchemaUpdate */ public CollectionSchemaUpdate set ( String key , IOperation operation ) { } }
collectionUpdateData . put ( key , operation ) ; return this ;
public class GlobalAjaxInvoker { /** * Set the global registry to be used . Note : this API can only called BEFORE * registrations are performed . Afterwards an { @ link IllegalStateException } is * thrown if this API is invoked . * @ param aRegistry * The registry to use . May not be < code > null < / code > . */ @ Nonnull public void setRegistry ( @ Nonnull final IAjaxRegistry aRegistry ) { } }
ValueEnforcer . notNull ( aRegistry , "Registry" ) ; if ( m_aRWLock . readLocked ( ( ) -> m_aRegistry . getAllRegisteredFunctions ( ) . isNotEmpty ( ) ) ) throw new IllegalStateException ( "Cannot change the registry after a function was already registered!" ) ; m_aRWLock . writeLocked ( ( ) -> m_aRegistry = aRegistry ) ;
public class ProcessorKey { /** * Set the properties of an object from the given attribute list . * @ param handler The stylesheet ' s Content handler , needed for * error reporting . * @ param rawName The raw name of the owner element , needed for * error reporting . * @ param attributes The list of attributes . * @ param target The target element where the properties will be set . */ void setPropertiesFromAttributes ( StylesheetHandler handler , String rawName , Attributes attributes , org . apache . xalan . templates . ElemTemplateElement target ) throws org . xml . sax . SAXException { } }
XSLTElementDef def = getElemDef ( ) ; // Keep track of which XSLTAttributeDefs have been processed , so // I can see which default values need to be set . List processedDefs = new ArrayList ( ) ; int nAttrs = attributes . getLength ( ) ; for ( int i = 0 ; i < nAttrs ; i ++ ) { String attrUri = attributes . getURI ( i ) ; String attrLocalName = attributes . getLocalName ( i ) ; XSLTAttributeDef attrDef = def . getAttributeDef ( attrUri , attrLocalName ) ; if ( null == attrDef ) { // Then barf , because this element does not allow this attribute . handler . error ( attributes . getQName ( i ) + "attribute is not allowed on the " + rawName + " element!" , null ) ; } else { String valueString = attributes . getValue ( i ) ; if ( valueString . indexOf ( org . apache . xpath . compiler . Keywords . FUNC_KEY_STRING + "(" ) >= 0 ) handler . error ( XSLMessages . createMessage ( XSLTErrorResources . ER_INVALID_KEY_CALL , null ) , null ) ; processedDefs . add ( attrDef ) ; attrDef . setAttrValue ( handler , attrUri , attrLocalName , attributes . getQName ( i ) , attributes . getValue ( i ) , target ) ; } } XSLTAttributeDef [ ] attrDefs = def . getAttributes ( ) ; int nAttrDefs = attrDefs . length ; for ( int i = 0 ; i < nAttrDefs ; i ++ ) { XSLTAttributeDef attrDef = attrDefs [ i ] ; String defVal = attrDef . getDefault ( ) ; if ( null != defVal ) { if ( ! processedDefs . contains ( attrDef ) ) { attrDef . setDefAttrValue ( handler , target ) ; } } if ( attrDef . getRequired ( ) ) { if ( ! processedDefs . contains ( attrDef ) ) handler . error ( XSLMessages . createMessage ( XSLTErrorResources . ER_REQUIRES_ATTRIB , new Object [ ] { rawName , attrDef . getName ( ) } ) , null ) ; } }
public class ClassUseMapper { /** * Return all implementing classes of an interface ( including all subClasses of implementing * classes and all classes implementing subInterfaces ) AND fill - in both classToImplementingClass * and classToSubinterface maps . */ private Collection < TypeElement > implementingClasses ( TypeElement te ) { } }
Collection < TypeElement > ret = classToImplementingClass . get ( te ) ; if ( ret == null ) { ret = new TreeSet < > ( utils . makeClassUseComparator ( ) ) ; Set < TypeElement > impl = classtree . implementingClasses ( te ) ; if ( impl != null ) { ret . addAll ( impl ) ; for ( TypeElement anImpl : impl ) { ret . addAll ( subclasses ( anImpl ) ) ; } } for ( TypeElement intfc : subinterfaces ( te ) ) { ret . addAll ( implementingClasses ( intfc ) ) ; } addAll ( classToImplementingClass , te , ret ) ; } return ret ;
public class DoubleFieldOption { /** * / * ( non - Javadoc ) * @ see ca . eandb . util . args . AbstractFieldOption # getOptionValue ( java . util . Queue ) */ @ Override protected Object getOptionValue ( Queue < String > argq ) { } }
return Double . parseDouble ( argq . remove ( ) ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link PersonType } * { @ code > } */ @ XmlElementDecl ( namespace = "http://www.w3.org/2005/Atom" , name = "author" , scope = SourceType . class ) public JAXBElement < PersonType > createSourceTypeAuthor ( PersonType value ) { } }
return new JAXBElement < PersonType > ( ENTRY_TYPE_AUTHOR_QNAME , PersonType . class , SourceType . class , value ) ;
public class ByteBufJsonParser { /** * Reads the next character into { @ link # currentChar } . * @ param level the current level of nesting . * @ throws EOFException if more input is needed . */ private void readNextChar ( final JsonLevel level ) throws EOFException { } }
int readerIndex = content . readerIndex ( ) ; int lastWsIndex = content . forEachByte ( wsProcessor ) ; if ( lastWsIndex == - 1 && level != null ) { throw NEED_MORE_DATA ; } if ( lastWsIndex > readerIndex ) { this . content . skipBytes ( lastWsIndex - readerIndex ) ; this . content . discardReadBytes ( ) ; } this . currentChar = this . content . readByte ( ) ;
public class JsDocInfoParser { /** * Trim characters from only the end of a string . * This method will remove all whitespace characters * ( defined by TokenUtil . isWhitespace ( char ) , in addition to the characters * provided , from the end of the provided string . * @ param s String to be trimmed * @ return String with whitespace and characters in extraChars removed * from the end . */ private static String trimEnd ( String s ) { } }
int trimCount = 0 ; while ( trimCount < s . length ( ) ) { char ch = s . charAt ( s . length ( ) - trimCount - 1 ) ; if ( TokenUtil . isWhitespace ( ch ) ) { trimCount ++ ; } else { break ; } } if ( trimCount == 0 ) { return s ; } return s . substring ( 0 , s . length ( ) - trimCount ) ;
public class CoreServiceImpl { /** * DS - driven component activation */ @ Activate protected void activate ( ComponentContext cContext , Map < String , Object > properties ) throws Exception { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "File monitor service activated" , properties ) ; } this . cContext = cContext ; modified ( properties ) ; // Make sure all file monitors have been initialized . for ( Map . Entry < ServiceReference < FileMonitor > , MonitorHolder > entry : fileMonitors . entrySet ( ) ) { entry . getValue ( ) . init ( ) ; }
public class SmileUtils { /** * Learns Gaussian RBF function and centers from data . The centers are * chosen as the medoids of CLARANS . The standard deviation ( i . e . width ) * of Gaussian radial basis function is estimated as the width of each * cluster multiplied with a given scaling parameter r . * @ param x the training dataset . * @ param centers an array to store centers on output . Its length is used as k of CLARANS . * @ param distance the distance functor . * @ param r the scaling parameter . * @ return Gaussian RBF functions with parameter learned from data . */ public static < T > GaussianRadialBasis [ ] learnGaussianRadialBasis ( T [ ] x , T [ ] centers , Metric < T > distance , double r ) { } }
if ( r <= 0.0 ) { throw new IllegalArgumentException ( "Invalid scaling parameter: " + r ) ; } int k = centers . length ; CLARANS < T > clarans = new CLARANS < > ( x , distance , k , Math . min ( 100 , ( int ) Math . round ( 0.01 * k * ( x . length - k ) ) ) ) ; System . arraycopy ( clarans . medoids ( ) , 0 , centers , 0 , k ) ; int n = x . length ; int [ ] y = clarans . getClusterLabel ( ) ; double [ ] sigma = new double [ k ] ; for ( int i = 0 ; i < n ; i ++ ) { sigma [ y [ i ] ] += Math . sqr ( distance . d ( x [ i ] , centers [ y [ i ] ] ) ) ; } int [ ] ni = clarans . getClusterSize ( ) ; GaussianRadialBasis [ ] rbf = new GaussianRadialBasis [ k ] ; for ( int i = 0 ; i < k ; i ++ ) { if ( ni [ i ] >= 5 || sigma [ i ] == 0.0 ) { sigma [ i ] = Math . sqrt ( sigma [ i ] / ni [ i ] ) ; } else { sigma [ i ] = Double . POSITIVE_INFINITY ; for ( int j = 0 ; j < k ; j ++ ) { if ( i != j ) { double d = distance . d ( centers [ i ] , centers [ j ] ) ; if ( d < sigma [ i ] ) { sigma [ i ] = d ; } } } sigma [ i ] /= 2.0 ; } rbf [ i ] = new GaussianRadialBasis ( r * sigma [ i ] ) ; } return rbf ;
public class JAnnotationWrapper { /** * Returns the annotation values . */ public HashMap < String , Object > getValueMap ( ) { } }
try { if ( _values == null ) { _values = new HashMap < String , Object > ( ) ; Method [ ] methods = _ann . annotationType ( ) . getMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { Method method = methods [ i ] ; if ( method . getDeclaringClass ( ) . equals ( Class . class ) ) continue ; if ( method . getDeclaringClass ( ) . equals ( Object . class ) ) continue ; if ( method . getParameterTypes ( ) . length != 0 ) continue ; _values . put ( method . getName ( ) , method . invoke ( _ann ) ) ; } } return _values ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class MethodWriter { /** * Updates the offset of the given label . * @ param indexes current positions of the instructions to be resized . Each * instruction must be designated by the index of its < i > last < / i > * byte , plus one ( or , in other words , by the index of the < i > first < / i > * byte of the < i > next < / i > instruction ) . * @ param sizes the number of bytes to be < i > added < / i > to the above * instructions . More precisely , for each i < < tt > len < / tt > , * < tt > sizes < / tt > [ i ] bytes will be added at the end of the * instruction designated by < tt > indexes < / tt > [ i ] or , if * < tt > sizes < / tt > [ i ] is negative , the < i > last < / i > | < tt > sizes [ i ] < / tt > | * bytes of the instruction will be removed ( the instruction size * < i > must not < / i > become negative or null ) . * @ param label the label whose offset must be updated . */ static void getNewOffset ( final int [ ] indexes , final int [ ] sizes , final Label label ) { } }
if ( ( label . status & Label . RESIZED ) == 0 ) { label . position = getNewOffset ( indexes , sizes , 0 , label . position ) ; label . status |= Label . RESIZED ; }
public class EmvTemplate { /** * Read EMV card with Payment System Environment or Proximity Payment System * Environment * @ return true is succeed false otherwise * @ throws CommunicationException communication error */ protected boolean readWithPSE ( ) throws CommunicationException { } }
boolean ret = false ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Try to read card with Payment System Environment" ) ; } // Select the payment environment PPSE or PSE directory byte [ ] data = selectPaymentEnvironment ( ) ; if ( ResponseUtils . isSucceed ( data ) ) { // Parse FCI Template card . getApplications ( ) . addAll ( parseFCIProprietaryTemplate ( data ) ) ; Collections . sort ( card . getApplications ( ) ) ; // For each application for ( Application app : card . getApplications ( ) ) { boolean status = false ; String applicationAid = BytesUtils . bytesToStringNoSpace ( app . getAid ( ) ) ; for ( IParser impl : parsers ) { if ( impl . getId ( ) != null && impl . getId ( ) . matcher ( applicationAid ) . matches ( ) ) { status = impl . parse ( app ) ; break ; } } if ( ! ret && status ) { ret = status ; if ( ! config . readAllAids ) { break ; } } } if ( ! ret ) { card . setState ( CardStateEnum . LOCKED ) ; } } else if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( ( config . contactLess ? "PPSE" : "PSE" ) + " not found -> Use kown AID" ) ; } return ret ;
public class cacheselector { /** * Use this API to delete cacheselector resources of given names . */ public static base_responses delete ( nitro_service client , String selectorname [ ] ) throws Exception { } }
base_responses result = null ; if ( selectorname != null && selectorname . length > 0 ) { cacheselector deleteresources [ ] = new cacheselector [ selectorname . length ] ; for ( int i = 0 ; i < selectorname . length ; i ++ ) { deleteresources [ i ] = new cacheselector ( ) ; deleteresources [ i ] . selectorname = selectorname [ i ] ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ;
public class NakadiClient { /** * Create a subscription for a single event type . * @ deprecated Use the { @ link SubscriptionBuilder } and { @ link NakadiClient # subscription ( String , String ) } instead . */ @ Deprecated public Subscription subscribe ( String applicationName , String eventName , String consumerGroup ) throws IOException { } }
return subscription ( applicationName , eventName ) . withConsumerGroup ( consumerGroup ) . subscribe ( ) ;
public class CollectionUtilsImpl { /** * { @ inheritDoc } */ public < T > void forAllDo ( final Collection < ? extends T > collection , final Closure < T > closure ) { } }
for ( final T current : collection ) { closure . execute ( current ) ; }
public class DefaultGroovyMethods { /** * Zips an Iterable with indices in ( index , value ) order . * Example usage : * < pre class = " groovyTestCase " > * assert [ 5 : " a " , 6 : " b " ] = = [ " a " , " b " ] . indexed ( 5) * assert [ " 1 : a " , " 2 : b " ] = = [ " a " , " b " ] . indexed ( 1 ) . collect { idx , str { @ code - > } " $ idx : $ str " } * < / pre > * @ param self an Iterable * @ param offset an index to start from * @ return a Map ( since the keys / indices are unique ) containing the elements from the iterable zipped with indices * @ see # withIndex ( Iterable , int ) * @ since 2.4.0 */ public static < E > Map < Integer , E > indexed ( Iterable < E > self , int offset ) { } }
Map < Integer , E > result = new LinkedHashMap < Integer , E > ( ) ; Iterator < Tuple2 < Integer , E > > indexed = indexed ( self . iterator ( ) , offset ) ; while ( indexed . hasNext ( ) ) { Tuple2 < Integer , E > next = indexed . next ( ) ; result . put ( next . getFirst ( ) , next . getSecond ( ) ) ; } return result ;
public class CommerceShipmentLocalServiceBaseImpl { /** * Returns a range of all the commerce shipments . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . model . impl . CommerceShipmentModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param start the lower bound of the range of commerce shipments * @ param end the upper bound of the range of commerce shipments ( not inclusive ) * @ return the range of commerce shipments */ @ Override public List < CommerceShipment > getCommerceShipments ( int start , int end ) { } }
return commerceShipmentPersistence . findAll ( start , end ) ;
public class StreamingLocatorsInner { /** * List Content Keys . * List Content Keys used by this Streaming Locator . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ param streamingLocatorName The Streaming Locator name . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < ListContentKeysResponseInner > listContentKeysAsync ( String resourceGroupName , String accountName , String streamingLocatorName , final ServiceCallback < ListContentKeysResponseInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listContentKeysWithServiceResponseAsync ( resourceGroupName , accountName , streamingLocatorName ) , serviceCallback ) ;
public class Ordering { /** * Creates a new ordering the represents an ordering on a prefix of the fields . If the * exclusive index up to which to create the ordering is < code > 0 < / code > , then there is * no resulting ordering and this method return < code > null < / code > . * @ param exclusiveIndex The index ( exclusive ) up to which to create the ordering . * @ return The new ordering on the prefix of the fields , or < code > null < / code > , if the prefix is empty . */ public Ordering createNewOrderingUpToIndex ( int exclusiveIndex ) { } }
if ( exclusiveIndex == 0 ) { return null ; } final Ordering newOrdering = new Ordering ( ) ; for ( int i = 0 ; i < exclusiveIndex ; i ++ ) { newOrdering . appendOrdering ( this . indexes . get ( i ) , this . types . get ( i ) , this . orders . get ( i ) ) ; } return newOrdering ;
public class TemplateParser { /** * Validate that a { @ link Prop } bounded with string binding is of type String * @ param localComponentProp The prop to check */ private void validateStringPropBinding ( LocalComponentProp localComponentProp ) { } }
if ( localComponentProp . getType ( ) . toString ( ) . equals ( String . class . getCanonicalName ( ) ) ) { return ; } logger . error ( "Passing a String to a non String Prop: \"" + localComponentProp . getPropName ( ) + "\". " + "If you want to pass a boolean or an int you should use v-bind. " + "For example: v-bind:my-prop=\"12\" (or using the short syntax, :my-prop=\"12\") instead of my-prop=\"12\"." ) ;
public class UidManager { /** * Gets a given row in HBase and prints it on standard output . * @ param client The HBase client to use . * @ param table The name of the HBase table to use . * @ param key The row key to attempt to get from HBase . * @ param family The family in which we ' re interested . * @ return 0 if at least one cell was found and printed , 1 otherwise . */ private static int findAndPrintRow ( final HBaseClient client , final byte [ ] table , final byte [ ] key , final byte [ ] family , boolean formard ) { } }
final GetRequest get = new GetRequest ( table , key ) ; get . family ( family ) ; ArrayList < KeyValue > row ; try { row = client . get ( get ) . joinUninterruptibly ( ) ; } catch ( HBaseException e ) { LOG . error ( "Get failed: " + get , e ) ; return 1 ; } catch ( Exception e ) { LOG . error ( "WTF? Unexpected exception type, get=" + get , e ) ; return 42 ; } return printResult ( row , family , formard ) ? 0 : 1 ;
public class TypeUtility { /** * Type name . * @ param element * the element * @ param suffix * the suffix * @ return the type name */ public static TypeName typeName ( TypeElement element , String suffix ) { } }
String fullName = element . getQualifiedName ( ) . toString ( ) + suffix ; int lastIndex = fullName . lastIndexOf ( "." ) ; String packageName = fullName . substring ( 0 , lastIndex ) ; String className = fullName . substring ( lastIndex + 1 ) ; return typeName ( packageName , className ) ;
public class PriorityQueue { /** * Insert data with the given priority into the heap and heapify . * @ param priority the priority to associate with the new data . * @ param value the date to enqueue . */ public final void put ( long priority , Object value ) { } }
// if ( tc . isEntryEnabled ( ) ) // SibTr . entry ( tc , " put " , new Object [ ] { new Long ( priority ) , value } ) ; PriorityQueueNode node = new PriorityQueueNode ( priority , value ) ; // Resize the array ( double it ) if we are out of space . if ( size == elements . length ) { PriorityQueueNode [ ] tmp = new PriorityQueueNode [ 2 * size ] ; System . arraycopy ( elements , 0 , tmp , 0 , size ) ; elements = tmp ; } int pos = size ++ ; setElement ( node , pos ) ; moveUp ( pos ) ; // if ( tc . isEntryEnabled ( ) ) // SibTr . exit ( tc , " put " ) ;
public class Storage { /** * Opens a new { @ link Log } , recovering the log from disk if it exists . * When a log is opened , the log will attempt to load { @ link Segment } s from the storage { @ link # directory ( ) } * according to the provided log { @ code name } . If segments for the given log name are present on disk , segments * will be loaded and indexes will be rebuilt from disk . If no segments are found , an empty log will be created . * When log files are loaded from disk , the file names are expected to be based on the provided log { @ code name } . * @ param name The log name . * @ return The opened log . */ public Log openLog ( String name ) { } }
return new Log ( name , this , ThreadContext . currentContextOrThrow ( ) . serializer ( ) . clone ( ) ) ;
public class ImageIngester { /** * Written by Michael Aird . */ @ SuppressWarnings ( "unused" ) private boolean checkSwf ( ) throws IOException { } }
// get rid of the last byte of the signature , the byte of the version and 4 bytes of the size byte [ ] a = new byte [ 6 ] ; if ( read ( a ) != a . length ) { return false ; } format = FORMAT_SWF ; int bitSize = ( int ) readUBits ( 5 ) ; int minX = ( int ) readSBits ( bitSize ) ; // unused , but necessary int maxX = ( int ) readSBits ( bitSize ) ; int minY = ( int ) readSBits ( bitSize ) ; // unused , but necessary int maxY = ( int ) readSBits ( bitSize ) ; width = maxX / 20 ; // cause we ' re in twips height = maxY / 20 ; // cause we ' re in twips setPhysicalWidthDpi ( 72 ) ; setPhysicalHeightDpi ( 72 ) ; return ( width > 0 && height > 0 ) ;
public class LoadBalancerDescription { /** * The IDs of the subnets for the load balancer . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setSubnets ( java . util . Collection ) } or { @ link # withSubnets ( java . util . Collection ) } if you want to override * the existing values . * @ param subnets * The IDs of the subnets for the load balancer . * @ return Returns a reference to this object so that method calls can be chained together . */ public LoadBalancerDescription withSubnets ( String ... subnets ) { } }
if ( this . subnets == null ) { setSubnets ( new com . amazonaws . internal . SdkInternalList < String > ( subnets . length ) ) ; } for ( String ele : subnets ) { this . subnets . add ( ele ) ; } return this ;
public class EurekaClinicalClient { /** * Gets a resource from a proxied server . * @ param path the path to the resource . Cannot be < code > null < / code > . * @ param parameterMap query parameters . May be < code > null < / code > . * @ param headers any request headers to add . * @ return ClientResponse the proxied server ' s response information . * @ throws ClientException if the proxied server responds with an " error " * status code , which is dependent on the server being called . * @ see # getResourceUrl ( ) for the URL of the proxied server . */ protected ClientResponse doGetForProxy ( String path , MultivaluedMap < String , String > parameterMap , MultivaluedMap < String , String > headers ) throws ClientException { } }
this . readLock . lock ( ) ; try { WebResource . Builder requestBuilder = getResourceWrapper ( ) . rewritten ( path , HttpMethod . GET , parameterMap ) . getRequestBuilder ( ) ; copyHeaders ( headers , requestBuilder ) ; return requestBuilder . get ( ClientResponse . class ) ; } catch ( ClientHandlerException ex ) { throw new ClientException ( ClientResponse . Status . INTERNAL_SERVER_ERROR , ex . getMessage ( ) ) ; } finally { this . readLock . unlock ( ) ; }
public class Number { /** * Evaluate this operation directly to a double . * @ param xctxt The runtime execution context . * @ return The result of the operation as a double . * @ throws javax . xml . transform . TransformerException */ public double num ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { } }
return m_right . num ( xctxt ) ;
public class Flowable { /** * Instructs a Publisher to emit an item ( returned by a specified function ) rather than invoking * { @ link Subscriber # onError onError } if it encounters an error . * < img width = " 640 " height = " 310 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onErrorReturn . png " alt = " " > * By default , when a Publisher encounters an error that prevents it from emitting the expected item to * its { @ link Subscriber } , the Publisher invokes its Subscriber ' s { @ code onError } method , and then quits * without invoking any more of its Subscriber ' s methods . The { @ code onErrorReturn } method changes this * behavior . If you pass a function ( { @ code resumeFunction } ) to a Publisher ' s { @ code onErrorReturn } * method , if the original Publisher encounters an error , instead of invoking its Subscriber ' s * { @ code onError } method , it will instead emit the return value of { @ code resumeFunction } . * You can use this to prevent errors from propagating or to supply fallback data should errors be * encountered . * < dl > * < dt > < b > Backpressure : < / b > < / dt > * < dd > The operator honors backpressure from downstream . The source { @ code Publisher } s is expected to honor * backpressure as well . If it this expectation is violated , the operator < em > may < / em > throw * { @ code IllegalStateException } when the source { @ code Publisher } completes or * { @ code MissingBackpressureException } is signaled somewhere downstream . < / dd > * < dt > < b > Scheduler : < / b > < / dt > * < dd > { @ code onErrorReturn } does not operate by default on a particular { @ link Scheduler } . < / dd > * < / dl > * @ param valueSupplier * a function that returns a single value that will be emitted along with a regular onComplete in case * the current Flowable signals an onError event * @ return the original Publisher with appropriately modified behavior * @ see < a href = " http : / / reactivex . io / documentation / operators / catch . html " > ReactiveX operators documentation : Catch < / a > */ @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > onErrorReturn ( Function < ? super Throwable , ? extends T > valueSupplier ) { } }
ObjectHelper . requireNonNull ( valueSupplier , "valueSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableOnErrorReturn < T > ( this , valueSupplier ) ) ;
public class EventBus { /** * Bind an { @ link OnceEventListenerBase once event listener } to an { @ link EventObject event object type } * @ param eventType * the event object type * @ param listener * the listener * @ return * this event bus instance */ public synchronized EventBus once ( Class < ? extends EventObject > eventType , OnceEventListenerBase listener ) { } }
if ( null != onceBus ) { onceBus . bind ( eventType , listener ) ; } else { bind ( eventType , listener ) ; } return this ;
public class GVRAssetLoader { /** * Loads a scene object { @ link GVRSceneObject } asynchronously from * a 3D model and raises asset events to a handler . * This function is a good choice for loading assets because * it does not block the thread from which it is initiated . * Instead , it runs the load request on a background thread * and issues events to the handler provided . * @ param fileVolume * GVRResourceVolume with the path to the model to load . * The filename is relative to the root of this volume . * The volume will be used to load models referenced by this model . * @ param model * { @ link GVRSceneObject } that is the root of the hierarchy generated * by loading the 3D model . * @ param settings * Additional import { @ link GVRImportSettings settings } * @ param cacheEnabled * If true , add the model ' s textures to the texture cache * @ param handler * IAssetEvents handler to process asset loading events * @ see IAssetEvents # loadMesh ( GVRAndroidResource . MeshCallback , GVRAndroidResource , int ) */ public void loadModel ( final GVRResourceVolume fileVolume , final GVRSceneObject model , final EnumSet < GVRImportSettings > settings , final boolean cacheEnabled , final IAssetEvents handler ) { } }
Threads . spawn ( new Runnable ( ) { public void run ( ) { String filePath = fileVolume . getFileName ( ) ; String ext = filePath . substring ( filePath . length ( ) - 3 ) . toLowerCase ( ) ; AssetRequest assetRequest = new AssetRequest ( model , fileVolume , null , handler , false ) ; model . setName ( assetRequest . getBaseName ( ) ) ; assetRequest . setImportSettings ( settings ) ; assetRequest . useCache ( cacheEnabled ) ; try { if ( ext . equals ( "x3d" ) ) { loadX3DModel ( assetRequest , model ) ; } else { loadJassimpModel ( assetRequest , model ) ; } } catch ( IOException ex ) { // onModelError is generated in this case } } } ) ;
public class NtResourceNodeRepresentation { /** * ( non - Javadoc ) * @ see * org . exoplatform . services . jcr . ext . resource . NodeRepresentation # getProperties ( java . lang . String ) */ public Collection < HierarchicalProperty > getProperties ( String name ) throws RepositoryException { } }
ArrayList < HierarchicalProperty > props = new ArrayList < HierarchicalProperty > ( ) ; for ( HierarchicalProperty p : properties ) { if ( p . getStringName ( ) . equals ( name ) ) props . add ( p ) ; } return props ; // HierarchicalProperty prop = getProperty ( name ) ; // if ( prop ! = null ) // props . add ( prop ) ; // return props ;
public class PngOptimizer { /** * Get the css containing data uris of the images processed by the optimizer */ public void generateDataUriCss ( String dir ) throws IOException { } }
final String path = ( dir == null ) ? "" : dir + "/" ; final PrintWriter out = new PrintWriter ( path + "DataUriCss.html" ) ; try { out . append ( "<html>\n<head>\n\t<style>" ) ; for ( OptimizerResult result : results ) { final String name = result . fileName . replaceAll ( "[^A-Za-z0-9]" , "_" ) ; out . append ( '#' ) . append ( name ) . append ( " {\n" ) . append ( "\tbackground: url(\"data:image/png;base64," ) . append ( result . dataUri ) . append ( "\") no-repeat left top;\n" ) . append ( "\twidth: " ) . append ( String . valueOf ( result . width ) ) . append ( "px;\n" ) . append ( "\theight: " ) . append ( String . valueOf ( result . height ) ) . append ( "px;\n" ) . append ( "}\n" ) ; } out . append ( "\t</style>\n</head>\n<body>\n" ) ; for ( OptimizerResult result : results ) { final String name = result . fileName . replaceAll ( "[^A-Za-z0-9]" , "_" ) ; out . append ( "\t<div id=\"" ) . append ( name ) . append ( "\"></div>\n" ) ; } out . append ( "</body>\n</html>" ) ; } finally { if ( out != null ) { out . close ( ) ; } }
public class SocketWrapperBar { /** * Returns the client certificate . */ private X509Certificate [ ] getClientCertificatesImpl ( ) throws CertificateException { } }
if ( ! ( _s instanceof SSLSocket ) ) return null ; SSLSocket sslSocket = ( SSLSocket ) _s ; SSLSession sslSession = sslSocket . getSession ( ) ; if ( sslSession == null ) return null ; try { return ( X509Certificate [ ] ) sslSession . getPeerCertificates ( ) ; } catch ( SSLPeerUnverifiedException e ) { if ( log . isLoggable ( Level . FINEST ) ) log . log ( Level . FINEST , e . toString ( ) , e ) ; return null ; } catch ( Throwable e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } return null ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcFastenerType ( ) { } }
if ( ifcFastenerTypeEClass == null ) { ifcFastenerTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 230 ) ; } return ifcFastenerTypeEClass ;
public class DataEncryption { /** * Decrypts the specified bytes using AES - 256 . This method uses the default secret key . * @ param encryptedIvTextBytes the text to decrypt * @ return the decrypted bytes * @ throws Exception a number of exceptions may be thrown * @ since 1.3.0 */ public static byte [ ] decryptAsBytes ( final byte [ ] encryptedIvTextBytes ) throws Exception { } }
final SecretKey secretKey = KeyManager . getInstance ( ) . getSecretKey ( ) ; return decryptAsBytes ( secretKey , encryptedIvTextBytes ) ;
public class XVariableDeclarationImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case XbasePackage . XVARIABLE_DECLARATION__TYPE : setType ( ( JvmTypeReference ) null ) ; return ; case XbasePackage . XVARIABLE_DECLARATION__NAME : setName ( NAME_EDEFAULT ) ; return ; case XbasePackage . XVARIABLE_DECLARATION__RIGHT : setRight ( ( XExpression ) null ) ; return ; case XbasePackage . XVARIABLE_DECLARATION__WRITEABLE : setWriteable ( WRITEABLE_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ;
public class ProjectDef { /** * Executes the task . Compiles the given files . * @ param task * cc task * @ param sources * source files ( includes headers ) * @ param targets * compilation targets * @ param linkTarget * link target */ public void execute ( final CCTask task , final List < File > sources , final Map < String , TargetInfo > targets , final TargetInfo linkTarget ) { } }
try { this . projectWriter . writeProject ( this . outFile , task , this , sources , targets , linkTarget ) ; } catch ( final BuildException ex ) { if ( this . failOnError ) { throw ex ; } else { task . log ( ex . toString ( ) ) ; } } catch ( final Exception ex ) { if ( this . failOnError ) { throw new BuildException ( ex ) ; } else { task . log ( ex . toString ( ) ) ; } }
public class DefaultExtensionInitializer { /** * Initialize an extension in the given namespace . * @ param installedExtension the extension to initialize * @ param namespace the namespace in which the extention is initialized , null for global * @ param initializedExtensions the currently initialized extensions set ( to avoid initializing twice a dependency ) * @ throws ExtensionException when an initialization error occurs */ private void initializeExtensionInNamespace ( InstalledExtension installedExtension , String namespace , Map < String , Set < InstalledExtension > > initializedExtensions ) throws ExtensionException { } }
// Check if the extension can be available from this namespace if ( ! installedExtension . isValid ( namespace ) ) { return ; } Set < InstalledExtension > initializedExtensionsInNamespace = initializedExtensions . get ( namespace ) ; if ( initializedExtensionsInNamespace == null ) { initializedExtensionsInNamespace = new HashSet < > ( ) ; initializedExtensions . put ( namespace , initializedExtensionsInNamespace ) ; } if ( ! initializedExtensionsInNamespace . contains ( installedExtension ) ) { initializeExtensionInNamespace ( installedExtension , namespace , initializedExtensions , initializedExtensionsInNamespace ) ; }
public class ScopeHelper { /** * Print a list of available scopes to the console . * @ param scopes * The available scopes . */ public void printScopes ( Map < String , Scope > scopes ) { } }
logger . info ( "Scopes [" + scopes . size ( ) + "]" ) ; for ( String scopeName : scopes . keySet ( ) ) { logger . info ( "\t" + scopeName ) ; }
public class XCodePrepareBuildManager { /** * Creates a directory . If the directory already exists the directory is deleted beforehand . * @ param directory * @ throws MojoExecutionException */ private static void createDirectory ( final File directory ) throws MojoExecutionException { } }
try { com . sap . prd . mobile . ios . mios . FileUtils . deleteDirectory ( directory ) ; } catch ( IOException ex ) { throw new MojoExecutionException ( "" , ex ) ; } if ( ! directory . mkdirs ( ) ) throw new MojoExecutionException ( "Cannot create directory (" + directory + ")" ) ;
public class SqlLine { /** * Try to obtain the current size of the specified { @ link ResultSet } by * jumping to the last row and getting the row number . * @ param rs the { @ link ResultSet } to get the size for * @ return the size , or - 1 if it could not be obtained */ int getSize ( ResultSet rs ) { } }
try { if ( rs . getType ( ) == ResultSet . TYPE_FORWARD_ONLY ) { return - 1 ; } rs . last ( ) ; int total = rs . getRow ( ) ; rs . beforeFirst ( ) ; return total ; } catch ( SQLException | AbstractMethodError sqle ) { return - 1 ; }
public class ClientSessionListener { /** * Actually closes the client , if it is a { @ link EurekaClinicalClient } . * @ param possibleClient the client . If it is not a * { @ link EurekaClinicalClient } , it is ignored . */ private void closeClient ( Object possibleClient ) { } }
if ( possibleClient instanceof EurekaClinicalClient ) { LOGGER . info ( "closing EurekaClinicalClient {}" , possibleClient . getClass ( ) . getName ( ) ) ; ( ( EurekaClinicalClient ) possibleClient ) . close ( ) ; }
public class ParameterServerClient { /** * Get an ndarray from the * designated ndarray retrieve url . * This will " pull " the current ndarray * from the master * @ return the current ndarray from the master . */ public INDArray getArray ( ) { } }
// start a subscriber that can send us ndarrays if ( subscriber == null ) { running = new AtomicBoolean ( true ) ; subscriber = AeronNDArraySubscriber . startSubscriber ( aeron , subscriberHost , subscriberPort , this , subscriberStream , running ) ; log . debug ( "Started parameter server client on " + subscriber . connectionUrl ( ) ) ; } if ( arr == null ) arr = new AtomicReference < > ( none ) ; log . debug ( "Parameter server client retrieving url from " + ndarrayRetrieveUrl ) ; // note here that this is the " master url " String [ ] split = ndarrayRetrieveUrl . split ( ":" ) ; // The response daemon is always the master daemon ' s port + 1 // A " master daemon " is one that holds both the // parameter averaging daemon AND the response daemon for being able to send // the " current state ndarray " int port = Integer . parseInt ( split [ 1 ] ) ; int streamToPublish = Integer . parseInt ( split [ 2 ] ) ; // the channel here is the master node host with the port + 1 // pointing at the response node where we can request ndarrays to be sent to // the listening daemon String channel = AeronUtil . aeronChannel ( split [ 0 ] , port ) ; // publish the address of our subscriber // note here that we send the ndarray send url , because the // master also hosts try ( HostPortPublisher hostPortPublisher = HostPortPublisher . builder ( ) . channel ( channel ) . aeron ( aeron ) // note here that we send our subscriber ' s listening information . streamId ( streamToPublish ) . uriToSend ( AeronConnectionInformation . of ( subscriberHost , subscriberPort , subscriberStream ) . toString ( ) ) . build ( ) ) { hostPortPublisher . send ( ) ; log . debug ( "Sent subscriber information " + AeronConnectionInformation . of ( subscriberHost , subscriberPort , subscriberStream ) . toString ( ) ) ; // wait for array to be available while ( arr . get ( ) == none ) { Thread . sleep ( 1000 ) ; log . info ( "Waiting on array to be updated." ) ; } } catch ( Exception e ) { log . error ( "Error with publishing" , e ) ; } INDArray arr2 = arr . get ( ) ; arr . set ( none ) ; return arr2 ;
public class StaticTypeCheckingVisitor { /** * Stores information about types when [ objectOfInstanceof instanceof typeExpression ] is visited * @ param objectOfInstanceOf the expression which must be checked against instanceof * @ param typeExpression the expression which represents the target type */ protected void pushInstanceOfTypeInfo ( final Expression objectOfInstanceOf , final Expression typeExpression ) { } }
final Map < Object , List < ClassNode > > tempo = typeCheckingContext . temporaryIfBranchTypeInformation . peek ( ) ; Object key = extractTemporaryTypeInfoKey ( objectOfInstanceOf ) ; List < ClassNode > potentialTypes = tempo . get ( key ) ; if ( potentialTypes == null ) { potentialTypes = new LinkedList < ClassNode > ( ) ; tempo . put ( key , potentialTypes ) ; } potentialTypes . add ( typeExpression . getType ( ) ) ;
public class JvmShortAnnotationValueImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case TypesPackage . JVM_SHORT_ANNOTATION_VALUE__VALUES : getValues ( ) . clear ( ) ; getValues ( ) . addAll ( ( Collection < ? extends Short > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class Page { /** * Set a composite as a named section and add it to the . * contents of the page */ public void addSection ( String section , Composite composite ) { } }
sections . put ( section , composite ) ; add ( composite ) ;
public class ArrayUtils { /** * Checks if all given arrays contain the same values . < br > * Note : Only use this method when the given arrays are sorted and contain * only distinct values . * @ param arrs * @ return */ public static boolean containSameElementsSorted ( short [ ] ... arrs ) { } }
Validate . notNull ( arrs ) ; if ( arrs . length == 1 ) return true ; int firstSize = arrs [ 0 ] . length ; for ( int i = 1 ; i < arrs . length ; i ++ ) { if ( arrs [ i ] . length != firstSize ) { return false ; } } for ( int j = 0 ; j < firstSize ; j ++ ) { short firstValue = arrs [ 0 ] [ j ] ; for ( int k = 1 ; k < arrs . length ; k ++ ) { if ( arrs [ k ] [ j ] != firstValue ) return false ; } } return true ;
public class Resources { /** * Retrieve a byte from bundle . * @ param key the key of resource * @ return the resource byte * @ throws MissingResourceException if the requested key is unknown */ public byte getByte ( String key ) throws MissingResourceException { } }
ResourceBundle bundle = getBundle ( ) ; String value = bundle . getString ( key ) ; try { return Byte . parseByte ( value ) ; } catch ( NumberFormatException nfe ) { throw new MissingResourceException ( "Expecting a byte value but got " + value , "java.lang.String" , key ) ; }
public class NodeSequence { /** * Create a sequence of nodes that iterates over the supplied node keys . Note that the supplied iterator is accessed lazily as * the resulting sequence ' s { @ link # nextBatch ( ) first batch } is { @ link Batch # nextRow ( ) used } . * @ param keys the iterator over the keys of the node keys to be returned ; if null , an { @ link # emptySequence empty instance } * is returned * @ param keyCount the number of node keys in the iterator ; must be - 1 if not known , 0 if known to be empty , or a positive * number if the number of node keys is known * @ param score the score to return for all of the nodes * @ param workspaceName the name of the workspace in which all of the nodes exist * @ param cache the node cache used to access the cached nodes ; may be null only if the key sequence is null or empty * @ return the sequence of nodes ; never null */ public static NodeSequence withNodeKeys ( final Iterator < NodeKey > keys , final long keyCount , final float score , final String workspaceName , final NodeCache cache ) { } }
assert keyCount >= - 1 ; if ( keys == null ) return emptySequence ( 1 ) ; return withBatch ( batchOfKeys ( keys , keyCount , score , workspaceName , cache ) ) ;
public class MDBRuntimeImpl { /** * Internal method for checking all known lookups and activating / deactivating * endpoints as needed in response to the results . * @ param activating true if new services have just come up , false if they are going down */ private void updateSchemeJndiNames ( boolean activating ) { } }
for ( Map . Entry < J2EEName , SchemeJndiNameInfo > entry : schemeJndiNames . entrySet ( ) ) { SchemeJndiNameInfo info = entry . getValue ( ) ; info . updateLookupResult ( ) ; if ( activating && info . lookupSucceeded ( ) ) { activateDeferredEndpoints ( info . endpointFactories ) ; } else if ( ! activating && ! info . lookupSucceeded ( ) ) { deactivateEndpoints ( info . endpointFactories ) ; } }
public class Sort { /** * method to sort an subarray from start to end with insertion sort algorithm * @ param arr an array of Comparable items * @ param start the begining position * @ param end the end position */ public static < T extends Comparable < ? super T > > void insertionSort ( T [ ] arr , int start , int end ) { } }
int i ; for ( int j = start + 1 ; j <= end ; j ++ ) { T tmp = arr [ j ] ; for ( i = j ; i > start && tmp . compareTo ( arr [ i - 1 ] ) < 0 ; i -- ) { arr [ i ] = arr [ i - 1 ] ; } if ( i < j ) arr [ i ] = tmp ; }
public class LssClient { /** * Get detail of stream in the live stream service . * @ param request The request object containing all options for querying detail of stream * @ return the response */ public GetStreamResponse getStream ( GetStreamRequest request ) { } }
checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getPlayDomain ( ) , "playDomain should NOT be empty." ) ; checkStringNotEmpty ( request . getApp ( ) , "App should NOT be empty." ) ; checkStringNotEmpty ( request . getStream ( ) , "Stream should NOT be empty." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , LIVE_DOMAIN , request . getPlayDomain ( ) , LIVE_APP , request . getApp ( ) , LIVE_STREAM , request . getStream ( ) ) ; return invokeHttpClient ( internalRequest , GetStreamResponse . class ) ;
public class DoubleArrayFunctionsND { /** * Validate the given result array against the given input array . * If the result array is not < code > null < / code > , it must have * the same size as the input array . If it is < code > null < / code > , * then a new array with the same size as the input array will * be created and returned . * @ param a The input array * @ param result The result array * @ return The result array * @ throws IllegalArgumentException If the given result array is * not < code > null < / code > and has a size that is different from * that of the input array . */ private static MutableDoubleArrayND validate ( DoubleArrayND a , MutableDoubleArrayND result ) { } }
if ( result == null ) { result = DoubleArraysND . create ( a . getSize ( ) ) ; } else { Utils . checkForEqualSizes ( a , result ) ; } return result ;
public class BackendServiceClient { /** * Retrieves the list of all BackendService resources , regional and global , available to the * specified project . * < p > Sample code : * < pre > < code > * try ( BackendServiceClient backendServiceClient = BackendServiceClient . create ( ) ) { * ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ; * for ( BackendServicesScopedList element : backendServiceClient . aggregatedListBackendServices ( project ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param project Name of the project scoping this request . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final AggregatedListBackendServicesPagedResponse aggregatedListBackendServices ( ProjectName project ) { } }
AggregatedListBackendServicesHttpRequest request = AggregatedListBackendServicesHttpRequest . newBuilder ( ) . setProject ( project == null ? null : project . toString ( ) ) . build ( ) ; return aggregatedListBackendServices ( request ) ;
public class ExecutorFilter { /** * { @ inheritDoc } */ @ Override public final void filterClose ( NextFilter nextFilter , IoSession session ) throws Exception { } }
if ( eventTypes . contains ( IoEventType . CLOSE ) ) { IoFilterEvent event = new IoFilterEvent ( nextFilter , IoEventType . CLOSE , session , null ) ; fireEvent ( event ) ; } else { nextFilter . filterClose ( session ) ; }
public class CmsJspContentAccessValueWrapper { /** * Returns a lazy initialized Map that provides the RDFA for nested sub values . < p > * The provided Map key is assumed to be a String that represents the relative xpath to the value . < p > * @ return a lazy initialized Map that provides the RDFA for nested sub values */ public Map < String , String > getRdfa ( ) { } }
if ( m_rdfa == null ) { m_rdfa = CmsCollectionsGenericWrapper . createLazyMap ( new CmsRdfaTransformer ( ) ) ; } return m_rdfa ;
public class DatastoreDescriptors { /** * Returns the descriptors of datastore types available in DataCleaner . */ public List < DatastoreDescriptor > getAvailableDatastoreDescriptors ( ) { } }
final List < DatastoreDescriptor > availableDatabaseDescriptors = new ArrayList < > ( ) ; final List < DatastoreDescriptor > manualDatastoreDescriptors = getManualDatastoreDescriptors ( ) ; availableDatabaseDescriptors . addAll ( manualDatastoreDescriptors ) ; final List < DatastoreDescriptor > driverBasedDatastoreDescriptors = getDriverBasedDatastoreDescriptors ( ) ; availableDatabaseDescriptors . addAll ( driverBasedDatastoreDescriptors ) ; final Set < String > alreadyAddedDatabaseNames = new HashSet < > ( ) ; for ( final DatastoreDescriptor datastoreDescriptor : driverBasedDatastoreDescriptors ) { alreadyAddedDatabaseNames . add ( datastoreDescriptor . getName ( ) ) ; } final List < DatastoreDescriptor > otherDatastoreDescriptors = getOtherDatastoreDescriptors ( alreadyAddedDatabaseNames ) ; availableDatabaseDescriptors . addAll ( otherDatastoreDescriptors ) ; return availableDatabaseDescriptors ;
public class AbstractGauge { /** * Takes a array of doubles that will be used as custom tickmark labels * e . g . you only want to show " 0 , 10 , 50 , 100 " in your * gauge scale so you could set the custom tickmarklabels * to these values . * @ param CUSTOM _ TICKMARK _ LABELS _ ARRAY */ public void setCustomTickmarkLabels ( final double ... CUSTOM_TICKMARK_LABELS_ARRAY ) { } }
customTickmarkLabels . clear ( ) ; for ( Double label : CUSTOM_TICKMARK_LABELS_ARRAY ) { customTickmarkLabels . add ( label ) ; } reInitialize ( ) ;
public class Mapper { /** * Return the results of mapping all objects with the mapper . * @ param mapper an Mapper * @ param i an Iterator * @ param includeNull specify whether nulls are included * @ return a Collection of the results . */ public static Collection map ( Mapper mapper , Iterator i , boolean includeNull ) { } }
ArrayList l = new ArrayList ( ) ; while ( i . hasNext ( ) ) { Object o = mapper . map ( i . next ( ) ) ; if ( includeNull || o != null ) { l . add ( o ) ; } } return l ;
public class CloudWatchDashboardMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CloudWatchDashboard cloudWatchDashboard , ProtocolMarshaller protocolMarshaller ) { } }
if ( cloudWatchDashboard == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( cloudWatchDashboard . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class NameCache { /** * Promote a frequently used name to the cache */ private void promote ( final K name ) { } }
transientMap . remove ( name ) ; cache . put ( name , name ) ; lookups += useThreshold ;
public class TransactionService { /** * Executes a { @ link Transaction } with { @ link Preauthorization } for the given amount in the given currency . * @ param preauthorizationId * The Id of a { @ link Preauthorization } , which has reserved some money from the client ’ s credit card . * @ param amount * Amount ( in cents ) which will be charged . * @ param currency * ISO 4217 formatted currency code . * @ return { @ link Transaction } object indicating whether a the call was successful or not . */ public Transaction createWithPreauthorization ( String preauthorizationId , Integer amount , String currency ) { } }
return this . createWithPreauthorization ( preauthorizationId , amount , currency , null ) ;
public class Client { /** * Get a batch of Roles . * @ param batchSize Size of the Batch * @ param afterCursor Reference to continue collecting items of next page * @ return OneLoginResponse of Role ( Batch ) * @ throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection * @ throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled * @ throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor * @ see com . onelogin . sdk . model . Role * @ see < a target = " _ blank " href = " https : / / developers . onelogin . com / api - docs / 1 / roles / get - roles " > Get Roles documentation < / a > */ public OneLoginResponse < Role > getRolesBatch ( int batchSize , String afterCursor ) throws OAuthSystemException , OAuthProblemException , URISyntaxException { } }
return getRolesBatch ( new HashMap < String , String > ( ) , batchSize , afterCursor ) ;
public class ExcelModuleDemoToDoItemBulkUpdateLineItem { @ Action ( semantics = SemanticsOf . IDEMPOTENT , invokeOn = InvokeOn . OBJECT_AND_COLLECTION ) public ExcelModuleDemoToDoItem apply ( ) { } }
ExcelModuleDemoToDoItem item = getToDoItem ( ) ; if ( item == null ) { // description must be unique , so check item = toDoItems . findByDescription ( getDescription ( ) ) ; if ( item != null ) { getContainer ( ) . warnUser ( "Item already exists with description '" + getDescription ( ) + "'" ) ; } else { // create new item // ( since this is just a demo , haven ' t bothered to validate new values ) item = toDoItems . newToDo ( getDescription ( ) , getCategory ( ) , getSubcategory ( ) , getDueBy ( ) , getCost ( ) ) ; item . setNotes ( getNotes ( ) ) ; item . setOwnedBy ( getOwnedBy ( ) ) ; item . setComplete ( isComplete ( ) ) ; } } else { // copy over new values // ( since this is just a demo , haven ' t bothered to validate new values ) item . setDescription ( getDescription ( ) ) ; item . setCategory ( getCategory ( ) ) ; item . setSubcategory ( getSubcategory ( ) ) ; item . setDueBy ( getDueBy ( ) ) ; item . setCost ( getCost ( ) ) ; item . setNotes ( getNotes ( ) ) ; item . setOwnedBy ( getOwnedBy ( ) ) ; item . setComplete ( isComplete ( ) ) ; } return actionInvocationContext . getInvokedOn ( ) . isCollection ( ) ? null : item ;
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public IfcPipeFittingTypeEnum createIfcPipeFittingTypeEnumFromString ( EDataType eDataType , String initialValue ) { } }
IfcPipeFittingTypeEnum result = IfcPipeFittingTypeEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;