public class TagList extends Object
A TagList only allows the storage of one Object value for each distinct Tag value. That is, if you call set(int tag, Object value) and a value already exists for that integer tag value, then this new value will overwrite the old one.
A TagList is synchronized.
Modifier and Type | Field and Description |
---|---|
static int |
EmptyTag |
int |
expandSize |
protected int |
num |
Constructor and Description |
---|
TagList() |
Modifier and Type | Method and Description |
---|---|
boolean |
change(int tag,
Object oldValue,
Object newValue) |
void |
clear()
Zero the TagList and free resources.
|
void |
clear(int tag)
Remove a tag value.
|
void |
defaultTo(int tag,
Object value)
Set a value for a tag if it has not already been set.
|
void |
ensureCapacity(int capacity) |
Tag |
get(int tag,
Tag dest)
Get the tag Object for the specified tag integer value.
|
Tag |
getAtIndex(int index,
Tag dest)
Get the tag at the specified index.
|
protected int |
getEmptyIndex() |
protected int |
getTagIndex(int tag) |
int[] |
getTags()
Returns the int array used for storing the tags.
|
Object |
getValue(int tag,
Object defaultValue) |
Object[] |
getValues()
Returns the Object array used for storing the tag values.
|
boolean |
hasTag(int tag)
Check if the specified tag has a value set for it.
|
void |
set(int tag,
Object value)
Set the Object value for a tag.
|
void |
set(TagList tl)
Set all the tag values from the other TagList.
|
int |
size() |
void |
zero()
Reset to zero without freeing resources.
|
protected int num
public int expandSize
public static final int EmptyTag
public int size()
public void zero()
public void clear()
public int[] getTags()
public Object[] getValues()
protected int getTagIndex(int tag)
protected int getEmptyIndex()
public Tag getAtIndex(int index, Tag dest)
public Tag get(int tag, Tag dest)
tag
- The integer tag value to look for.dest
- An optional destination tag object.public Object getValue(int tag, Object defaultValue)
tag
- The integer tag value to look for.defaultValue
- a default Object value to return if the tag is not foundpublic void ensureCapacity(int capacity)
public void set(int tag, Object value)
tag
- The integer tag value to set.value
- The Object value to set.public void set(TagList tl)
tl
- Another TagList to copy values from.public void clear(int tag)
tag
- The integer tag value to remove.public void defaultTo(int tag, Object value)
tag
- The integer tag value.value
- The object tag value.public boolean hasTag(int tag)
tag
- The integer tag value to check for.