/** @methodtype set */ public SphericCoordinate setLongitude(double longitude) { // precondition assertIsValidLongitude(longitude); SphericCoordinate result = getInstance(this.latitude, longitude, this.radius); // postcondition assertClassInvariants(); return result; }
/** @methodtype constructor */ private SphericCoordinate(double latitude, double longitude, double radiusInKm) { // preconditions assertIsValidLatitude(latitude); assertIsValidLongitude(longitude); assertIsValidRadius(radiusInKm); this.latitude = latitude; this.longitude = longitude; this.radius = radiusInKm; // postconditions assertClassInvariants(); }
/** @methodtype assertion */ protected void assertClassInvariants() { super.assertClassInvariants(); assertIsValidLatitude(this.latitude); assertIsValidLongitude(this.longitude); assertIsValidRadius(this.radius); }