1 package org.catacomb.numeric.data; 2 3 import org.catacomb.datalish.Box; 4 import org.catacomb.datalish.array.Array; 5 6 7 8 public class EventSequence implements NumDataItem { 9 10 String name; 11 12 int nevent; 13 double[] times; 14 int[] channels; 15 int maxch; 16 17 public EventSequence(String s) { 18 name = s; 19 times = new double[10]; 20 channels = new int[10]; 21 maxch = 0; 22 } 23 24 25 public String getUnit() { 26 return null; 27 } 28 29 public String getName() { 30 return name; 31 } 32 33 public String getLabel() { 34 return name; 35 } 36 37 public void addEvent(double t, int ich) { 38 if (nevent >= times.length) { 39 int nn = nevent + nevent / 2 + 10; 40 times = Array.extendDArray(times, nevent, nn); 41 channels = Array.extendIArray(channels, nevent, nn); 42 } 43 times[nevent] = t; 44 channels[nevent] = ich; 45 nevent += 1; 46 if (ich > maxch) { 47 maxch = ich; 48 } 49 } 50 51 public int getNEvent() { 52 return nevent; 53 } 54 55 public int[] getChannels() { 56 return channels; 57 } 58 59 public double[] getTimes() { 60 return times; 61 } 62 63 64 public Box getLimitBox() { 65 Box ret = null; 66 67 if (nevent == 0) { 68 ret = new Box(); 69 } else { 70 ret = new Box(times[0], 0, times[nevent-1], maxch + 1.); 71 } 72 return ret; 73 } 74 75 }