FileDocCategorySizeDatePackage
TypeListItem.javaAPI DocAndroid 1.5 API3362Wed May 06 22:41:02 BST 2009com.android.dx.dex.file

TypeListItem

public final class TypeListItem extends OffsettedItem
Representation of a list of class references.

Fields Summary
private static final int
ALIGNMENT
alignment requirement
private static final int
ELEMENT_SIZE
element size in bytes
private static final int
HEADER_SIZE
header size in bytes
private final com.android.dx.rop.type.TypeList
list
non-null; the actual list
Constructors Summary
public TypeListItem(com.android.dx.rop.type.TypeList list)
Constructs an instance.

param
list non-null; the actual list


                   
       
        super(ALIGNMENT, (list.size() * ELEMENT_SIZE) + HEADER_SIZE);

        this.list = list;
    
Methods Summary
public voidaddContents(DexFile file)
{@inheritDoc}

        TypeIdsSection typeIds = file.getTypeIds();
        int sz = list.size();

        for (int i = 0; i < sz; i++) {
            typeIds.intern(list.getType(i));
        }
    
protected intcompareTo0(OffsettedItem other)
{@inheritDoc}

        TypeList thisList = this.list;
        TypeList otherList = ((TypeListItem) other).list;

        return StdTypeList.compareContents(thisList, otherList);
    
public com.android.dx.rop.type.TypeListgetList()
Gets the underlying list.

return
non-null; the list

        return list;
    
public inthashCode()
{@inheritDoc}

        return StdTypeList.hashContents(list);
    
public ItemTypeitemType()
{@inheritDoc}

        return ItemType.TYPE_TYPE_LIST;
    
public java.lang.StringtoHuman()
{@inheritDoc}

        throw new RuntimeException("unsupported");
    
protected voidwriteTo0(DexFile file, com.android.dx.util.AnnotatedOutput out)
{@inheritDoc}

        TypeIdsSection typeIds = file.getTypeIds();
        int sz = list.size();

        if (out.annotates()) {
            out.annotate(0, offsetString() + " type_list");
            out.annotate(HEADER_SIZE, "  size: " + Hex.u4(sz));
            for (int i = 0; i < sz; i++) {
                Type one = list.getType(i);
                int idx = typeIds.indexOf(one);
                out.annotate(ELEMENT_SIZE,
                             "  " + Hex.u2(idx) + " // " + one.toHuman());
            }
        }

        out.writeInt(sz);

        for (int i = 0; i < sz; i++) {
            out.writeShort(typeIds.indexOf(list.getType(i)));
        }