FileDocCategorySizeDatePackage
LocalItem.javaAPI DocAndroid 5.1 API3798Thu Mar 12 22:18:30 GMT 2015com.android.dx.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.dx.rop.cst.CstString
name
{@code null-ok;} local variable name
private final com.android.dx.rop.cst.CstString
signature
{@code null-ok;} local variable signature
Constructors Summary
private LocalItem(com.android.dx.rop.cst.CstString name, com.android.dx.rop.cst.CstString 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.dx.rop.cst.CstString a, com.android.dx.rop.cst.CstString 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.dx.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.dx.rop.cst.CstStringgetName()
Gets name.

return
{@code null-ok;} name

        return name;
    
public com.android.dx.rop.cst.CstStringgetSignature()
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.dx.rop.code.LocalItemmake(com.android.dx.rop.cst.CstString name, com.android.dx.rop.cst.CstString 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());