GeomConverter/src/org/lcsim/geometry/layer
diff -u -r1.5 -r1.6
--- LayerSlice.java 5 Jul 2005 22:40:17 -0000 1.5
+++ LayerSlice.java 19 Jul 2005 18:48:29 -0000 1.6
@@ -18,7 +18,7 @@
{
private boolean sensitive;
- private Material material;
+ private Material material = null;
private double thickness;
public LayerSlice()
@@ -26,27 +26,30 @@
material = null;
thickness = 0.0;
sensitive = false;
- }
-
- public LayerSlice(Material m, double w, boolean sens)
- {
- material = m;
- thickness = w;
- sensitive = sens;
- }
+ }
public LayerSlice(String matName, double w, boolean sens)
- {
- //Material material = MaterialManager.getMaterial( matName );
- Material material;
- try {
+ {
+ try {
material = MaterialManager.findMaterial( matName );
}
catch (MaterialNotFoundException mnfe)
{
- throw new RuntimeException(mnfe);
+ throw new RuntimeException("Material not found.", mnfe);
}
+
+ thickness = w;
+ sensitive = sens;
+ }
+
+ private LayerSlice(Material m, double w, boolean sens)
+ {
+ if ( m == null )
+ {
+ throw new IllegalArgumentException("Material argument cannot be null.");
+ }
+ material = m;
thickness = w;
sensitive = sens;
}