package _VisualDVM.Passes.All;
import Common.Visual.UI;
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
import _VisualDVM.ComponentsServer.Component.Sapfor.TransformationPermission;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Sapfor.SapforTransformation;
import _VisualDVM.ProjectData.SapforData.Variants.ParallelVariant;
public class SPF_CreateParallelVariant extends SapforTransformation {
    ParallelVariant variant = null;
    @Override
    protected TransformationPermission getPermission() {
        return TransformationPermission.VariantsOnly;
    }
    @Override
    public boolean hasStats() {
        return false;
    }
    @Override
    public boolean needsConfirmations() {
        return false;
    }
    @Override
    protected boolean needsAnimation() {
        return false;
    }
    @Override
    protected boolean resetAnalysesAfter() {
        return false;
    }
    @Override
    protected String getVersionLetter() {
        return "p";
    }
    @Override
    protected String getVersionDescription() {
        return variant.getDescription();
    }
    @Override
    protected PassCode necessary() {
        return PassCode.SPF_GetArrayDistribution;
    }
    @Override
    protected void performPreparation() throws Exception {
        target.createEmptyVersion(getVersionLetter(), getVersionDescription());
    }
    @Override
    protected boolean canStart(Object... args) throws Exception {
        if (super.canStart(args)) {
            if (args.length > 0) {
                variant = (ParallelVariant) args[0];
            } else {
                target.filter_distributed = 1;
                target.filter_multiplied = 1;
                target.gen_variants_vectors();
                if (target.parallelVariants.size() == 1) {
                    variant = target.parallelVariants.getFirstRecord();
                } else return false;
            }
            Options = variant.getVector();
            return true;
        }
        return false;
    }
    @Override
    protected void performDone() throws Exception {
        Sapfor.transformationPermission = TransformationPermission.VariantsOnly;
        target.migrateFilesSettings(target.last_version, true, true);
        if (UI.isActive())
            variant.UpdateStats(sapfor.getPredictorStats(), target.last_version.name);
    }
    @Override
    protected void performFinish() throws Exception {
    }
    @Override
    protected void showFinish() throws Exception {
    }
    @Override
    protected void FocusResult() {
    }
}
