This is an automated email from the ASF dual-hosted git repository. bchapuis pushed a commit to branch data-refactoring in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit c08db34632e0a4b68f44ab2e07f6bc7065f09731 Author: Bertil Chapuis <[email protected]> AuthorDate: Sat Apr 5 14:30:14 2025 +0200 Improve the javadoc for the DataType --- .../baremaps/data/type/BooleanArrayDataType.java | 4 ++- .../apache/baremaps/data/type/BooleanDataType.java | 8 +++-- .../baremaps/data/type/BooleanListDataType.java | 4 ++- .../baremaps/data/type/ByteArrayDataType.java | 2 +- .../apache/baremaps/data/type/ByteDataType.java | 10 ++++--- .../baremaps/data/type/ByteListDataType.java | 2 +- .../data/type/CoordinateArrayDataType.java | 2 +- .../baremaps/data/type/CoordinateDataType.java | 6 ++-- .../org/apache/baremaps/data/type/DataType.java | 24 +++++++-------- .../baremaps/data/type/DoubleArrayDataType.java | 6 ++-- .../apache/baremaps/data/type/DoubleDataType.java | 10 ++++--- .../baremaps/data/type/DoubleListDataType.java | 6 ++-- .../baremaps/data/type/FixedSizeDataType.java | 8 ++--- .../baremaps/data/type/FloatArrayDataType.java | 6 ++-- .../apache/baremaps/data/type/FloatDataType.java | 6 ++-- .../baremaps/data/type/FloatListDataType.java | 6 ++-- .../data/type/GeometryCollectionDataType.java | 10 +++---- .../baremaps/data/type/GeometryDataType.java | 8 ++--- .../baremaps/data/type/IntegerArrayDataType.java | 7 +++-- .../apache/baremaps/data/type/IntegerDataType.java | 6 ++-- .../baremaps/data/type/IntegerListDataType.java | 7 +++-- .../baremaps/data/type/LineStringDataType.java | 6 ++-- .../apache/baremaps/data/type/ListDataType.java | 9 +++--- .../apache/baremaps/data/type/LonLatDataType.java | 23 +++++++++++++- .../baremaps/data/type/LongArrayDataType.java | 6 ++-- .../apache/baremaps/data/type/LongDataType.java | 7 ++++- .../baremaps/data/type/LongListDataType.java | 6 ++-- .../org/apache/baremaps/data/type/MapDataType.java | 16 ++++++++++ .../baremaps/data/type/MemoryAlignedDataType.java | 7 +++-- .../data/type/MultiLineStringDataType.java | 6 ++-- .../baremaps/data/type/MultiPointDataType.java | 6 ++-- .../baremaps/data/type/MultiPolygonDataType.java | 6 ++-- .../baremaps/data/type/NullableDataType.java | 10 +++++-- .../apache/baremaps/data/type/PairDataType.java | 35 +++++++++++++++++++++- .../apache/baremaps/data/type/PointDataType.java | 6 ++-- .../apache/baremaps/data/type/PolygonDataType.java | 6 ++-- .../org/apache/baremaps/data/type/RowDataType.java | 14 ++++++++- .../baremaps/data/type/ShortArrayDataType.java | 4 ++- .../apache/baremaps/data/type/ShortDataType.java | 8 +++-- .../baremaps/data/type/ShortListDataType.java | 6 ++-- .../baremaps/data/type/SmallIntegerDataType.java | 12 ++++---- .../baremaps/data/type/SmallLongDataType.java | 12 ++++---- .../apache/baremaps/data/type/StringDataType.java | 2 +- .../org/apache/baremaps/data/type/WKBDataType.java | 23 +++++++------- 44 files changed, 253 insertions(+), 131 deletions(-) diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanArrayDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanArrayDataType.java index 328a483e0..628eaf413 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanArrayDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanArrayDataType.java @@ -21,7 +21,9 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing lists of floats in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing arrays of boolean values in {@link ByteBuffer}s. + */ public class BooleanArrayDataType implements DataType<boolean[]> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanDataType.java index 5758aad52..495c32db5 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanDataType.java @@ -23,10 +23,14 @@ import static java.lang.Boolean.TRUE; import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing bytes in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing boolean values in {@link ByteBuffer}s. + */ public class BooleanDataType extends MemoryAlignedDataType<Boolean> { - /** Constructs a {@link ByteDataType}. */ + /** + * Constructs a {@link BooleanDataType} with a fixed size of {@link Byte#BYTES}. + */ public BooleanDataType() { super(Byte.BYTES); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanListDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanListDataType.java index 0368a67a1..52c60bd58 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanListDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/BooleanListDataType.java @@ -23,7 +23,9 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -/** A {@link DataType} for reading and writing lists of floats in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing lists of boolean values in {@link ByteBuffer}s. + */ public class BooleanListDataType implements DataType<List<Boolean>> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteArrayDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteArrayDataType.java index c1210dcb1..787f4bb42 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteArrayDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteArrayDataType.java @@ -21,7 +21,7 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; /** - * A {@link DataType} for reading and writing lists of values in {@link ByteBuffer}s. + * A {@link DataType} for reading and writing byte arrays in {@link ByteBuffer}s. */ public class ByteArrayDataType implements DataType<byte[]> { diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteDataType.java index 1c14bd945..e284f4c88 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteDataType.java @@ -17,14 +17,16 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing bytes in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing byte values in {@link ByteBuffer}s. + */ public class ByteDataType extends MemoryAlignedDataType<Byte> { - /** Constructs a {@link ByteDataType}. */ + /** + * Constructs a {@link ByteDataType} with a fixed size of {@link Byte#BYTES}. + */ public ByteDataType() { super(Byte.BYTES); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteListDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteListDataType.java index 8ed14b208..41248ccd2 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteListDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ByteListDataType.java @@ -24,7 +24,7 @@ import java.nio.ByteBuffer; import java.util.List; /** - * A {@link DataType} for reading and writing lists of bytes in {@link ByteBuffer}s. + * A {@link DataType} for reading and writing lists of byte values in {@link ByteBuffer}s. */ public class ByteListDataType implements DataType<List<Byte>> { diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/CoordinateArrayDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/CoordinateArrayDataType.java index 124dc1e99..7b2afc939 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/CoordinateArrayDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/CoordinateArrayDataType.java @@ -21,7 +21,7 @@ import java.nio.ByteBuffer; import org.locationtech.jts.geom.Coordinate; /** - * A data type for {@link Coordinate} arrays. + * A {@link DataType} for reading and writing arrays of {@link Coordinate} values in {@link ByteBuffer}s. */ public class CoordinateArrayDataType implements DataType<Coordinate[]> { diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/CoordinateDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/CoordinateDataType.java index 0e4d99961..e1b2a9966 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/CoordinateDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/CoordinateDataType.java @@ -22,10 +22,12 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; import org.locationtech.jts.geom.Coordinate; -/** A {@link DataType} for reading and writing {@link Coordinate}s in {@link ByteBuffer}s. */ +/** A {@link DataType} for reading and writing {@link Coordinate} values in {@link ByteBuffer}s. */ public class CoordinateDataType extends MemoryAlignedDataType<Coordinate> { - /** Constructs a {@link CoordinateDataType}. */ + /** + * Constructs a {@link CoordinateDataType} with a fixed size of two {@link Double#BYTES}. + */ public CoordinateDataType() { super(Double.BYTES * 2); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/DataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/DataType.java index 281cc794b..26f9901b1 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/DataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/DataType.java @@ -25,7 +25,7 @@ import java.nio.ByteBuffer; * A data type for reading and writing values in {@link ByteBuffer}s. Read and write operations must * use absolute positions within the {@link ByteBuffer}. * - * @param <T> + * @param <T> the type of value being read or written */ public interface DataType<T> { @@ -33,34 +33,34 @@ public interface DataType<T> { * Returns the size of the value. * * @param value the value - * @return the size of the value + * @return the size of the value in bytes */ int size(final T value); /** * Returns the size of the value stored at the specified position in a {@link ByteBuffer}. * - * @param buffer the buffer - * @param position the position - * @return the size of the value + * @param buffer the buffer containing the value + * @param position the absolute position of the value within the buffer + * @return the size of the value in bytes */ int size(final ByteBuffer buffer, final int position); /** - * Write a value. + * Writes a value to the specified position in a {@link ByteBuffer}. * - * @param buffer the source buffer - * @param position the absolute position of the value within the buffer - * @param value the value + * @param buffer the destination buffer + * @param position the absolute position within the buffer to write the value + * @param value the value to write */ void write(final ByteBuffer buffer, final int position, final T value); /** - * Read a value. + * Reads a value from the specified position in a {@link ByteBuffer}. * * @param buffer the source buffer - * @param position the absolute position of the value within the buffer - * @return the object + * @param position the absolute position within the buffer to read the value + * @return the read value */ T read(final ByteBuffer buffer, final int position); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleArrayDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleArrayDataType.java index ecd83f681..cb2ce175c 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleArrayDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleArrayDataType.java @@ -17,11 +17,11 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing lists of doubles in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing arrays of double values in {@link ByteBuffer}s. + */ public class DoubleArrayDataType implements DataType<double[]> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleDataType.java index 030b36c63..219f50bb4 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleDataType.java @@ -17,14 +17,16 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing doubles in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing double values in {@link ByteBuffer}s. + */ public class DoubleDataType extends MemoryAlignedDataType<Double> { - /** Constructs a {@link DoubleDataType}. */ + /** + * Constructs a {@link DoubleDataType} with a fixed size of {@link Double#BYTES}. + */ public DoubleDataType() { super(Double.BYTES); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleListDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleListDataType.java index 16e1133d6..5d2e8fa6f 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleListDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/DoubleListDataType.java @@ -17,13 +17,13 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -/** A {@link DataType} for reading and writing lists of doubles in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing lists of double values in {@link ByteBuffer}s. + */ public class DoubleListDataType implements DataType<List<Double>> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/FixedSizeDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/FixedSizeDataType.java index 04a51bcfd..f62cb427b 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/FixedSizeDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/FixedSizeDataType.java @@ -24,7 +24,7 @@ import java.nio.ByteBuffer; /** * A {@link DataType} for reading and writing values in {@link ByteBuffer}s whose size is fixed. * - * @param <T> + * @param <T> the type of value being read or written */ public abstract class FixedSizeDataType<T> implements DataType<T> { @@ -33,7 +33,7 @@ public abstract class FixedSizeDataType<T> implements DataType<T> { /** * Creates a {@link FixedSizeDataType} with a fixed size. * - * @param size the size of the value + * @param size the size of the value in bytes */ protected FixedSizeDataType(final int size) { this.size = size; @@ -52,9 +52,9 @@ public abstract class FixedSizeDataType<T> implements DataType<T> { } /** - * Returns the size of the data type. + * Returns the fixed size of this data type. * - * @return the size of the data type + * @return the size in bytes */ public int size() { return size; diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatArrayDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatArrayDataType.java index a970f8f0d..4f0b303c2 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatArrayDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatArrayDataType.java @@ -17,11 +17,11 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing lists of floats in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing arrays of float values in {@link ByteBuffer}s. + */ public class FloatArrayDataType implements DataType<float[]> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatDataType.java index 660a21bd5..56faa817b 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatDataType.java @@ -22,11 +22,13 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; /** - * A {@link DataType} for reading and writing floats in {@link ByteBuffer}s. + * A {@link DataType} for reading and writing float values in {@link ByteBuffer}s. */ public class FloatDataType extends MemoryAlignedDataType<Float> { - /** Constructs a {@link FloatDataType}. */ + /** + * Constructs a {@link FloatDataType} with a fixed size of {@link Float#BYTES}. + */ public FloatDataType() { super(Float.BYTES); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatListDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatListDataType.java index 3f11fc5ba..e25e5f66e 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatListDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/FloatListDataType.java @@ -17,13 +17,13 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -/** A {@link DataType} for reading and writing lists of floats in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing lists of float values in {@link ByteBuffer}s. + */ public class FloatListDataType implements DataType<List<Float>> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/GeometryCollectionDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/GeometryCollectionDataType.java index 768a27b67..75c71c274 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/GeometryCollectionDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/GeometryCollectionDataType.java @@ -24,7 +24,7 @@ import org.locationtech.jts.geom.GeometryCollection; import org.locationtech.jts.geom.GeometryFactory; /** - * A data type for {@link GeometryCollection} objects. + * A {@link DataType} for reading and writing {@link GeometryCollection} objects in {@link ByteBuffer}s. */ public class GeometryCollectionDataType implements DataType<GeometryCollection> { @@ -33,14 +33,14 @@ public class GeometryCollectionDataType implements DataType<GeometryCollection> private final GeometryDataType geometryDataType; /** - * Constructs a {@code GeometryCollectionDataType} with a default {@code GeometryFactory}. + * Constructs a {@link GeometryCollectionDataType} with a default {@link GeometryFactory}. */ public GeometryCollectionDataType() { this(new GeometryFactory(), new GeometryDataType()); } /** - * Constructs a {@code GeometryCollectionDataType} with a specified {@code GeometryFactory}. + * Constructs a {@link GeometryCollectionDataType} with a specified {@link GeometryFactory}. * * @param geometryFactory the geometry factory */ @@ -49,8 +49,8 @@ public class GeometryCollectionDataType implements DataType<GeometryCollection> } /** - * Constructs a {@code GeometryCollectionDataType} with a specified {@code GeometryFactory} and - * {@code GeometryDataType}. + * Constructs a {@link GeometryCollectionDataType} with a specified {@link GeometryFactory} and + * {@link GeometryDataType}. * * @param geometryFactory the geometry factory * @param geometryDataType the geometry data type diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/GeometryDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/GeometryDataType.java index 8e741d007..c124ff091 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/GeometryDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/GeometryDataType.java @@ -22,7 +22,7 @@ import java.nio.ByteBuffer; import org.locationtech.jts.geom.*; /** - * A {@code DataType} for {@link Geometry} objects. + * A {@link DataType} for reading and writing {@link Geometry} objects in {@link ByteBuffer}s. */ public class GeometryDataType implements DataType<Geometry> { @@ -42,16 +42,16 @@ public class GeometryDataType implements DataType<Geometry> { private final GeometryCollectionDataType geometryCollectionDataType; /** - * Constructs a {@code GeometryDataType} with a default {@code GeometryFactory}. + * Constructs a {@link GeometryDataType} with a default {@link GeometryFactory}. */ public GeometryDataType() { this(new GeometryFactory()); } /** - * Constructs a {@code GeometryDataType} with a specified {@code GeometryFactory}. + * Constructs a {@link GeometryDataType} with a specified {@link GeometryFactory}. * - * @param geometryFactory + * @param geometryFactory the geometry factory */ public GeometryDataType(GeometryFactory geometryFactory) { this.pointDataType = new PointDataType(geometryFactory); diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerArrayDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerArrayDataType.java index f66bb2255..45081b4c8 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerArrayDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerArrayDataType.java @@ -17,11 +17,11 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing lists of integers in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing arrays of integer values in {@link ByteBuffer}s. + */ public class IntegerArrayDataType implements DataType<int[]> { /** {@inheritDoc} */ @@ -30,6 +30,7 @@ public class IntegerArrayDataType implements DataType<int[]> { return Integer.BYTES + values.length * Integer.BYTES; } + /** {@inheritDoc} */ @Override public int size(final ByteBuffer buffer, final int position) { return buffer.getInt(position); diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerDataType.java index 7fdfd23e8..34cd9ef50 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerDataType.java @@ -22,11 +22,13 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; /** - * A {@link DataType} for reading and writing integers in {@link ByteBuffer}s. + * A {@link DataType} for reading and writing integer values in {@link ByteBuffer}s. */ public class IntegerDataType extends MemoryAlignedDataType<Integer> { - /** Constructs a {@link IntegerDataType}. */ + /** + * Constructs an {@link IntegerDataType} with a fixed size of {@link Integer#BYTES}. + */ public IntegerDataType() { super(Integer.BYTES); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerListDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerListDataType.java index 35b7e813e..df4525ac3 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerListDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/IntegerListDataType.java @@ -17,13 +17,13 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -/** A {@link DataType} for reading and writing lists of integers in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing lists of integer values in {@link ByteBuffer}s. + */ public class IntegerListDataType implements DataType<List<Integer>> { /** {@inheritDoc} */ @@ -32,6 +32,7 @@ public class IntegerListDataType implements DataType<List<Integer>> { return Integer.BYTES + values.size() * Integer.BYTES; } + /** {@inheritDoc} */ @Override public int size(final ByteBuffer buffer, final int position) { return buffer.getInt(position); diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LineStringDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LineStringDataType.java index c6960230f..527639894 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LineStringDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LineStringDataType.java @@ -22,7 +22,7 @@ import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.LineString; /** - * A data type for {@link LineString} objects. + * A {@link DataType} for reading and writing {@link LineString} objects in {@link ByteBuffer}s. */ public class LineStringDataType implements DataType<LineString> { @@ -31,14 +31,14 @@ public class LineStringDataType implements DataType<LineString> { private final CoordinateArrayDataType coordinateArrayDataType; /** - * Constructs a {@code LineStringDataType} with a default {@code GeometryFactory}. + * Constructs a {@link LineStringDataType} with a default {@link GeometryFactory}. */ public LineStringDataType() { this(new GeometryFactory()); } /** - * Constructs a {@code LineStringDataType} with a specified {@code GeometryFactory}. + * Constructs a {@link LineStringDataType} with a specified {@link GeometryFactory}. * * @param geometryFactory the geometry factory */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ListDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ListDataType.java index 0c0d9c819..abcda4835 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ListDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ListDataType.java @@ -17,23 +17,23 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; /** * A {@link DataType} for reading and writing lists of objects in {@link ByteBuffer}s. + * + * @param <T> the type of elements in the list */ public class ListDataType<T> implements DataType<List<T>> { public final DataType<T> dataType; /** - * Constructs a {@link ListDataType} with a data type. + * Constructs a {@link ListDataType} with a data type for its elements. * - * @param dataType the data type of the values + * @param dataType the data type of the list elements */ public ListDataType(final DataType<T> dataType) { this.dataType = dataType; @@ -49,6 +49,7 @@ public class ListDataType<T> implements DataType<List<T>> { return size; } + /** {@inheritDoc} */ @Override public int size(final ByteBuffer buffer, final int position) { return buffer.getInt(position); diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LonLatDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LonLatDataType.java index 939e6e8a1..2b7758a6e 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LonLatDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LonLatDataType.java @@ -32,11 +32,20 @@ public class LonLatDataType extends MemoryAlignedDataType<Coordinate> { private static final long SHIFT = 32; private static final long MASK = (1L << 32) - 1L; - /** Constructs a {@link LonLatDataType}. */ + /** + * Constructs a {@link LonLatDataType} with a fixed size of {@link Long#BYTES}. + */ public LonLatDataType() { super(Long.BYTES); } + /** + * Encodes longitude and latitude values into a single long value. + * + * @param lon the longitude value + * @param lat the latitude value + * @return the encoded coordinate as a long value + */ public static long encodeLonLat(final double lon, final double lat) { long x = (long) (((lon + 180) / 360) * BITS); long y = (long) (((lat + 90) / 180) * BITS); @@ -45,11 +54,23 @@ public class LonLatDataType extends MemoryAlignedDataType<Coordinate> { return l | r; } + /** + * Decodes the longitude value from an encoded coordinate. + * + * @param value the encoded coordinate + * @return the longitude value + */ public static double decodeLon(final long value) { double l = (value >>> 32); return (l / BITS) * 360 - 180; } + /** + * Decodes the latitude value from an encoded coordinate. + * + * @param value the encoded coordinate + * @return the latitude value + */ public static double decodeLat(final long value) { long r = (value & MASK); return (r / BITS) * 180 - 90; diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongArrayDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongArrayDataType.java index d426b3aa6..2b03165e1 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongArrayDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongArrayDataType.java @@ -17,11 +17,11 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing lists of longs in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing arrays of long values in {@link ByteBuffer}s. + */ public class LongArrayDataType implements DataType<long[]> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongDataType.java index ddff6d3e7..78727fe9c 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongDataType.java @@ -21,9 +21,14 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing longs in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing long values in {@link ByteBuffer}s. + */ public class LongDataType extends MemoryAlignedDataType<Long> { + /** + * Constructs a {@link LongDataType} with a fixed size of {@link Long#BYTES}. + */ public LongDataType() { super(Long.BYTES); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongListDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongListDataType.java index df8af2146..926c391e6 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongListDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/LongListDataType.java @@ -17,13 +17,13 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -/** A {@link DataType} for reading and writing lists of longs in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing lists of long values in {@link ByteBuffer}s. + */ public class LongListDataType implements DataType<List<Long>> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MapDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MapDataType.java index 82fda0bb8..141c3894e 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MapDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MapDataType.java @@ -21,17 +21,30 @@ import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; +/** + * A {@link DataType} for reading and writing map objects in {@link ByteBuffer}s. + * + * @param <K> the type of keys in the map + * @param <V> the type of values in the map + */ public class MapDataType<K, V> implements DataType<Map<K, V>> { private final DataType<K> keyType; private final DataType<V> valueType; + /** + * Constructs a {@link MapDataType} with data types for keys and values. + * + * @param keyType the data type for map keys + * @param valueType the data type for map values + */ public MapDataType(final DataType<K> keyType, final DataType<V> valueType) { this.keyType = keyType; this.valueType = valueType; } + /** {@inheritDoc} */ @Override public int size(final Map<K, V> value) { int size = Integer.BYTES; @@ -42,11 +55,13 @@ public class MapDataType<K, V> implements DataType<Map<K, V>> { return size; } + /** {@inheritDoc} */ @Override public int size(final ByteBuffer buffer, final int position) { return buffer.getInt(position); } + /** {@inheritDoc} */ @Override public void write(final ByteBuffer buffer, final int position, final Map<K, V> value) { buffer.putInt(position, size(value)); @@ -59,6 +74,7 @@ public class MapDataType<K, V> implements DataType<Map<K, V>> { } } + /** {@inheritDoc} */ @Override public Map<K, V> read(final ByteBuffer buffer, final int position) { int size = buffer.getInt(position); diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MemoryAlignedDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MemoryAlignedDataType.java index 94c44a254..a6c6029b7 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MemoryAlignedDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MemoryAlignedDataType.java @@ -25,14 +25,15 @@ import java.nio.ByteBuffer; * A {@link DataType} for reading and writing values in {@link ByteBuffer}s whose size is memory * aligned. * - * @param <T> + * @param <T> the type of value being read or written */ public abstract class MemoryAlignedDataType<T> extends FixedSizeDataType<T> { /** - * Constructs a {@link MemoryAlignedDataType}. + * Constructs a {@link MemoryAlignedDataType} with a memory-aligned size. * - * @param size + * @param size the size of the value in bytes (must be a power of 2) + * @throws IllegalArgumentException if the size is not a power of 2 */ protected MemoryAlignedDataType(int size) { super(size); diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiLineStringDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiLineStringDataType.java index fd2e773ee..96a750ea9 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiLineStringDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiLineStringDataType.java @@ -24,7 +24,7 @@ import org.locationtech.jts.geom.LineString; import org.locationtech.jts.geom.MultiLineString; /** - * A data type for {@link MultiLineString} objects. + * A {@link DataType} for reading and writing {@link MultiLineString} objects in {@link ByteBuffer}s. */ public class MultiLineStringDataType implements DataType<MultiLineString> { @@ -33,14 +33,14 @@ public class MultiLineStringDataType implements DataType<MultiLineString> { private final GeometryFactory geometryFactory; /** - * Constructs a {@code MultiLineStringDataType} with a default {@code GeometryFactory}. + * Constructs a {@link MultiLineStringDataType} with a default {@link GeometryFactory}. */ public MultiLineStringDataType() { this(new GeometryFactory()); } /** - * Constructs a {@code MultiLineStringDataType} with a specified {@code GeometryFactory}. + * Constructs a {@link MultiLineStringDataType} with a specified {@link GeometryFactory}. * * @param geometryFactory the geometry factory */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiPointDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiPointDataType.java index 8161660c6..ad63c2042 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiPointDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiPointDataType.java @@ -22,7 +22,7 @@ import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.MultiPoint; /** - * A data type for {@link MultiPoint} objects. + * A {@link DataType} for reading and writing {@link MultiPoint} objects in {@link ByteBuffer}s. */ public class MultiPointDataType implements DataType<MultiPoint> { @@ -31,14 +31,14 @@ public class MultiPointDataType implements DataType<MultiPoint> { private final GeometryFactory geometryFactory; /** - * Constructs a {@code MultiPointDataType} with a default {@code GeometryFactory}. + * Constructs a {@link MultiPointDataType} with a default {@link GeometryFactory}. */ public MultiPointDataType() { this(new GeometryFactory()); } /** - * Constructs a {@code MultiPointDataType} with a specified {@code GeometryFactory}. + * Constructs a {@link MultiPointDataType} with a specified {@link GeometryFactory}. * * @param geometryFactory the geometry factory */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiPolygonDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiPolygonDataType.java index b7a881852..be7b68863 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiPolygonDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/MultiPolygonDataType.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import org.locationtech.jts.geom.*; /** - * A data type for {@link GeometryCollection} objects. + * A {@link DataType} for reading and writing {@link MultiPolygon} objects in {@link ByteBuffer}s. */ public class MultiPolygonDataType implements DataType<MultiPolygon> { @@ -31,14 +31,14 @@ public class MultiPolygonDataType implements DataType<MultiPolygon> { private final PolygonDataType polygonDataType; /** - * Constructs a {@code MultiPolygonDataType} with a default {@code GeometryFactory}. + * Constructs a {@link MultiPolygonDataType} with a default {@link GeometryFactory}. */ public MultiPolygonDataType() { this(new GeometryFactory()); } /** - * Constructs a {@code MultiPolygonDataType} with a specified {@code GeometryFactory}. + * Constructs a {@link MultiPolygonDataType} with a specified {@link GeometryFactory}. * * @param geometryFactory the geometry factory */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/NullableDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/NullableDataType.java index 1a70d6d1e..83656c6ca 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/NullableDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/NullableDataType.java @@ -21,15 +21,19 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing nullable values in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing nullable values in {@link ByteBuffer}s. + * + * @param <T> the type of value being read or written + */ public class NullableDataType<T> implements DataType<T> { private final DataType<T> dataType; /** - * Constructs a {@link NullableDataType} with a data type. + * Constructs a {@link NullableDataType} with a data type for the wrapped value. * - * @param dataType the data type of the values + * @param dataType the data type for the non-null values */ public NullableDataType(final DataType<T> dataType) { this.dataType = dataType; diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/PairDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/PairDataType.java index 4f6bc37c5..1964e6030 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/PairDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/PairDataType.java @@ -23,12 +23,23 @@ import java.nio.ByteBuffer; import java.util.Objects; import org.apache.baremaps.data.type.PairDataType.Pair; -/** A {@link DataType} for reading and writing pairs of values in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing pairs of values in {@link ByteBuffer}s. + * + * @param <L> the type of the left value in the pair + * @param <R> the type of the right value in the pair + */ public class PairDataType<L, R> extends FixedSizeDataType<Pair<L, R>> { private final FixedSizeDataType<L> left; private final FixedSizeDataType<R> right; + /** + * Constructs a {@link PairDataType} with data types for left and right values. + * + * @param left the data type for the left value + * @param right the data type for the right value + */ public PairDataType(final FixedSizeDataType<L> left, final FixedSizeDataType<R> right) { super(left.size() + right.size()); this.left = left; @@ -50,21 +61,43 @@ public class PairDataType<L, R> extends FixedSizeDataType<Pair<L, R>> { right.read(buffer, position + left.size())); } + /** + * A class representing a pair of values. + * + * @param <L> the type of the left value + * @param <R> the type of the right value + */ public static class Pair<L, R> { private final L left; private final R right; + /** + * Constructs a pair with left and right values. + * + * @param left the left value + * @param right the right value + */ public Pair(L left, R right) { this.left = left; this.right = right; } + /** + * Returns the left value of the pair. + * + * @return the left value + */ public L left() { return left; } + /** + * Returns the right value of the pair. + * + * @return the right value + */ public R right() { return right; } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/PointDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/PointDataType.java index e48156acb..ed3e2a33a 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/PointDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/PointDataType.java @@ -23,21 +23,21 @@ import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; /** - * A data type for {@link Point} objects. + * A {@link DataType} for reading and writing {@link Point} objects in {@link ByteBuffer}s. */ public class PointDataType implements DataType<Point> { private final GeometryFactory geometryFactory; /** - * Constructs a {@code PointDataType} with a default {@code GeometryFactory}. + * Constructs a {@link PointDataType} with a default {@link GeometryFactory}. */ public PointDataType() { this(new GeometryFactory()); } /** - * Constructs a {@code PointDataType} with a specified {@code GeometryFactory}. + * Constructs a {@link PointDataType} with a specified {@link GeometryFactory}. * * @param geometryFactory the geometry factory */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/PolygonDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/PolygonDataType.java index 86822094d..6bfb32146 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/PolygonDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/PolygonDataType.java @@ -25,7 +25,7 @@ import org.locationtech.jts.geom.LinearRing; import org.locationtech.jts.geom.Polygon; /** - * A data type for {@link Polygon} objects. + * A {@link DataType} for reading and writing {@link Polygon} objects in {@link ByteBuffer}s. */ public class PolygonDataType implements DataType<Polygon> { @@ -34,14 +34,14 @@ public class PolygonDataType implements DataType<Polygon> { private final GeometryFactory geometryFactory; /** - * Constructs a {@code PolygonDataType} with a default {@code GeometryFactory}. + * Constructs a {@link PolygonDataType} with a default {@link GeometryFactory}. */ public PolygonDataType() { this(new GeometryFactory()); } /** - * Constructs a {@code PolygonDataType} with a specified {@code GeometryFactory}. + * Constructs a {@link PolygonDataType} with a specified {@link GeometryFactory}. * * @param geometryFactory the geometry factory */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/RowDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/RowDataType.java index ba8bede60..a4ba70582 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/RowDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/RowDataType.java @@ -27,10 +27,13 @@ import org.apache.baremaps.store.DataRowImpl; import org.apache.baremaps.store.DataSchema; /** - * A data type for rows. + * A {@link DataType} for reading and writing {@link DataRow} objects in {@link ByteBuffer}s. */ public class RowDataType implements DataType<DataRow> { + /** + * Map of data types for each of the supported column types. + */ private static final EnumMap<Type, DataType> types = new EnumMap<>(Type.class); static { @@ -55,10 +58,16 @@ public class RowDataType implements DataType<DataRow> { private final DataSchema rowType; + /** + * Constructs a {@link RowDataType} with a specified schema. + * + * @param rowType the data schema defining the row's structure + */ public RowDataType(DataSchema rowType) { this.rowType = rowType; } + /** {@inheritDoc} */ @Override public int size(final DataRow row) { int size = Integer.BYTES; @@ -72,11 +81,13 @@ public class RowDataType implements DataType<DataRow> { return size; } + /** {@inheritDoc} */ @Override public int size(final ByteBuffer buffer, final int position) { return buffer.getInt(position); } + /** {@inheritDoc} */ @Override public void write(final ByteBuffer buffer, final int position, final DataRow row) { int p = position + Integer.BYTES; @@ -92,6 +103,7 @@ public class RowDataType implements DataType<DataRow> { buffer.putInt(position, p - position); } + /** {@inheritDoc} */ @Override public DataRow read(final ByteBuffer buffer, final int position) { int p = position + Integer.BYTES; diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortArrayDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortArrayDataType.java index a45bb37bd..c242a25eb 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortArrayDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortArrayDataType.java @@ -21,7 +21,9 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing lists of shorts in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing arrays of short values in {@link ByteBuffer}s. + */ public class ShortArrayDataType implements DataType<short[]> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortDataType.java index 02ca4d1d3..e6289e9a8 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortDataType.java @@ -21,10 +21,14 @@ package org.apache.baremaps.data.type; import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing shorts in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing short values in {@link ByteBuffer}s. + */ public class ShortDataType extends FixedSizeDataType<Short> { - /** Constructs a {@link ShortDataType}. */ + /** + * Constructs a {@link ShortDataType} with a fixed size of {@link Short#BYTES}. + */ public ShortDataType() { super(Short.BYTES); } diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortListDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortListDataType.java index 1f99d24a7..8888cddd0 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortListDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/ShortListDataType.java @@ -17,13 +17,13 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -/** A {@link DataType} for reading and writing lists of shorts in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing lists of short values in {@link ByteBuffer}s. + */ public class ShortListDataType implements DataType<List<Short>> { /** {@inheritDoc} */ diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/SmallIntegerDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/SmallIntegerDataType.java index b8ccd7e5f..229de201c 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/SmallIntegerDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/SmallIntegerDataType.java @@ -17,19 +17,21 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing small integers in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing small integer values in {@link ByteBuffer}s + * with a customizable storage size. + */ public class SmallIntegerDataType extends FixedSizeDataType<Integer> { private final int n; /** - * Constructs a {@link SmallIntegerDataType}. + * Constructs a {@link SmallIntegerDataType} with a specified number of bytes. * - * @param n the number of bytes used to store the integer + * @param n the number of bytes used to store the integer (must be between 1 and 4) + * @throws IllegalArgumentException if n is less than 1 or greater than 4 */ public SmallIntegerDataType(int n) { super(n); diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/SmallLongDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/SmallLongDataType.java index 2e7812f04..a2041f5df 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/SmallLongDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/SmallLongDataType.java @@ -17,19 +17,21 @@ package org.apache.baremaps.data.type; - - import java.nio.ByteBuffer; -/** A {@link DataType} for reading and writing small longs in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing small long values in {@link ByteBuffer}s + * with a customizable storage size. + */ public class SmallLongDataType extends FixedSizeDataType<Long> { private final int n; /** - * Constructs a {@link SmallIntegerDataType}. + * Constructs a {@link SmallLongDataType} with a specified number of bytes. * - * @param n the number of bytes used to store the integer + * @param n the number of bytes used to store the long value (must be between 1 and 8) + * @throws IllegalArgumentException if n is less than 1 or greater than 8 */ public SmallLongDataType(int n) { super(n); diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/StringDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/StringDataType.java index a3eb253ad..7050140f8 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/StringDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/StringDataType.java @@ -23,7 +23,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; /** - * A {@link DataType} for reading and writing strings in {@link ByteBuffer}s. + * A {@link DataType} for reading and writing string values in {@link ByteBuffer}s. */ public class StringDataType implements DataType<String> { diff --git a/baremaps-data/src/main/java/org/apache/baremaps/data/type/WKBDataType.java b/baremaps-data/src/main/java/org/apache/baremaps/data/type/WKBDataType.java index 1c3b3bfed..fda9d612d 100644 --- a/baremaps-data/src/main/java/org/apache/baremaps/data/type/WKBDataType.java +++ b/baremaps-data/src/main/java/org/apache/baremaps/data/type/WKBDataType.java @@ -17,8 +17,6 @@ package org.apache.baremaps.data.type; - - import static org.locationtech.jts.io.WKBConstants.wkbNDR; import java.nio.ByteBuffer; @@ -29,7 +27,10 @@ import org.locationtech.jts.io.ParseException; import org.locationtech.jts.io.WKBReader; import org.locationtech.jts.io.WKBWriter; -/** A {@link DataType} for reading and writing {@link Geometry} in {@link ByteBuffer}s. */ +/** + * A {@link DataType} for reading and writing {@link Geometry} objects in Well-Known Binary (WKB) format + * in {@link ByteBuffer}s. + */ public class WKBDataType implements DataType<Geometry> { /** {@inheritDoc} */ @@ -70,14 +71,11 @@ public class WKBDataType implements DataType<Geometry> { return deserialize(bytes); } - public static final GeometryFactory GEOMETRY_FACTORY_WGS84 = - new GeometryFactory(new PrecisionModel(), 4326); - /** - * Serializes a geometry in the WKB format. + * Serializes a geometry into the WKB format. * - * @param geometry - * @return + * @param geometry the geometry to serialize + * @return the serialized geometry as a byte array, or null if the input is null */ private static byte[] serialize(Geometry geometry) { if (geometry == null) { @@ -88,10 +86,11 @@ public class WKBDataType implements DataType<Geometry> { } /** - * Deserializes a geometry in the WKB format. + * Deserializes a geometry from the WKB format. * - * @param wkb - * @return + * @param wkb the WKB byte array to deserialize + * @return the deserialized geometry, or null if the input is null + * @throws IllegalArgumentException if the WKB cannot be parsed */ private static Geometry deserialize(byte[] wkb) { if (wkb == null) {
