Code Cleanup

- Removed unused util.cpp compressIds function.
This commit is contained in:
Paul Beckingham 2014-09-07 16:57:05 -04:00
parent dd6399aba7
commit 4f54578241
2 changed files with 0 additions and 56 deletions

View file

@ -267,61 +267,6 @@ int flock (int fd, int operation)
}
#endif
////////////////////////////////////////////////////////////////////////////////
// The vector must be sorted first. This is a modified version of the run-
// length encoding algorithm.
//
// This function converts the vector:
//
// [1, 3, 4, 6, 7, 8, 9, 11]
//
// to ths string:
//
// 1,3-4,6-9,11
//
std::string compressIds (const std::vector <int>& ids)
{
std::stringstream result;
int range_start = 0;
int range_end = 0;
for (unsigned int i = 0; i < ids.size (); ++i)
{
if (i + 1 == ids.size ())
{
if (result.str ().length ())
result << ",";
if (range_start < range_end)
result << ids[range_start] << "-" << ids[range_end];
else
result << ids[range_start];
}
else
{
if (ids[range_end] + 1 == ids[i + 1])
{
++range_end;
}
else
{
if (result.str ().length ())
result << ",";
if (range_start < range_end)
result << ids[range_start] << "-" << ids[range_end];
else
result << ids[range_start];
range_start = range_end = i + 1;
}
}
}
return result.str ();
}
////////////////////////////////////////////////////////////////////////////////
void combine (std::vector <int>& dest, const std::vector <int>& source)
{

View file

@ -61,7 +61,6 @@ int execute (const std::string&, const std::vector <std::string>&, const std::st
int flock (int, int);
#endif
std::string compressIds (const std::vector <int>&);
void combine (std::vector <int>&, const std::vector <int>&);
unsigned burndown_size (unsigned ntasks);