@Test public void testGet() { IVectorN vector = VectorN.from(42, 1337, 2); assertThat(vector.get(0)).isEqualTo(vector.x()); assertThat(vector.get(1)).isEqualTo(vector.y()); assertThatThrownBy(() -> vector.get(3)).isExactlyInstanceOf(IllegalArgumentException.class); }
@Override public double get(final int i) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } return data[i]; }
VectorN extends AVectorN { @Override public double get(final int i) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } return data[i]; } }
VectorN extends AVectorN { @Override public double get(final int i) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } return data[i]; } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); }
VectorN extends AVectorN { @Override public double get(final int i) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } return data[i]; } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); static VectorN zero(final int dim); static VectorN empty(); static VectorN from(final double... data); static VectorN copy(final IVector vector); static VectorN fromReal(final RealVector rv); void set(final int i, final double value); VectorN add(final IVector vector); VectorN subtract(final IVector vector); VectorN multiply(final double factor); VectorN apply(final Function<Double, Double> function); @Override double x(); @Override double y(); @Override double get(final int i); @Override int getNumDimensions(); }
VectorN extends AVectorN { @Override public double get(final int i) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } return data[i]; } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); static VectorN zero(final int dim); static VectorN empty(); static VectorN from(final double... data); static VectorN copy(final IVector vector); static VectorN fromReal(final RealVector rv); void set(final int i, final double value); VectorN add(final IVector vector); VectorN subtract(final IVector vector); VectorN multiply(final double factor); VectorN apply(final Function<Double, Double> function); @Override double x(); @Override double y(); @Override double get(final int i); @Override int getNumDimensions();  }