本文整理汇总了Java中javafx.collections.ListChangeListener.Change.getFrom方法的典型用法代码示例。如果您正苦于以下问题:Java Change.getFrom方法的具体用法?Java Change.getFrom怎么用?Java Change.getFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.ListChangeListener.Change
的用法示例。
在下文中一共展示了Change.getFrom方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addRemove
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
private void addRemove(Change<? extends E> c) {
if (c.getFrom() == 0 && c.getRemovedSize() == size) {
removeAllFromMapping();
} else {
for (int i = 0, sz = c.getRemovedSize(); i < sz; ++i) {
removeFromMapping(c.getFrom(), c.getRemoved().get(i));
}
}
if (size == 0) {
setAllToMapping(c.getList(), c.getTo()); // This is basically equivalent to getAddedSubList
// as size is 0, only valid "from" is also 0
} else {
for (int i = c.getFrom(), to = c.getTo(); i < to; ++i) {
insertToMapping(c.getList().get(i), i);
}
}
}
示例2: permute
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
protected void permute(Change<? extends F> c) {
int from = c.getFrom();
int to = c.getTo();
if (to > from) {
List<E> clone = new ArrayList<E>(mappedValues);
int[] perm = IntStream.range(0, size()).toArray();
for (int i = from; i < to; ++i) {
perm[i] = c.getPermutation(i);
mappedValues.set(i, clone.get(c.getPermutation(i)));
}
nextPermutation(from, to, perm);
}
}
示例3: fromCurrentStateOf
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
static <E, F extends E> QuasiListModification<E> fromCurrentStateOf(
Change<F> ch) {
List<F> list = ch.getList();
int from = ch.getFrom();
int addedSize = ch.getTo() - from; // use (to - from), because
// ch.getAddedSize() is 0 on permutation
List<F> removed;
if(ch.wasPermutated()) {
removed = new ArrayList<>(addedSize);
for(int i = 0; i < addedSize; ++i) {
int pi = ch.getPermutation(from + i);
removed.add(list.get(pi));
}
} else {
removed = ch.getRemoved();
}
return new QuasiListModificationImpl<>(from, removed, addedSize);
}
示例4: updateUnsorted
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
private void updateUnsorted(Change<? extends E> c) {
while (c.next()) {
if (c.wasPermutated()) {
Element[] sortedTmp = new Element[sorted.length];
for (int i = 0; i < size; ++i) {
if (i >= c.getFrom() && i < c.getTo()) {
sortedTmp[c.getPermutation(i)] = sorted[i];
} else {
sortedTmp[i] = sorted[i];
}
}
sorted = sortedTmp;
}
if (c.wasRemoved()) {
final int removedTo = c.getFrom() + c.getRemovedSize();
System.arraycopy(sorted, removedTo, sorted, c.getFrom(), size - removedTo);
size -= c.getRemovedSize();
updateIndices(removedTo, -c.getRemovedSize());
}
if (c.wasAdded()) {
ensureSize(size + c.getAddedSize());
updateIndices(c.getFrom(), c.getAddedSize());
System.arraycopy(sorted, c.getFrom(), sorted, c.getTo(), size - c.getFrom());
size += c.getAddedSize();
for (int i = c.getFrom(); i < c.getTo(); ++i) {
sorted[i] = new Element<E>(c.getList().get(i), i);
}
}
}
}
示例5: update
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
private void update(Change<? extends E> c) {
int[] perm = helper.sort(sorted, 0, size, elementComparator);
nextPermutation(0, size, perm);
for (int i = c.getFrom(), to = c.getTo(); i < to; ++i) {
nextUpdate(findPosition(i, c.getList().get(i)));
}
}
示例6: update
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
protected void update(Change<? extends F> c) {
int from = c.getFrom();
int to = c.getTo();
if (to > from) {
for (int i = from; i < to; ++i) {
mappedValues.set(i, mapper.apply(getSource().get(i)));
nextUpdate(i);
}
}
}
示例7: addRemove
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
protected void addRemove(Change<? extends F> c) {
int from = c.getFrom();
int to = c.getTo();
for (int index = from + c.getRemovedSize() - 1; index >= from; index--) {
nextRemove(index, mappedValues.remove(index));
}
for (int index = from; index < from + c.getAddedSize(); index++) {
mappedValues.add(index, mapper.apply(getSource().get(index)));
nextAdd(index, index + 1);
}
}