comparison flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java @ 4052:6d8c7a00e74e

Do cumentation.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 08 Oct 2012 09:51:03 +0200
parents a5f65e8983be
children 2b4f78ccfbaa
comparison
equal deleted inserted replaced
4051:58bdf95df5e4 4052:6d8c7a00e74e
6 6
7 import java.util.Arrays; 7 import java.util.Arrays;
8 8
9 import org.apache.log4j.Logger; 9 import org.apache.log4j.Logger;
10 10
11 /** Utils to deal with Double precision values. */
11 public class DoubleUtil 12 public class DoubleUtil
12 { 13 {
14 /** Private logger. */
13 private static Logger log = Logger.getLogger(DoubleUtil.class); 15 private static Logger log = Logger.getLogger(DoubleUtil.class);
14 16
15 public static final double DEFAULT_STEP_PRECISION = 1e6; 17 public static final double DEFAULT_STEP_PRECISION = 1e6;
16 18
17 private DoubleUtil() { 19 private DoubleUtil() {
142 double [] result = new double[N]; 144 double [] result = new double[N];
143 Arrays.fill(result, value); 145 Arrays.fill(result, value);
144 return result; 146 return result;
145 } 147 }
146 148
149
150 /** Use with parseSegments. */
147 public interface SegmentCallback { 151 public interface SegmentCallback {
148 void newSegment(double from, double to, double [] values); 152 void newSegment(double from, double to, double [] values);
149 } 153 }
150 154
155
156 /** Call callback for every string split by colon.
157 * Expected format FROM:TO:VALUE1,VALUE2,VALUE3*/
151 public static final void parseSegments( 158 public static final void parseSegments(
152 String input, 159 String input,
153 SegmentCallback callback 160 SegmentCallback callback
154 ) { 161 ) {
155 TDoubleArrayList vs = new TDoubleArrayList(); 162 TDoubleArrayList vs = new TDoubleArrayList();

http://dive4elements.wald.intevation.org