# HG changeset patch # User Felix Wolfsteller # Date 1386323507 -3600 # Node ID 4fb5e89e7bd3bcc5e38adf6dc7893db4b91b75a5 # Parent 84573d5935be65edad81717010c162f8b55088c0 issue1020: WstWriter: Add flag to ignore Qs alltogether. diff -r 84573d5935be -r 4fb5e89e7bd3 artifacts/src/main/java/org/dive4elements/river/exports/WstWriter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/WstWriter.java Thu Dec 05 22:22:37 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/WstWriter.java Fri Dec 06 10:51:47 2013 +0100 @@ -66,6 +66,9 @@ /** The last Q values. */ protected double[] qs; + /** Workaround for one use of wrongly imported files: ignore the Qs at + * all. */ + protected boolean ignoreQs; /** * This constructor creates a new WstWriter with a number of Q columns. @@ -73,11 +76,22 @@ * @param columns The number of columns of the resulting WST. */ public WstWriter(int columns) { + this(columns, false); + } + + /** + * This constructor creates a new WstWriter with a number of Q columns. + * + * @param columns The number of columns of the resulting WST. + * @param workaroundIgnoreQs do not write QLines to shadow broken data. + */ + public WstWriter(int columns, boolean workaroundIgnoreQs) { this.cols = columns; this.columnNames = new ArrayList(cols); this.lines = new HashMap(); this.qs = new double[cols]; this.locale = Locale.US; + this.ignoreQs = workaroundIgnoreQs; } @@ -217,7 +231,7 @@ double[] qs = line.getQs(); int num = line.getSize(); - if (dischargesChanged(qs)) { + if (!ignoreQs && dischargesChanged(qs)) { writeQLine(writer, qs); }