code
stringlengths
73
34.1k
label
stringclasses
1 value
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; }
java
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 = ...
java
public void computeIndicatorValuesHD(List<S> solutionSet, double[] maximumValues, double[] minimumValues) { List<S> A, B; // Initialize the structures indicatorValues = new ArrayList<List<Double>>(); maxIndicatorValue = -Double.MAX_VALUE; for (int j = 0; j < solutionSet.size(); j++) { A...
java
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...
java
public void calculateFitness(List<S> solutionSet) { // Obtains the lower and upper bounds of the population double[] maximumValues = new double[problem.getNumberOfObjectives()]; double[] minimumValues = new double[problem.getNumberOfObjectives()]; for (int i = 0; i < problem.getNumberOfObjectives(); i+...
java
public void removeWorst(List<S> solutionSet) { // Find the worst; 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)) > ...
java
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...
java
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 "...
java
public int location(S solution) { //Create a int [] to store the range of each objective int[] position = new int[numberOfObjectives]; //Calculate the position for each objective for (int obj = 0; obj < numberOfObjectives; obj++) { if ((solution.getObjective(obj) > gridUpperLimits[obj]) ...
java
public void removeSolution(int location) { //Decrease the solutions in the location specified. hypercubes[location]--; //Update the most populated hypercube if (location == mostPopulatedHypercube) { for (int i = 0; i < hypercubes.length; i++) { if (hypercubes[i] > hypercubes[mostPo...
java
public void addSolution(int location) { //Increase the solutions in the location specified. hypercubes[location]++; //Update the most populated hypercube if (hypercubes[location] > hypercubes[mostPopulatedHypercube]) { mostPopulatedHypercube = location; } //if hypercubes[locatio...
java
public int rouletteWheel(BoundedRandomGenerator<Double> randomGenerator) { //Calculate the inverse sum double inverseSum = 0.0; for (int hypercube : hypercubes) { if (hypercube > 0) { inverseSum += 1.0 / (double) hypercube; } } //Calculate a random value between 0 and s...
java
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;...
java
public int randomOccupiedHypercube(BoundedRandomGenerator<Integer> randomGenerator) { int rand = randomGenerator.getRandomValue(0, occupied.length - 1); return occupied[rand]; }
java
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(); } ...
java
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[n...
java
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[n...
java
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 poin...
java
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...
java
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(i).getDimensi...
java
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 { ...
java
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()) ; } ...
java
@Override 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 ne...
java
public double spread(Front front, Front referenceFront) { PointDistance distance = new EuclideanDistance() ; // STEP 1. Sort normalizedFront and normalizedParetoFront; front.sort(new LexicographicalPointComparator()); referenceFront.sort(new LexicographicalPointComparator()); // STEP 2. Compute df...
java
private double hypervolume(Front front, Front referenceFront) { Front invertedFront; invertedFront = FrontUtils.getInvertedFront(front); int numberOfObjectives = referenceFront.getPoint(0).getDimension() ; // STEP4. The hypervolume (control is passed to the Java version of Zitzler code) return th...
java
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[]>(); Collections.addAll(...
java
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()); } // STEP 4. Divid...
java
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.put("media...
java
protected int[] rankUnfeasibleSolutions(List<S> population){ int numberOfViolatedConstraintsBySolution1, numberOfViolatedConstraintsBySolution2; int indexOfFirstSolution, indexOfSecondSolution, indexOfWeight; double overallConstraintViolationSolution1, overallConstraintViolationSolution2; ...
java
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) ))); }
java
private void scaleToPositive() { // Obtain min value double minScalarization = Double.MAX_VALUE; for (S solution : getSolutionList()) { if (scalarization.getAttribute(solution) < minScalarization) { minScalarization = scalarization.getAttribute(solution); } } if (minScala...
java
private double[] energyVector(double[][] distanceMatrix) { // Ignore the set (maxSize + 1)'th archive member since it's the new // solution that is tested for eligibility of replacement. double[] energyVector = new double[distanceMatrix.length - 1]; for (int i = 0; i < energyVector.length - 1; i++) ...
java
private double[] replacementVector(double[][] distanceMatrix) { double[] replacementVector = new double[distanceMatrix.length - 1]; // Energy between archive member k and new solution double[] individualEnergy = new double[distanceMatrix.length - 1]; // Sum of all individual energies double tot...
java
public static void printFinalSolutionSet(List<? extends Solution<?>> population) { new SolutionListOutput(population) .setSeparator("\t") .setVarFileOutputContext(new DefaultFileOutputContext("VAR.tsv")) .setFunFileOutputContext(new DefaultFileOutputContext("FUN.tsv")) .print(); ...
java
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 =...
java
public void doMutation(PermutationSolution<T> solution) { int permutationLength ; permutationLength = solution.getNumberOfVariables() ; if ((permutationLength != 0) && (permutationLength != 1)) { if (mutationRandomGenerator.getRandomValue() < mutationProbability) { int pos1 = positionRandomGe...
java
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)) * random...
java
@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() cannot instan...
java
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; }
java
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; }
java
public FieldsFilter withFields(String fields, boolean includeFields) { parameters.put("fields", fields); parameters.put("include_fields", includeFields); return this; }
java
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") @JsonProperty("created_at") public Date getCreatedAt() { return createdAt; }
java
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") @JsonProperty("updated_at") public Date getUpdatedAt() { return updatedAt; }
java
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") @JsonProperty("last_login") public Date getLastLogin() { return lastLogin; }
java
@Deprecated @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; }
java
@Deprecated @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"); } ...
java
public QueryFilter withQuery(String query) { try { String encodedQuery = urlEncode(query); parameters.put(KEY_QUERY, encodedQuery); return this; } catch (UnsupportedEncodingException ex) { //"Every implementation of the Java platform is required to support...
java
public String build() { for (Map.Entry<String, String> p : parameters.entrySet()) { builder.addQueryParameter(p.getKey(), p.getValue()); } return builder.build().toString(); }
java
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") @JsonProperty("enrolled_at") public Date getEnrolledAt() { return enrolledAt; }
java
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") @JsonProperty("last_auth") public Date getLastAuth() { return lastAuth; }
java
public AuthorizeUrlBuilder withParameter(String name, String value) { assertNotNull(name, "name"); assertNotNull(value, "value"); parameters.put(name, value); return this; }
java
public Object getValue(String key) { if (values == null) { return null; } return values.get(key); }
java
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") @JsonProperty("date") public Date getDate() { return date; }
java
public LogEventFilter withCheckpoint(String from, int take) { parameters.put("from", from); parameters.put("take", take); return this; }
java
@Override public void setup(JavaStreamingContext jssc, CommandLine cli) throws Exception { String filtersArg = cli.getOptionValue("tweetFilters"); String[] filters = (filtersArg != null) ? filtersArg.split(",") : new String[0]; // start receiving a stream of tweets ... JavaReceiverInputDStream<Status...
java
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"); displayProcessorOptions...
java
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...
java
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 ...
java
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) { for (int...
java
@SuppressWarnings("unchecked") private static List<Class<RDDProcessor>> findProcessorClassesInPackage(String packageName) { List<Class<RDDProcessor>> streamProcClasses = new ArrayList<Class<RDDProcessor>>(); try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); String pat...
java
public static Map<String,String> parseColumns(String sqlStmt) throws Exception { // NOTE: While I prefer using a SQL parser here, the presto / calcite / Spark parsers were too complex // for this basic task and pulled in unwanted / incompatible dependencies, e.g. presto requires a different // version of g...
java
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,Object>> termsIt...
java
public InsertStrategy getOverridenStrategy(AbstractEntityProperty<?> property) { final InsertStrategy insertStrategy = OverridingOptional .from(this.insertStrategy) .defaultValue(property.insertStrategy()) .get(); if (LOGGER.isTraceEnabled()) { ...
java
@Override public TypeSpec buildDeleteWhereForClusteringColumn(EntityMetaSignature signature, List<FieldSignatureInfo> clusteringCols, List<ClassSignatureInfo> classesSignature, ...
java
public T withDefaultReadConsistencyMap(Map<String, ConsistencyLevel> readConsistencyMap) { configMap.put(CONSISTENCY_LEVEL_READ_MAP, readConsistencyMap); return getThis(); }
java
public T withDefaultWriteConsistencyMap(Map<String, ConsistencyLevel> writeConsistencyMap) { configMap.put(CONSISTENCY_LEVEL_WRITE_MAP, writeConsistencyMap); return getThis(); }
java
public T withDefaultSerialConsistencyMap(Map<String, ConsistencyLevel> serialConsistencyMap) { configMap.put(CONSISTENCY_LEVEL_SERIAL_MAP, serialConsistencyMap); return getThis(); }
java
public T withEventInterceptors(List<Interceptor<?>> interceptors) { configMap.put(EVENT_INTERCEPTORS, interceptors); return getThis(); }
java
public T withParameter(ConfigurationParameters parameter, Object value) { configMap.put(parameter, value); return getThis(); }
java
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()....
java
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; }
java
public CassandraEmbeddedServerBuilder withScriptTemplate(String scriptTemplateLocation, Map<String, Object> values) { Validator.validateNotBlank(scriptTemplateLocation, "The script template should not be blank while executing CassandraEmbeddedServerBuilder.withScriptTemplate()"); Validator.validateNotEm...
java
public List<TypeSpec> buildWhereClasses(GlobalParsingContext context, EntityMetaSignature signature) { SelectWhereDSLCodeGen selectWhereDSLCodeGen = context.selectWhereDSLCodeGen(); final List<FieldSignatureInfo> partitionKeys = getPartitionKeysSignatureInfo(signature.fieldMetaSignatures); fina...
java
public T withConsistencyLevel(ConsistencyLevel consistencyLevel) { getOptions().setCl(Optional.of(consistencyLevel)); return getThis(); }
java
public T withSerialConsistencyLevel(ConsistencyLevel serialConsistencyLevel) { getOptions().setSerialCL(Optional.of(serialConsistencyLevel)); return getThis(); }
java
public T withOutgoingPayload(Map<String, ByteBuffer> outgoingPayload) { getOptions().setOutgoingPayLoad(Optional.of(outgoingPayload)); return getThis(); }
java
public T withOptionalOutgoingPayload(Optional<Map<String, ByteBuffer>> outgoingPayload) { getOptions().setOutgoingPayLoad(outgoingPayload); return getThis(); }
java
public T withPagingState(PagingState pagingState) { getOptions().setPagingState(Optional.of(pagingState)); return getThis(); }
java
public T withOptionalPagingStateString(Optional<String> pagingStateString) { pagingStateString.ifPresent(cl -> getOptions().setPagingState(Optional.of(PagingState.fromString(pagingStateString.get())))); return getThis(); }
java
public T withRetryPolicy(RetryPolicy retryPolicy) { getOptions().setRetryPolicy(Optional.of(retryPolicy)); return getThis(); }
java
@Override public Iterator<ENTITY> iterator() { StatementWrapper statementWrapper = new BoundStatementWrapper(getOperationType(boundStatement), meta, boundStatement, encodedBoundValues); if (LOGGER.isTraceEnabled()) { LOGGER.trace(String.format("Generate iterator for typ...
java
public void executeScriptTemplate(String scriptTemplateLocation, Map<String, Object> values) { final List<SimpleStatement> statements = buildStatements(loadScriptAsLines(scriptTemplateLocation, values)); for (SimpleStatement statement : statements) { if (isDMLStatement(statement)) { ...
java
public CompletableFuture<ResultSet> executeAsync(Statement statement) { return FutureUtils.toCompletableFuture(session.executeAsync(statement), sameThreadExecutor); }
java
public static Map<ExecutableElement, AnnotationValue> getElementValuesWithDefaults(AnnotationMirror annotMirror) { Map<ExecutableElement, AnnotationValue> valMap = Optional .ofNullable((Map<ExecutableElement, AnnotationValue>)annotMirror.getElementValues()) .map(x -> new HashMap<...
java
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...
java
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()); return value; ...
java
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 (T...
java
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; }
java
@Override public CompletableFuture<ExecutionInfo> executeAsyncWithStats() { final StatementWrapper statementWrapper = new NativeStatementWrapper(getOperationType(boundStatement), meta, boundStatement, encodedBoundValues); final String queryString = statementWrapper.getBoundStatement().preparedState...
java
public VALUEFROM decodeFromRaw(Object o) { if (o == null && !isOptional()) return null; return decodeFromRawInternal(o); }
java
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 : { retur...
java
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); ...
java
public static int getMaxIntersectionBytes(final int nomEntries) { final int nomEnt = ceilingPowerOf2(nomEntries); final int bytes = (nomEnt << 4) + (Family.INTERSECTION.getMaxPreLongs() << 3); return bytes; }
java
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...
java
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 newLgArrLongs; }
java
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; }
java
static final void hipAndKxQIncrementalUpdate(final AbstractHllArray host, final int oldValue, final int newValue) { assert newValue > oldValue; final int configK = 1 << host.getLgConfigK(); //update hipAccum BEFORE updating kxq0 and kxq1 double kxq0 = host.getKxQ0(); double kxq1 = host.getKxQ1...
java
public static SingleItemSketch heapify(final Memory mem) { final long memPre0 = mem.getLong(0); checkDefaultBytes0to7(memPre0); return new SingleItemSketch(mem.getLong(8)); }
java
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 SingleIte...
java
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); }
java