public class Attributes extends java.lang.Object implements java.lang.Iterable<Attribute>, java.util.Comparator<Attribute>, java.lang.Comparable<Attributes>
Modifier and Type | Field and Description |
---|---|
protected Array<Attribute> |
attributes |
protected long |
mask |
protected boolean |
sorted |
Constructor and Description |
---|
Attributes() |
Modifier and Type | Method and Description |
---|---|
int |
attributesHash() |
void |
clear()
Removes all attributes
|
int |
compare(Attribute arg0,
Attribute arg1)
Used for sorting attributes by type (not by value)
|
int |
compareTo(Attributes other) |
boolean |
equals(java.lang.Object other) |
Array<Attribute> |
get(Array<Attribute> out,
long type)
Get multiple attributes at once.
|
<T extends Attribute> |
get(java.lang.Class<T> clazz,
long type)
Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;
|
Attribute |
get(long type)
Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;
|
long |
getMask() |
boolean |
has(long type) |
int |
hashCode() |
protected int |
indexOf(long type) |
java.util.Iterator<Attribute> |
iterator()
Used for iterating through the attributes
|
void |
remove(long mask)
Removes the attribute from the material, i.e.: material.remove(BlendingAttribute.ID); Can also be used to remove multiple
attributes also, i.e.
|
boolean |
same(Attributes other)
|
boolean |
same(Attributes other,
boolean compareValues)
Check if this collection has the same attributes as the other collection.
|
void |
set(Attribute... attributes)
Add an array of attributes to this material.
|
void |
set(Attribute attribute)
Add a attribute to this material.
|
void |
set(Attribute attribute1,
Attribute attribute2)
Add multiple attributes to this material.
|
void |
set(Attribute attribute1,
Attribute attribute2,
Attribute attribute3)
Add multiple attributes to this material.
|
void |
set(Attribute attribute1,
Attribute attribute2,
Attribute attribute3,
Attribute attribute4)
Add multiple attributes to this material.
|
void |
set(java.lang.Iterable<Attribute> attributes)
Add an array of attributes to this material.
|
int |
size() |
void |
sort()
Sort the attributes by their ID
|
public final void sort()
public final long getMask()
public final Attribute get(long type)
public final <T extends Attribute> T get(java.lang.Class<T> clazz, long type)
public final Array<Attribute> get(Array<Attribute> out, long type)
public void clear()
public int size()
public final void set(Attribute attribute)
public final void set(Attribute attribute1, Attribute attribute2)
public final void set(Attribute attribute1, Attribute attribute2, Attribute attribute3)
public final void set(Attribute attribute1, Attribute attribute2, Attribute attribute3, Attribute attribute4)
public final void set(Attribute... attributes)
public final void set(java.lang.Iterable<Attribute> attributes)
public final void remove(long mask)
public final boolean has(long type)
protected int indexOf(long type)
public final boolean same(Attributes other, boolean compareValues)
compareValues
- True to compare attribute values, false to only compare attribute typespublic final boolean same(Attributes other)
public final int compare(Attribute arg0, Attribute arg1)
compare
in interface java.util.Comparator<Attribute>
public final java.util.Iterator<Attribute> iterator()
iterator
in interface java.lang.Iterable<Attribute>
public int attributesHash()
hashCode()
because the latter
might include other properties as well, i.e. the material id.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in interface java.util.Comparator<Attribute>
equals
in class java.lang.Object
public int compareTo(Attributes other)
compareTo
in interface java.lang.Comparable<Attributes>