• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

apache / datasketches-java / #306

30 Apr 2024 10:01PM UTC coverage: 97.645% (-0.5%) from 98.139%
#306

push

web-flow
Merge pull request #555 from apache/fix_pom_xml_header

Fix pom xml header

26865 of 27513 relevant lines covered (97.64%)

0.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/main/java/org/apache/datasketches/tuple/Sketches.java
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements.  See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership.  The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License.  You may obtain a copy of the License at
9
 *
10
 *   http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19

20
package org.apache.datasketches.tuple;
21

22
import org.apache.datasketches.memory.Memory;
23

24
/**
25
 * Convenient static methods to instantiate generic tuple sketches.
26
 */
27
@SuppressWarnings("deprecation")
28
public final class Sketches {
×
29

30
  /**
31
   * @param <S> Type of Summary
32
   * @return an empty instance of Sketch
33
   */
34
  public static <S extends Summary> Sketch<S> createEmptySketch() {
35
    return new CompactSketch<>(null, null, Long.MAX_VALUE, true);
1✔
36
  }
37

38
  /**
39
   * Instantiate a Sketch from a given Memory.
40
   * @param <S> Type of Summary
41
   * @param mem Memory object representing a Sketch
42
   * @param deserializer instance of SummaryDeserializer
43
   * @return Sketch created from its Memory representation
44
   */
45
  public static <S extends Summary> Sketch<S> heapifySketch(
46
      final Memory mem,
47
      final SummaryDeserializer<S> deserializer) {
48
    final SerializerDeserializer.SketchType sketchType = SerializerDeserializer.getSketchType(mem);
1✔
49
    if (sketchType == SerializerDeserializer.SketchType.QuickSelectSketch) {
1✔
50
      return new QuickSelectSketch<>(mem, deserializer, null);
1✔
51
    }
52
    return new CompactSketch<>(mem, deserializer);
1✔
53
  }
54

55
  /**
56
   * Instantiate UpdatableSketch from a given Memory
57
   * @param <U> Type of update value
58
   * @param <S> Type of Summary
59
   * @param mem Memory object representing a Sketch
60
   * @param deserializer instance of SummaryDeserializer
61
   * @param summaryFactory instance of SummaryFactory
62
   * @return Sketch created from its Memory representation
63
   */
64
  public static <U, S extends UpdatableSummary<U>> UpdatableSketch<U, S> heapifyUpdatableSketch(
65
      final Memory mem,
66
      final SummaryDeserializer<S> deserializer,
67
      final SummaryFactory<S> summaryFactory) {
68
    return new UpdatableSketch<>(mem, deserializer, summaryFactory);
1✔
69
  }
70

71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc