- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.geotools.resources.XArray.resize()
方法的一些代码示例,展示了XArray.resize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XArray.resize()
方法的具体详情如下:
包路径:org.geotools.resources.XArray
类名称:XArray
方法名:resize
[英]Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.
[中]返回一个新表,该表包含与数组相同的元素,但具有指定的长度。如果所需的长度大于数组表的初始长度,则返回的表将包含数组的所有元素以及在表末尾初始化为null的元素。相反,如果所需的长度小于数组表的初始长度,则该表将被截断(也就是说,多余的数组元素将被忽略)。如果数组的长度等于length,那么数组将按原样返回。
代码示例来源:origin: org.geotools/gt2-coverageio
/**
* Libre la mmoire rserve en trop. Cette mthode peut tre appele
* lorsqu'on a termin de lire les donnes et qu'on veut les conserver
* en mmoire pendant encore quelque temps.
*/
public void trimToSize() {
if (data != null) {
data = XArray.resize(data, upper);
}
}
代码示例来源:origin: org.geotools/gt2-coverage
/**
* Adds an observer. This observer will be notified everytime a tile initially empty become
* available. If the observer is already present, it will receive multiple notifications.
*/
public synchronized void addTileObserver(final TileObserver observer) {
if (observer != null) {
if (observers == null) {
observers = new TileObserver[] {observer};
} else {
final int length = observers.length;
observers = (TileObserver[]) XArray.resize(observers, length+1);
observers[length] = observer;
}
}
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Add the next element from the iterator to this set. This method doesn't check
* if more element were available; the check must have been done before to invoke
* this method.
*/
private void addNext() {
if (size >= elements.length) {
elements = XArray.resize(elements, size*2);
}
elements[size++] = iterator.next();
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Makes sure that the {@link #visibles} array has the specified capacity.
*/
private void ensureCapacity(final int capacity) {
if (visibles.length < capacity) {
visibles = XArray.resize(visibles, Math.max(size*2, capacity));
}
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Set all values in the current line. The {@code values} argument must be an array,
* which may be of primitive type.
*
* @param values The array to set as values.
* @throws IllegalArgumentException if {@code values} is not an array.
*
* @since 2.4
*/
public void setValues(final Object values) throws IllegalArgumentException {
final int length = Array.getLength(values);
data = XArray.resize(data, length);
for (int i=0; i<length; i++) {
data[i] = Array.get(values, i);
}
count = length;
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Sets all values in the current line. The {@code values} argument must be an array,
* which may be of primitive type.
*
* @param values The array to set as values.
* @throws IllegalArgumentException if {@code values} is not an array.
*
* @since 2.4
*/
public void setValues(final Object values) throws IllegalArgumentException {
final int length = Array.getLength(values);
data = XArray.resize(data, length);
for (int i=0; i<length; i++) {
data[i] = Array.get(values, i);
}
count = length;
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Trims the capacity of this list to be its current size.
*/
public void trimToSize() {
values = XArray.resize(values, length(size));
}
代码示例来源:origin: org.geotools/gt2-coverageio
/**
* Ajoute une ligne de donnes. Si la ligne est plus courte que la longueur
* attendues, les colonnes manquantes seront considres comme contenant des
* {@code NaN}. Si elle est plus longue que la longueur attendue, les
* colonnes en trop seront ignores.
*/
public void add(final double[] line) {
if (data==null) {
if (columnCount<0) columnCount=line.length;
min = new double[columnCount]; Arrays.fill(min, Double.POSITIVE_INFINITY);
max = new double[columnCount]; Arrays.fill(max, Double.NEGATIVE_INFINITY);
data = new float [columnCount*expectedLineCount];
}
final int limit=Math.min(columnCount, line.length);
final int nextUpper = upper+columnCount;
if (nextUpper >= data.length) {
data = XArray.resize(data, Math.max(nextUpper, data.length+Math.min(data.length, 65536)));
}
for (int i=0; i<limit; i++) {
final double value = line[i];
if (value < min[i]) min[i] = value;
if (value > max[i]) max[i] = value;
data[upper+i] = (float)value;
}
Arrays.fill(data, upper+limit, nextUpper, Float.NaN);
upper = nextUpper;
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Sets or adds a value to current line. The index should be in the range 0 to
* {@link #getValueCount} inclusively. If the index is equals to {@link #getValueCount},
* then {@code value} will be appended as a new column after existing data.
*
* @param index Index of the value to add or modify.
* @param value The new value.
* @throws ArrayIndexOutOfBoundsException If the index is outside the expected range.
*/
public void setValue(final int index, final Object value) throws ArrayIndexOutOfBoundsException {
if (index > count) {
throw new ArrayIndexOutOfBoundsException(index);
}
if (value == null) {
throw new IllegalArgumentException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "value"));
}
if (index == count) {
if (index == data.length) {
data = XArray.resize(data, index+Math.min(index, 256));
}
count++;
}
data[index] = value;
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Sets the list size to the given value. If the new size is lower than previous size,
* then the elements after the new size are discarted. If the new size is greater than
* the previous one, then the extra elements are initialized to 0.
*
* @param size The new size.
*/
public void resize(final int size) {
if (size < 0) {
throw new IllegalArgumentException();
}
if (size > this.size) {
int base = this.size * bitCount;
final int offset = base & OFFSET_MASK;
base >>>= BASE_SHIFT;
if (offset != 0 && base < values.length) {
values[base] &= (1L << offset) - 1;
base++;
}
final int length = length(size);
Arrays.fill(values, base, Math.min(length, values.length), 0L);
if (length > values.length) {
values = XArray.resize(values, length);
}
}
this.size = size;
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Add the specified elements to the selection list (the one to appears on the right side). If
* an element specified in the {@code selected} collection has not been previously {@linkplain
* #addElements(Collection) added}, it will be ignored.
*
* @since 2.3
*/
public void selectElements(final Collection selected) {
final Model source = (Model) left .getModel();
final Model target = (Model) right.getModel();
int[] indices = new int[Math.min(selected.size(), source.choices.size())];
int indice=0, count=0;
for (final Iterator it=source.choices.iterator(); it.hasNext(); indice++) {
if (selected.contains(ListElement.unwrap(it.next()))) {
indices[count++] = indice;
}
}
indices = XArray.resize(indices, count);
target.move(source, indices);
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Set or add a value to current line. The index should be in the range 0 to
* {@link #getValueCount} inclusively. If the index is equals to {@link #getValueCount},
* then {@code value} will be appended as a new column after existing data.
*
* @param index Index of the value to add or modify.
* @param value The new value.
* @throws ArrayIndexOutOfBoundsException If the index is outside the expected range.
*/
public void setValue(final int index, final Object value)
throws ArrayIndexOutOfBoundsException
{
if (index > count) {
throw new ArrayIndexOutOfBoundsException(index);
}
if (value == null) {
throw new IllegalArgumentException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "value"));
}
if (index == count) {
if (index == data.length) {
data = XArray.resize(data, index+Math.min(index, 256));
}
count++;
}
data[index] = value;
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Returns the array of kernel names. <strong>This method
* returns the array by reference; do not modify!</strong>.
*
* @see KernelEditor#getKernelNames
*/
public String[] getKernelNames() {
if (names == null) {
int count = 0;
names = new String[kernels.size() + 1];
final String category = getKernelCategory();
for (final Iterator it=categories.entrySet().iterator(); it.hasNext();) {
final Map.Entry entry = (Map.Entry) it.next();
if (category==null || category.equals(entry.getValue())) {
names[count++] = (String) entry.getKey();
}
}
names[count++] = getString(VocabularyKeys.PERSONALIZED);
names = (String[]) XArray.resize(names, count);
}
return names;
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Returns the list of available locales.
*/
public static Locale[] getAvailableLocales() {
final Locale[] languages = getAvailableLanguages();
Locale[] locales = Locale.getAvailableLocales();
int count = 0;
for (int i=0; i<locales.length; i++) {
final Locale locale = locales[i];
if (containsLanguage(languages, locale)) {
locales[count++] = locale;
}
}
locales = (Locale[]) XArray.resize(locales, count);
return locales;
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Returns the list of available locales.
*
* @return Available locales.
*/
public static Locale[] getAvailableLocales() {
final Locale[] languages = getAvailableLanguages();
Locale[] locales = Locale.getAvailableLocales();
int count = 0;
for (int i=0; i<locales.length; i++) {
final Locale locale = locales[i];
if (containsLanguage(languages, locale)) {
locales[count++] = locale;
}
}
locales = XArray.resize(locales, count);
return locales;
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Returns a view of this set as an array. Elements will be in an arbitrary
* order. Note that this array contains strong reference. Consequently, no
* object reclamation will occurs as long as a reference to this array is hold.
*/
@Override
public synchronized E[] toArray() {
assert valid();
@SuppressWarnings("unchecked")
final E[] elements = (E[]) Array.newInstance(type, count);
int index = 0;
for (int i=0; i<table.length; i++) {
for (Entry el=table[i]; el!=null; el=el.next) {
if ((elements[index]=el.get()) != null) {
index++;
}
}
}
return XArray.resize(elements, index);
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Returns a view of this set as an array. Elements will be in an arbitrary
* order. Note that this array contains strong reference. Consequently, no
* object reclamation will occurs as long as a reference to this array is hold.
*/
public synchronized Object[] toArray() {
assert valid();
final Object[] elements = new Object[count];
int index = 0;
for (int i=0; i<table.length; i++) {
for (Entry el=table[i]; el!=null; el=el.next) {
if ((elements[index]=el.get()) != null) {
index++;
}
}
}
return XArray.resize(elements, index);
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Returns the list of unprocessed arguments. If the number of remaining arguments is
* greater than the specified maximum, then this method invokes {@link #illegalArgument}.
*
* @param max Maximum remaining arguments autorized.
* @return An array of remaining arguments. Will never be longer than {@code max}.
*/
public String[] getRemainingArguments(final int max) {
int count = 0;
final String[] left = new String[Math.min(max, arguments.length)];
for (int i=0; i<arguments.length; i++) {
final String arg = arguments[i];
if (arg != null) {
if (count >= max) {
illegalArgument(new IllegalArgumentException(Errors.getResources(locale).
getString(ErrorKeys.UNEXPECTED_PARAMETER_$1, arguments[i])));
}
left[count++] = arg;
}
}
return XArray.resize(left, count);
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Adds the given element as the {@code int} primitive type.
*
* @param value The value to add.
* @throws IllegalArgumentException if the given value is out of bounds.
*/
public void addInteger(final int value) throws IllegalArgumentException {
if (value < 0 || value > mask) {
throw new IllegalArgumentException(Errors.format(ErrorKeys.VALUE_OUT_OF_BOUNDS_$3,
value, 0, mask));
}
final int length = length(++size);
if (length > values.length) {
values = XArray.resize(values, 2*values.length);
}
setUnchecked(size - 1, value);
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Returns the list of unprocessed arguments. If the number of remaining arguments is
* greater than the specified maximum, then this method invokes {@link #illegalArgument}.
*
* @param max Maximum remaining arguments autorized.
* @return An array of remaining arguments. Will never be longer than {@code max}.
*/
public String[] getRemainingArguments(final int max) {
int count = 0;
final String[] left = new String[Math.min(max, arguments.length)];
for (int i=0; i<arguments.length; i++) {
final String arg = arguments[i];
if (arg != null) {
if (count >= max) {
illegalArgument(new IllegalArgumentException(Errors.getResources(locale).
format(ErrorKeys.UNEXPECTED_PARAMETER_$1, arguments[i])));
}
left[count++] = arg;
}
}
return (String[]) XArray.resize(left, count);
}
我有一个 View ,不是窗口的大小,也不是窗口本身,当它调整大小时,我想比较调整大小的开始值和结束值。然而,JQ-UI 的 resize ui 对象只包含以前的状态,而不是原始状态,所以它只是按像素
我有一个简单的可调整大小 jQueryUI 元素。 element.resizable({ start: function(event, ui) {...}, resize: func
我有几个嵌套的可调整大小的 div,需要调整大小以适应子大小。一切正常,直到我尝试调整其中一个外部 div 的大小(垂直)然后它卡住了。 这是一个 fiddle . $(function () { $
CNN 模型将大小为 (112x112) 的图像张量作为输入,并给出 (1x512) 大小的张量作为输出。 使用 Opencv 函数 cv2.resize() 或在 pytorch 中使用 Trans
经过大量搜索和研究,我找不到任何答案。 我将非常感谢可以帮助我的人。 在 SWT Java 中, 我希望我的窗口不能调整大小,所以我这样定义它: shell = new Shell(SWT.CLOSE
$(window).bind('resize') 和 $(window).resize() 有什么区别? 我看到bind嵌套在resize之上。它有什么影响?请参阅下面的代码。 我知道.resize(
使用 Vaadin 14.1.19 和 Vaadin“我的入门元素”元素,我尝试创建一个多行 TextArea。乍一看它工作正常,但是当调整 TextArea 大小时,它不会调整行数。这是我的代码:
我有一个使用 Ext.js 的侧面板。在浏览器调整大小之前,侧面板中的其中一个面板很好。浏览器调整大小时,它会切断面板的组件。 如何在浏览器调整大小时调整面板大小? { xtype:
我需要一种可靠的方法来检测 $(window).on('resize') 是否已由用户交互或 jQuery .trigger 调用触发。 我尝试了以下方法,但我似乎没有在函数调用中取回参数: $(wi
我有一个可调整大小的 div,现在我想在调整此框大小/用户完成调整大小时编辑 cookie。 (我有cookie插件) 我该怎么做? PS:我有多个具有不同 id 的 .div。 我的代码不起作用
这些游标类型有什么区别?我在 Chrome/windows 中看到了所有 3 个相同的光标 .e-resize {cursor: e-resize;} .ew-resize {cursor: ew-r
我使用了一个指令,它调用了一个返回一些值的方法,该方法运行良好。但我的问题是它反复调用它,而我想要的是它应该只在调整大小完成时调用该方法。我采取了这种代码形式 https://codepen.io/f
为了检查这种意外行为,我只是将 TextArea 直接放入 PrimaryStage 包含的 Scene 中:在应用程序启动时,TextArea 完全适合窗口(正如预期的那样)。 但是如果我移动窗口的
我在我的项目中使用 jquery-ui-resizable 插件。 默认情况下,当您制作 DOM 对象 jquery-ui-resizable 时,可调整大小的句柄将出现在右下角,我需要在左下角显示可
我正在 MonoTouch 中使用来自 AV Foundation 的 AVPlayer API 开发视频播放器(但 objective-c 中的解决方案也可能不错)。我正在尝试实现全屏模式。 为了显
我只是想让我的响应式 div 示例像这里一样工作 http://voormedia.com/blog/2012/11/responsive-background-images-with-fixed-o
我正在制作一个包含一个 .html 文件和一个 .css 文件的页面。 我已将 bootstrap 4 CDN 合并到我的 html 头中。 网格在中等屏幕尺寸下显示正确,但在我的手机上查看时它没有调
所以我有一个最近出现的非常具体的问题(就在我们计划的明天发布日之前),我不确定如何解决它。我用我有限的前端技能构建了我们的 HTML 模板网站,我们对此非常满意。但是,我似乎无法解决这个问题。 问题:
据我了解,有类instance.method(parameters)=class.method(instance,parameters),所以只是记法上的区别。但是 np.resize(ndarray
window.resize() 和 window.on('resize' , function()) 有什么区别在 jquery 中? 最佳答案 来自 jQuery页面.resize(): This
我是一名优秀的程序员,十分优秀!