GeomConverter/src/org/lcsim/geometry/compact
diff -u -r1.5 -r1.6
--- Header.java 17 Jan 2006 18:58:25 -0000 1.5
+++ Header.java 16 Feb 2006 00:56:49 -0000 1.6
@@ -4,81 +4,104 @@
/**
* The header of the compact detector description.
+ *
* @author tonyj
*/
public class Header
{
private String name;
- private String title;
- private String author;
- private String version = "none";
- private String url;
- private String comment;
-
+ private String title = "NONE";
+ private String author = "NONE";
+ private String version = "NONE";
+ private String url = "NONE";
+ private String comment = "NONE";
+
protected Header(Element info)
{
- name = info.getAttributeValue("name");
- author = info.getAttributeValue("author");
- title = info.getAttributeValue("title");
-
- if ( info.getAttribute("version") != null )
+ if (info.getAttributeValue("name") != null)
+ {
+ name = info.getAttributeValue("name");
+ }
+ else {
+ throw new RuntimeException("info element for this detector is missing the name attribute.");
+ }
+
+ if (info.getChild("author") != null)
+ {
+ author = info.getAttributeValue("author");
+ }
+
+ if (info.getChild("title") != null)
+ {
+ title = info.getAttributeValue("title");
+ }
+
+ if (info.getAttribute("version") != null)
{
version = info.getAttributeValue("version");
}
-
- url = info.getAttributeValue("url");
-
- if ( info.getChild("comment") != null )
+
+ if (info.getAttribute("url") != null)
+ {
+ url = info.getAttributeValue("url");
+ }
+
+ if (info.getChild("comment") != null)
{
comment = info.getChild("comment").getTextNormalize();
}
}
-
+
/**
* Get the detector name.
+ *
* @return The name.
*/
public String getDetectorName()
{
return name;
}
-
+
/**
* Get the author of this detector description.
+ *
* @return The author.
*/
public String getAuthor()
{
return author;
}
-
+
/**
* Get the version of the detector.
+ *
* @return The version
*/
public String getVersion()
{
return version;
}
-
+
/**
* The URL providing more information about this detector.
+ *
* @return The URL.
*/
public String getURL()
{
return url;
}
-
+
/**
* A comment describing the detector
+ *
* @return The comment.
*/
public String getComment()
{
return comment;
}
-
+
public String getTitle()
{
return title;