forked from martinadamek/json-android-compare
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
207 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.martinadamek.jsonandroid; | ||
|
||
public class ResultsContainer { | ||
private final long mDuration; | ||
private final int mTestRepeats; | ||
private final String mParserName; | ||
|
||
public long getDuration() { | ||
return mDuration; | ||
} | ||
|
||
public int getTestRepeats() { | ||
return mTestRepeats; | ||
} | ||
|
||
public String getParserName() { | ||
return mParserName; | ||
} | ||
|
||
public ResultsContainer(String parserName, long duration, int testRepeats){ | ||
mParserName = parserName; | ||
mDuration = duration; | ||
mTestRepeats = testRepeats; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.martinadamek.jsonandroid; | ||
|
||
import java.util.Map; | ||
|
||
public class StringUtils { | ||
public static String map2json(Map map) { | ||
StringBuilder sb = new StringBuilder("{"); | ||
|
||
for (Object key: map.keySet()) { | ||
sb.append('"').append(key).append('"').append(':').append('"').append(map.get(key)).append('"').append(","); | ||
} | ||
|
||
sb.append("}"); | ||
return sb.toString(); | ||
} | ||
|
||
public static String padLeft(String s, int n) { | ||
return String.format("%1$" + n + "s", s); | ||
} | ||
|
||
public static String padRight(String s, int n) { | ||
return String.format("%1$-" + n + "s", s); | ||
} | ||
|
||
public static String padLeft(long l, int n){ | ||
return String.format("%0"+n+"d", l); | ||
} | ||
} |