00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 package sensix.sensing;
00036
00037 import sensix.*;
00038
00039
00040 public class PeakSense extends Sense
00041 {
00042 protected double threshold_h;
00043 protected double threshold_l;
00044
00045
00046 public PeakSense(byte l, byte s, double r, double th, boolean hi) {
00047 super(l, s, r);
00048 if (hi) {
00049 threshold_h = th;
00050 threshold_l = Double.NEGATIVE_INFINITY;
00051 }
00052 else {
00053 threshold_h = Double.POSITIVE_INFINITY;
00054 threshold_l = th;
00055 }
00056 }
00057
00058 public PeakSense(byte l, byte s, double r, double th, double tl) {
00059 super(l, s, r);
00060 threshold_h = th;
00061 threshold_l = tl;
00062 }
00063
00064 public PeakSense(byte s, double r, double th, boolean hi) {
00065 super(s, r);
00066 if (hi) {
00067 threshold_h = th;
00068 threshold_l = Double.NEGATIVE_INFINITY;
00069 }
00070 else {
00071 threshold_h = Double.POSITIVE_INFINITY;
00072 threshold_l = th;
00073 }
00074 }
00075
00076 public PeakSense(byte s, double r, double th, double tl) {
00077 super(s, r);
00078 threshold_h = th;
00079 threshold_l = tl;
00080 }
00081
00082
00083 public PeakSense(byte l, byte s, double th, boolean hi) {
00084 super(l, s);
00085 if (hi) {
00086 threshold_h = th;
00087 threshold_l = Double.NEGATIVE_INFINITY;
00088 }
00089 else {
00090 threshold_h = Double.POSITIVE_INFINITY;
00091 threshold_l = th;
00092 }
00093 }
00094
00095 public PeakSense(byte l, byte s, double th, double tl) {
00096 super(l, s);
00097 threshold_h = th;
00098 threshold_l = tl;
00099 }
00100
00101 public PeakSense(byte s, double th, boolean hi) {
00102 super(s);
00103 if (hi) {
00104 threshold_h = th;
00105 threshold_l = Double.NEGATIVE_INFINITY;
00106 }
00107 else {
00108 threshold_h = Double.POSITIVE_INFINITY;
00109 threshold_l = th;
00110 }
00111 }
00112
00113 public PeakSense(byte s, double th, double tl) {
00114 super(s);
00115 threshold_h = th;
00116 threshold_l = tl;
00117 }
00118
00119 public PeakSense(byte l, byte s, double r, double th, double tl, int seq) {
00120 super(l, s, r, seq);
00121 threshold_h = th;
00122 threshold_l = tl;
00123 }
00124
00125
00126 public double highthreshold() {
00127 return threshold_h;
00128 }
00129
00130 public void highthreshold(double h) {
00131 threshold_h = h;
00132 }
00133
00134 public double lowthreshold() {
00135 return threshold_l;
00136 }
00137
00138 public void lowthreshold(double l) {
00139 threshold_l = l;
00140 }
00141
00142 public byte identifier() {
00143 return Sensix.BETA;
00144 }
00145
00146 public String asString() {
00147 String string_rep = "PeakSense(";
00148 if (level() != Sensix.INVALID)
00149 string_rep += "level=" + (int)level() + ",";
00150 string_rep += "sensor=" + SenseUtil.capabilityToString(sensor());
00151 if (rate() > 0.0)
00152 string_rep += ",rate=" + rate();
00153 if (threshold_h != Double.POSITIVE_INFINITY)
00154 string_rep += ",high threshold=" + threshold_h;
00155 if (threshold_l != Double.NEGATIVE_INFINITY)
00156 string_rep += ",low threshold=" + threshold_l;
00157 string_rep += ")";
00158 return string_rep;
00159 }
00160 }