org.jf.dexlib2.iface.value.LongEncodedValue Java Examples

The following examples show how to use org.jf.dexlib2.iface.value.LongEncodedValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseLongEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof LongEncodedValue) {
        return getValue() == ((LongEncodedValue)o).getValue();
    }
    return false;
}
 
Example #2
Source File: BaseLongEncodedValue.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof LongEncodedValue) {
        return getValue() == ((LongEncodedValue)o).getValue();
    }
    return false;
}
 
Example #3
Source File: DexField.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Add constant tag. Should only be called if field is final.
 * @param df
 * @param sf
 */
private static void addConstantTag(SootField df, Field sf) {
    Tag tag = null;

    EncodedValue ev = sf.getInitialValue();

    if (ev instanceof BooleanEncodedValue) {
      tag = new IntegerConstantValueTag(((BooleanEncodedValue) ev).getValue() ==true?1:0);
    } else if (ev instanceof ByteEncodedValue) {
      tag = new IntegerConstantValueTag(((ByteEncodedValue) ev).getValue());
    } else if (ev instanceof CharEncodedValue) {
      tag = new IntegerConstantValueTag(((CharEncodedValue) ev).getValue());
    } else if (ev instanceof DoubleEncodedValue) {
      tag = new DoubleConstantValueTag(((DoubleEncodedValue) ev).getValue());
    } else if (ev instanceof FloatEncodedValue) {
      tag = new FloatConstantValueTag(((FloatEncodedValue) ev).getValue());
    } else if (ev instanceof IntEncodedValue) {
      tag = new IntegerConstantValueTag(((IntEncodedValue) ev).getValue());
    } else if (ev instanceof LongEncodedValue) {
      tag = new LongConstantValueTag(((LongEncodedValue) ev).getValue());
    } else if (ev instanceof ShortEncodedValue) {
      tag = new IntegerConstantValueTag(((ShortEncodedValue) ev).getValue());
    } else if (ev instanceof StringEncodedValue) {
      tag = new StringConstantValueTag(((StringEncodedValue) ev).getValue());
    }

    if (tag != null)
      df.addTag(tag);
}
 
Example #4
Source File: BaseLongEncodedValue.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof LongEncodedValue) {
        return getValue() == ((LongEncodedValue)o).getValue();
    }
    return false;
}
 
Example #5
Source File: BaseLongEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof LongEncodedValue) {
        return getValue() == ((LongEncodedValue)o).getValue();
    }
    return false;
}
 
Example #6
Source File: ImmutableLongEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public static ImmutableLongEncodedValue of(LongEncodedValue longEncodedValue) {
    if (longEncodedValue instanceof ImmutableLongEncodedValue) {
        return (ImmutableLongEncodedValue)longEncodedValue;
    }
    return new ImmutableLongEncodedValue(longEncodedValue.getValue());
}
 
Example #7
Source File: BaseLongEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return Longs.compare(getValue(), ((LongEncodedValue)o).getValue());
}
 
Example #8
Source File: EncodedValueAdaptor.java    From atlas with Apache License 2.0 4 votes vote down vote up
public static void writeTo(@Nonnull IndentingWriter writer, @Nonnull EncodedValue encodedValue,
                           @Nullable String containingClass)
        throws IOException {
    switch (encodedValue.getValueType()) {
        case ValueType.ANNOTATION:
            AnnotationEncodedValueAdaptor.writeTo(writer, (AnnotationEncodedValue) encodedValue, containingClass);
            return;
        case ValueType.ARRAY:
            ArrayEncodedValueAdaptor.writeTo(writer, (ArrayEncodedValue)encodedValue, containingClass);
            return;
        case ValueType.BOOLEAN:
            BooleanRenderer.writeTo(writer, ((BooleanEncodedValue) encodedValue).getValue());
            return;
        case ValueType.BYTE:
            ByteRenderer.writeTo(writer, ((ByteEncodedValue) encodedValue).getValue());
            return;
        case ValueType.CHAR:
            CharRenderer.writeTo(writer, ((CharEncodedValue) encodedValue).getValue());
            return;
        case ValueType.DOUBLE:
            DoubleRenderer.writeTo(writer, ((DoubleEncodedValue) encodedValue).getValue());
            return;
        case ValueType.ENUM:
            EnumEncodedValue enumEncodedValue = (EnumEncodedValue)encodedValue;
            boolean useImplicitReference = false;
            if (enumEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            writer.write(".enum ");
            ReferenceUtil.writeFieldDescriptor(writer, enumEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.FIELD:
            FieldEncodedValue fieldEncodedValue = (FieldEncodedValue)encodedValue;
            useImplicitReference = false;
            if (fieldEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            ReferenceUtil.writeFieldDescriptor(writer, fieldEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.FLOAT:
            FloatRenderer.writeTo(writer, ((FloatEncodedValue) encodedValue).getValue());
            return;
        case ValueType.INT:
            IntegerRenderer.writeTo(writer, ((IntEncodedValue) encodedValue).getValue());
            return;
        case ValueType.LONG:
            LongRenderer.writeTo(writer, ((LongEncodedValue) encodedValue).getValue());
            return;
        case ValueType.METHOD:
            MethodEncodedValue methodEncodedValue = (MethodEncodedValue)encodedValue;
            useImplicitReference = false;
            if (methodEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            ReferenceUtil.writeMethodDescriptor(writer, methodEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.NULL:
            writer.write("null");
            return;
        case ValueType.SHORT:
            ShortRenderer.writeTo(writer, ((ShortEncodedValue) encodedValue).getValue());
            return;
        case ValueType.STRING:
            ReferenceFormatter.writeStringReference(writer, ((StringEncodedValue) encodedValue).getValue());
            return;
        case ValueType.TYPE:
            writer.write(((TypeEncodedValue)encodedValue).getValue());
    }
}
 
Example #9
Source File: ImmutableLongEncodedValue.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public static ImmutableLongEncodedValue of(LongEncodedValue longEncodedValue) {
    if (longEncodedValue instanceof ImmutableLongEncodedValue) {
        return (ImmutableLongEncodedValue)longEncodedValue;
    }
    return new ImmutableLongEncodedValue(longEncodedValue.getValue());
}
 
Example #10
Source File: BaseLongEncodedValue.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return Longs.compare(getValue(), ((LongEncodedValue)o).getValue());
}
 
Example #11
Source File: ImmutableLongEncodedValue.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public static ImmutableLongEncodedValue of(LongEncodedValue longEncodedValue) {
    if (longEncodedValue instanceof ImmutableLongEncodedValue) {
        return (ImmutableLongEncodedValue)longEncodedValue;
    }
    return new ImmutableLongEncodedValue(longEncodedValue.getValue());
}
 
Example #12
Source File: BaseLongEncodedValue.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return Longs.compare(getValue(), ((LongEncodedValue)o).getValue());
}
 
Example #13
Source File: ImmutableLongEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public static ImmutableLongEncodedValue of(LongEncodedValue longEncodedValue) {
    if (longEncodedValue instanceof ImmutableLongEncodedValue) {
        return (ImmutableLongEncodedValue)longEncodedValue;
    }
    return new ImmutableLongEncodedValue(longEncodedValue.getValue());
}
 
Example #14
Source File: BaseLongEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return Longs.compare(getValue(), ((LongEncodedValue)o).getValue());
}