FileDocCategorySizeDatePackage
IndexedItem.javaAPI DocAndroid 1.5 API2295Wed May 06 22:41:02 BST 2009com.android.dx.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
>= -1; assigned index of the item, or -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
>= 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
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
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 RuntimeException if called a second (or subsequent) time.

param
index >= 0; the item index

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

        this.index = index;