@Test public void getDoubleAnswerValueFromIAnswerDataTest() { assertNull(StringWidgetUtils.getIntegerAnswerValueFromIAnswerData(null)); assertEquals(new Double(0), StringWidgetUtils.getDoubleAnswerValueFromIAnswerData(new DecimalData(0))); assertEquals(new Double(-15), StringWidgetUtils.getDoubleAnswerValueFromIAnswerData(new DecimalData(-15))); assertEquals(new Double(-15.123), StringWidgetUtils.getDoubleAnswerValueFromIAnswerData(new DecimalData(-15.123))); assertEquals(new Double(15), StringWidgetUtils.getDoubleAnswerValueFromIAnswerData(new DecimalData(15))); assertEquals(new Double(15.123), StringWidgetUtils.getDoubleAnswerValueFromIAnswerData(new DecimalData(15.123))); }
@SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) public static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Integer ? (double) (Integer) dataValue : (Double) dataValue; } } return null; }
StringWidgetUtils { @SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) public static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Integer ? (double) (Integer) dataValue : (Double) dataValue; } } return null; } }
StringWidgetUtils { @SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) public static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Integer ? (double) (Integer) dataValue : (Double) dataValue; } } return null; } private  StringWidgetUtils(); }
StringWidgetUtils { @SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) public static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Integer ? (double) (Integer) dataValue : (Double) dataValue; } } return null; } private  StringWidgetUtils(); @SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder); @SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder); static IntegerData getIntegerData(String answer, FormEntryPrompt prompt); static DecimalData getDecimalData(String answer, FormEntryPrompt prompt); static StringData getStringNumberData(String answer, FormEntryPrompt prompt); static void adjustEditTextAnswerToIntegerWidget(EditText answerText, FormEntryPrompt prompt); static void adjustEditTextAnswerToDecimalWidget(EditText answerText, FormEntryPrompt prompt); static void adjustEditTextAnswerToStringNumberWidget(EditText answerText, FormEntryPrompt prompt); }
StringWidgetUtils { @SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) public static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Integer ? (double) (Integer) dataValue : (Double) dataValue; } } return null; } private  StringWidgetUtils(); @SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder); @SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder); static IntegerData getIntegerData(String answer, FormEntryPrompt prompt); static DecimalData getDecimalData(String answer, FormEntryPrompt prompt); static StringData getStringNumberData(String answer, FormEntryPrompt prompt); static void adjustEditTextAnswerToIntegerWidget(EditText answerText, FormEntryPrompt prompt); static void adjustEditTextAnswerToDecimalWidget(EditText answerText, FormEntryPrompt prompt); static void adjustEditTextAnswerToStringNumberWidget(EditText answerText, FormEntryPrompt prompt);  }