Changeset 2845 in josm for trunk/src/org/openstreetmap/josm/data/Bounds.java
- Timestamp:
- 2010-01-13T19:55:07+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Bounds.java
r2805 r2845 6 6 import java.awt.geom.Rectangle2D; 7 7 import java.text.DecimalFormat; 8 import java.text.MessageFormat; 8 9 9 10 import org.openstreetmap.josm.data.coor.LatLon; 11 import org.openstreetmap.josm.tools.CheckParameterUtil; 10 12 11 13 /** … … 48 50 49 51 public Bounds(double [] coords) { 50 if (coords == null) 51 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "coords")); 52 CheckParameterUtil.ensureParameterNotNull(coords, "coords"); 52 53 if (coords.length != 4) 53 throw new IllegalArgumentException( tr("Expected array of length 4, got {0}", coords.length));54 throw new IllegalArgumentException(MessageFormat.format("Expected array of length 4, got {0}", coords.length)); 54 55 this.minLat = coords[0]; 55 56 this.minLon = coords[1]; … … 59 60 60 61 public Bounds(String asString, String separator) throws IllegalArgumentException { 61 if (asString == null) 62 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "asString")); 62 CheckParameterUtil.ensureParameterNotNull(asString, "asString"); 63 63 String[] components = asString.split(separator); 64 64 if (components.length != 4) 65 throw new IllegalArgumentException( tr("Exactly four doubles excpected in string, got {0}", components.length));65 throw new IllegalArgumentException(MessageFormat.format("Exactly four doubles excpected in string, got {0}", components.length)); 66 66 double[] values = new double[4]; 67 67 for (int i=0; i<4; i++) { … … 69 69 values[i] = Double.parseDouble(components[i]); 70 70 } catch(NumberFormatException e) { 71 throw new IllegalArgumentException( tr("Illegal double value ''{0}''", components[i]));71 throw new IllegalArgumentException(MessageFormat.format("Illegal double value ''{0}''", components[i])); 72 72 } 73 73 } … … 108 108 */ 109 109 public Bounds(LatLon center, double latExtent, double lonExtent) { 110 if (center == null) 111 throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", "center")); 110 CheckParameterUtil.ensureParameterNotNull(center, "center"); 112 111 if (latExtent <= 0.0) 113 throw new IllegalArgumentException( tr("Parameter ''{0}'' > 0.0 exptected, got {1}", "latExtent", latExtent));112 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' > 0.0 exptected, got {1}", "latExtent", latExtent)); 114 113 if (lonExtent <= 0.0) 115 throw new IllegalArgumentException( tr("Parameter ''{0}'' > 0.0 exptected, got {1}", "lonExtent", lonExtent));114 throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' > 0.0 exptected, got {1}", "lonExtent", lonExtent)); 116 115 117 116 this.minLat = center.lat() - latExtent / 2;
Note:
See TracChangeset
for help on using the changeset viewer.