Package eas.miscellaneous.system

Examples of eas.miscellaneous.system.FileNamePostfixFilter


     */
    public static void renameALL(final String ext1,
                                 final String ext2,
                                 final ParCollection params) {
        File pfad = new File(params.getStdDirectory());
        String[] alleDat = pfad.list(new FileNamePostfixFilter(ext1));
        String neuName;
       
        if (alleDat == null) {
            return;
        }
View Full Code Here


     * @param params  Die Parameter.
     */
    public static void deleteALL(final String ext,
                                 final ParCollection params) {
        File pfad = new File(params.getStdDirectory());
        String[] alleDat = pfad.list(new FileNamePostfixFilter(ext));
       
        if (alleDat == null) {
            return;
        }

View Full Code Here

        externalFiles.put(fileID, dotStarterFileFile);
       
        if (!dotStarterFileFile.exists()) {
            if (fileSel) {
                FileDialog dia = new FileDialog((JFrame) null, "Please show me the path to " + fileID + " (select the file and confirm)", FileDialog.LOAD);
                dia.setFilenameFilter(new FileNamePostfixFilter(".eas"));
                dia.setVisible(true);
   
                if (dia.getDirectory() == null || dia.getFile() == null) {
                    GeneralDialog.message(fileID + " is not available, sorry I will not be able to perform the according actions.", fileID + " not available");
                    throw new RuntimeException(fileID + " not available: " + dsf);
View Full Code Here

        this.repeat = repeat;
    }
   
    public MP3Player(File f) {
        try {
            String[] files = f.list(new FileNamePostfixFilter("mp3"));
            ArrayList<String> a = new ArrayList<String>(files.length);
            for (String s : files) {
                a.add(s);
            }
            Collections.sort(a);
View Full Code Here

        ParCollection params = GlobalVariables.getPrematureParameters();
        params.complete();
        params.setLoggingLevel(-1);
        String endungGZ = "gz";
        String endung = "xml";
        String[] gespGrGZ = path.list(new FileNamePostfixFilter(endungGZ));
        String[] gespGr;
        String[] gespGrFIT;
       
        if (gespGrGZ == null) {
            StaticMethods.log(
                    StaticMethods.LOG_ERROR,
                    "Ungueltiges Verzeichnis: " + path.getAbsolutePath(),
                    params);
            throw new RuntimeException("Ungültiges Verzeichnis.\n" + path.getAbsolutePath());
        }
       
        // Entpacke Dateien.
        for (String s : gespGrGZ) {
            if (!new File(path.getAbsolutePath() + File.separator + StaticMethods.datNamOhneHintErw(s)).exists()) {
                StaticMethods.logInfo("Entpacken " + s + ".", params);
                StaticMethods.entpackeDatei(
                        path.getAbsolutePath() + File.separator + s,
                        path.getAbsolutePath() + File.separator + StaticMethods.datNamOhneHintErw(s),
                        false);
            } else {
                params.logInfo("Datei existiert bereits: " + StaticMethods.datNamOhneHintErw(s));
            }
        }
       
        gespGr = path.list(new FileNamePostfixFilter(endung));
       
        // Find all changing parameters.
       
        HashSet<String> differingPars;
        if (changingParams != null) {
            differingPars = changingParams;
        } else {
            differingPars = new HashSet<String>();
            ArrayList<SingleParameter> allPars0 = null;
            for (String s : gespGr) {
                if (new File(path + "\\" + s + "-fitness.txt").exists()) {
                    params.logInfo("Datei existiert bereits: " + s + "-fitness.txt");
                } else {
                    XMLAufnLesen read = new XMLAufnLesen(new File(path + "\\" + s), params);
                    params.logInfo("Datei gelesen: " + s);
                   
                    if (allPars0 == null) {
                        allPars0 = read.getParams().getAllPars();
                    }
                   
                    ParCollection parColl = read.getParams();
                   
                    ArrayList<SingleParameter> allParsI = parColl.getAllPars();
                    for (SingleParameter par0 : allPars0) {
                        for (SingleParameter parI : allParsI) {
                            if (par0.getParameterName().equals(parI.getParameterName())) {
                                if (!par0.getParValue().equals(parI.getParValue())) {
                                    differingPars.add(par0.getParameterName());
                                }
                            }
                        }
                    }
                }
            }
        }
       
        params.logInfo("Folgende sich ändernde Parameter gefunden: " + differingPars);
       
        int window = 50;
        double[] formerValues = new double[window];
        int count;
       
        // Extrahiere Fitness in Einzeldateien.
        for (String s : gespGr) {
            if (new File(path + "\\" + s + "-fitness.txt").exists()) {
                params.logInfo("Datei existiert bereits: " + s + "-fitness.txt");
            } else {
                   
                XMLAufnLesen read = new XMLAufnLesen(new File(path + "\\" + s), params);
                params.logInfo("Datei gelesen: " + s);
                LinkedList<String> fitness = new LinkedList<String>();
   
                String preAmble = "";
                for (String par : differingPars) {
                    preAmble += par + "=" + read.getParams().getParValue(par) + ";";
                }

                count = 0;
                double lastMovingAvgVal = 0;
                int fitsumGes = 0;
               
                for (Population pop : read.getAllPopulations()) {
                   
                    String fit = "" + preAmble;
                    fit += pop.getCycle() + ";";
                    double fitSum = 0;
                    int min = Integer.MAX_VALUE;
                    int max = Integer.MIN_VALUE;
                    for (Roboter rob : pop.getRoboterArray()) {
                        if (rob.getFit() > max) {
                            max = rob.getFit();
                        }
                        if (rob.getFit() < min) {
                            min = rob.getFit();
                        }
                       
                        fit += rob.getFit() +";";
                        fitSum += rob.getFit();
                    }
                    fitSum /= pop.getRoboterArray().length;
                   
                    fit += fitSum;
                   
                    formerValues[count % window] = fitSum;
                   
                    if (count >= window) {
                        fit += ";" + average(formerValues) + ";" + (average(formerValues) - lastMovingAvgVal);
                    } else {
                        fit += ";" + 0 + ";0";
                    }
                   
                    // Par;zyklus;rob0...robn;fitSum;movAvg;movAvgDelta;Integral;min;max
                   
                    fitsumGes += fitSum;
                    fit += ";" + fitsumGes;
                   
                    fit += ";" + min + ";" + max;
                   
                    fitness.add(fit);
                    count++;
                    lastMovingAvgVal = average(formerValues);
                }
               
                StaticMethods.speichereTextAusArray(path.getAbsolutePath(), s + "-fitness.txt", fitness, params);
            }
        }
       
        gespGrFIT = path.list(new FileNamePostfixFilter("-fitness.txt"));
        LinkedList<String> liste = new LinkedList<String>();
        for (String s : gespGrFIT) {
            params.logInfo("Schreibe Daten in Gesamtdatei: " + s);

            for (String line : StaticMethods.liesTextArray(new File(path + "\\"
View Full Code Here

    private int filesFinished;

    @Override
    public void runBeforeSimulation(EnvironmentEA umg, ParCollection params) {
        super.runBeforeSimulation(umg, params);
        storedRuns = new File(params.getStdDirectory()).listFiles(new FileNamePostfixFilter("gz"));
        filesFinished = 0;
    }
View Full Code Here

     * Verzeichnis.
     */
    private void ladeGraphen() {
        File verz = new File(this.pars.getStdDirectory());
        String endung = eas.startSetup.marbBuilder.ConstantsGraphVis.GRAPH_ENDUNG;
        String[] gespGr = verz.list(new FileNamePostfixFilter(endung));
        String grNam;
        VisMantel visRob = null;
        Vis obs = null;
       
        if (gespGr != null) {
View Full Code Here

     * Verzeichnis.
     */
    private void ladeGraphen() {
        File verz = new File(this.pars.getStdDirectory());
        String endung = ConstantsFunktionen2D.PFEIL_ENDUNG;
        String[] gespGr = verz.list(new FileNamePostfixFilter(endung));
        String graphName;
        ZeichFen graphFenster;

        if (gespGr != null) {
            for (int i = 0; i < gespGr.length; i++) {
View Full Code Here

                    if (!diaAllg.getResult().equals("Abbrechen")) {
                        dia = new FileDialog(this, "Pfeil als PNG speichern",
                                FileDialog.SAVE);
   
                        dia.setFilenameFilter(
                                new FileNamePostfixFilter(diaAllg.getResult()));
   
                        dia.setVisible(true);
   
                        if (dia.getDirectory() != null
                                && dia.getFile() != null) {
View Full Code Here

     * Verzeichnis.
     */
    private void ladeGraphen() {
        File verz = new File(this.pars.getStdDirectory());
        String endung = eas.startSetup.marbBuilder.ConstantsGraphVis.GRAPH_ENDUNG;
        String[] gespGr = verz.list(new FileNamePostfixFilter(endung));
        String graphName;
        Vis graphFenster;

        if (gespGr != null) {
            for (int i = 0; i < gespGr.length; i++) {
View Full Code Here

TOP

Related Classes of eas.miscellaneous.system.FileNamePostfixFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.