Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksVasilev committed Oct 31, 2021
1 parent eb74e7b commit 7c9907d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
Binary file modified out/jar/fit2gpx.jar
Binary file not shown.
24 changes: 6 additions & 18 deletions src/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ int run() { // Основной поэтапный цикл работы кон
int readStatus = this.read(); // read file to buffer
if(readStatus !=0) {return readStatus;}

int fixstatus = this.fix(); // try to fix data in non corrupted file
if(fixstatus !=0) {return fixstatus;}
int fixstatus = this.fix(); // try to fix data in non corrupted file
if(fixstatus !=0) {return fixstatus;}

if(OUT == Out.DATABASE) {

Expand Down Expand Up @@ -289,13 +289,6 @@ private int fix() { // fix various error and hole in data (#1, #13,
}
}

/* if(last_dist.equals(prev_dist) && speed != 0.0) {
row1.put("speed",String.valueOf(0.0));
row1.put("enhanced_speed",String.valueOf(0.0));
row1.put("fixed",append(row1.get("fixed"),"speed-to-zero,"));
speed = 0.0;
}
*/
prev_date = date;

if (row1.containsKey("position_lat") && row1.containsKey("position_long")) { // Fix 01-Bryton-hole-ele/Bryton-hole-coord - Bryton hole fix
Expand All @@ -319,7 +312,7 @@ private int fix() { // fix various error and hole in data (#1, #13,
row1.put("fixed",append(row1.get("fixed"),"Bryton-hole-ele,"));
}

Buffer.put(m.getKey(), new HashMap<>() { { row1.forEach(this::put); } }); // write change to buffer
Buffer.put(m.getKey(), new HashMap<>() { { this.putAll(row1); } }); // write change to buffer
row1.clear();
} // End 01-Bryton-hole-ele/Bryton-hole-coord

Expand All @@ -336,7 +329,7 @@ private int fix() { // fix various error and hole in data (#1, #13,
row2.put("position_lat",lat);
row2.put("position_long",lon);
row2.put("fixed",append(row2.get("fixed"),"Bryton-start-coord,"));
Buffer.put(map02b_i.getKey(), new HashMap<>() { { row2.forEach(this::put); } }); // write change to buffer
Buffer.put(map02b_i.getKey(), new HashMap<>() { { this.putAll(row2); } }); // write change to buffer
row2.clear();
} else {
break;
Expand Down Expand Up @@ -560,7 +553,7 @@ private int read() { // Try to read input file // Чукча-читатель
SimpleDateFormat hashDate = new SimpleDateFormat("yyyyMMddHHmmss");
hashDate.setTimeZone(TimeZone.getTimeZone("UTC"));

String hashString = (String.valueOf(__manufacturer) + String.valueOf(__product) + hashDate.format(FileTimeStamp) + String.valueOf(SerialNumber));
String hashString = (__manufacturer + String.valueOf(__product) + hashDate.format(FileTimeStamp) + SerialNumber);
hashActivity = SHA1(hashString);

};
Expand Down Expand Up @@ -765,7 +758,7 @@ private int read() { // Try to read input file // Чукча-читатель
if(mesg.getFieldStringValue(4) != null) { // 227.4 - ?, always = 1?
fields.put("gsi_227_4",mesg.getFieldStringValue(4)); }

Buffer.put(DateFormatCSV.format(TimeStamp), new HashMap<>() { { fields.forEach(this::put); } });
Buffer.put(DateFormatCSV.format(TimeStamp), new HashMap<>() { { this.putAll(fields); } });
fields.clear();
EmptyTrack = false;
}
Expand Down Expand Up @@ -846,10 +839,6 @@ private int read() { // Try to read input file // Чукча-читатель
return 0;
}

private void get_connect_iq_fields(){ // TODO

}

private void format() { // format output from buffer to text

if(EmptyTrack && !SaveIfEmpty) {
Expand Down Expand Up @@ -1067,7 +1056,6 @@ private int write() { // Try to write output file // Чукча-писател
if(MergeOut) { // TODO определить стратегию формирования имени выходного файла
if (OutputFileNameMerged.equals("")) {
OutputFileNameMerged = OutputFileName;
append = false;
} else {
OutputFileName = OutputFileNameMerged;
append = true;
Expand Down
2 changes: 1 addition & 1 deletion src/fit2gpx.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

public class fit2gpx extends Component {

static final String _version_ = "0.1.17";
static final String _version_ = "0.1.18";

static ResourceBundle tr = ResourceBundle.getBundle("locale/tr", Locale.getDefault());
static ArrayList<Mode> WorkMODE = new ArrayList<>();
Expand Down

0 comments on commit 7c9907d

Please sign in to comment.