2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-07 00:58:29 +03:00
|
|
|
import _VisualDVM.Global;
|
|
|
|
|
import Common_old.Utils.Utils;
|
2023-09-17 22:13:42 +03:00
|
|
|
import GlobalData.Tasks.RunTask.RunTask;
|
2023-11-19 02:12:44 +03:00
|
|
|
import Visual_DVM_2021.Passes.SilentSapforPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.nio.file.StandardCopyOption;
|
|
|
|
|
public class SPF_StatisticAnalyzer extends SilentSapforPass {
|
|
|
|
|
public RunTask task;
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
if (super.canStart(args)) {
|
|
|
|
|
task = (RunTask) args[0];
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void body() throws Exception {
|
|
|
|
|
sapfor.RunAnalysis(
|
|
|
|
|
code().toString(),
|
|
|
|
|
-Global.messagesServer.getPort(),
|
|
|
|
|
Global.packSapforSettings(),
|
|
|
|
|
Utils.DQuotes(task.getLocalStsFile().getAbsolutePath()) +
|
|
|
|
|
" "
|
|
|
|
|
+ Utils.DQuotes(target.getStsFile().getAbsolutePath()));
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean isGoodCode() {
|
|
|
|
|
return sapfor.getErrorCode() == 0;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public boolean needsConfirmations() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
if (target.getStsFile().exists()) {
|
|
|
|
|
Files.copy(target.getStsFile().toPath(), task.getLocalStsTextFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|