FileDocCategorySizeDatePackage
Dop.javaAPI DocAndroid 1.5 API4441Wed May 06 22:41:02 BST 2009com.android.dx.dex.code

Dop

public final class Dop extends Object
Representation of an opcode.

Fields Summary
private final int
opcode
DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode value itself
private final int
family
DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family
private final InsnFormat
format
non-null; the instruction format
private final boolean
hasResult
whether this opcode uses a result register
private final String
name
non-null; the name
Constructors Summary
public Dop(int opcode, int family, InsnFormat format, boolean hasResult, String name)
Constructs an instance.

param
opcode DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode value itself
param
family DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family
param
format non-null; the instruction format
param
hasResult whether the opcode has a result register; if so it is always the first register
param
name non-null; the name

        if ((opcode < DalvOps.MIN_VALUE) || (opcode > DalvOps.MAX_VALUE)) {
            throw new IllegalArgumentException("bogus opcode");
        }

        if ((family < DalvOps.MIN_VALUE) || (family > DalvOps.MAX_VALUE)) {
            throw new IllegalArgumentException("bogus family");
        }

        if (format == null) {
            throw new NullPointerException("format == null");
        }

        if (name == null) {
            throw new NullPointerException("name == null");
        }

        this.opcode = opcode;
        this.family = family;
        this.format = format;
        this.hasResult = hasResult;
        this.name = name;
    
Methods Summary
public intgetFamily()
Gets the opcode family. The opcode family is the unmarked (no "/...") opcode that has equivalent semantics to this one.

return
DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family

        return family;
    
public InsnFormatgetFormat()
Gets the instruction format.

return
non-null; the instruction format

        return format;
    
public java.lang.StringgetName()
Gets the opcode name.

return
non-null; the opcode name

        return name;
    
public intgetOpcode()
Gets the opcode value.

return
DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode value

        return opcode;
    
public com.android.dx.dex.code.DopgetOppositeTest()
Gets the opcode for the opposite test of this instance. This is only valid for opcodes which are in fact tests.

return
non-null; the opposite test

        switch (opcode) {
            case DalvOps.IF_EQ:  return Dops.IF_NE;
            case DalvOps.IF_NE:  return Dops.IF_EQ;
            case DalvOps.IF_LT:  return Dops.IF_GE;
            case DalvOps.IF_GE:  return Dops.IF_LT;
            case DalvOps.IF_GT:  return Dops.IF_LE;
            case DalvOps.IF_LE:  return Dops.IF_GT;
            case DalvOps.IF_EQZ: return Dops.IF_NEZ;
            case DalvOps.IF_NEZ: return Dops.IF_EQZ;
            case DalvOps.IF_LTZ: return Dops.IF_GEZ;
            case DalvOps.IF_GEZ: return Dops.IF_LTZ;
            case DalvOps.IF_GTZ: return Dops.IF_LEZ;
            case DalvOps.IF_LEZ: return Dops.IF_GTZ;
        }

        throw new IllegalArgumentException("bogus opcode: " + this);
    
public booleanhasResult()
Returns whether this opcode uses a result register.

return
true iff this opcode uses a result register

        return hasResult;
    
public java.lang.StringtoString()
{@inheritDoc}

        return name;