Projects >> openxc-android >>d93c442cf19e0d7398c0433c78471f8046c407dc

Chunk
Conflicting content
 * the measurement and its unit type. This unfortunately means we have to add
 * constructors to every child class because they aren't inherited from
 * Measurement. If you know of a better way, please say so.
<<<<<<< HEAD
 *
 * All subclasses must have a public static String field named ID to be used
 * with the OpenXC vehicle services - this is unfortunately not enforced by the
 * class hierarchy.
=======
>>>>>>> 2a3a97910753fd3d180c6bc7c48b30739809fb4f
 */
public class BaseMeasurement implements Measurement {
    private AgingData mValue;
Solution content
 * the measurement and its unit type. This unfortunately means we have to add
 * constructors to every child class because they aren't inherited from
 * Measurement. If you know of a better way, please say so.
 */
public class BaseMeasurement implements Measurement {
    private AgingData mValue;
File
BaseMeasurement.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
        return getEvent();
    }

<<<<<<< HEAD
    public String serialize() {
        // TODO
        return "";
    }

    public static Measurement deserialize(String serializedMeasurement) {
        // TODO
        return null;
=======
    // TODO can we make this protected for everyone? it's really internal state
    // because all external users should care about is it being serialized. the
    // only place we use it right now is the MockedLocationSink.
    public static String getGenericName() {
        // TODO this needs to go away.
        return null;
    }

    private static void cacheMeasurementId(
            Class measurementType)
            throws UnrecognizedMeasurementTypeException {
        String measurementId;
        try {
            measurementId = (String) measurementType.getDeclaredMethod(
                    "getGenericName", null).invoke(null, null);
            sMeasurementIdToClass.put(measurementId, measurementType);
        } catch(NoSuchMethodException e) {
            throw new UnrecognizedMeasurementTypeException(
                    measurementType + " doesn't have a getGenericName method",
                    e);
        } catch(IllegalAccessException e) {
            throw new UnrecognizedMeasurementTypeException(
                    measurementType + " has an inaccessible ID", e);
        } catch(InvocationTargetException e) {
            throw new UnrecognizedMeasurementTypeException(
                    measurementType + " has an inaccessible ID", e);
        }
    }

    public static String getIdForClass(
            Class measurementType)
            throws UnrecognizedMeasurementTypeException {
        if(!sMeasurementIdToClass.inverse().containsKey(measurementType)) {
            cacheMeasurementId(measurementType);
        }
        return sMeasurementIdToClass.inverse().get(measurementType);
    }

    public static Class
            getClassForId(String measurementId)
            throws UnrecognizedMeasurementTypeException {
        Class result = sMeasurementIdToClass.get(measurementId);
        if(result == null) {
            throw new UnrecognizedMeasurementTypeException(
                    "Didn't have a measurement with ID " + measurementId +
                    " cached");
        }
        return result;
>>>>>>> 2a3a97910753fd3d180c6bc7c48b30739809fb4f
    }

    public static Measurement getMeasurementFromRaw(
Solution content
        return getEvent();
    }

    public String serialize() {
        // TODO
        return "";
    }

    public static Measurement deserialize(String serializedMeasurement) {
        // TODO
        return null;
    }

    // TODO can we make this protected for everyone? it's really internal state
    // because all external users should care about is it being serialized. the
    // only place we use it right now is the MockedLocationSink.
    public static String getGenericName() {
        // TODO this needs to go away.
        return null;
    }

    private static void cacheMeasurementId(
            Class measurementType)
            throws UnrecognizedMeasurementTypeException {
        String measurementId;
        try {
            measurementId = (String) measurementType.getDeclaredMethod(
                    "getGenericName", null).invoke(null, null);
            sMeasurementIdToClass.put(measurementId, measurementType);
        } catch(NoSuchMethodException e) {
            throw new UnrecognizedMeasurementTypeException(
                    measurementType + " doesn't have a getGenericName method",
                    e);
        } catch(IllegalAccessException e) {
            throw new UnrecognizedMeasurementTypeException(
                    measurementType + " has an inaccessible ID", e);
        } catch(InvocationTargetException e) {
            throw new UnrecognizedMeasurementTypeException(
                    measurementType + " has an inaccessible ID", e);
        }
    }

    public static String getIdForClass(
            Class measurementType)
            throws UnrecognizedMeasurementTypeException {
        if(!sMeasurementIdToClass.inverse().containsKey(measurementType)) {
            cacheMeasurementId(measurementType);
        }
        return sMeasurementIdToClass.inverse().get(measurementType);
    }

    public static Class
            getClassForId(String measurementId)
            throws UnrecognizedMeasurementTypeException {
        Class result = sMeasurementIdToClass.get(measurementId);
        if(result == null) {
            throw new UnrecognizedMeasurementTypeException(
                    "Didn't have a measurement with ID " + measurementId +
                    " cached");
        }
        return result;
    }

    public static Measurement getMeasurementFromRaw(
File
BaseMeasurement.java
Developer's decision
Concatenation
Kind of conflict
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Variable