APIdia Launch Partner
Top Fields Constructors Methods
com.badlogic.gdx.graphics.g3d

public Class Attributes

extends Object
implements Iterable<Attribute>, Comparator<Attribute>, Comparable<Attributes>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable, java.util.Comparator, java.lang.Iterable
Known Direct Subclasses
com.badlogic.gdx.graphics.g3d.Environment, com.badlogic.gdx.graphics.g3d.Material
Imports
java.util.Comparator, .Iterator, com.badlogic.gdx.utils.Array

Field Summary

Modifier and TypeField and Description
protected final Array<Attribute>
protected long
protected boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
attributesHash()

Returns: A hash code based on only the attribute values, which might be different compared to hashCode() because the latter might include other properties as well, i.e. the material id.

public void
clear()

Removes all attributes

public final int
compare(final Attribute arg0, final Attribute arg1)

Implements java.util.Comparator.compare.

Used for sorting attributes by type (not by value)

public int
compareTo(Attributes other)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

private final void
disable(final long mask)

private final void
enable(final long mask)

public boolean
equals(Object other)

Overrides java.lang.Object.equals.

Implements java.util.Comparator.equals.

Indicates whether some other object is "equal to" this comparator.

public final Attribute

Returns:

The attribute (which can safely be cast) if any, otherwise null
get
(final long type)

Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;

public final <T extends Attribute> T

Returns:

The attribute if any, otherwise null
get
(Class<T> clazz, final long type)

Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;

public final Array<Attribute>
get(final Array<Attribute> out, final long type)

Get multiple attributes at once.

public final long
getMask()

Returns: Bitwise mask of the ID's of all the containing attributes

public final boolean
has(final long type)

Returns: True if this collection has the specified attribute, i.e. attributes.has(ColorAttribute.Diffuse); Or when multiple attribute types are specified, true if this collection has all specified attributes, i.e. attributes.has(out, ColorAttribute.Diffuse | ColorAttribute.Specular | TextureAttribute.Diffuse);

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

protected int
indexOf(final long type)

Returns: the index of the attribute with the specified type or negative if not available.

public final Iterator<Attribute>
iterator()

Implements java.lang.Iterable.iterator.

Used for iterating through the attributes

