org.apache.sis.math.Vector.size()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中org.apache.sis.math.Vector.size()方法的一些代码示例,展示了Vector.size()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.size()方法的具体详情如下:
包路径:org.apache.sis.math.Vector
类名称:Vector
方法名:size

Vector.size介绍

[英]Returns the number of elements in this vector.
[中]返回此向量中的元素数。

代码示例

代码示例来源:origin: org.apache.sis.storage/sis-netcdf

/**
 * Returns the number of features.
 */
@Override
public long estimateSize() {
  return counts.size();
}

代码示例来源:origin: apache/sis

/**
 * Returns the number of features.
 */
@Override
public long estimateSize() {
  return counts.size();
}

代码示例来源:origin: apache/sis

/**
 * Returns the number of instants in this list.
 */
@Override
public int size() {
  return times.size();
}

代码示例来源:origin: apache/sis

/**
 * Returns the number of features in this set.
 *
 * @return the number of features.
 */
@Override
protected Integer getFeatureCount() {
  return counts.size();
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Creates a concatenated vector.
 *
 * @param first   the vector for the lower indices.
 * @param second  the vector for the higher indices.
 */
public ConcatenatedVector(final Vector first, final Vector second) {
  this.first  = first;
  this.second = second;
  this.limit  = first.size();
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Returns the length of this vector.
 */
@Override
public int size() {
  return limit + second.size();
}

代码示例来源:origin: org.apache.sis.core/sis-feature

/**
 * Returns the number of instants in this list.
 */
@Override
public int size() {
  return times.size();
}

代码示例来源:origin: apache/sis

/**
 * Creates a concatenated vector.
 *
 * @param first   the vector for the lower indices.
 * @param second  the vector for the higher indices.
 */
public ConcatenatedVector(final Vector first, final Vector second) {
  this.first  = first;
  this.second = second;
  this.limit  = first.size();
}

代码示例来源:origin: apache/sis

/**
 * Returns the length of this vector.
 */
@Override
public int size() {
  return limit + second.size();
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Wraps the given array of ordinate values.
 */
CompoundDirectPositions(final Vector... ordinates) {
  this.ordinates = ordinates;
  final int length = ordinates[0].size();
  for (int i=1; i<ordinates.length; i++) {
    if (ordinates[i].size() != length) {
      throw new IllegalArgumentException(Errors.format(Errors.Keys.MismatchedArrayLengths));
    }
  }
  last  = length - 1;
  index = length;
}

代码示例来源:origin: apache/sis

/**
 * Returns the minimal and maximal values found in this vector.
 *
 * @return minimal and maximal values found in this vector.
 */
public NumberRange<?> range() {
  return range(null, size());
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Returns the minimal and maximal values found in this vector.
 *
 * @return minimal and maximal values found in this vector.
 */
public NumberRange<?> range() {
  return range(null, size());
}

代码示例来源:origin: apache/sis

/**
 * Returns a view which contains the values of this vector in reverse order.
 *
 * <div class="note"><b>Implementation note:</b> this method delegates its work
 * to <code>{@linkplain #subSampling(int,int,int) subSampling}(size-1, -1, {@linkplain #size() size})</code>.
 * This method is declared final in order to force subclasses to override {@code subSampling(…)} instead.</div>
 *
 * @return the vector values in reverse order.
 */
public final Vector reverse() {
  final int length = size();
  return (length > 1) ? subSampling(length-1, -1, length) : this;
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Returns a view which contains the values of this vector in reverse order.
 *
 * <div class="note"><b>Implementation note:</b> this method delegates its work
 * to <code>{@linkplain #subSampling(int,int,int) subSampling}(size-1, -1, {@linkplain #size() size})</code>.
 * This method is declared final in order to force subclasses to override {@code subSampling(…)} instead.</div>
 *
 * @return the vector values in reverse order.
 */
public final Vector reverse() {
  final int length = size();
  return (length > 1) ? subSampling(length-1, -1, length) : this;
}

代码示例来源:origin: apache/sis

/**
 * The range of values in this vector is the range of values in the {@linkplain #base} vector
 * if we use all its data.
 */
@Override
public final NumberRange<?> range() {
  return (cycleLength == base.size()) ? base.range() : super.range();
}

代码示例来源:origin: apache/sis

/**
 * Creates a vector of repeated data from the result of a call to {@link Vector#repetitions(int...)}.
 *
 * @param base         the vector on which this vector is derived from.
 * @param repetitions  results of {@link Vector#repetitions(int...)}. Must be non-empty.
 * @param tolerance    tolerance factor for compression of the base vector.
 */
RepeatedVector(final Vector base, final int[] repetitions, final double tolerance) {
  size        = base.size();
  occurrences = repetitions[0];
  cycleLength = (repetitions.length >= 2) ? repetitions[1] : size / occurrences;
  this.base   = base.subSampling(0, occurrences, cycleLength).compress(tolerance);
}

代码示例来源:origin: apache/sis

/**
   * Asserts that the content of the given vector are equal.
   * The vectors do not need to use the same element type.
   */
  private static void assertContentEquals(final Vector expected, final Vector actual) {
    final int length = expected.size();
    assertEquals("size", length, actual.size());
    for (int i=0; i<length; i++) {
      assertEquals("value", expected.doubleValue(i), actual.doubleValue(i), STRICT);
    }
  }
}

代码示例来源:origin: apache/sis

/**
 * Tests {@link SequenceVector} with byte values.
 */
@Test
public void testSequenceOfBytes() {
  vector = Vector.createSequence(100, 2, 10);
  assertEquals(Integer.class, vector.getElementType());
  assertEquals(10, vector.size());
  for (int i=0; i<vector.size(); i++) {
    assertEquals(100 + 2*i, vector.byteValue(i));
  }
}

代码示例来源:origin: apache/sis

/**
 * Tests {@link SequenceVector} with float values.
 */
@Test
public void testSequenceOfFloats() {
  vector = Vector.createSequence(100, 0.1, 10);
  assertEquals(Double.class, vector.getElementType());
  assertEquals(10, vector.size());
  for (int i=0; i<vector.size(); i++) {
    assertEquals(100 + 0.1*i, vector.doubleValue(i), 1E-10);
  }
}

代码示例来源:origin: apache/sis

/**
 * Tests a vector backed by an array of strings.
 * This is not recommended, but happen in GDAL extensions of GeoTIFF.
 * See {@code org.apache.sis.storage.geotiff.Type.ASCII}.
 */
@Test
public void testStringArray() {
  vector = Vector.create(new String[] {"100", "80", "-20"}, false);
  assertEquals(  3, vector.size());
  assertEquals(100, vector.intValue(0));
  assertEquals( 80, vector.shortValue(1));
  assertEquals(-20, vector.doubleValue(2), STRICT);
}

相关文章