1 package tim.prune.data;
3 import tim.prune.I18nManager;
6 * Class to represent a field of a data point
11 private String _labelKey = null;
12 private String _customLabel = null;
13 private FieldType _type = null;
14 private boolean _builtin = false;
16 public static final Field LATITUDE = new Field("fieldname.latitude", FieldType.COORD);
17 public static final Field LONGITUDE = new Field("fieldname.longitude", FieldType.COORD);
18 public static final Field ALTITUDE = new Field("fieldname.altitude", FieldType.INT);
19 public static final Field TIMESTAMP = new Field("fieldname.timestamp", FieldType.TIME);
20 public static final Field WAYPT_NAME = new Field("fieldname.waypointname", FieldType.NONE);
21 public static final Field WAYPT_TYPE = new Field("fieldname.waypointtype", FieldType.NONE);
22 public static final Field NEW_SEGMENT = new Field("fieldname.newsegment", FieldType.BOOL);
24 public static final Field[] ALL_AVAILABLE_FIELDS = {
25 LATITUDE, LONGITUDE, ALTITUDE, TIMESTAMP, WAYPT_NAME, WAYPT_TYPE, NEW_SEGMENT,
26 new Field("fieldname.custom", FieldType.NONE)
31 * @param inLabelKey Key for label texts
32 * @param inType type of field
34 private Field(String inLabelKey, FieldType inType)
36 _labelKey = inLabelKey;
44 * Public constructor for custom fields
45 * @param inLabel label to use for display
47 public Field(String inLabel)
50 _customLabel = inLabel;
51 _type = FieldType.NONE;
55 * @return the name of the field
57 public String getName()
59 if (_labelKey != null)
60 return I18nManager.getText(_labelKey);
65 * Change the name of the (non built-in) field
66 * @param inName new name
68 public void setName(String inName)
70 if (!isBuiltIn()) _customLabel = inName;
74 * @return true if this is a built-in field
76 public boolean isBuiltIn()
84 public FieldType getType()
90 * Checks if the two fields are equal
91 * @param inOther other Field object
92 * @return true if Fields identical
94 public boolean equals(Field inOther)
96 return (isBuiltIn() == inOther.isBuiltIn() && getName().equals(inOther.getName()));