Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cosyverif
Services
service adt2amas
Commits
1c1af04c
Commit
1c1af04c
authored
Dec 09, 2020
by
Jaime Arias
Browse files
add minimal schedulign response
parent
ebfa0a60
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/org/cosyverif/service/adt2amas/MinimalScheduling.java
View file @
1c1af04c
package
org.cosyverif.service.adt2amas
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.nio.file.Paths
;
...
...
@@ -44,10 +46,13 @@ public class MinimalScheduling extends BinaryService {
multiline
=
true
)
private
String
outputParameter
=
""
;
@Parameter
(
name
=
"Number of graphs"
,
help
=
"String parameter help message."
,
direction
=
Direction
.
OUT
)
private
int
nGraphs
=
0
;
@Launch
public
Task
executeBinary
()
throws
IOException
{
parser
=
GrmlParser
.
create
(
modelParameter
);
File
model
=
parser
.
parse
();
final
File
model
=
parser
.
parse
();
String
binaryPath
=
Paths
.
get
(
baseDirectory
().
getAbsolutePath
(),
"adt2amas"
).
toString
();
...
...
@@ -63,7 +68,7 @@ public class MinimalScheduling extends BinaryService {
@Override
public
void
fallback
(
String
line
){
try
{
outputParameter
=
formatResult
();
outputParameter
=
formatResult
(
model
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -75,25 +80,58 @@ public class MinimalScheduling extends BinaryService {
});
}
private
String
formatResult
()
throws
IOException
{
BufferedWriter
bw
=
null
;
private
String
formatResult
(
File
modelFile
)
throws
IOException
{
BufferedReader
br
=
null
;
FileReader
fr
=
null
;
StringBuffer
s
=
new
StringBuffer
();
String
line
=
""
;
String
match
;
FileWriter
fw
=
null
;
String
result
=
""
;
try
{
File
fileOutput
=
new
File
(
baseDirectory
().
getAbsolutePath
()
+
"/minimal_scheduling.log"
);
fw
=
new
FileWriter
(
fileOutput
);
bw
=
new
BufferedWriter
(
fw
);
File
fileOutput
=
new
File
(
baseDirectory
().
getAbsolutePath
()
+
"/"
+
modelFile
.
getName
()
+
".log"
);
fr
=
new
FileReader
(
fileOutput
);
br
=
new
BufferedReader
(
fr
);
fw
=
new
FileWriter
(
modelFile
.
getParent
()
+
"/debug.out"
);
fw
.
write
(
"writing output: \n"
);
line
=
br
.
readLine
();
if
(
line
!=
null
)
{
match
=
line
.
substring
(
line
.
indexOf
(
":"
)
+
1
).
trim
();
this
.
nGraphs
=
Integer
.
parseInt
(
match
);
fw
.
append
(
"n graphs: "
+
match
+
"\n"
);
}
while
(
this
.
nGraphs
>
0
&&
(
line
=
br
.
readLine
())
!=
null
)
{
// find a graph info
if
(
line
.
startsWith
(
"Graph #"
)
||
line
.
startsWith
(
"# Agents:"
)
||
line
.
startsWith
(
"# Slots:"
))
{
if
(
line
.
startsWith
(
"#"
))
{
s
.
append
(
" - "
);
}
s
.
append
(
line
);
}
// new graph
if
(
line
==
""
&&
s
.
length
()
!=
0
)
{
s
.
append
(
"\n"
);
}
}
fw
.
append
(
"data:\n"
+
s
);
}
catch
(
Exception
e
)
{
fw
.
append
(
"error: "
+
e
.
getMessage
()
+
"\n"
);
e
.
printStackTrace
();
}
finally
{
if
(
bw
!=
null
)
bw
.
close
();
if
(
br
!=
null
)
br
.
close
();
if
(
fr
!=
null
)
fr
.
close
();
if
(
fw
!=
null
)
fw
.
close
();
}
return
result
;
return
s
.
toString
()
;
}
@Example
(
name
=
"Example of the minimal scheduling algorithm"
,
...
...
src/main/resources/binaries.properties
View file @
1c1af04c
binary-linux
=
https://ci.appveyor.com/api/buildjobs/
0i8yjco6qkfmik50
/artifacts/linux-x86_64.zip
binary-linux
=
https://ci.appveyor.com/api/buildjobs/
3fh7puk3cpb2qn9i
/artifacts/linux-x86_64.zip
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment