00001
00002
00003
00004
00005
00006
00007 package oh.aida;
00008 import hep.aida.*;
00009 import oh.*;
00010
00015 public abstract class ISHistogramAdapter implements hep.aida.IHistogram {
00016 protected ISHistogram data;
00017
00019 public ISHistogramAdapter(ISHistogram data) {
00020 this.data = data;
00021 }
00022
00023 protected void unimplementedFunction() {
00024 System.err.println("Error - unimplemented function called in :" + this);
00025 Thread.currentThread().dumpStack();
00026 }
00027
00028 public int dimension() {
00029 return data.is_axis.length;
00030 }
00031
00032 public hep.aida.IAnnotation annotation() {
00033 return new AnnotationAdapter();
00034 }
00035
00036 public int entries() {
00037 return 0;
00038 }
00039
00040 public void reset() throws java.lang.RuntimeException {
00041 unimplementedFunction();
00042 }
00043
00044 public void setTitle(String str) throws java.lang.IllegalArgumentException {
00045 unimplementedFunction();
00046 }
00047
00048 public String title() {
00049 return data.is_title;
00050 }
00051
00052 public int allEntries() {
00053 return 0;
00054 }
00055
00056 public double equivalentBinEntries() {
00057 return 0.;
00058 }
00059
00060 public int extraEntries() {
00061 return 0;
00062 }
00063
00064 public double maxBinHeight() {
00065 unimplementedFunction();
00066 return 0;
00067 }
00068
00069 public double minBinHeight() {
00070 unimplementedFunction();
00071 return 0;
00072 }
00073
00074 public void scale(double param) throws java.lang.IllegalArgumentException {
00075 unimplementedFunction();
00076 }
00077
00078 public double sumAllBinHeights() {
00079 unimplementedFunction();
00080 return 0;
00081 }
00082
00083 public double sumBinHeights() {
00084 unimplementedFunction();
00085 return 0;
00086 }
00087
00088 public double sumExtraBinHeights() {
00089 unimplementedFunction();
00090 return 0;
00091 }
00092
00096 class AnnotationAdapter implements IAnnotation {
00097
00098 public void addItem(String str, String str1) throws java.lang.IllegalArgumentException {
00099 unimplementedFunction();
00100 }
00101
00102 public void addItem(String str, String str1, boolean param) throws java.lang.IllegalArgumentException {
00103 unimplementedFunction();
00104 }
00105
00106 public String key(int param) {
00107 return data.is_annotations[param*2];
00108 }
00109
00110 public void removeItem(String str) throws java.lang.IllegalArgumentException {
00111 unimplementedFunction();
00112 }
00113
00114 public void reset() {
00115 unimplementedFunction();
00116 }
00117
00118 public void setSticky(String str, boolean param) {
00119 unimplementedFunction();
00120 }
00121
00122 public void setValue(String str, String str1) {
00123 unimplementedFunction();
00124 }
00125
00126 public int size() {
00127 return data.is_annotations.length/2;
00128 }
00129
00130 public String value(String str) {
00131 for (int i=0; i<data.is_annotations.length; i+=2) {
00132 if (data.is_annotations[i].equals(str)) return data.is_annotations[i+1];
00133 }
00134 return null;
00135 }
00136
00137 public String value(int param) {
00138 return data.is_annotations[param*2+1];
00139 }
00140
00141 }
00142
00143 class AxisAdapter implements IAxis {
00144 protected ISAxis axis;
00145
00146 AxisAdapter(int index) {
00147 axis = data.is_axis[index];
00148 }
00149
00150 public double binLowerEdge(int param) {
00151 if (axis.is_type == ISHistogram.IS_FIXED) {
00152 return axis.is_axis[0] + axis.is_axis[1] * (param-1);
00153 } else {
00154 unimplementedFunction();
00155 return 0;
00156 }
00157 }
00158
00159 public double binUpperEdge(int param) {
00160 if (axis.is_type == ISHistogram.IS_FIXED) {
00161 return axis.is_axis[0] + axis.is_axis[1] * param;
00162 } else {
00163 unimplementedFunction();
00164 return 0;
00165 }
00166 }
00167
00168 public double binWidth(int param) {
00169 if (axis.is_type == ISHistogram.IS_FIXED) {
00170 return axis.is_axis[1];
00171 } else {
00172 unimplementedFunction();
00173 return 0;
00174 }
00175 }
00176
00177 public int bins() {
00178 if (axis.is_type == ISHistogram.IS_FIXED) {
00179 return (int)axis.is_axis[2];
00180 } else {
00181 unimplementedFunction();
00182 return 0;
00183 }
00184 }
00185
00186 public int coordToIndex(double param) {
00187 unimplementedFunction();
00188 return 0;
00189 }
00190
00191 public boolean isFixedBinning() {
00192 return axis.is_type == ISHistogram.IS_FIXED;
00193 }
00194
00195 public double lowerEdge() {
00196 if (axis.is_type == ISHistogram.IS_FIXED) {
00197 return axis.is_axis[0];
00198 } else {
00199 unimplementedFunction();
00200 return 0;
00201 }
00202 }
00203
00204 public double upperEdge() {
00205 if (axis.is_type == ISHistogram.IS_FIXED) {
00206 return axis.is_axis[1] * axis.is_axis[2];
00207 } else {
00208 unimplementedFunction();
00209 return 0;
00210 }
00211 }
00212
00213 }
00214
00218 protected double _binError(int param) throws java.lang.IllegalArgumentException {
00219
00220 if (param >= data.is_errors.length) {
00221 java.lang.IllegalArgumentException e = new java.lang.IllegalArgumentException();
00222 throw e;
00223 }
00224
00225 if (data.is_errors.length !=0) return data.is_errors[param];
00226 else if (data.is_minuserrors.length !=0 && data.is_pluserrors.length != 0) return data.is_pluserrors[param] + data.is_minuserrors[param];
00227 return 0;
00228 }
00229
00230 protected double _binHeight(int param) throws java.lang.IllegalArgumentException {
00231 if (param<data.is_bins.length) return data.is_bins[param];
00232 else {
00233 java.lang.IllegalArgumentException e = new java.lang.IllegalArgumentException();
00234 throw e;
00235 }
00236 }
00237 }