add javadoc to MassSpectrum
@@ -29,11 +29,10 @@ import javax.annotation.Nullable;
* Iterable, but there is an important point - to avoid consuming memory for each DataPoint
* instance, we will iterate over the stored data points with a single DataPoint instance that is
* incrementing an internal cursor. That means this code will work:
- *
+ * <p>
* {@code for (DataPoint d : spectrum) System.out.println(d.getMz() + ":" + d.getIntensity();} but
- * this code will NOT work:
- * {@code ArrayList<DataPoint> list = new ArrayList<>(); list.addAll(spectrum);}
- *
+ * this code will NOT work: {@code ArrayList<DataPoint> list = new ArrayList<>();
+ * list.addAll(spectrum);}
*/
public interface MassSpectrum extends Iterable<DataPoint> {
@@ -51,30 +50,34 @@ public interface MassSpectrum extends Iterable<DataPoint> {
MassSpectrumType getSpectrumType();
/**
- * @return The m/z values of this spectrum sorted in m/z order. The capacity of the returned
- * buffer is equivalent to the number of data points in this spectrum.
+ * @param dst A buffer the m/z values will be written into. The buffer should ideally have the
+ * size {@link #getNumberOfDataPoints()}. Some implementations of mass spectrum
+ * reallocate a new buffer, if the current buffer is not big enough.
+ * @return The buffer the m/z values were written into. Usually the same as the supplied buffer.
+ * However, a new buffer will be allocated if the original buffer is not big enough.
*/
-// @Nonnull
-// DoubleBuffer getMzValues();
+ double[] getMzValues(@Nonnull double[] dst);
/**
- * @return The intensity values corresponding to the m/z values returned by getMzValues(). The
- * capacity of the returned buffer is equivalent to the number of data points in this spectrum.
+ * @param dst A buffer the intensity values will be written into. The buffer should ideally have
+ * the size {@link #getNumberOfDataPoints()}. Some implementations of mass spectrum
+ * reallocate a new buffer, if the current buffer is not big enough.
+ * @return The buffer the intensity values were written into. Usually the same as the supplied
+ * buffer. However, a new buffer will be allocated if the original buffer is not big enough.
*/
-// @Nonnull
-// DoubleBuffer getIntensityValues();
-
- double[] getMzValues(@Nonnull double[] dst);
-
double[] getIntensityValues(@Nonnull double[] dst);
/**
- * A shortcut method for {@code getMzValues().get(index)}
+ *
+ * @param index The data point index.
+ * @return The m/z at the given index.
*/
double getMzValue(int index);
/**
- * A shortcut method for {@code getIntensityValues().get(index)}
+ *
+ * @param index The data point index.
+ * @return The intensity at the given index.
*/
double getIntensityValue(int index);
@@ -115,7 +118,7 @@ public interface MassSpectrum extends Iterable<DataPoint> {
* Creates a stream of DataPoints to iterate over this array. To avoid consuming memory for each
* DataPoint instance, we will iterate over the stored data points with a single DataPoint
* instance that is incrementing an internal cursor. That means this code will NOT work:
- *
+ * <p>
* {@code ArrayList<DataPoint> list = spectrum.stream().collect();}
*
* @return A stream of DataPoint represented by a single DataPoint instance that is iterating over
