| 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 |
| 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 |
| 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 extends Measurement> 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 extends Measurement> measurementType)
throws UnrecognizedMeasurementTypeException {
if(!sMeasurementIdToClass.inverse().containsKey(measurementType)) {
cacheMeasurementId(measurementType);
}
return sMeasurementIdToClass.inverse().get(measurementType);
}
public static Class extends Measurement>
getClassForId(String measurementId)
throws UnrecognizedMeasurementTypeException {
Class extends Measurement> 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 extends Measurement> 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 extends Measurement> measurementType)
throws UnrecognizedMeasurementTypeException {
if(!sMeasurementIdToClass.inverse().containsKey(measurementType)) {
cacheMeasurementId(measurementType);
}
return sMeasurementIdToClass.inverse().get(measurementType);
}
public static Class extends Measurement>
getClassForId(String measurementId)
throws UnrecognizedMeasurementTypeException {
Class extends Measurement> 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 |