+
+
+ /**
+ * Resize the value array
+ * @param inNewIndex new index to allow
+ */
+ private void resizeValueArray(int inNewIndex)
+ {
+ int newSize = inNewIndex + 1;
+ if (newSize > _fieldValues.length)
+ {
+ String[] newArray = new String[newSize];
+ System.arraycopy(_fieldValues, 0, newArray, 0, _fieldValues.length);
+ _fieldValues = newArray;
+ }
+ }
+
+
+ /**
+ * @return a clone object with copied data
+ */
+ public DataPoint clonePoint()
+ {
+ // Copy all values (note that photo not copied)
+ String[] valuesCopy = new String[_fieldValues.length];
+ System.arraycopy(_fieldValues, 0, valuesCopy, 0, _fieldValues.length);
+
+ PointCreateOptions options = new PointCreateOptions();
+ if (_altitude != null) {
+ options.setAltitudeUnits(_altitude.getUnit());
+ }
+ // Make new object to hold cloned data
+ DataPoint point = new DataPoint(valuesCopy, _fieldList, options);
+ // Copy the speed information
+ if (hasHSpeed()) {
+ point.getHSpeed().copyFrom(_hSpeed);
+ }
+ if (hasVSpeed()) {
+ point.getVSpeed().copyFrom(_vSpeed);
+ }
+ return point;
+ }
+
+
+ /**
+ * Remove all single and double quotes surrounding each value
+ * @param inValues array of values
+ */
+ private static void removeQuotes(String[] inValues)
+ {
+ if (inValues == null) {return;}
+ for (int i=0; i<inValues.length; i++)
+ {
+ inValues[i] = removeQuotes(inValues[i]);
+ }
+ }
+
+ /**
+ * Remove any single or double quotes surrounding a value
+ * @param inValue value to modify
+ * @return modified String
+ */
+ private static String removeQuotes(String inValue)
+ {
+ if (inValue == null) {return inValue;}
+ final int len = inValue.length();
+ if (len <= 1) {return inValue;}
+ // get the first and last characters
+ final char firstChar = inValue.charAt(0);
+ final char lastChar = inValue.charAt(len-1);
+ if (firstChar == lastChar)
+ {
+ if (firstChar == '\"' || firstChar == '\'') {
+ return inValue.substring(1, len-1);
+ }
+ }
+ return inValue;
+ }
+
+ /**
+ * Get string for debug
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[Lat=" + getLatitude().toString() + ", Lon=" + getLongitude().toString() + "]";
+ }