98 lines
1.9 KiB
Java
98 lines
1.9 KiB
Java
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<ChannelRecord> values;
|
|
|
|
public ChannelRecords(int channel){
|
|
this.channel = channel;
|
|
this.values = new LinkedList<WorkShiftRecord.ChannelRecords.ChannelRecord>();
|
|
}
|
|
|
|
public void addValue(DateTime timestamp,int value){
|
|
this.values.add(new ChannelRecord(timestamp, value));
|
|
}
|
|
|
|
public void sort(){
|
|
/* List<ChannelRecord> sorted = new LinkedList<WorkShiftRecord.ChannelRecords.ChannelRecord>();
|
|
|
|
for (ChannelRecord r: values){
|
|
if (values.size() == 0)
|
|
sorted.add(r);
|
|
}
|
|
|
|
this.values = sorted;
|
|
*/
|
|
}
|
|
|
|
public List<ChannelRecord> getRecords(){
|
|
return this.values;
|
|
}
|
|
|
|
}
|
|
|
|
WorkShift workShift;
|
|
Date date;
|
|
|
|
Hashtable<Integer, ChannelRecords>
|
|
records;
|
|
|
|
public WorkShiftRecord(WorkShift shift,Date date){
|
|
workShift = shift;
|
|
this.date = date;
|
|
records = new Hashtable<Integer, WorkShiftRecord.ChannelRecords>();
|
|
|
|
loadRecords();
|
|
}
|
|
|
|
void loadRecords(){
|
|
}
|
|
|
|
public Integer[] getChannels(){
|
|
return (Integer[]) this.records.keySet().toArray(new Integer[0]);
|
|
}
|
|
|
|
public ChannelRecords getChannelRecords(int channel){
|
|
return records.get(channel);
|
|
}
|
|
}
|