add Inlist.appendList(), rename append() to appendItem()
This commit is contained in:
parent
3782ab8f57
commit
178f096b60
@ -87,7 +87,7 @@ public abstract class SpriteManager<T> {
|
|||||||
}
|
}
|
||||||
Sprite sprite = new Sprite(item, mAtlas, r);
|
Sprite sprite = new Sprite(item, mAtlas, r);
|
||||||
|
|
||||||
items = Inlist.append(items, sprite);
|
items = Inlist.appendItem(items, sprite);
|
||||||
|
|
||||||
draw(item, r);
|
draw(item, r);
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public final class SymbolLayer extends TextureLayer {
|
|||||||
private SymbolItem symbols;
|
private SymbolItem symbols;
|
||||||
|
|
||||||
public SymbolLayer() {
|
public SymbolLayer() {
|
||||||
type = RenderElement.SYMBOL;
|
super(RenderElement.SYMBOL);
|
||||||
fixed = true;
|
fixed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public final class SymbolLayer extends TextureLayer {
|
|||||||
// clone TextureItem to use same texID with
|
// clone TextureItem to use same texID with
|
||||||
// multiple TextureItem
|
// multiple TextureItem
|
||||||
to = TextureItem.clone(to);
|
to = TextureItem.clone(to);
|
||||||
textures = Inlist.append(textures, to);
|
textures = Inlist.appendItem(textures, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureAtlas.Rect r = it.texRegion.rect;
|
TextureAtlas.Rect r = it.texRegion.rect;
|
||||||
@ -104,7 +104,7 @@ public final class SymbolLayer extends TextureLayer {
|
|||||||
// to.bitmap = it.bitmap;
|
// to.bitmap = it.bitmap;
|
||||||
// to.width = it.bitmap.getWidth();
|
// to.width = it.bitmap.getWidth();
|
||||||
// to.height = it.bitmap.getHeight();
|
// to.height = it.bitmap.getHeight();
|
||||||
textures = Inlist.append(textures, to);
|
textures = Inlist.appendItem(textures, to);
|
||||||
|
|
||||||
to.upload();
|
to.upload();
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ public final class SymbolLayer extends TextureLayer {
|
|||||||
for (to = prevTextures; to != null; to = to.next) {
|
for (to = prevTextures; to != null; to = to.next) {
|
||||||
if (to.bitmap == bitmap) {
|
if (to.bitmap == bitmap) {
|
||||||
prevTextures = Inlist.remove(prevTextures, to);
|
prevTextures = Inlist.remove(prevTextures, to);
|
||||||
textures = Inlist.append(textures, to);
|
textures = Inlist.appendItem(textures, to);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,12 +85,11 @@ public class Inlist<T extends Inlist<T>> {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends Inlist<T>> T append(T list, T item) {
|
public static <T extends Inlist<T>> T appendItem(T list, T item) {
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
if (item.next != null) {
|
if (item.next != null) {
|
||||||
// warn
|
throw new IllegalArgumentException("item is list");
|
||||||
item.next = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +106,37 @@ public class Inlist<T extends Inlist<T>> {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T extends Inlist<T>> T appendList(T list, T list2) {
|
||||||
|
|
||||||
|
if (list == null)
|
||||||
|
return list2;
|
||||||
|
|
||||||
|
if (list == list2)
|
||||||
|
return list;
|
||||||
|
|
||||||
|
Inlist<T> it = list;
|
||||||
|
|
||||||
|
while (it.next != null) {
|
||||||
|
if (it.next == list2)
|
||||||
|
// hmmmm, already in list
|
||||||
|
return list;
|
||||||
|
|
||||||
|
it = it.next;
|
||||||
|
}
|
||||||
|
it.next = list2;
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends Inlist<T>> T last(T list) {
|
||||||
|
while (list != null) {
|
||||||
|
if (list.next == null)
|
||||||
|
return list;
|
||||||
|
list = list.next;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static <T extends Inlist<T>> T prependRelative(T list, T item, T other) {
|
public static <T extends Inlist<T>> T prependRelative(T list, T item, T other) {
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user