Hi,
In Java, array is also an object, so the` Object[] values` in Tablet.java
is a two-dimension array. Object represents arrays of different type.

Java doesn't have class member function template, however maybe in C++, you
can use that feature to improve the performance. But even in this way, we
cannot only contains 'primitive" types array in tablet, because different
sensors in this tablet may have different types and the number of the
sensors are also unknown.

But you can use variadic template feature introduced since C++11 to fix
that. You can refer to the implementation of tuple in C++, the number of
which is also unknown.

On Wed, Sep 29, 2021 at 9:17 AM Giorgio Zoppi <[email protected]>
wrote:

> Hello again,
> i am in learning mode. I've seen in the Tablet.java an array of Object[]
> and i want to know the rational of this. We know that in Java generics are
> "fake" due to the type erasure, but is there any possibility to replace
> that:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *** deviceId of this tablet */  public String prefixPath;  /** the list of
> measurement schemas for creating the tablet */  private
> List<IMeasurementSchema> schemas;  /**
> measurementId->indexOf(measurementSchema) */  private Map<String, Integer>
> measurementIndex;  /** timestamps in this tablet */  public long[]
> timestamps;  /** each object is a primitive type array, which represents
> values of one measurement */  public Object[] values;  /** each bitmap
> represents the existence of each value in the current column. */  public
> BitMap[] bitMaps;  /** the number of rows to include in this tablet */
> public int rowSize;  /** the maximum number of rows for this tablet */
> private int maxRowNumber;  /** whether this tablet store data of aligned
> timeseries or not */  private boolean isAligned;*
>
>
> With restrictions, i mean a primitive type array  wrapper that it doesn't
> accept virtually everything
> in
> - addValue(String measurementId, int rowIndex, Object value)
>
>
> And replacing addValue with something like
>
> -addValue<T extends Number> ( String measurementId, int rowIndex, T
> Object);
> -addValue<T extends String> ( String measurementId, int rowIndex, T
> Object);
>
> In this way we could have in the tablet only the 'primitive" types and
> using boxing as well.
> What do you think?
> Best Regards,
> Giorgio.
>
>
>
>
>
> --
> Life is a chess game - Anonymous.
>

Reply via email to