Mercurial > dive4elements > gnv-client
changeset 814:9d427dd2a96a
Added Javadoc in statistic package.
gnv-artifacts/trunk@898 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 09 Apr 2010 14:34:45 +0000 (2010-04-09) |
parents | 79c1db3ca7cc |
children | 22c18083225e |
files | gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistic.java gnv-artifacts/src/main/java/de/intevation/gnv/statistics/StatisticSet.java gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistics.java gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java |
diffstat | 9 files changed, 96 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/ChangeLog Fri Apr 09 14:34:45 2010 +0000 @@ -1,3 +1,15 @@ +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/statistics/StatisticSet.java, + src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java, + src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java, + src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java, + src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java, + src/main/java/de/intevation/gnv/statistics/Statistic.java, + src/main/java/de/intevation/gnv/statistics/Statistics.java, + src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java: Added + more Javadoc. + 2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/java/de/intevation/gnv/state/exception/StateException.java,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java Fri Apr 09 14:34:45 2010 +0000 @@ -7,6 +7,10 @@ import org.apache.log4j.Logger; /** + * An abstract implementation of <code>Statistics</code> with a default + * implementation of the {@link #generateStatisticsValues(org.apache.commons.math.stat.descriptive.DescriptiveStatistics, org.apache.commons.math.stat.regression.SimpleRegression, java.lang.String)} + * method. + * * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public abstract class AbstractStatistics @@ -18,6 +22,15 @@ public AbstractStatistics() { } + /** + * This method takes a statistics object and puts relevant values into a + * <code>StatisticSet</code>. + * + * @param lStatistics A statistics object. + * @param lRegression A simple regression. + * @param statisticName Name for the resulting statistic. + * @return a set of statistics. + */ protected StatisticSet generateStatisticsValues( DescriptiveStatistics lStatistics, SimpleRegression lRegression,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java Fri Apr 09 14:34:45 2010 +0000 @@ -18,6 +18,8 @@ import org.apache.log4j.Logger; /** + * This class is used to create a statistic for 'Horizontalprofil' products. + * * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ @@ -38,16 +40,15 @@ super(); } - /** - * @see de.intevation.gnv.statistics.TimeseriesStatistics#calculateXOrdinateValue(de.intevation.gnv.geobackend.base.Result, de.intevation.gnv.geobackend.base.Result) - */ + @Override protected double calculateXOrdinateValue(Result previousRow,Result row) throws SQLException { try { Point start = (Point)this.wktReader.read(previousRow.getString("SHAPE")); Point current = (Point)this.wktReader.read(row.getString("SHAPE")); - double delta = this.dc.calculateDistance(start, current); + @SuppressWarnings("static-access") + double delta = DistanceCalculator.calculateDistance(start, current); if (!Double.isNaN(delta)){ this.distance = this.distance + delta; @@ -58,9 +59,7 @@ return this.distance; } - /** - * @see de.intevation.gnv.statistics.TimeseriesStatistics#generateStatisticsName(java.lang.String, java.lang.String, java.lang.String, java.util.Collection, java.util.Collection, java.util.Collection) - */ + @Override protected String generateStatisticsName( String break1, @@ -74,9 +73,7 @@ this.findValueTitle(dates,break3); } - /** - * @see de.intevation.gnv.statistics.TimeseriesStatistics#clearStatistics() - */ + @Override protected void clearStatistics() { log.debug("HorizontalProfileStatistics.clearStatistics");
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistic.java Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistic.java Fri Apr 09 14:34:45 2010 +0000 @@ -18,16 +18,9 @@ import org.apache.log4j.Logger; /** - * The class <code>Statistic</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> + * This class stores a double value with a specific key. * * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 14.12.2007 09:38:18 */ public class Statistic { @@ -40,22 +33,41 @@ private double mValue; private String mKey; + /** + * Creates a new Statistic with a given key and a value. + * @param pKey The key. + * @param pValue The value. + */ public Statistic(String pKey, double pValue) { mKey = pKey; mValue = pValue; } + /** + * Returns the value. + * @return the value. + */ public double getValue() { return mValue; } + /** + * Returns the key. + * @return the key. + */ public String getKey() { return mKey; } + /** + * Turns the value into string representation and returns it.<br> + * <b>Attention:</b> This method doesn't take a locale into account. + * + * @return the value as string. + */ public String getStringValue() { java.text.DecimalFormat df = new java.text.DecimalFormat("#.##"); return df.format(mValue); } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/StatisticSet.java Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/StatisticSet.java Fri Apr 09 14:34:45 2010 +0000 @@ -4,8 +4,9 @@ import java.util.Collection; /** + * A container to store several statistics. + * * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> - * */ public class StatisticSet { @@ -16,22 +17,36 @@ /** * Constructor + * @param name Name of this container. */ public StatisticSet(String name) { this.name = name; } + /** + * Add a further statistic to this container. + * + * @param statistic A statistic. + */ public void addStatistic(Statistic statistic){ this.statistics.add(statistic); } + /** + * Returns all statistics in this container. + * @return all statistics. + */ public Collection<Statistic> getStatistics(){ return this.statistics; } + /** + * Returns the name of this container. + * @return the name. + */ public String getName(){ return this.name; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistics.java Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistics.java Fri Apr 09 14:34:45 2010 +0000 @@ -22,27 +22,23 @@ import java.util.Collection; /** - * The interface <code>Statistics</code> fulfills the following purposes: - * <ol> - * <li>Providng a marker interface for statistics.</li> - * </ol> + * This interface defines one single method to calculate a statistic for a + * given data set. * * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 14.12.2007 09:34:32 */ public interface Statistics { /** + * This method takes a data set and creates a statistic from it. * - * @param resultSet - * @param parameters - * @param measurements - * @param dates - * @return - * @throws StatisticsException + * @param resultSet The resulting statistic is about this data set. + * @param parameters A collection of parameters. + * @param measurements A collection of measurements. + * @param dates A collection of dates. + * @return a collection of statistics. + * @throws StatisticsException if an error occured while creating the + * statistic. */ public Collection<StatisticSet> calculateStatistics( Object resultSet, @@ -52,3 +48,4 @@ ) throws StatisticsException; } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java Fri Apr 09 14:34:45 2010 +0000 @@ -35,17 +35,9 @@ import org.apache.log4j.Logger; /** - * The class <code>TimeseriesStatistics</code> fulfills the following purposes: - * <ol> - * <li></li> - * </ol> + * This class is used to create a statistic in timeseries products. * * @author blume - * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> - * @version 1.0 - * @serial 1.0 - * @see - * @since 06.12.2007 18:02:27 */ public class TimeseriesStatistics extends AbstractStatistics @@ -62,9 +54,7 @@ public TimeseriesStatistics() { } - /** - * @see de.intevation.gnv.statistics.Statistics#calculateStatistics(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection) - */ + public Collection<StatisticSet> calculateStatistics( Object result, Collection<KeyValueDescibeData> parameters, @@ -195,18 +185,12 @@ return statisticSets; } + /** + * Nothing is done here. + */ protected void clearStatistics(){} - /** - * - * @param break1 - * @param break2 - * @param break3 - * @param parameters - * @param measurements - * @param dates - * @return - */ + protected String generateStatisticsName(String break1, String break2, String break3, @@ -233,8 +217,10 @@ } return ""; } + + protected double calculateXOrdinateValue(Result previousRow, Result row) throws SQLException { return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600); } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java Fri Apr 09 14:34:45 2010 +0000 @@ -12,6 +12,8 @@ import org.apache.log4j.Logger; /** + * This class is used to create a statistic in 'Profilschnitt' products. + * * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class VerticalCrossSectionStatistics @@ -23,6 +25,7 @@ public VerticalCrossSectionStatistics() { } + public Collection<StatisticSet> calculateStatistics( Object result, Collection<KeyValueDescibeData> parameters,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java Fri Apr 09 13:09:25 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java Fri Apr 09 14:34:45 2010 +0000 @@ -9,8 +9,9 @@ import java.util.Collection; /** + * This class is used to create a statistic in 'Vertikalprofil' products. + * * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> - * */ public class VerticalProfileStatistics extends TimeseriesStatistics { @@ -38,7 +39,5 @@ return (this.findValueTitle(parameters, break1)+ " "+ this.findValueTitle(measurements,break2)).trim(); } - - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file