Skip to content

Commit 501ad7a

Browse files
committed
Maven central release and minor documentation updates
1 parent 9c9ebec commit 501ad7a

File tree

11 files changed

+131
-24
lines changed

11 files changed

+131
-24
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# index4j
22

3+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4+
[![Maven Central Version](https://img.shields.io/maven-central/v/com.dynatrace.index4j/indices)](https://central.sonatype.com/artifact/com.dynatrace.index4j/indices)
5+
[![javadoc](https://javadoc.io/badge2/com.dynatrace.index4j/indices/javadoc.svg)](https://javadoc.io/doc/com.dynatrace.index4j/indices)
6+
37
This repository is a Java library developed by Dynatrace that implements the FM-Index succinct data structure. The FM-Index takes
48
advantage of the relationship between the suffix array and the Burrows-Wheeler transform to enable both compression and
59
fast queries.
@@ -23,7 +27,21 @@ In addition, this repository also contains further data structures for working w
2327

2428
## First steps
2529

26-
TODO add dependency on maven
30+
To add a dependency on `index4j` using Maven, use the following:
31+
32+
```
33+
<dependency>
34+
<groupId>com.dynatrace.index4j</groupId>
35+
<artifactId>indices</artifactId>
36+
<version>0.1.0</version>
37+
</dependency>
38+
```
39+
40+
To add the dependency using Gradle:
41+
42+
```
43+
implementation group: 'com.dynatrace.index4j', name: 'indices', version: '0.1.0'
44+
```
2745

2846
## Supported data structures
2947

build.gradle

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
plugins {
2+
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
3+
id 'signing'
4+
id 'java-library'
5+
id 'maven-publish'
6+
id 'org.sonarqube' version '6.0.1.5171'
7+
}
8+
9+
sonarqube {
10+
properties {
11+
property 'sonar.projectKey', 'dynatrace-oss_index4j'
12+
property 'sonar.organization', 'dynatrace-oss'
13+
property 'sonar.host.url', 'https://sonarcloud.io'
14+
}
15+
}
16+
17+
nexusPublishing {
18+
packageGroup = 'com.dynatrace'
19+
useStaging = true
20+
repositories {
21+
sonatype {
22+
nexusUrl = uri('https://oss.sonatype.org/service/local/')
23+
snapshotRepositoryUrl = uri('https://oss.sonatype.org/content/repositories/snapshots/')
24+
username = System.getenv('OSSRH_USERNAME')
25+
password = System.getenv('OSSRH_PASSWORD')
26+
}
27+
}
28+
}

indices/build.gradle

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,29 +104,61 @@ test {
104104

105105
java {
106106
toolchain {
107-
languageVersion.set(JavaLanguageVersion.of(17))
107+
languageVersion.set(JavaLanguageVersion.of(21))
108108
}
109+
withSourcesJar()
110+
withJavadocJar()
109111
}
110112

111113
jar {
112114
archiveBaseName.set('research-succinct-ds')
113115
}
114116

117+
javadoc {
118+
failOnError true
119+
title 'index4j ' + project.version + ' API'
120+
}
121+
122+
group = 'com.dynatrace.index4j'
123+
version = '0.1.0'
124+
125+
gradlePlugin { automatedPublishing = false }
126+
115127
publishing {
116128
publications {
129+
117130
mavenJava(MavenPublication) {
118-
groupId = 'com.dynatrace.research'
119-
artifactId = 'succinct-ds'
120131
from components.java
132+
pom {
133+
name = 'com.dynatrace.index4j:index4j'
134+
description = 'index4j: A Dynatrace FM-Index library for Java'
135+
url = 'https://github.com/dynatrace-oss/index4j'
136+
licenses {
137+
license {
138+
name = 'The Apache License, Version 2.0'
139+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
140+
}
141+
}
142+
developers {
143+
developer {
144+
id = 'Dynatrace'
145+
name = 'Dynatrace LLC'
146+
email = 'opensource@dynatrace.com'
147+
}
148+
}
149+
scm {
150+
connection = 'scm:git:git://github.com/dynatrace-oss/index4j.git'
151+
developerConnection = 'scm:git:ssh://github.com/dynatrace-oss/index4j.git'
152+
url = 'https://github.com/dynatrace-oss/index4j'
153+
}
154+
}
121155
}
122156
}
123157
}
124158

125-
tasks.withType(PublishToMavenLocal) {
126-
doFirst {
127-
println "Publishing '${publication.name}' to maven local with the following artifacts:"
128-
publication.artifacts.each { artifact -> println(" ${artifact.file}") }
129-
}
159+
signing {
160+
useInMemoryPgpKeys(System.getenv('GPG_PRIVATE_KEY'), System.getenv('GPG_PASSPHRASE'))
161+
sign publishing.publications.mavenJava
130162
}
131163

132164
static def readJavaLicense(file, licenseName) {

indices/src/main/java/com/dynatrace/bitsequence/RrrVector.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Dynatrace LLC
2+
* Copyright 2024-2025 Dynatrace LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,17 +34,20 @@
3434
* bits is sparse. For example, a bit sequence of size 2^31 (2,147,483,648) bits stored with a
3535
* sample rate of 256 requires the following amount of bits depending on the sparseness:
3636
*
37+
* <p>
38+
*
3739
* <table border="1">
38-
* <tr align="center">
40+
* <caption>Compression ratio by number of bits set and size</caption>
41+
* <tr style = "text-align: center;">
3942
* <td>Number of set bits </td> <td>Size in bits</td> <td>Compression ratio</td>
4043
* </tr>
41-
* <tr align="right">
44+
* <tr style = "text-align: right;">
4245
* <td>1%</td> <td>809,837,056</td><td>2.65x</td>
4346
* </tr>
44-
* <tr align="right">
47+
* <tr style = "text-align: right;">
4548
* <td>5%</td> <td>1,063,113,216</td><td>2.01x</td>
4649
* </tr>
47-
* <tr align="right">
50+
* <tr style = "text-align: right;">
4851
* <td>10%</td> <td>1,353,711,936</td><td>1.58x</td>
4952
* </tr>
5053
* </table>
@@ -426,6 +429,7 @@ public int getEstimatedMemoryUsage() {
426429
* Serializes this object to an {@code ObjectOutput} stream.
427430
*
428431
* @param objectOutput The stream to which the object will be written
432+
* @throws IOException if an I/O error occurs.
429433
*/
430434
public void write(ObjectOutput objectOutput) throws IOException {
431435
objectOutput.writeByte(SERIAL_VERSION_V0);
@@ -444,6 +448,7 @@ public void write(ObjectOutput objectOutput) throws IOException {
444448
*
445449
* @param objectInput The stream from which to read
446450
* @return The deserialized instance of this object
451+
* @throws IOException if an I/O error occurs.
447452
*/
448453
public static RrrVector read(ObjectInput objectInput) throws IOException {
449454
checkSerialVersion(SERIAL_VERSION_V0, objectInput.readByte());

indices/src/main/java/com/dynatrace/fm/FmIndex.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Dynatrace LLC
2+
* Copyright 2024-2025 Dynatrace LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -944,6 +944,7 @@ public int getAlphabetLength() {
944944
* Serializes this object to an {@code ObjectOutput} stream.
945945
*
946946
* @param objectOutput The stream to which the object will be written
947+
* @throws IOException if an I/O error occurs
947948
*/
948949
public void write(ObjectOutput objectOutput) throws IOException {
949950
objectOutput.writeByte(SERIAL_VERSION_V0);
@@ -978,7 +979,8 @@ public void write(ObjectOutput objectOutput) throws IOException {
978979
* Deserializes an {@code FM-index} from an {@code ObjectInput} stream.
979980
*
980981
* @param objectInput The stream from which to read from
981-
* @return The deserialized instance of this object
982+
* @return The deserialized instance of this object\
983+
* @throws IOException if an I/O error occurs
982984
*/
983985
public static FmIndex read(ObjectInput objectInput) throws IOException {
984986
checkSerialVersion(SERIAL_VERSION_V0, objectInput.readByte());

indices/src/main/java/com/dynatrace/fm/FmIndexBuilder.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Dynatrace LLC
2+
* Copyright 2024-2025 Dynatrace LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,9 @@ public final class FmIndexBuilder {
2121
private int sampleRate = 32;
2222
private boolean enableExtraction = true;
2323

24+
/** Builds a new FmIndexBuilder with a {@code sampleRate} of 32 and extraction enabled. */
25+
public FmIndexBuilder() {}
26+
2427
/**
2528
* Sets the sampling rate for the FM-Index. The lower the value of the sample rate, the higher
2629
* the memory consumption but the higher the query throughput. The default value is 32. A value

indices/src/main/java/com/dynatrace/intsequence/IntVector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Dynatrace LLC
2+
* Copyright 2024-2025 Dynatrace LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -192,6 +192,7 @@ public int getElementWidth() {
192192
* Serializes this object to an {@code ObjectOutput} stream.
193193
*
194194
* @param objectOutput The stream to which the object will be written
195+
* @throws IOException if an I/O error occurs
195196
*/
196197
public void write(ObjectOutput objectOutput) throws IOException {
197198
objectOutput.writeByte(SERIAL_VERSION_V0);
@@ -207,6 +208,7 @@ public void write(ObjectOutput objectOutput) throws IOException {
207208
*
208209
* @param objectInput The stream from which to read from
209210
* @return The deserialized instance of the object
211+
* @throws IOException if an I/O error occurs
210212
*/
211213
public static IntVector read(ObjectInput objectInput) throws IOException {
212214
checkSerialVersion(SERIAL_VERSION_V0, objectInput.readByte());

indices/src/main/java/com/dynatrace/intsequence/VariableWidthIntVector.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Dynatrace LLC
2+
* Copyright 2024-2025 Dynatrace LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,8 @@ private VariableWidthIntVector(long[] words) {
5151
}
5252

5353
/**
54-
* Sets the value at {@code position} with {@value} using the minimum number of bits possible.
54+
* Sets the value at {@code position} with {@code value} using the minimum number of bits
55+
* possible.
5556
*
5657
* @param position The absolute position in bit counts
5758
* @param value The value to write
@@ -85,7 +86,7 @@ public void setValue(long position, long value) {
8586
}
8687

8788
/**
88-
* Sets the value at {@code position} with {@value} using the given number of bits.
89+
* Sets the value at {@code position} with {@code value} using the given number of bits.
8990
*
9091
* @param position The absolute position in bit counts
9192
* @param value The value to write
@@ -171,6 +172,7 @@ public int getSizeInBytes() {
171172
* Serializes this object to an {@code ObjectOutput} stream.
172173
*
173174
* @param objectOutput The stream to which the object will be written
175+
* @throws IOException if an I/O error occurs
174176
*/
175177
public void write(ObjectOutput objectOutput) throws IOException {
176178
objectOutput.writeByte(SERIAL_VERSION_V0);
@@ -185,6 +187,7 @@ public void write(ObjectOutput objectOutput) throws IOException {
185187
*
186188
* @param objectInput The stream from which to read from
187189
* @return The deserialized instance of this object
190+
* @throws IOException if an I/O error occurs
188191
*/
189192
public static VariableWidthIntVector read(ObjectInput objectInput) throws IOException {
190193
checkSerialVersion(SERIAL_VERSION_V0, objectInput.readByte());

indices/src/main/java/com/dynatrace/run/Runner.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Dynatrace LLC
2+
* Copyright 2024-2025 Dynatrace LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,12 +22,22 @@
2222
import java.nio.file.Files;
2323
import java.nio.file.Path;
2424

25+
/** A simple Main class template to build and query an FM-Index. */
2526
public final class Runner {
2627

2728
private Runner() {
2829
// Main class
2930
}
3031

32+
/**
33+
* Example Main class which builds an FM-Index of the given file and sample rate and then
34+
* queries the number of times the string "INFO" appears.
35+
*
36+
* @param args An array of size two, where the first string is the location of the input file
37+
* and the second is the sample rate for the FM-Index.
38+
* @throws IOException if the file does not exist
39+
* @throws IllegalArgumentException if the arguments are not correctly supplied
40+
*/
3141
public static void main(String[] args) throws IOException {
3242

3343
if (args.length < 2) {

indices/src/main/java/com/dynatrace/suffixarray/SuffixArray.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Dynatrace LLC
2+
* Copyright 2024-2025 Dynatrace LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -168,6 +168,7 @@ public int[] getSuffixArray() {
168168
* Serializes this object to an {@code ObjectOutput} stream.
169169
*
170170
* @param objectOutput The stream to which the object will be written
171+
* @throws IOException if an I/O error occurs
171172
*/
172173
public void write(ObjectOutput objectOutput) throws IOException {
173174
objectOutput.writeByte(SERIAL_VERSION_V0);
@@ -185,6 +186,7 @@ public void write(ObjectOutput objectOutput) throws IOException {
185186
*
186187
* @param objectInput The stream from which to read from
187188
* @return The deserialized instance of this object
189+
* @throws IOException if an I/O error occurs
188190
*/
189191
public static SuffixArray read(ObjectInput objectInput) throws IOException {
190192
checkSerialVersion(SERIAL_VERSION_V0, objectInput.readByte());

indices/src/main/java/com/dynatrace/wavelet/WaveletFixedBlockBoosting.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Dynatrace LLC
2+
* Copyright 2024-2025 Dynatrace LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -282,6 +282,7 @@ private static long restoreCodeFromBlockHeader(
282282
*
283283
* @param objectInput The stream from which to read from
284284
* @return The deserialized instance of this object
285+
* @throws IOException if an I/O error occurs
285286
*/
286287
public static WaveletFixedBlockBoosting read(ObjectInput objectInput) throws IOException {
287288
checkSerialVersion(SERIAL_VERSION_V0, objectInput.readByte());
@@ -1540,6 +1541,7 @@ public long inverseSelect(long position) {
15401541
* Serializes this object to an {@code ObjectOutput} stream.
15411542
*
15421543
* @param objectOutput The stream to which the object will be written
1544+
* @throws IOException if an I/O error occurs
15431545
*/
15441546
public void write(ObjectOutput objectOutput) throws IOException {
15451547
objectOutput.writeByte(SERIAL_VERSION_V0);

0 commit comments

Comments
 (0)