00001 package SummaryReader;
00002
00003 public class DefectInfo {
00004
00005 String name;
00006 String first_chan;
00007 String last_chan;
00008 java.util.Set badChannelSet;
00009
00010 public DefectInfo() {
00011 badChannelSet = new java.util.HashSet();
00012 }
00013
00014 public void setName(String name) {
00015 this.name=name;
00016 }
00017 public void setFirstChannel(String first_chan) {
00018 this.first_chan=first_chan;
00019 }
00020 public void setLastChannel(String last_chan) {
00021 this.last_chan=last_chan;
00022 try {
00023 int i1 = Integer.parseInt(first_chan);
00024 int i2 = Integer.parseInt(last_chan);
00025 for(int i=i1;i<=i2;i++) badChannelSet.add(new Integer(i));
00026 }catch(Exception e){}
00027 }
00028 public String getName() {
00029 if(name==null) return "Unknown";
00030 else return name;
00031 }
00032 public String getFirstChannel() {
00033 if(first_chan==null) return "-1";
00034 else return first_chan;
00035 }
00036 public String getLastChannel() {
00037 if(last_chan==null) return "-1";
00038 else return last_chan;
00039 }
00040 public int getNoDefects() {
00041 if(first_chan==null || last_chan==null) return -1;
00042 int i1=-1, i2=-1;
00043 try {
00044 i1 = Integer.parseInt(first_chan);
00045 i2 = Integer.parseInt(last_chan);
00046 }catch(Exception e){System.err.println("Non-integer channel numbers in DefectInfo"); return -1;}
00047 return (i2-i1+1);
00048 }
00049 public java.util.Set getBadChannelSet() {
00050 return badChannelSet;
00051 }
00052 public String getDefectKey() {
00053 if(first_chan.equals(last_chan)) return first_chan;
00054 return first_chan+"-"+last_chan;
00055 }
00056
00057
00058 }