CPD Results

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

Duplications

File Line
org/sat4j/maxsat/reader/P2DimacsReader.java 44
org/sat4j/maxsat/reader/WDimacsReader.java 48
        super(solver, format);
    }

    @Override
    protected void readProblemLine(LineNumberReader in) throws IOException,
            ParseFormatException {
        String line = in.readLine();

        if (line == null) {
            throw new ParseFormatException(
                    "premature end of file: <p cnf ...> expected  on line "
                            + in.getLineNumber());
        }
        StringTokenizer stk = new StringTokenizer(line);

        if (!(stk.hasMoreTokens() && stk.nextToken().equals("p")
                && stk.hasMoreTokens() && stk.nextToken().equals(formatString))) {
            throw new ParseFormatException(
                    "problem line expected (p cnf ...) on line "
                            + in.getLineNumber());
        }

        int vars;

        // reads the max var id
        vars = Integer.parseInt(stk.nextToken());
        assert vars > 0;
        solver.newVar(vars);
        // reads the number of clauses
        expectedNbOfConstr = Integer.parseInt(stk.nextToken());
        assert expectedNbOfConstr > 0;
        solver.setExpectedNumberOfClauses(expectedNbOfConstr);

        if ("wcnf".equals(formatString)) {