Skip to content

Commit

Permalink
Rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
stewid committed Nov 5, 2019
1 parent fcac3f0 commit 570a5e6
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/trace.cpp
Expand Up @@ -38,19 +38,19 @@

typedef struct Contact
{
int rowid_;
int identifier_;
int t_;
int rowid;
int identifier;
int t;
} Contact;

class CompareContact {
public:
bool operator()(const Contact& c, int t) {
return c.t_ < t;
return c.t < t;
}

bool operator()(int t, const Contact& c) {
return t < c.t_;
return t < c.t;
}
};

Expand Down Expand Up @@ -200,7 +200,7 @@ doShortestPaths(const std::vector<std::map<int, Contacts> >& data,
tBegin,
CompareContact());

if (t_begin != it->second.end() && t_begin->t_ <= tEnd) {
if (t_begin != it->second.end() && t_begin->t <= tEnd) {
int t0, t1;

std::map<int, std::pair<int, int> >::iterator distance_it =
Expand All @@ -210,13 +210,13 @@ doShortestPaths(const std::vector<std::map<int, Contacts> >& data,

/* Increment with one since R vector is
* one-based. */
result[it->first].second = t_begin->rowid_ + 1;
result[it->first].second = t_begin->rowid + 1;
} else if (distance < distance_it->second.first) {
distance_it->second.first = distance;

/* Increment with one since R vector is
* one-based. */
distance_it->second.second = t_begin->rowid_ + 1;
distance_it->second.second = t_begin->rowid + 1;
}

if (ingoing) {
Expand All @@ -228,9 +228,9 @@ doShortestPaths(const std::vector<std::map<int, Contacts> >& data,
CompareContact());

t0 = tBegin;
t1 = (t_end-1)->t_;
t1 = (t_end-1)->t;
} else {
t0 = t_begin->t_;
t0 = t_begin->t;
t1 = tEnd;
}

Expand Down Expand Up @@ -388,7 +388,7 @@ doTraceContacts(const std::vector<std::map<int, Contacts> >& data,
tBegin,
CompareContact());

if (t_begin != it->second.end() && t_begin->t_ <= tEnd) {
if (t_begin != it->second.end() && t_begin->t <= tEnd) {
int t0, t1;

/* and then the upper bound, tEnd. */
Expand All @@ -401,7 +401,7 @@ doTraceContacts(const std::vector<std::map<int, Contacts> >& data,
for (Contacts::const_iterator iit=t_begin; iit!=t_end; ++iit) {
/* Increment with one since R vector is
* one-based. */
resultRowid.push_back(iit->rowid_ + 1);
resultRowid.push_back(iit->rowid + 1);

resultDistance.push_back(distance);
}
Expand All @@ -411,9 +411,9 @@ doTraceContacts(const std::vector<std::map<int, Contacts> >& data,

if (ingoing) {
t0 = tBegin;
t1 = (t_end-1)->t_;
t1 = (t_end-1)->t;
} else {
t0 = t_begin->t_;
t0 = t_begin->t;
t1 = tEnd;
}

Expand Down Expand Up @@ -529,7 +529,7 @@ degree(const std::vector<std::map<int, Contacts> >& data,
tBegin,
CompareContact());

if (t_begin != it->second.end() && t_begin->t_ <= tEnd) {
if (t_begin != it->second.end() && t_begin->t <= tEnd) {
++result;
}
}
Expand Down Expand Up @@ -560,7 +560,7 @@ contactChain(const std::vector<std::map<int, Contacts> >& data,
tBegin,
CompareContact());

if (t_begin != it->second.end() && t_begin->t_ <= tEnd) {
if (t_begin != it->second.end() && t_begin->t <= tEnd) {
int t0, t1;

if (ingoing) {
Expand All @@ -572,9 +572,9 @@ contactChain(const std::vector<std::map<int, Contacts> >& data,
CompareContact());

t0 = tBegin;
t1 = (t_end-1)->t_;
t1 = (t_end-1)->t;
} else {
t0 = t_begin->t_;
t0 = t_begin->t;
t1 = tEnd;
}

Expand Down

1 comment on commit 570a5e6

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/network-summary.R:262:1: style: functions should have cyclomatic complexity of less than 15, this has 38.

setMethod("NetworkSummary",
^

R/shortest-paths.R:169:1: style: functions should have cyclomatic complexity of less than 15, this has 41.

setMethod("ShortestPaths",
^

R/trace.R:161:1: style: functions should have cyclomatic complexity of less than 15, this has 56.

Trace <- function(movements,
^

R/tree.R:135:1: style: functions should have cyclomatic complexity of less than 15, this has 48.

position_tree <- function(tree,
^

Please sign in to comment.