1
\$\begingroup\$
public final class Descriptors {    
public static final EnumValueDescriptor TIME_SETTING = new EnumValueDescriptor(
            R.string.pref_label_time_setting, 
            Measures.TIME_SETTING_12, R.string.pref_time_setting_12,
            Measures.TIME_SETTING_24, R.string.pref_time_setting_24);

public static final EnumValueDescriptor MEASURE_BG = new EnumValueDescriptor(
        R.string.pref_label_bg, 
        Measures.BG_MMOL_L, R.string.measure_mmol_l,
        Measures.BG_MG_DL, R.string.measure_mg_dl);

public static final EnumValueDescriptor MEASURE_СH = new EnumValueDescriptor(
        R.string.pref_label_ch, 
        Measures.CH_G, R.string.measure_g,
        Measures.CH_EXCH, R.string.measure_exch);

    // Is there a better way to specify table data?
public static final NumericValueDescriptor TBG_MMOL_L = new NumericValueDescriptor(
        R.string.pref_label_target_blood_glucose,
        ValueFormat.ONE_SIGNIFICANT_DIGIT,
        0.0f,
        40.0f,
        0.1f,
        R.string.measure_mmol_l);

public static final NumericValueDescriptor TBG_MG_DL = new NumericValueDescriptor(
        R.string.pref_label_target_blood_glucose,
        ValueFormat.INT,
        0f,
        300f,
        1f,
        R.string.measure_mg_dl);

public static final NumericValueDescriptor CF_MMOL_L_U = new NumericValueDescriptor(
        R.string.pref_label_correction_factor,
        ValueFormat.ONE_SIGNIFICANT_DIGIT,
        0.1f,
        99.0f,
        0.1f,
        R.string.measure_mmol_l_u);

public static final NumericValueDescriptor CF_MG_DL_U = new NumericValueDescriptor(
        R.string.pref_label_correction_factor,
        ValueFormat.INT,
        1f,
        99f,
        1f,
        R.string.measure_mg_dl_u);

public static final NumericValueDescriptor MF_G_U = new NumericValueDescriptor(
        R.string.pref_label_meal_factor,
        ValueFormat.ONE_SIGNIFICANT_DIGIT,
        0.1f,
        99.0f,
        0.1f,
        R.string.measure_g_u);

public static final NumericValueDescriptor MF_U_EXCH = new NumericValueDescriptor(
        R.string.pref_label_meal_factor,
        ValueFormat.INT,            
        1f,
        99f,
        1f,
        R.string.measure_u_exch);

public static final int TYPE_TBG_MMOL_L = 0;
public static final int TYPE_TBG_MG_DL = 1;
public static final int TYPE_CF_MMOL_L_U = 2;
public static final int TYPE_CF_MG_DL_U = 3;
public static final int TYPE_MF_G_U = 4;
public static final int TYPE_MF_U_EXCH = 5;

    // Actually this is mapping of TYPE_TBG_MMOL_L  to an object, how better link constants above with objects?
public static final NumericValueDescriptor[] NUMERIC_DESCRIPTORS = {
    TBG_MMOL_L,
    TBG_MG_DL,
    CF_MMOL_L_U,
    CF_MG_DL_U,
    MF_G_U,
    MF_U_EXCH
};
 }
\$\endgroup\$
2
  • 3
    \$\begingroup\$ if would make our lives easier if you tell us what is your actual question \$\endgroup\$ Commented Apr 13, 2011 at 18:34
  • \$\begingroup\$ First, ask yourself: do you really need a table data or can you solve it by applying some OOP principles like polymorphism? I have read the code and couldn't come to another conclusion. \$\endgroup\$ Commented Apr 28, 2011 at 18:08

1 Answer 1

2
\$\begingroup\$

This class doesn't have any responsibilities, it just holds a group of static variables. It is unclear what the purpose of these variables are. I am sure there is a better way to achieve your goal as I doubt you actually need to be storing these details here.

\$\endgroup\$
2
  • \$\begingroup\$ Exactly, it has no responsibilites... I need to specify such static (table) data, what is better approach to do it in Java? (Android application) \$\endgroup\$ Commented Apr 17, 2011 at 13:06
  • \$\begingroup\$ @Solvek, if this (whatever it is) really needs to be stored in variable, then put it in the class that uses it instead. \$\endgroup\$ Commented Apr 17, 2011 at 19:44

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.