idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
31,700
public float [ ] t1 ( float [ ] z , int k ) { float [ ] result = new float [ z . length ] ; for ( int i = 0 ; i < z . length ; i ++ ) { result [ i ] = ( new Transformations ( ) ) . sDecept ( z [ i ] , ( float ) 0.35 , ( float ) 0.001 , ( float ) 0.05 ) ; } return result ; }
WFG5 t1 transformation
31,701
double calculateHypervolumeIndicator ( Solution < ? > solutionA , Solution < ? > solutionB , int d , double maximumValues [ ] , double minimumValues [ ] ) { double a , b , r , max ; double volume ; double rho = 2.0 ; r = rho * ( maximumValues [ d - 1 ] - minimumValues [ d - 1 ] ) ; max = minimumValues [ d - 1 ] + r ; a...
Calculates the hypervolume of that portion of the objective space that is dominated by individual a but not by individual b
31,702
public void computeIndicatorValuesHD ( List < S > solutionSet , double [ ] maximumValues , double [ ] minimumValues ) { List < S > A , B ; indicatorValues = new ArrayList < List < Double > > ( ) ; maxIndicatorValue = - Double . MAX_VALUE ; for ( int j = 0 ; j < solutionSet . size ( ) ; j ++ ) { A = new ArrayList < > ( ...
This structure stores the indicator values of each pair of elements
31,703
public void fitness ( List < S > solutionSet , int pos ) { double fitness = 0.0 ; double kappa = 0.05 ; for ( int i = 0 ; i < solutionSet . size ( ) ; i ++ ) { if ( i != pos ) { fitness += Math . exp ( ( - 1 * indicatorValues . get ( i ) . get ( pos ) / maxIndicatorValue ) / kappa ) ; } } solutionFitness . setAttribute...
Calculate the fitness for the individual at position pos
31,704
public void calculateFitness ( List < S > solutionSet ) { double [ ] maximumValues = new double [ problem . getNumberOfObjectives ( ) ] ; double [ ] minimumValues = new double [ problem . getNumberOfObjectives ( ) ] ; for ( int i = 0 ; i < problem . getNumberOfObjectives ( ) ; i ++ ) { maximumValues [ i ] = - Double . ...
Calculate the fitness for the entire population .
31,705
public void removeWorst ( List < S > solutionSet ) { double worst = ( double ) solutionFitness . getAttribute ( solutionSet . get ( 0 ) ) ; int worstIndex = 0 ; double kappa = 0.05 ; for ( int i = 1 ; i < solutionSet . size ( ) ; i ++ ) { if ( ( double ) solutionFitness . getAttribute ( solutionSet . get ( i ) ) > wors...
Update the fitness before removing an individual
31,706
public double evaluate ( List < ? extends Solution < ? > > set1 , List < ? extends Solution < ? > > set2 ) { double result ; int sum = 0 ; if ( set2 . size ( ) == 0 ) { if ( set1 . size ( ) == 0 ) { result = 0.0 ; } else { result = 1.0 ; } } else { for ( Solution < ? > solution : set2 ) { if ( SolutionListUtils . isSol...
Calculates the set coverage of set1 over set2
31,707
protected void checkNumberOfParents ( List < S > population , int numberOfParentsForCrossover ) { if ( ( population . size ( ) % numberOfParentsForCrossover ) != 0 ) { throw new JMetalException ( "Wrong number of parents: the remainder if the " + "population size (" + population . size ( ) + ") is not divisible by " + ...
A crossover operator is applied to a number of parents and it assumed that the population contains a valid number of solutions . This method checks that .
31,708
public int location ( S solution ) { int [ ] position = new int [ numberOfObjectives ] ; for ( int obj = 0 ; obj < numberOfObjectives ; obj ++ ) { if ( ( solution . getObjective ( obj ) > gridUpperLimits [ obj ] ) || ( solution . getObjective ( obj ) < gridLowerLimits [ obj ] ) ) { return - 1 ; } else if ( solution . g...
Calculates the hypercube of a solution
31,709
public void removeSolution ( int location ) { hypercubes [ location ] -- ; if ( location == mostPopulatedHypercube ) { for ( int i = 0 ; i < hypercubes . length ; i ++ ) { if ( hypercubes [ i ] > hypercubes [ mostPopulatedHypercube ] ) { mostPopulatedHypercube = i ; } } } if ( hypercubes [ location ] == 0 ) { this . ca...
Decreases the number of solutions into a specific hypercube .
31,710
public void addSolution ( int location ) { hypercubes [ location ] ++ ; if ( hypercubes [ location ] > hypercubes [ mostPopulatedHypercube ] ) { mostPopulatedHypercube = location ; } if ( hypercubes [ location ] == 1 ) { this . calculateOccupied ( ) ; } }
Increases the number of solutions into a specific hypercube .
31,711
public int rouletteWheel ( BoundedRandomGenerator < Double > randomGenerator ) { double inverseSum = 0.0 ; for ( int hypercube : hypercubes ) { if ( hypercube > 0 ) { inverseSum += 1.0 / ( double ) hypercube ; } } double random = randomGenerator . getRandomValue ( 0.0 , inverseSum ) ; int hypercube = 0 ; double accumul...
Returns a random hypercube using a rouleteWheel method .
31,712
public void calculateOccupied ( ) { int total = 0 ; for ( int hypercube : hypercubes ) { if ( hypercube > 0 ) { total ++ ; } } occupied = new int [ total ] ; int base = 0 ; for ( int i = 0 ; i < hypercubes . length ; i ++ ) { if ( hypercubes [ i ] > 0 ) { occupied [ base ] = i ; base ++ ; } } }
Calculates the number of hypercubes having one or more solutions . return the number of hypercubes with more than zero solutions .
31,713
public int randomOccupiedHypercube ( BoundedRandomGenerator < Integer > randomGenerator ) { int rand = randomGenerator . getRandomValue ( 0 , occupied . length - 1 ) ; return occupied [ rand ] ; }
Returns a random hypercube that has more than zero solutions .
31,714
public double getAverageOccupation ( ) { calculateOccupied ( ) ; double result ; if ( occupiedHypercubes ( ) == 0 ) { result = 0.0 ; } else { double sum = 0.0 ; for ( int value : occupied ) { sum += hypercubes [ value ] ; } result = sum / occupiedHypercubes ( ) ; } return result ; }
Return the average number of solutions in the occupied hypercubes
31,715
public static double [ ] getMaximumValues ( Front front ) { if ( front == null ) { throw new NullFrontException ( ) ; } else if ( front . getNumberOfPoints ( ) == 0 ) { throw new EmptyFrontException ( ) ; } int numberOfObjectives = front . getPoint ( 0 ) . getDimension ( ) ; double [ ] maximumValue = new double [ numbe...
Gets the maximum values for each objectives in a front
31,716
public static double [ ] getMinimumValues ( Front front ) { if ( front == null ) { throw new NullFrontException ( ) ; } else if ( front . getNumberOfPoints ( ) == 0 ) { throw new EmptyFrontException ( ) ; } int numberOfObjectives = front . getPoint ( 0 ) . getDimension ( ) ; double [ ] minimumValue = new double [ numbe...
Gets the minimum values for each objectives in a given front
31,717
public static double distanceToNearestPoint ( Point point , Front front , PointDistance distance ) { if ( front == null ) { throw new NullFrontException ( ) ; } else if ( front . getNumberOfPoints ( ) == 0 ) { throw new EmptyFrontException ( ) ; } else if ( point == null ) { throw new JMetalException ( "The point is nu...
Gets the distance between a point and the nearest one in a front . If a distance equals to 0 is found that means that the point is in the front so it is excluded
31,718
public static Front getInvertedFront ( Front front ) { if ( front == null ) { throw new NullFrontException ( ) ; } else if ( front . getNumberOfPoints ( ) == 0 ) { throw new EmptyFrontException ( ) ; } int numberOfDimensions = front . getPoint ( 0 ) . getDimension ( ) ; Front invertedFront = new ArrayFront ( front . ge...
This method receives a normalized pareto front and return the inverted one . This method is for minimization problems
31,719
public static double [ ] [ ] convertFrontToArray ( Front front ) { if ( front == null ) { throw new NullFrontException ( ) ; } double [ ] [ ] arrayFront = new double [ front . getNumberOfPoints ( ) ] [ ] ; for ( int i = 0 ; i < front . getNumberOfPoints ( ) ; i ++ ) { arrayFront [ i ] = new double [ front . getPoint ( ...
Given a front converts it to an array of double values
31,720
public static List < PointSolution > convertFrontToSolutionList ( Front front ) { if ( front == null ) { throw new NullFrontException ( ) ; } int numberOfObjectives ; int solutionSetSize = front . getNumberOfPoints ( ) ; if ( front . getNumberOfPoints ( ) == 0 ) { numberOfObjectives = 0 ; } else { numberOfObjectives = ...
Given a front converts it to a Solution set of PointSolutions
31,721
public List < PermutationSolution < Integer > > execute ( List < PermutationSolution < Integer > > parents ) { if ( null == parents ) { throw new JMetalException ( "Null parameter" ) ; } else if ( parents . size ( ) != 2 ) { throw new JMetalException ( "There must be two parents instead of " + parents . size ( ) ) ; } ...
Executes the operation
31,722
public int compare ( Point pointOne , Point pointTwo ) { if ( pointOne == null ) { throw new JMetalException ( "PointOne is null" ) ; } else if ( pointTwo == null ) { throw new JMetalException ( "PointTwo is null" ) ; } else if ( pointOne . getDimension ( ) != pointTwo . getDimension ( ) ) { throw new JMetalException (...
Compares two Point objects
31,723
public double spread ( Front front , Front referenceFront ) { PointDistance distance = new EuclideanDistance ( ) ; front . sort ( new LexicographicalPointComparator ( ) ) ; referenceFront . sort ( new LexicographicalPointComparator ( ) ) ; double df = distance . compute ( front . getPoint ( 0 ) , referenceFront . getPo...
Calculates the Spread metric .
31,724
private double hypervolume ( Front front , Front referenceFront ) { Front invertedFront ; invertedFront = FrontUtils . getInvertedFront ( front ) ; int numberOfObjectives = referenceFront . getPoint ( 0 ) . getDimension ( ) ; return this . calculateHypervolume ( FrontUtils . convertFrontToArray ( invertedFront ) , inve...
Returns the hypervolume value of a front of points
31,725
private double [ ] hvContributions ( double [ ] [ ] front ) { int numberOfObjectives = front [ 0 ] . length ; double [ ] contributions = new double [ front . length ] ; double [ ] [ ] frontSubset = new double [ front . length - 1 ] [ front [ 0 ] . length ] ; LinkedList < double [ ] > frontCopy = new LinkedList < double...
Calculates how much hypervolume each point dominates exclusively . The points have to be transformed beforehand to accommodate the assumptions of Zitzler s hypervolume code .
31,726
public double invertedGenerationalDistancePlus ( Front front , Front referenceFront ) { double sum = 0.0 ; for ( int i = 0 ; i < referenceFront . getNumberOfPoints ( ) ; i ++ ) { sum += FrontUtils . distanceToClosestPoint ( referenceFront . getPoint ( i ) , front , new DominanceDistance ( ) ) ; } return sum / reference...
Returns the inverted generational distance plus value for a given front
31,727
private Map < String , Double > computeStatistics ( List < Double > values ) { Map < String , Double > results = new HashMap < > ( ) ; DescriptiveStatistics stats = new DescriptiveStatistics ( ) ; for ( Double value : values ) { stats . addValue ( value ) ; } results . put ( "mean" , stats . getMean ( ) ) ; results . p...
Computes the statistical values
31,728
protected int [ ] rankUnfeasibleSolutions ( List < S > population ) { int numberOfViolatedConstraintsBySolution1 , numberOfViolatedConstraintsBySolution2 ; int indexOfFirstSolution , indexOfSecondSolution , indexOfWeight ; double overallConstraintViolationSolution1 , overallConstraintViolationSolution2 ; double minimum...
Obtain the rank of each solution in a list of unfeasible solutions
31,729
private double delta ( double y , double bMutationParameter ) { double rand = randomGenenerator . getRandomValue ( ) ; int it , maxIt ; it = currentIteration ; maxIt = maxIterations ; return ( y * ( 1.0 - Math . pow ( rand , Math . pow ( ( 1.0 - it / ( double ) maxIt ) , bMutationParameter ) ) ) ) ; }
Calculates the delta value used in NonUniform mutation operator
31,730
private void scaleToPositive ( ) { double minScalarization = Double . MAX_VALUE ; for ( S solution : getSolutionList ( ) ) { if ( scalarization . getAttribute ( solution ) < minScalarization ) { minScalarization = scalarization . getAttribute ( solution ) ; } } if ( minScalarization < 0 ) { double eps = 10e-6 ; for ( S...
The niching mechanism of ESPEA only works if the scalarization values are positive . Otherwise scalarization values cannot be interpreted as charges of a physical system that signal desirability .
31,731
private double [ ] energyVector ( double [ ] [ ] distanceMatrix ) { double [ ] energyVector = new double [ distanceMatrix . length - 1 ] ; for ( int i = 0 ; i < energyVector . length - 1 ; i ++ ) { for ( int j = i + 1 ; j < energyVector . length ; j ++ ) { energyVector [ i ] += scalarization . getAttribute ( archive . ...
Computes the energy contribution of each archive member . Note that the archive member at position maxSize + 1 is the new solution that is tested for eligibility of replacement .
31,732
private double [ ] replacementVector ( double [ ] [ ] distanceMatrix ) { double [ ] replacementVector = new double [ distanceMatrix . length - 1 ] ; double [ ] individualEnergy = new double [ distanceMatrix . length - 1 ] ; double totalEnergy = 0.0 ; for ( int i = 0 ; i < replacementVector . length ; i ++ ) { individua...
Computes the replacement energy vector . Each component k of the replacement vector states how much energy the new solution would introduce into the archive instead of the archive member at position k .
31,733
public static void printFinalSolutionSet ( List < ? extends Solution < ? > > population ) { new SolutionListOutput ( population ) . setSeparator ( "\t" ) . setVarFileOutputContext ( new DefaultFileOutputContext ( "VAR.tsv" ) ) . setFunFileOutputContext ( new DefaultFileOutputContext ( "FUN.tsv" ) ) . print ( ) ; JMetal...
Write the population into two files and prints some data on screen
31,734
public static < S extends Solution < ? > > void printQualityIndicators ( List < S > population , String paretoFrontFile ) throws FileNotFoundException { Front referenceFront = new ArrayFront ( paretoFrontFile ) ; FrontNormalizer frontNormalizer = new FrontNormalizer ( referenceFront ) ; Front normalizedReferenceFront =...
Print all the available quality indicators
31,735
public void doMutation ( PermutationSolution < T > solution ) { int permutationLength ; permutationLength = solution . getNumberOfVariables ( ) ; if ( ( permutationLength != 0 ) && ( permutationLength != 1 ) ) { if ( mutationRandomGenerator . getRandomValue ( ) < mutationProbability ) { int pos1 = positionRandomGenerat...
Performs the operation
31,736
private void doMutation ( double probability , DoubleSolution solution ) { for ( int i = 0 ; i < solution . getNumberOfVariables ( ) ; i ++ ) { if ( randomGenerator . getRandomValue ( ) <= probability ) { Double value = solution . getLowerBound ( i ) + ( ( solution . getUpperBound ( i ) - solution . getLowerBound ( i )...
Implements the mutation operation
31,737
@ SuppressWarnings ( "unchecked" ) public static < S > Problem < S > loadProblem ( String problemName ) { Problem < S > problem ; try { problem = ( Problem < S > ) Class . forName ( problemName ) . getConstructor ( ) . newInstance ( ) ; } catch ( InstantiationException e ) { throw new JMetalException ( "newInstance() c...
Create an instance of problem passed as argument
31,738
public float [ ] t1 ( float [ ] z , int k ) { float [ ] result = new float [ z . length ] ; for ( int i = 0 ; i < z . length ; i ++ ) { result [ i ] = ( new Transformations ( ) ) . sMulti ( z [ i ] , 30 , 10 , ( float ) 0.35 ) ; } return result ; }
WFG4 t1 transformation
31,739
public double evalG ( BinarySolution solution ) { double res = 0.0 ; for ( int i = 1 ; i < solution . getNumberOfVariables ( ) ; i ++ ) { res += evalV ( u ( solution . getVariableValue ( i ) ) ) ; } return res ; }
Returns the value of the ZDT5 function G .
31,740
public FieldsFilter withFields ( String fields , boolean includeFields ) { parameters . put ( "fields" , fields ) ; parameters . put ( "include_fields" , includeFields ) ; return this ; }
Only retrieve certain fields from the item .
31,741
@ JsonFormat ( shape = JsonFormat . Shape . STRING , pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) @ JsonProperty ( "created_at" ) public Date getCreatedAt ( ) { return createdAt ; }
Getter for the date this user was created on .
31,742
@ JsonFormat ( shape = JsonFormat . Shape . STRING , pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) @ JsonProperty ( "updated_at" ) public Date getUpdatedAt ( ) { return updatedAt ; }
Getter for the date this user was last updated on .
31,743
@ JsonFormat ( shape = JsonFormat . Shape . STRING , pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) @ JsonProperty ( "last_login" ) public Date getLastLogin ( ) { return lastLogin ; }
Getter for the last login date .
31,744
@ JsonProperty ( "from" ) public void setFrom ( String from ) throws IllegalArgumentException { if ( messagingServiceSID != null ) { throw new IllegalArgumentException ( "You must specify either `from` or `messagingServiceSID`, but not both" ) ; } this . from = from ; }
Setter for the Twilio From number .
31,745
@ JsonProperty ( "messaging_service_sid" ) public void setMessagingServiceSID ( String messagingServiceSID ) throws IllegalArgumentException { if ( from != null ) { throw new IllegalArgumentException ( "You must specify either `from` or `messagingServiceSID`, but not both" ) ; } this . messagingServiceSID = messagingSe...
Setter for the Twilio Messaging Service SID .
31,746
public QueryFilter withQuery ( String query ) { try { String encodedQuery = urlEncode ( query ) ; parameters . put ( KEY_QUERY , encodedQuery ) ; return this ; } catch ( UnsupportedEncodingException ex ) { throw new IllegalStateException ( "UTF-8 encoding not supported by current Java platform implementation." , ex ) ;...
Filter by a query
31,747
public String build ( ) { for ( Map . Entry < String , String > p : parameters . entrySet ( ) ) { builder . addQueryParameter ( p . getKey ( ) , p . getValue ( ) ) ; } return builder . build ( ) . toString ( ) ; }
Creates a string representation of the URL with the configured parameters .
31,748
@ JsonFormat ( shape = JsonFormat . Shape . STRING , pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) @ JsonProperty ( "enrolled_at" ) public Date getEnrolledAt ( ) { return enrolledAt ; }
Getter for the enrolled at .
31,749
@ JsonFormat ( shape = JsonFormat . Shape . STRING , pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) @ JsonProperty ( "last_auth" ) public Date getLastAuth ( ) { return lastAuth ; }
Getter for the last authentication .
31,750
public AuthorizeUrlBuilder withParameter ( String name , String value ) { assertNotNull ( name , "name" ) ; assertNotNull ( value , "value" ) ; parameters . put ( name , value ) ; return this ; }
Sets an additional parameter .
31,751
public Object getValue ( String key ) { if ( values == null ) { return null ; } return values . get ( key ) ; }
Returns a value from the error map if any .
31,752
@ JsonFormat ( shape = JsonFormat . Shape . STRING , pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) @ JsonProperty ( "date" ) public Date getDate ( ) { return date ; }
Getter for the date to which the stats belong
31,753
public LogEventFilter withCheckpoint ( String from , int take ) { parameters . put ( "from" , from ) ; parameters . put ( "take" , take ) ; return this ; }
Filter by checkpoint
31,754
public void setup ( JavaStreamingContext jssc , CommandLine cli ) throws Exception { String filtersArg = cli . getOptionValue ( "tweetFilters" ) ; String [ ] filters = ( filtersArg != null ) ? filtersArg . split ( "," ) : new String [ 0 ] ; JavaReceiverInputDStream < Status > tweets = TwitterUtils . createStream ( jssc...
Sends a stream of tweets to Solr .
31,755
public static void main ( String [ ] args ) throws Exception { if ( args == null || args . length == 0 || args [ 0 ] == null || args [ 0 ] . trim ( ) . length ( ) == 0 ) { System . err . println ( "Invalid command-line args! Must pass the name of a processor to run.\n" + "Supported processors:\n" ) ; displayProcessorOp...
Runs a stream processor implementation .
31,756
public static Option [ ] getCommonOptions ( ) { return new Option [ ] { Option . builder ( ) . hasArg ( ) . required ( false ) . desc ( "Batch interval (seconds) for streaming applications; default is 1 second" ) . longOpt ( "batchInterval" ) . build ( ) , Option . builder ( ) . hasArg ( ) . required ( false ) . desc (...
Support options common to all tools .
31,757
private static RDDProcessor newProcessor ( String streamProcType ) throws Exception { streamProcType = streamProcType . trim ( ) ; if ( "twitter-to-solr" . equals ( streamProcType ) ) return new TwitterToSolrStreamProcessor ( ) ; else if ( "word-count" . equals ( streamProcType ) ) return new WordCount ( ) ; else if ( ...
Creates an instance of the requested tool using classpath scanning if necessary
31,758
public static CommandLine processCommandLineArgs ( Option [ ] customOptions , String [ ] args ) { Options options = new Options ( ) ; options . addOption ( "h" , "help" , false , "Print this message" ) ; options . addOption ( "v" , "verbose" , false , "Generate verbose log messages" ) ; if ( customOptions != null ) { f...
Parses the command - line arguments passed by the user .
31,759
@ SuppressWarnings ( "unchecked" ) private static List < Class < RDDProcessor > > findProcessorClassesInPackage ( String packageName ) { List < Class < RDDProcessor > > streamProcClasses = new ArrayList < Class < RDDProcessor > > ( ) ; try { ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader (...
Scans Jar files on the classpath for RDDProcessor implementations to activate .
31,760
public static Map < String , String > parseColumns ( String sqlStmt ) throws Exception { String tmp = sqlStmt . replaceAll ( "\\s+" , " " ) . trim ( ) ; String lc = tmp . toLowerCase ( ) ; if ( ! lc . startsWith ( SELECT ) ) throw new IllegalArgumentException ( "Expected SQL to start with '" + SELECT + "' but found [" ...
Given a valid Solr SQL statement parse out the columns and aliases as a map .
31,761
public static SolrTermVector newInstance ( String docId , HashingTF hashingTF , NamedList < Object > termList ) { int termCount = termList . size ( ) ; int [ ] indices = new int [ termCount ] ; double [ ] weights = new double [ termCount ] ; String [ ] terms = new String [ termCount ] ; Iterator < Map . Entry < String ...
Converts doc - level term vector information the Solr QueryResponse into a SolrTermVector .
31,762
public InsertStrategy getOverridenStrategy ( AbstractEntityProperty < ? > property ) { final InsertStrategy insertStrategy = OverridingOptional . from ( this . insertStrategy ) . defaultValue ( property . insertStrategy ( ) ) . get ( ) ; if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( format ( "Get runtime insert...
Determine the insert strategy for the given entity using static configuration and runtime option
31,763
public TypeSpec buildDeleteWhereForClusteringColumn ( EntityMetaSignature signature , List < FieldSignatureInfo > clusteringCols , List < ClassSignatureInfo > classesSignature , ClassSignatureInfo lastSignature ) { final ClassSignatureInfo classSignature = classesSignature . get ( 0 ) ; final ClassSignatureInfo nextSig...
Generate extra method to extends the AbstractDeleteEnd class
31,764
public T withDefaultReadConsistencyMap ( Map < String , ConsistencyLevel > readConsistencyMap ) { configMap . put ( CONSISTENCY_LEVEL_READ_MAP , readConsistencyMap ) ; return getThis ( ) ; }
Define the default Consistency level map to be used for all READ operations The map keys represent table names and values represent the corresponding consistency level
31,765
public T withDefaultWriteConsistencyMap ( Map < String , ConsistencyLevel > writeConsistencyMap ) { configMap . put ( CONSISTENCY_LEVEL_WRITE_MAP , writeConsistencyMap ) ; return getThis ( ) ; }
Define the default Consistency level map to be used for all WRITE operations The map keys represent table names and values represent the corresponding consistency level
31,766
public T withDefaultSerialConsistencyMap ( Map < String , ConsistencyLevel > serialConsistencyMap ) { configMap . put ( CONSISTENCY_LEVEL_SERIAL_MAP , serialConsistencyMap ) ; return getThis ( ) ; }
Define the default Consistency level map to be used for all LightWeightTransaction operations operations The map keys represent table names and values represent the corresponding consistency level
31,767
public T withEventInterceptors ( List < Interceptor < ? > > interceptors ) { configMap . put ( EVENT_INTERCEPTORS , interceptors ) ; return getThis ( ) ; }
Provide a list of event interceptors
31,768
public T withParameter ( ConfigurationParameters parameter , Object value ) { configMap . put ( parameter , value ) ; return getThis ( ) ; }
Pass an arbitrary parameter to configure Achilles
31,769
public ENTITY mapFromRow ( Row row ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( format ( "Map row %s back to entity of type %s" , row , entityClass . getCanonicalName ( ) ) ) ; } validateNotNull ( row , "Row object should not be null" ) ; final String tableName = row . getColumnDefinitions ( ) . asList ( )...
Map a given row back to an entity instance . This method provides a raw object mapping facility . Advanced features like interceptors are not available . User codecs are taken into account though .
31,770
public CassandraEmbeddedServerBuilder withScript ( String scriptLocation ) { Validator . validateNotBlank ( scriptLocation , "The script location should not be blank while executing CassandraEmbeddedServerBuilder.withScript()" ) ; scriptLocations . add ( scriptLocation . trim ( ) ) ; return this ; }
Load an CQL script in the class path and execute it upon initialization of the embedded Cassandra server
31,771
public CassandraEmbeddedServerBuilder withScriptTemplate ( String scriptTemplateLocation , Map < String , Object > values ) { Validator . validateNotBlank ( scriptTemplateLocation , "The script template should not be blank while executing CassandraEmbeddedServerBuilder.withScriptTemplate()" ) ; Validator . validateNotE...
Load an CQL script template in the class path inject the values into the template to produce the final script and execute it upon initialization of the embedded Cassandra server
31,772
public List < TypeSpec > buildWhereClasses ( GlobalParsingContext context , EntityMetaSignature signature ) { SelectWhereDSLCodeGen selectWhereDSLCodeGen = context . selectWhereDSLCodeGen ( ) ; final List < FieldSignatureInfo > partitionKeys = getPartitionKeysSignatureInfo ( signature . fieldMetaSignatures ) ; final Li...
ClassSignatureInfo lastSignature ) ;
31,773
public T withConsistencyLevel ( ConsistencyLevel consistencyLevel ) { getOptions ( ) . setCl ( Optional . of ( consistencyLevel ) ) ; return getThis ( ) ; }
Set the given consistency level on the generated statement
31,774
public T withSerialConsistencyLevel ( ConsistencyLevel serialConsistencyLevel ) { getOptions ( ) . setSerialCL ( Optional . of ( serialConsistencyLevel ) ) ; return getThis ( ) ; }
Set the given serial consistency level on the generated statement
31,775
public T withOutgoingPayload ( Map < String , ByteBuffer > outgoingPayload ) { getOptions ( ) . setOutgoingPayLoad ( Optional . of ( outgoingPayload ) ) ; return getThis ( ) ; }
Set the given outgoing payload map on the generated statement
31,776
public T withOptionalOutgoingPayload ( Optional < Map < String , ByteBuffer > > outgoingPayload ) { getOptions ( ) . setOutgoingPayLoad ( outgoingPayload ) ; return getThis ( ) ; }
Set the given outgoing payload map on the generated statement IF NOT NULL
31,777
public T withPagingState ( PagingState pagingState ) { getOptions ( ) . setPagingState ( Optional . of ( pagingState ) ) ; return getThis ( ) ; }
Set the given paging state on the generated statement
31,778
public T withOptionalPagingStateString ( Optional < String > pagingStateString ) { pagingStateString . ifPresent ( cl -> getOptions ( ) . setPagingState ( Optional . of ( PagingState . fromString ( pagingStateString . get ( ) ) ) ) ) ; return getThis ( ) ; }
Set the given paging state string on the generated statement IF NOT NULL
31,779
public T withRetryPolicy ( RetryPolicy retryPolicy ) { getOptions ( ) . setRetryPolicy ( Optional . of ( retryPolicy ) ) ; return getThis ( ) ; }
Set the given retry policy
31,780
public Iterator < ENTITY > iterator ( ) { StatementWrapper statementWrapper = new BoundStatementWrapper ( getOperationType ( boundStatement ) , meta , boundStatement , encodedBoundValues ) ; if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( String . format ( "Generate iterator for typed query : %s" , statementWrapp...
Execute the typed query and return an iterator of entities
31,781
public void executeScriptTemplate ( String scriptTemplateLocation , Map < String , Object > values ) { final List < SimpleStatement > statements = buildStatements ( loadScriptAsLines ( scriptTemplateLocation , values ) ) ; for ( SimpleStatement statement : statements ) { if ( isDMLStatement ( statement ) ) { DML_LOGGER...
Execute a CQL script template located in the class path and inject provided values into the template to produce the actual script
31,782
public CompletableFuture < ResultSet > executeAsync ( Statement statement ) { return FutureUtils . toCompletableFuture ( session . executeAsync ( statement ) , sameThreadExecutor ) ; }
Execute a CQL statement asynchronously
31,783
public static Map < ExecutableElement , AnnotationValue > getElementValuesWithDefaults ( AnnotationMirror annotMirror ) { Map < ExecutableElement , AnnotationValue > valMap = Optional . ofNullable ( ( Map < ExecutableElement , AnnotationValue > ) annotMirror . getElementValues ( ) ) . map ( x -> new HashMap < > ( x ) )...
Returns the values of an annotation s attributes including defaults . The method with the same name in JavacElements cannot be used directly because it includes a cast to Attribute . Compound which doesn t hold for annotations generated by the Checker Framework .
31,784
public static < T > Optional < Class < T > > getElementValueClass ( AnnotationMirror anno , CharSequence name , boolean useDefaults ) { Name cn = getElementValueClassName ( anno , name , useDefaults ) ; try { Class < ? > cls = Class . forName ( cn . toString ( ) ) ; return Optional . of ( ( Class < T > ) cls ) ; } catc...
Get the Class that is referenced by attribute name . This method uses Class . forName to load the class . It returns null if the class wasn t found .
31,785
public static < T extends Enum < T > > T getElementValueEnum ( AnnotationMirror anno , CharSequence name , Class < T > t , boolean useDefaults ) { Symbol . VarSymbol vs = getElementValue ( anno , name , Symbol . VarSymbol . class , useDefaults ) ; T value = Enum . valueOf ( t , vs . getSimpleName ( ) . toString ( ) ) ;...
Version that is suitable for Enum elements .
31,786
public static TypeElement enclosingClass ( final Element elem ) { Element result = elem ; while ( result != null && ! result . getKind ( ) . isClass ( ) && ! result . getKind ( ) . isInterface ( ) ) { Element encl = result . getEnclosingElement ( ) ; result = encl ; } return ( TypeElement ) result ; }
Returns the innermost type element enclosing the given element
31,787
public static VariableElement findFieldInType ( TypeElement type , String name ) { for ( VariableElement field : ElementFilter . fieldsIn ( type . getEnclosedElements ( ) ) ) { if ( field . getSimpleName ( ) . toString ( ) . equals ( name ) ) { return field ; } } return null ; }
Returns the field of the class
31,788
public CompletableFuture < ExecutionInfo > executeAsyncWithStats ( ) { final StatementWrapper statementWrapper = new NativeStatementWrapper ( getOperationType ( boundStatement ) , meta , boundStatement , encodedBoundValues ) ; final String queryString = statementWrapper . getBoundStatement ( ) . preparedStatement ( ) ....
Execute the native query asynchronously and return the execution info
31,789
public VALUEFROM decodeFromRaw ( Object o ) { if ( o == null && ! isOptional ( ) ) return null ; return decodeFromRawInternal ( o ) ; }
Decode the given raw object to Java value value using Achilles codec system
31,790
public static SetOperation heapify ( final Memory srcMem , final long seed ) { final byte famID = srcMem . getByte ( FAMILY_BYTE ) ; final Family family = idToFamily ( famID ) ; switch ( family ) { case UNION : { return UnionImpl . heapifyInstance ( srcMem , seed ) ; } case INTERSECTION : { return IntersectionImpl . he...
Heapify takes the SetOperation image in Memory and instantiates an on - heap SetOperation using the given seed . The resulting SetOperation will not retain any link to the source Memory .
31,791
public static SetOperation wrap ( final Memory srcMem , final long seed ) { final byte famID = srcMem . getByte ( FAMILY_BYTE ) ; final Family family = idToFamily ( famID ) ; final int serVer = srcMem . getByte ( SER_VER_BYTE ) ; if ( serVer != 3 ) { throw new SketchesArgumentException ( "SerVer must be 3: " + serVer )...
Wrap takes the SetOperation image in Memory and refers to it directly . There is no data copying onto the java heap . Only Direct SetOperations that have been explicitly stored as direct can be wrapped .
31,792
public static int getMaxIntersectionBytes ( final int nomEntries ) { final int nomEnt = ceilingPowerOf2 ( nomEntries ) ; final int bytes = ( nomEnt << 4 ) + ( Family . INTERSECTION . getMaxPreLongs ( ) << 3 ) ; return bytes ; }
Returns the maximum required storage bytes given a nomEntries parameter for Intersection operations
31,793
static final CompactSketch createCompactSketch ( final long [ ] compactCache , boolean empty , final short seedHash , final int curCount , long thetaLong , final boolean dstOrdered , final WritableMemory dstMem ) { thetaLong = thetaOnCompact ( empty , curCount , thetaLong ) ; empty = emptyOnCompact ( curCount , thetaLo...
used only by the set operations
31,794
static final int computeMinLgArrLongsFromCount ( final int count ) { final int upperCount = ( int ) Math . ceil ( count / REBUILD_THRESHOLD ) ; final int arrLongs = max ( ceilingPowerOf2 ( upperCount ) , 1 << MIN_LG_ARR_LONGS ) ; final int newLgArrLongs = Integer . numberOfTrailingZeros ( arrLongs ) ; return newLgArrLo...
Used by intersection and AnotB
31,795
static boolean isValidSetOpID ( final int id ) { final Family family = Family . idToFamily ( id ) ; final boolean ret = ( ( family == Family . UNION ) || ( family == Family . INTERSECTION ) || ( family == Family . A_NOT_B ) ) ; return ret ; }
Returns true if given Family id is one of the set operations
31,796
static final void hipAndKxQIncrementalUpdate ( final AbstractHllArray host , final int oldValue , final int newValue ) { assert newValue > oldValue ; final int configK = 1 << host . getLgConfigK ( ) ; double kxq0 = host . getKxQ0 ( ) ; double kxq1 = host . getKxQ1 ( ) ; host . addToHipAccum ( configK / ( kxq0 + kxq1 ) ...
Called here and by Heap and Direct 6 and 8 bit implementations
31,797
public static SingleItemSketch heapify ( final Memory mem ) { final long memPre0 = mem . getLong ( 0 ) ; checkDefaultBytes0to7 ( memPre0 ) ; return new SingleItemSketch ( mem . getLong ( 8 ) ) ; }
Creates a SingleItemSketch on the heap given a Memory and assumes the DEFAULT_UPDATE_SEED .
31,798
public static SingleItemSketch heapify ( final Memory mem , final long seed ) { final long memPre0 = mem . getLong ( 0 ) ; checkDefaultBytes0to5 ( memPre0 ) ; final short seedHashIn = mem . getShort ( 6 ) ; final short seedHashCk = computeSeedHash ( seed ) ; checkSeedHashes ( seedHashIn , seedHashCk ) ; return new Sing...
Creates a SingleItemSketch on the heap given a Memory . Checks the seed hash of the given Memory against a hash of the given seed .
31,799
public static SingleItemSketch create ( final byte [ ] data ) { if ( ( data == null ) || ( data . length == 0 ) ) { return null ; } return new SingleItemSketch ( hash ( data , DEFAULT_UPDATE_SEED ) [ 0 ] >>> 1 ) ; }
Create this sketch with the given byte array . If the byte array is null or empty no create attempt is made and the method returns null .