Java 类com.badlogic.gdx.utils.SortedIntList 实例源码

项目:gdx-cclibs    文件:SortedIntListSerializer.java   
@Override
public void write(Kryo kryo, Output output, SortedIntList list) {
    output.writeVarInt(list.size(), true);
    Serializer serializer = null;
    if (genericType != null) {
        if (serializer == null) serializer = kryo.getSerializer(genericType);
        genericType = null;
    }
    for (Iterator<SortedIntList.Node> iter = list.iterator(); iter.hasNext();){
        SortedIntList.Node node = iter.next();
        output.writeInt(node.index);
        if (serializer != null) {
            kryo.writeObjectOrNull(output, node.value, serializer);
        } else {
            kryo.writeClassAndObject(output, node.value);
        }
    }
}
项目:gdx-cclibs    文件:SortedIntListSerializer.java   
@Override
public SortedIntList read(Kryo kryo, Input input, Class<SortedIntList> type) {
    int length = input.readVarInt(true);
    SortedIntList list = new SortedIntList();
    kryo.reference(list);
    Class elementClass = null;
    Serializer serializer = null;
    if (genericType != null) {
        elementClass = genericType;
        serializer = kryo.getSerializer(genericType);
        genericType = null;
    }
    for (int i = 0; i < length; i++) {
        int index = input.readInt();
        Object value = serializer != null ?
                kryo.readObjectOrNull(input, elementClass, serializer) : kryo.readClassAndObject(input);
        list.insert(index, value);
    }
    return list;
}
项目:DoubleHelix    文件:BillboardDecalBatch.java   
/** Renders all decals to the buffer and flushes the buffer to the GL when full/done */
protected void render () {
    groupStrategy.beforeBillboardGroups();
    for (SortedIntList.Node<Array<BillboardDecal>> group : groupList) {
        groupStrategy.beforeBillboardGroup(group.index, group.value);
        ShaderProgram shader = groupStrategy.getBillboardGroupShader(group.index);
        render(shader, group.value);
        groupStrategy.afterBillboardGroup(group.index);
    }
    groupStrategy.afterBillboardGroups();
}
项目:gdx-kiwi    文件:GdxLists.java   
/** @param elements will be added to the list with ascending indexes, starting from 0.
 * @return new instance of {@link SortedIntList}.
 * @param <Type> type of stored values. */
public static <Type> SortedIntList<Type> newSortedList(final Type... elements) {
    final SortedIntList<Type> list = new SortedIntList<Type>();
    for (int index = 0, size = elements.length; index < size; index++) {
        list.insert(index, elements[index]);
    }
    return list;
}
项目:gdx-kiwi    文件:GdxLists.java   
/** @param iterable will be copied.
 * @return a new sorted int list with iterable's values inserted with ascending indexes, starting with 0.
 * @param <Type> type of stored values. */
public static <Type> SortedIntList<Type> toSortedIntList(final Iterable<? extends Type> iterable) {
    final SortedIntList<Type> list = new SortedIntList<Type>();
    int index = 0;
    for (final Type value : iterable) {
        list.insert(index++, value);
    }
    return list;
}
项目:gdx-kiwi    文件:GdxLists.java   
/** Null-safe lists clearing method.
 *
 * @param lists will all be cleared. Any of these lists can be null. */
public static void clear(final SortedIntList<?>... lists) {
    for (final SortedIntList<?> list : lists) {
        if (list != null) {
            list.clear();
        }
    }
}
项目:gdx-lml    文件:GdxLists.java   
/** @param elements will be added to the list with ascending indexes, starting from 0.
 * @return new instance of {@link SortedIntList}.
 * @param <Type> type of stored values. */
public static <Type> SortedIntList<Type> newSortedList(final Type... elements) {
    final SortedIntList<Type> list = new SortedIntList<Type>();
    for (int index = 0, size = elements.length; index < size; index++) {
        list.insert(index, elements[index]);
    }
    return list;
}
项目:gdx-lml    文件:GdxLists.java   
/** @param iterable will be copied.
 * @return a new sorted int list with iterable's values inserted with ascending indexes, starting with 0.
 * @param <Type> type of stored values. */
public static <Type> SortedIntList<Type> toSortedIntList(final Iterable<? extends Type> iterable) {
    final SortedIntList<Type> list = new SortedIntList<Type>();
    int index = 0;
    for (final Type value : iterable) {
        list.insert(index++, value);
    }
    return list;
}
项目:gdx-lml    文件:GdxLists.java   
/** Null-safe lists clearing method.
 *
 * @param lists will all be cleared. Any of these lists can be null. */
public static void clear(final SortedIntList<?>... lists) {
    for (final SortedIntList<?> list : lists) {
        if (list != null) {
            list.clear();
        }
    }
}
项目:libgdxcn    文件:DecalBatch.java   
/** Renders all decals to the buffer and flushes the buffer to the GL when full/done */
protected void render () {
    groupStrategy.beforeGroups();
    for (SortedIntList.Node<Array<Decal>> group : groupList) {
        groupStrategy.beforeGroup(group.index, group.value);
        ShaderProgram shader = groupStrategy.getGroupShader(group.index);
        render(shader, group.value);
        groupStrategy.afterGroup(group.index);
    }
    groupStrategy.afterGroups();
}
项目:ingress-indonesia-dev    文件:DecalBatch.java   
protected void render()
{
  this.groupStrategy.beforeGroups();
  Iterator localIterator = this.groupList.iterator();
  while (localIterator.hasNext())
  {
    SortedIntList.Node localNode = (SortedIntList.Node)localIterator.next();
    this.groupStrategy.beforeGroup(localNode.index, (Array)localNode.value);
    render(this.groupStrategy.getGroupShader(localNode.index), (Array)localNode.value);
    this.groupStrategy.afterGroup(localNode.index);
  }
  this.groupStrategy.afterGroups();
}
项目:gdx-kiwi    文件:GdxLists.java   
/** @return new empty instance of {@link SortedIntList}.
 * @param <Type> type of stored values. */
public static <Type> SortedIntList<Type> newSortedList() {
    return new SortedIntList<Type>();
}
项目:gdx-kiwi    文件:GdxLists.java   
/** @param list can be null.
 * @return true if list is null or empty. */
public static boolean isEmpty(final SortedIntList<?> list) {
    return list == null || list.size() == 0;
}
项目:gdx-kiwi    文件:GdxLists.java   
/** @param list can be null.
 * @return true if list is not null and has elements. */
public static boolean isNotEmpty(final SortedIntList<?> list) {
    return list != null && list.size() > 0;
}
项目:gdx-lml    文件:GdxLists.java   
/** @return new empty instance of {@link SortedIntList}.
 * @param <Type> type of stored values. */
public static <Type> SortedIntList<Type> newSortedList() {
    return new SortedIntList<Type>();
}
项目:gdx-lml    文件:GdxLists.java   
/** @param list can be null.
 * @return true if list is null or empty. */
public static boolean isEmpty(final SortedIntList<?> list) {
    return list == null || list.size() == 0;
}
项目:gdx-lml    文件:GdxLists.java   
/** @param list can be null.
 * @return true if list is not null and has elements. */
public static boolean isNotEmpty(final SortedIntList<?> list) {
    return list != null && list.size() > 0;
}