FileDocCategorySizeDatePackage
LocalItem.javaAPI DocAndroid 5.1 API3784Thu Mar 12 22:18:30 GMT 2015com.android.dexgen.rop.code

LocalItem

public class LocalItem extends Object implements Comparable
A local variable item: either a name or a signature or both.

Fields Summary
private final com.android.dexgen.rop.cst.CstUtf8
name
{@code null-ok;} local variable name
private final com.android.dexgen.rop.cst.CstUtf8
signature
{@code null-ok;} local variable signature
Constructors Summary
private LocalItem(com.android.dexgen.rop.cst.CstUtf8 name, com.android.dexgen.rop.cst.CstUtf8 signature)
Constructs instance.

param
name {@code null-ok;} local variable name
param
signature {@code null-ok;} local variable signature

        this.name = name;
        this.signature = signature;
    
Methods Summary
private static intcompareHandlesNulls(com.android.dexgen.rop.cst.CstUtf8 a, com.android.dexgen.rop.cst.CstUtf8 b)
Compares two strings like String.compareTo(), excepts treats a null as the least-possible string value.

return
negative integer, zero, or positive integer in accordance with Comparable.compareTo()

        if (a == b) {
            return 0;
        } else if (a == null) {
            return -1;
        } else if (b == null) {
            return 1;
        } else {
            return a.compareTo(b);
        }
    
public intcompareTo(com.android.dexgen.rop.code.LocalItem local)
{@inheritDoc}

        int ret;

        ret = compareHandlesNulls(name, local.name);

        if (ret != 0) {
            return ret;
        }

        ret = compareHandlesNulls(signature, local.signature);

        return ret;
    
public booleanequals(java.lang.Object other)
{@inheritDoc}

        if (!(other instanceof LocalItem)) {
            return false;
        }

        LocalItem local = (LocalItem) other;

        return 0 == compareTo(local);
    
public com.android.dexgen.rop.cst.CstUtf8getName()
Gets name.

return
{@code null-ok;} name

        return name;
    
public com.android.dexgen.rop.cst.CstUtf8getSignature()
Gets signature.

return
{@code null-ok;} signature

        return signature;
    
public inthashCode()
{@inheritDoc}

        return (name == null ? 0 : name.hashCode()) * 31
                + (signature == null ? 0 : signature.hashCode());
    
public static com.android.dexgen.rop.code.LocalItemmake(com.android.dexgen.rop.cst.CstUtf8 name, com.android.dexgen.rop.cst.CstUtf8 signature)
Make a new item. If both name and signature are null, null is returned. TODO: intern these

param
name {@code null-ok;} local variable name
param
signature {@code null-ok;} local variable signature
return
{@code non-null;} appropriate instance.

        if (name == null && signature == null) {
            return null;
        }

        return new LocalItem (name, signature);
    
public java.lang.StringtoString()
{@inheritDoc}

        if (name != null && signature == null) {
            return name.toQuoted();
        } else if (name == null && signature == null) {
            return "";
        }

        return "[" + (name == null ? "" : name.toQuoted())
                + "|" + (signature == null ? "" : signature.toQuoted());