Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-graph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Lambert
swh-graph
Commits
4e2a94b3
Commit
4e2a94b3
authored
4 years ago
by
Antoine Pietri
Browse files
Options
Downloads
Patches
Plain Diff
java: cleanup MPHTranslate
parent
a315f1b9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/main/java/org/softwareheritage/graph/utils/MPHTranslate.java
+12
-19
12 additions, 19 deletions
...n/java/org/softwareheritage/graph/utils/MPHTranslate.java
with
12 additions
and
19 deletions
java/src/main/java/org/softwareheritage/graph/utils/MPHTranslate.java
+
12
−
19
View file @
4e2a94b3
...
...
@@ -5,20 +5,17 @@ import it.unimi.dsi.fastutil.io.BinIO;
import
it.unimi.dsi.fastutil.objects.Object2LongFunction
;
import
it.unimi.dsi.io.FastBufferedReader
;
import
it.unimi.dsi.io.LineIterator
;
import
org.softwareheritage.graph.experiments.multiplicationfactor.GenDistribution
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.nio.charset.StandardCharsets
;
public
class
MPHTranslate
{
final
static
String
SORT_BUFFER_SIZE
=
"40%"
;
private
static
JSAPResult
parse_args
(
String
[]
args
)
{
JSAPResult
config
=
null
;
try
{
SimpleJSAP
jsap
=
new
SimpleJSAP
(
GenDistribution
.
class
.
getName
(),
MPHTranslate
.
class
.
getName
(),
""
,
new
Parameter
[]{
new
UnflaggedOption
(
"function"
,
JSAP
.
STRING_PARSER
,
JSAP
.
REQUIRED
,
...
...
@@ -36,25 +33,21 @@ public class MPHTranslate {
return
config
;
}
public
static
void
main
(
String
[]
args
)
throws
IOExcep
tion
{
JSAPResult
config
=
parse_args
(
args
);
String
mphPath
=
config
.
getString
(
"func
tion
"
);
outputPermutation
(
mphPath
);
@SuppressWarnings
(
"unchecked"
)
// Suppress warning for Object2LongFunc
tion
cast
static
Object2LongFunction
<
String
>
loadMPH
(
String
mphPath
)
throws
IOException
,
ClassNotFoundExcep
tion
{
return
(
Object2LongFunction
<
String
>)
BinIO
.
loadObject
(
mphPath
);
}
public
static
void
main
(
String
[]
args
)
throws
IOException
,
ClassNotFoundException
{
JSAPResult
config
=
parse_args
(
args
);
String
mphPath
=
config
.
getString
(
"function"
);
@SuppressWarnings
(
"unchecked"
)
// Suppress warning for Object2LongFunction cast
static
void
outputPermutation
(
String
mphPath
)
throws
IOException
{
Object2LongFunction
<
String
>
mphMap
=
null
;
try
{
mphMap
=
(
Object2LongFunction
<
String
>)
BinIO
.
loadObject
(
mphPath
);
}
catch
(
ClassNotFoundException
e
)
{
System
.
exit
(
2
);
}
Object2LongFunction
<
String
>
mphMap
=
loadMPH
(
mphPath
);
FastBufferedReader
buffer
=
new
FastBufferedReader
(
new
InputStreamReader
(
System
.
in
,
StandardCharsets
.
US_ASCII
));
FastBufferedReader
buffer
=
new
FastBufferedReader
(
new
InputStreamReader
(
System
.
in
,
StandardCharsets
.
US_ASCII
));
LineIterator
lineIterator
=
new
LineIterator
(
buffer
);
while
(
lineIterator
.
hasNext
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment