FileDocCategorySizeDatePackage
IndexedItem.javaAPI DocAndroid 5.1 API2305Thu Mar 12 22:18:30 GMT 2015com.android.dexgen.dex.file

IndexedItem

public abstract class IndexedItem extends Item
An item in a Dalvik file which is referenced by index.

Fields Summary
private int
index
{@code >= -1;} assigned index of the item, or {@code -1} if not yet assigned
Constructors Summary
public IndexedItem()
Constructs an instance. The index is initially unassigned.

        index = -1;
    
Methods Summary
public final intgetIndex()
Gets the item index.

return
{@code >= 0;} the index
throws
RuntimeException thrown if the item index is not yet assigned

        if (index < 0) {
            throw new RuntimeException("index not yet set");
        }

        return index;
    
public final booleanhasIndex()
Gets whether or not this instance has been assigned an index.

return
{@code true} iff this instance has been assigned an index

        return (index >= 0);
    
public final java.lang.StringindexString()
Gets the index of this item as a string, suitable for including in annotations.

return
{@code non-null;} the index string

        return '[" + Integer.toHexString(index) + ']";
    
public final voidsetIndex(int index)
Sets the item index. This method may only ever be called once per instance, and this will throw a {@code RuntimeException} if called a second (or subsequent) time.

param
index {@code >= 0;} the item index

        if (this.index != -1) {
            throw new RuntimeException("index already set");
        }

        this.index = index;