public final void
remove(final 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. remove(AttributeA.ID | AttributeB.ID);

public final boolean

Returns:

True if this collection contains the same attributes (and optionally attribute values) as the other.
same
(final Attributes other, boolean
True to compare attribute values, false to only compare attribute types
compareValues
)

Check if this collection has the same attributes as the other collection.

public final boolean

Returns:

True if this collection contains the same attributes (but not values) as the other.
same
(final Attributes other)

See same(Attributes, boolean)

public final void
set(final Attribute attribute)

Add a attribute to this material.

public final void
set(final Attribute attribute1, final Attribute attribute2)

Add multiple attributes to this material.

public final void
set(final Attribute attribute1, final Attribute attribute2, final Attribute attribute3)

Add multiple attributes to this material.

public final void
set(final Attribute attribute1, final Attribute attribute2, final Attribute attribute3, final Attribute attribute4)

Add multiple attributes to this material.

public final void
set(final Attribute... attributes)

Add an array of attributes to this material.

public final void
set(final Iterable<Attribute> attributes)

Add an array of attributes to this material.

public int
size()

Returns: The amount of attributes this material contains.

public final void
sort()

Sort the attributes by their ID

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

attributesback to summary
protected final Array<Attribute> attributes
maskback to summary
protected long mask
sortedback to summary
protected boolean sorted

Constructor Detail

Attributesback to summary
public Attributes()

Method Detail

attributesHashback to summary
public int attributesHash()
Returns:int

A hash code based on only the attribute values, which might be different compared to hashCode() because the latter might include other properties as well, i.e. the material id.

clearback to summary
public void clear()

Removes all attributes

compareback to summary
public final int compare(final Attribute arg0, final Attribute arg1)

Implements java.util.Comparator.compare.

Used for sorting attributes by type (not by value)

Annotations
@Override
compareToback to summary
public int compareTo(Attributes other)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Annotations
@Override
disableback to summary
private final void disable(final long mask)
enableback to summary
private final void enable(final long mask)
equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Implements java.util.Comparator.equals.

Doc from java.util.Comparator.equals.

Indicates whether some other object is "equal to" this comparator. This method must obey the general contract of Object#equals(Object). Additionally, this method can return true only if the specified object is also a comparator and it imposes the same ordering as this comparator. Thus, comp1.equals(comp2) implies that signum(comp1.compare(o1, o2))==signum(comp2.compare(o1, o2)) for every object reference o1 and o2.

Note that it is always safe not to override Object.equals(Object). However, overriding this method may, in some cases, improve performance by allowing programs to determine that two distinct comparators impose the same order.

Annotations
@Override
getback to summary
public final Attribute get(final long type)

Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;

Returns:Attribute

The attribute (which can safely be cast) if any, otherwise null

getback to summary
public final <T extends Attribute> T get(Class<T> clazz, final long type)

Example usage: ((BlendingAttribute)material.get(BlendingAttribute.ID)).sourceFunction;

Returns:T

The attribute if any, otherwise null

getback to summary
public final Array<Attribute> get(final Array<Attribute> out, final long type)

Get multiple attributes at once. Example: material.get(out, ColorAttribute.Diffuse | ColorAttribute.Specular | TextureAttribute.Diffuse);

getMaskback to summary
public final long getMask()
Returns:long

Bitwise mask of the ID's of all the containing attributes

hasback to summary
public final boolean has(final long type)
Returns:boolean

True if this collection has the specified attribute, i.e. attributes.has(ColorAttribute.Diffuse); Or when multiple attribute types are specified, true if this collection has all specified attributes, i.e. attributes.has(out, ColorAttribute.Diffuse | ColorAttribute.Specular | TextureAttribute.Diffuse);

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
indexOfback to summary
protected int indexOf(final long type)
Returns:int

the index of the attribute with the specified type or negative if not available.

iteratorback to summary
public final Iterator<Attribute> iterator()

Implements java.lang.Iterable.iterator.

Used for iterating through the attributes

Annotations
@Override
removeback to summary
public final void remove(final 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. remove(AttributeA.ID | AttributeB.ID);

sameback to summary
public final boolean same(final Attributes other, boolean compareValues)

Check if this collection has the same attributes as the other collection. If compareValues is true, it also compares the values of each attribute.

Parameters
compareValues:boolean

True to compare attribute values, false to only compare attribute types

Returns:boolean

True if this collection contains the same attributes (and optionally attribute values) as the other.

sameback to summary
public final boolean same(final Attributes other)

See same(Attributes, boolean)

Returns:boolean

True if this collection contains the same attributes (but not values) as the other.

setback to summary
public final void set(final Attribute attribute)

Add a attribute to this material. If the material already contains an attribute of the same type it is overwritten.

setback to summary
public final void set(final Attribute attribute1, final Attribute attribute2)

Add multiple attributes to this material. If the material already contains an attribute of the same type it is overwritten.

setback to summary
public final void set(final Attribute attribute1, final Attribute attribute2, final Attribute attribute3)

Add multiple attributes to this material. If the material already contains an attribute of the same type it is overwritten.

setback to summary
public final void set(final Attribute attribute1, final Attribute attribute2, final Attribute attribute3, final Attribute attribute4)

Add multiple attributes to this material. If the material already contains an attribute of the same type it is overwritten.

setback to summary
public final void set(final Attribute... attributes)

Add an array of attributes to this material. If the material already contains an attribute of the same type it is overwritten.

setback to summary
public final void set(final Iterable<Attribute> attributes)

Add an array of attributes to this material. If the material already contains an attribute of the same type it is overwritten.

sizeback to summary
public int size()
Returns:int

The amount of attributes this material contains.

sortback to summary
public final void sort()

Sort the attributes by their ID