Clover coverage report -
Coverage timestamp: jeu. juin 15 2006 08:24:33 CEST
file stats: LOC: 59   Methods: 2
NCLOC: 33   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Reader.java 50% 75% 100% 71,4%
coverage coverage
 1    /*
 2    * Created on 15 sept. 2004
 3    *
 4    * To change the template for this generated file go to
 5    * Window - Preferences - Java - Code Generation - Code and Comments
 6    */
 7    package org.sat4j.reader;
 8   
 9    import java.io.FileInputStream;
 10    import java.io.FileNotFoundException;
 11    import java.io.IOException;
 12    import java.io.InputStream;
 13    import java.io.InputStreamReader;
 14    import java.net.URL;
 15    import java.util.zip.GZIPInputStream;
 16   
 17    import org.sat4j.specs.ContradictionException;
 18    import org.sat4j.specs.IProblem;
 19   
 20    /**
 21    * A reader is responsible to feed an ISolver from a text file and to convert
 22    * the model found by the solver to a textual representation.
 23    *
 24    * @author leberre
 25    */
 26    public abstract class Reader {
 27   
 28  2491 public IProblem parseInstance(final String filename)
 29    throws FileNotFoundException, ParseFormatException, IOException,
 30    ContradictionException {
 31  2491 InputStream in;
 32  2491 if (filename.startsWith("http://")) {
 33  0 in = (new URL(filename)).openStream();
 34    } else {
 35  2491 in = new FileInputStream(filename);
 36    }
 37  2491 if (filename.endsWith(".gz")) {
 38  0 in = new GZIPInputStream(in);
 39    }
 40  2491 return parseInstance(in);
 41    }
 42   
 43  828 public IProblem parseInstance(final InputStream in)
 44    throws ParseFormatException, ContradictionException, IOException {
 45  828 return parseInstance(new InputStreamReader(in));
 46    }
 47   
 48    public abstract IProblem parseInstance(final java.io.Reader in)
 49    throws ParseFormatException, ContradictionException, IOException;
 50   
 51    /**
 52    * Produce a model using the reader format.
 53    *
 54    * @param model
 55    * a model using the Dimacs format.
 56    * @return a human readable view of the model.
 57    */
 58    public abstract String decode(int[] model);
 59    }