CPD Results

The following document contains the results of PMD's CPD 6.21.0.

Duplications

File Line
org\djunits\generator\GenerateDJUNIT.java 429
org\djunits\generator\GenerateDJUNIT.java 611
    private static String formulasVector(String java, String errorType, String prefix)
    {
        String ret = java;
        while (ret.contains("%FORMULAS%"))
        {
            int pos = ret.indexOf("%FORMULAS%");
            ret = ret.replaceFirst("%FORMULAS%", "");
            int end = ret.indexOf("%", pos);
            if (end == -1)
            {
                System.err.println("Closing % not found for %FORMULAS% in file for type " + errorType);
                return ret;
            }
            String type = ret.substring(pos, end);
            if (!formulas.containsKey(type))
            {
                System.err.println("Formulas in FORMULAS.txt does not contain entry for type " + errorType);
                return ret.substring(0, pos - 1) + ret.substring(pos + type.length() + 2, ret.length() - 1);
            }
            String fStr = "";
            ret = ret.substring(0, pos - 1) + fStr + ret.substring(pos + type.length() + 1, ret.length() - 1);
        }
        return ret;
    }

    /****************************************************************************************************************/
    /********************************************* DOUBLEVECTOR *****************************************************/
    /****************************************************************************************************************/

    /**
     * Generate all Abs + Rel classes in value.vdouble.vector.
     * @throws IOException on I/O error
     * @throws URISyntaxException when file could not be found on the file system
     */
    private static void generateDoubleVectorAbsRel() throws IOException, URISyntaxException
File Line
org\djunits\generator\GenerateStaticUNITS.java 74
org\djunits\generator\GenerateStaticUNITS.java 89
            for (Field f : c.getFields())
            {
                if (Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers())
                        && Modifier.isFinal(f.getModifiers()) && !f.getName().equals("SI")
                        && !f.getName().equals("STANDARD_UNITS"))
                {
                    String n = f.getName();
                    if (f.getName().contains("ELECTRONVOLT"))
                    {
                        n = cs.trim() + "_" + n;
                    }
File Line
org\djunits\generator\GenerateDJUNIT.java 798
org\djunits\generator\GenerateDJUNIT.java 835
org\djunits\generator\GenerateDJUNIT.java 876
org\djunits\generator\GenerateDJUNIT.java 913
org\djunits\generator\GenerateDJUNIT.java 954
org\djunits\generator\GenerateDJUNIT.java 991
                Files.readAllBytes(Paths.get(URLResource.getResource("/" + relativePath + "SISCALAR_AS.java").toURI())));

        List<String> allRelTypes = new ArrayList<>(typesRel);
        for (String[] arType : typesAbsRel)
        {
            allRelTypes.add(arType[1]);
        }

        String asMethods = "";
        for (String type : allRelTypes)
        {
            String lc = type.toLowerCase();
            asMethods += asJava.replaceAll("%Type%", type).replaceAll("%type%", lc);
        }

        File outPath = new File(absoluteRootPath + relativePath);
        outPath.mkdirs();
        PrintWriter out = new PrintWriter(absoluteRootPath + relativePath + "SIScalar.java");
File Line
org\djunits\generator\GenerateDJUNIT.java 1027
org\djunits\generator\GenerateXSD.java 309
    private static void makeAndCleanAbsolutePath() throws FileNotFoundException
    {
        URL mainURL = URLResource.getResource("/");
        String path;
        try
        {
            path = mainURL.toURI().getPath();
        }
        catch (URISyntaxException exception)
        {
            path = mainURL.getPath();
        }
        if (path.endsWith("/target/classes/"))
        {
            path = path.substring(0, path.length() - "/target/classes/".length());
        }
        path += generatedCodeRelativePath;
        if (!new File(path).exists())
        {
            new File(path).mkdirs();
        }