package org.hwo.pulscounter.elements; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.LinkedList; import java.util.List; import org.hwo.datetime.Date; import org.hwo.datetime.DateTime; public class WorkShiftRecord { public class ChannelRecords{ public class ChannelRecord { DateTime timestamp; Integer value; public ChannelRecord(DateTime timestamp,int value){ this.timestamp = timestamp; this.value = value; } public DateTime getTimestamp() { return timestamp; } public void setTimestamp(DateTime timestamp) { this.timestamp = timestamp; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } } int channel; List values; public ChannelRecords(int channel){ this.channel = channel; this.values = new LinkedList(); } public void addValue(DateTime timestamp,int value){ this.values.add(new ChannelRecord(timestamp, value)); } public void sort(){ /* List sorted = new LinkedList(); for (ChannelRecord r: values){ if (values.size() == 0) sorted.add(r); } this.values = sorted; */ } public List getRecords(){ return this.values; } } WorkShift workShift; Date date; Hashtable records; public WorkShiftRecord(WorkShift shift,Date date){ workShift = shift; this.date = date; records = new Hashtable(); loadRecords(); } void loadRecords(){ } public Integer[] getChannels(){ return (Integer[]) this.records.keySet().toArray(new Integer[0]); } public ChannelRecords getChannelRecords(int channel){ return records.get(channel); } }