Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
java-wowa-training
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cylab
java-wowa-training
Commits
75280f8e
Commit
75280f8e
authored
5 years ago
by
a.croix
Browse files
Options
Downloads
Patches
Plain Diff
Remove class used to convert data from array to List
parent
1d6457cd
No related branches found
No related tags found
No related merge requests found
Pipeline
#1687
failed
5 years ago
Stage: leaks
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/be/cylab/java/wowa/training/Convert.java
+0
-84
0 additions, 84 deletions
src/main/java/be/cylab/java/wowa/training/Convert.java
src/main/java/be/cylab/java/wowa/training/Example.java
+2
-2
2 additions, 2 deletions
src/main/java/be/cylab/java/wowa/training/Example.java
with
2 additions
and
86 deletions
src/main/java/be/cylab/java/wowa/training/Convert.java
deleted
100644 → 0
+
0
−
84
View file @
1d6457cd
package
be.cylab.java.wowa.training
;
import
com.owlike.genson.GenericType
;
import
com.owlike.genson.Genson
;
import
java.io.BufferedWriter
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Class to convert. Tmp
*/
public
final
class
Convert
{
private
Convert
()
{
}
/**
* Main.
*
* @param args
*/
public
static
void
main
(
final
String
[]
args
)
{
String
data_json
=
null
;
String
expected_json
=
null
;
try
{
data_json
=
new
String
(
Files
.
readAllBytes
(
Paths
.
get
(
"./ressources/webshell_data.json"
)),
StandardCharsets
.
UTF_8
);
expected_json
=
new
String
(
Files
.
readAllBytes
(
Paths
.
get
(
"./ressources/webshell_expected.json"
)),
StandardCharsets
.
UTF_8
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
Genson
genson
=
new
Genson
();
List
<
double
[]>
data
=
genson
.
deserialize
(
data_json
,
new
GenericType
<
List
<
double
[]>>()
{
});
List
<
List
<
Double
>>
data_list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
data
.
size
();
i
++)
{
List
<
Double
>
vector_list
=
new
ArrayList
<>();
double
[]
vector
=
new
double
[
data
.
get
(
i
).
length
];
for
(
double
el
:
vector
)
{
vector_list
.
add
(
el
);
}
data_list
.
add
(
vector_list
);
}
double
[]
expected
=
genson
.
deserialize
(
expected_json
,
double
[].
class
);
List
<
Double
>
expected_list
=
new
ArrayList
<>();
for
(
double
el
:
expected
)
{
expected_list
.
add
(
el
);
}
String
data_final
=
genson
.
serialize
(
data_list
);
try
{
BufferedWriter
writer
=
new
BufferedWriter
(
new
FileWriter
(
"./ressources/webshell_data_list.json"
));
writer
.
write
(
data_final
);
writer
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
String
expected_final
=
genson
.
serialize
(
expected_list
);
try
{
BufferedWriter
writer
=
new
BufferedWriter
(
new
FileWriter
(
"./ressources/webshell_expected_list.json"
));
writer
.
write
(
expected_final
);
writer
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/be/cylab/java/wowa/training/Example.java
+
2
−
2
View file @
75280f8e
...
...
@@ -65,8 +65,8 @@ public final class Example {
long
start_time
=
System
.
currentTimeMillis
();
AbstractSolution
solution
=
trainer
.
run
(
"./ressources/webshell_data.json"
,
"./ressources/webshell_expected.json"
);
"./ressources/webshell_data
_list
.json"
,
"./ressources/webshell_expected
_list
.json"
);
System
.
out
.
println
(
solution
);
long
end_time
=
System
.
currentTimeMillis
();
logger
.
log
(
Level
.
INFO
,
"Execution time : "
...
...
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